:root {
  color-scheme: dark;
  --bg: #0f1220;
  --bg-soft: #12172a;
  --surface: #171b2e;
  --surface-2: #11162a;
  --text: #f8fafc;
  --muted: #a7b0c3;
  --line: #2b3350;
  --line-strong: #3a4568;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --gold: #f5c542;
  --gold-soft: #3a2c10;
  --success: #22c55e;
  --danger: #f87171;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 70%);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: rgba(15, 18, 32, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.topbar nav a {
  color: var(--text);
  font-weight: 700;
}

.page {
  position: relative;
  width: min(1040px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.hero,
.panel,
.card,
.daily-task,
.podium-card,
.leaderboard-list,
.admin-card {
  background: linear-gradient(180deg, rgba(23, 27, 46, 0.98), rgba(17, 22, 42, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(28px, 6vw, 72px);
}

.hero h1,
.panel h1 {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1;
  text-shadow: 0 0 28px rgba(245, 197, 66, 0.18);
}

.hero p,
.panel p,
.card p {
  color: var(--muted);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 16px;
  background: #1a2037;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.primary {
  border-color: rgba(56, 189, 248, 0.62);
  background: linear-gradient(135deg, #2563eb, var(--primary));
  color: #06101f;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.22);
}

button:hover,
.button:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.18);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  margin-bottom: 28px;
  border-color: rgba(245, 197, 66, 0.3);
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--text);
}

.daily-task {
  margin: -12px 0 28px;
  padding: 20px 24px;
}

.daily-task-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.daily-task h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.daily-task p {
  margin: 0 0 8px;
  color: var(--muted);
}

.daily-task input {
  max-width: 520px;
}

.share-submit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.invite-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invite-link-row input {
  max-width: 520px;
}

.invite-link-row form {
  flex: 0 0 auto;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
}

.button-stack {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.podium-card {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 124px;
  padding: 18px;
  text-align: center;
}

.podium-card strong {
  color: var(--gold);
  font-size: 44px;
  text-shadow: 0 0 22px rgba(245, 197, 66, 0.2);
}

.podium-card span {
  font-weight: 900;
}

.podium-card small {
  color: var(--muted);
  font-weight: 700;
}

.podium-card.place-1 {
  min-height: 158px;
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(58, 44, 16, 0.78), rgba(23, 27, 46, 0.98));
}

.podium-card.place-2 {
  min-height: 136px;
}

.podium-card.place-3 {
  min-height: 112px;
}

.podium-card.empty {
  opacity: 0.7;
}

.leaderboard-list {
  display: grid;
  max-height: 260px;
  overflow: auto;
  padding: 0;
  margin: 0;
  list-style: none;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.leaderboard-list li:last-child {
  border-bottom: 0;
}

h2 {
  margin: 30px 0 14px;
  color: var(--text);
  font-size: 25px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.shop-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.reward-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1020;
}

.card h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.card form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card form strong,
.history li span,
.leaderboard-list strong {
  color: var(--gold);
}

.card form input[type="number"] {
  width: 86px;
  flex: 0 0 86px;
}

.card form.promo-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.promo-form input {
  min-width: 0;
}

.price-stack {
  display: grid;
  gap: 4px;
}

.price-stack small {
  color: var(--muted);
  font-weight: 600;
}

.sale-badge {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  font-size: 12px;
  font-weight: 900;
}

.history {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.history small {
  color: var(--muted);
}

.admin-section {
  margin-top: 28px;
}

.admin-list {
  display: grid;
  gap: 16px;
}

.admin-scroll {
  max-height: 520px;
  overflow: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}

.history.admin-scroll {
  padding-right: 8px;
}

.admin-scroll::-webkit-scrollbar,
.leaderboard-list::-webkit-scrollbar {
  width: 10px;
}

.admin-scroll::-webkit-scrollbar-track,
.leaderboard-list::-webkit-scrollbar-track {
  background: #0c1020;
  border-radius: 999px;
}

.admin-scroll::-webkit-scrollbar-thumb,
.leaderboard-list::-webkit-scrollbar-thumb {
  background: #3a4568;
  border-radius: 999px;
  border: 2px solid #0c1020;
}

.admin-scroll::-webkit-scrollbar-thumb:hover,
.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: #53607f;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.admin-permissions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 32, 0.58);
}

.admin-permissions strong {
  color: var(--gold);
}

.admin-preview {
  width: min(220px, 100%);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.admin-card form,
form.admin-card {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: 1.4fr 0.8fr 1fr;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0c1020;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(56, 189, 248, 0.26);
  border-color: var(--primary);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkline input {
  width: auto;
  min-height: auto;
}

.roulette-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(260px, 1fr);
  align-items: center;
  gap: 28px;
}

.roulette-stage {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.roulette-wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 8px solid rgba(245, 158, 11, 0.85);
  border-radius: 50%;
  background: var(
    --roulette-gradient,
    conic-gradient(
      #f59e0b 0deg 288deg,
      #38bdf8 288deg 356.4deg,
      #a78bfa 356.4deg 359.964deg,
      #ef4444 359.964deg 360deg
    )
  );
  box-shadow: 0 28px 80px rgba(245, 158, 11, 0.22), inset 0 0 0 10px rgba(12, 16, 32, 0.88);
  transform: rotate(0deg);
  will-change: transform;
}

.roulette-wheel.is-spinning {
  box-shadow: 0 32px 95px rgba(245, 158, 11, 0.36), 0 0 44px rgba(56, 189, 248, 0.2), inset 0 0 0 10px rgba(12, 16, 32, 0.88);
}

.roulette-wheel.is-finished {
  animation: none;
}

.roulette-wheel::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  border: 3px solid rgba(12, 16, 32, 0.9);
  pointer-events: none;
}

.roulette-label {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  min-width: 66px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(12, 16, 32, 0.62);
  color: #fff;
  font-size: clamp(12px, 1.65vw, 16px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(-150px)
    rotate(68deg);
  transform-origin: center;
}

.roulette-label::after {
  content: " bodov";
  margin-left: 3px;
}

.roulette-label.label-3,
.roulette-label.label-4 {
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(-166px)
    rotate(68deg);
  font-size: 12px;
  min-width: 78px;
}

.roulette-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 36px solid #f8fafc;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
  z-index: 5;
  pointer-events: none;
}

.roulette-center {
  position: absolute;
  inset: 38%;
  display: grid;
  place-items: center;
  border: 2px solid rgba(245, 158, 11, 0.9);
  border-radius: 50%;
  background: #0c1020;
  color: var(--gold);
  font-weight: 900;
  text-align: center;
}

.roulette-prizes {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.roulette-prizes li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.roulette-admin-row {
  margin-bottom: 12px;
}

.roulette-reset-card {
  margin-top: 14px;
}

.roulette-reset-card h3 {
  margin: 0 0 8px;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.case-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(23, 27, 46, 0.98), rgba(17, 22, 42, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.case-visual {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px solid rgba(245, 197, 66, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 20%, rgba(245, 197, 66, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(56, 189, 248, 0.08), rgba(0, 0, 0, 0.14));
  overflow: hidden;
}

.case-visual img,
.case-item-image img,
.case-reel-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ursus-case-box {
  position: relative;
  display: grid;
  place-items: center;
  width: min(82%, 260px);
  aspect-ratio: 1.65;
  border: 3px solid rgba(245, 197, 66, 0.9);
  border-radius: 10px;
  background: linear-gradient(145deg, #d97706, #facc15 45%, #92400e);
  box-shadow: inset 0 -18px 28px rgba(0, 0, 0, 0.28), 0 24px 50px rgba(245, 158, 11, 0.18);
  color: #111827;
  transform: perspective(600px) rotateX(8deg);
}

.ursus-case-box::before,
.ursus-case-box::after {
  content: "";
  position: absolute;
  inset: 14px auto 14px 22px;
  width: 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.4);
}

.ursus-case-box::after {
  left: auto;
  right: 22px;
}

.ursus-case-box span {
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: 0;
}

.ursus-case-box strong {
  font-size: 15px;
  color: #4c1d95;
}

.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 28px;
  align-items: center;
  min-height: 420px;
  padding: clamp(28px, 5vw, 56px);
  margin-bottom: 26px;
  border: 1px solid rgba(245, 197, 66, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 18, 32, 0.78), rgba(15, 18, 32, 0.4)),
    radial-gradient(circle at 72% 35%, rgba(245, 197, 66, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(76, 29, 149, 0.2));
  box-shadow: var(--shadow);
}

.case-hero h1 {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.95;
}

.eyebrow {
  color: var(--primary);
  font-weight: 900;
  text-transform: uppercase;
}

.case-opening {
  margin-bottom: 30px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 22, 42, 0.82);
}

.case-reel-window {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  margin-bottom: 16px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 18, 32, 0.9), rgba(0, 0, 0, 0.28));
}

.case-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: 3px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(245, 197, 66, 0.6);
}

.case-reel {
  display: flex;
  gap: 12px;
  padding: 16px;
  will-change: transform;
}

.case-reel.is-opening {
  filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.25));
}

.case-reel-item {
  flex: 0 0 132px;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 116px;
  padding: 10px;
  border: 1px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 8px;
  background: rgba(23, 27, 46, 0.92);
  text-align: center;
}

.case-items-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.case-item-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 27, 46, 0.98), rgba(17, 22, 42, 0.98));
}

.case-item-image {
  display: grid;
  place-items: center;
  height: 92px;
  border-radius: 8px;
  background: rgba(15, 18, 32, 0.8);
}

.case-item-image span,
.case-reel-item span {
  color: var(--gold);
  font-weight: 1000;
}

.rarity-common {
  border-bottom-color: #94a3b8;
}

.rarity-rare {
  border-bottom-color: #38bdf8;
}

.rarity-epic {
  border-bottom-color: #a78bfa;
}

.rarity-legendary {
  border-bottom-color: #f59e0b;
}

.case-win-result {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(245, 197, 66, 0.5);
  border-radius: 8px;
  background: rgba(245, 197, 66, 0.12);
}

.case-win-result strong,
.case-win-result span {
  display: block;
}

.case-item-admin {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 18, 32, 0.42);
}

.case-item-admin h4 {
  margin: 0 0 10px;
}

.admin-preview.small {
  max-width: 120px;
}

@media (prefers-reduced-motion: reduce) {
  .roulette-wheel.is-spinning {
    box-shadow: 0 28px 80px rgba(245, 158, 11, 0.22), inset 0 0 0 10px rgba(12, 16, 32, 0.88);
  }
}

@media (max-width: 680px) {
  .topbar,
  .panel,
  .daily-task-content,
  .history li {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar nav {
    flex-wrap: wrap;
  }

  .panel form,
  .panel button,
  .daily-task button,
  .daily-task .button,
  .daily-task input {
    width: 100%;
  }

  .share-submit {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .invite-link-row {
    width: 100%;
  }

  .invite-link-row form,
  .invite-link-row .icon-button {
    width: 42px;
  }

  .button-stack {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .podium {
    grid-template-columns: 1fr;
  }

  .podium-card,
  .podium-card.place-1,
  .podium-card.place-2,
  .podium-card.place-3 {
    min-height: 108px;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .roulette-layout {
    grid-template-columns: 1fr;
  }

  .case-grid,
  .case-items-grid,
  .case-hero {
    grid-template-columns: 1fr;
  }

  .roulette-label {
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateY(-112px)
      rotate(68deg);
  }

  .roulette-label.label-3,
  .roulette-label.label-4 {
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateY(-126px)
      rotate(68deg);
  }
}

@media (min-width: 681px) and (max-width: 960px) {
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
