﻿@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;700&display=swap");

:root {
  color-scheme: light;
  font-family: "Space Grotesk", "Noto Sans KR", sans-serif;
  line-height: 1.5;
  font-weight: 400;
  --bg: #f3f1ec;
  --bg-soft: #faf7f2;
  --ink: #1c1b19;
  --muted: #635f56;
  --accent: #1f7a8c;
  --accent-2: #e07a5f;
  --card: #ffffff;
  --stroke: #e4dfd6;
  --shadow: 0 24px 50px rgba(23, 22, 19, 0.12);
  --topbar-bg: rgba(250, 247, 242, 0.86);
  --hero-grad-start: #ffffff;
  --hero-grad-end: #f4f7f8;
  --pill-bg: #f5efe6;
  --logo-mark-border: #fef6eb;
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121111;
  --bg-soft: #1c1b1a;
  --ink: #f6f4f0;
  --muted: #c7c2b8;
  --accent: #7fb7be;
  --accent-2: #f4b58a;
  --card: #1f1e1c;
  --stroke: #2b2a28;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(24, 23, 22, 0.9);
  --hero-grad-start: #1f1e1c;
  --hero-grad-end: #262523;
  --pill-bg: #2a2622;
  --logo-mark-border: #151412;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fff6e9 0%, #f3f1ec 45%, #efe7db 100%);
  color: var(--ink);
}

[data-theme="dark"] body {
  background: radial-gradient(circle at top, #2a2a28 0%, #161514 55%, #121111 100%);
}

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

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 20px 8vw;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
  color: var(--ink);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--card) url("/favicon.png") center / cover no-repeat;
  box-shadow: inset 0 0 0 2px var(--logo-mark-border);
}

.nav {
  display: flex;
  gap: 18px;
  font-weight: 600;
  color: var(--muted);
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav a.active {
  background: var(--card);
  border-color: var(--stroke);
  color: var(--ink);
}

.theme-toggle {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.nav-toggle {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 42px;
  height: 42px;
}

.nav-toggle i,
.theme-toggle i {
  font-size: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.nav-overlay[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

.nav-panel {
  width: min(420px, 92vw);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
}

.nav-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.nav-panel-body {
  display: grid;
  gap: 10px;
}

.nav-panel-body button,
.nav-panel-body a {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
  display: block;
}

.nav-panel-body button.active {
  border-color: rgba(31, 122, 140, 0.5);
  background: rgba(31, 122, 140, 0.12);
}

.nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  border: none;
}

.theme-toggle:hover {
  color: var(--ink);
}

.content {
  flex: 1;
  padding: 40px 0 80px;
}

.content-inner {
  max-width: calc(1200px + 32px);
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.hero {
  display: grid;
  gap: 20px;
  padding: 36px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--hero-grad-start), var(--hero-grad-end));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.hero.compact {
  padding: 30px 32px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 0;
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary,
.secondary,
.ghost {
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(31, 122, 140, 0.25);
}

[data-theme="dark"] .primary {
  box-shadow: 0 12px 24px rgba(15, 23, 26, 0.5);
}

.primary:hover {
  transform: translateY(-1px);
}

.secondary {
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border: 1px dashed var(--stroke);
  color: var(--muted);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 22px;
  border-radius: 22px;
  display: grid;
  gap: 16px;
  min-height: 200px;
  box-shadow: 0 14px 30px rgba(30, 30, 25, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-thumb {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card.clickable {
  cursor: pointer;
}

.card.clickable:focus-visible {
  outline: 3px solid rgba(31, 122, 140, 0.35);
  outline-offset: 4px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(30, 30, 25, 0.12);
}


.card-header {
  display: grid;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--pill-bg);
  color: var(--accent-2);
}

.card h2 {
  margin: 0;
  font-size: 20px;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pill-bg);
  color: var(--accent);
  border: 1px solid var(--stroke);
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 3em;
}

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

.game-shell {
  display: grid;
  gap: 28px;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.panel {
  padding: 28px;
  border-radius: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 20px;
}

.policy h1 {
  margin: 0 0 8px;
}

.policy p {
  margin: 0;
  color: var(--muted);
}

.policy-actions {
  margin-top: 8px;
}

.panel.seo h2 {
  margin: 0 0 8px;
}

.panel.seo p {
  margin: 0;
  color: var(--muted);
}

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

.panel-card {
  background: var(--card);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  display: grid;
  gap: 12px;
}

.panel-card h3 {
  margin: 0;
  font-size: 16px;
}

.panel-card p {
  margin: 0;
  color: var(--muted);
}


.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 6px;
}

.faq-item h3 {
  margin: 0;
  font-size: 16px;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
}

.roulette {
  display: grid;
  gap: 24px;
  padding: 28px;
  border-radius: 26px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
}

.lottery {
  display: grid;
  gap: 24px;
  padding: 28px;
  border-radius: 26px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
}

.card-draw {
  display: grid;
  gap: 24px;
  padding: 28px;
  border-radius: 26px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
  --card-ratio: 234 / 333;
}

.card-draw.deck-tarot {
  --card-ratio: 300 / 527;
}

.ladder {
  display: grid;
  gap: 24px;
  padding: 28px;
  border-radius: 26px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
}

.dice {
  display: grid;
  gap: 24px;
  padding: 28px;
  border-radius: 26px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
}

.ladder.v2 .ladder-step {
  display: grid;
  gap: 18px;
}

.ladder.v2 .ladder-step-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ladder.v2 .ladder-result-list {
  display: grid;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
  justify-items: center;
}

.ladder.v2 .result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.ladder.v2 .result-name,
.ladder.v2 .result-value {
  font-weight: 600;
  color: var(--ink);
}

.ladder.v2 .result-arrow {
  text-align: center;
  color: var(--muted);
}

.ladder-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.ladder-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.ladder-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.ladder-count input {
  width: 72px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 6px 10px;
  background: transparent;
  color: var(--ink);
}

.ladder-board {
  display: grid;
  gap: 18px;
  width: 100%;
}

.ladder-top,
.ladder-bottom {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(var(--ladder-cols, 2), minmax(0, 1fr));
  padding: 0;
  width: 100%;
}

.ladder-cell {
  display: grid;
  gap: 8px;
  align-items: center;
  justify-items: stretch;
  min-width: 0;
}

.ladder-cell input {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
  width: 100%;
}

.name-pill {
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  padding: 6px 12px;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
}

.name-pill:hover {
  color: var(--ink);
}

.name-pill.hit {
  border-color: rgba(31, 122, 140, 0.6);
  box-shadow: 0 12px 24px rgba(31, 122, 140, 0.2);
  color: var(--ink);
}

.result-pill {
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  padding: 6px 12px;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
  cursor: default;
}

.ladder-cell.hit .result-pill {
  border-color: rgba(31, 122, 140, 0.6);
  box-shadow: 0 12px 24px rgba(31, 122, 140, 0.2);
  color: var(--ink);
}

.ladder-canvas {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 0;
  width: 100%;
}

.ladder-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ladder-vertical {
  stroke: var(--ladder-line, rgba(28, 27, 25, 0.8));
  stroke-width: 4;
}

[data-theme="dark"] {
  --ladder-line: rgba(246, 244, 240, 0.65);
}

.ladder-rung {
  stroke: rgba(31, 122, 140, 0.5);
  stroke-width: 3;
  stroke-linecap: round;
}

.ladder-trace {
  stroke: var(--accent-2);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ladder-marker {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 3;
}

.ladder-label {
  fill: var(--muted);
  font-size: 20px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  cursor: pointer;
  user-select: none;
}

@media (min-width: 1100px) {
  .ladder-label {
    font-size: 16px;
  }
}

@media (max-width: 720px) {
  .ladder-label {
    font-size: 36px;
  }
}

@media (max-width: 520px) {
  .ladder-label {
    font-size: 52px;
  }
}

.ladder-label.active {
  fill: var(--accent);
}

.ladder-label.result {
  fill: var(--muted);
}

.ladder-cell.hit input {
  border-color: rgba(31, 122, 140, 0.6);
  box-shadow: 0 12px 24px rgba(31, 122, 140, 0.2);
}

.lottery-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(200px, 0.45fr) minmax(0, 1.55fr);
  align-items: center;
}

.dice-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr) minmax(220px, 0.42fr);
  align-items: start;
}

.dice-controls {
  display: grid;
  gap: 16px;
}

.dice-sides {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dice-sides button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

.dice-sides button.active {
  background: rgba(31, 122, 140, 0.12);
  border-color: rgba(31, 122, 140, 0.4);
  color: var(--ink);
}

.dice-stage {
  min-height: 240px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.dice-results {
  min-height: 240px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.dice-canvas {
  width: 100%;
  height: 450px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(250, 247, 242, 0.9), rgba(240, 236, 229, 0.6));
  border: 1px solid var(--stroke);
  overflow: hidden;
}

.dice-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

[data-theme="dark"] .dice-canvas {
  background: linear-gradient(135deg, rgba(28, 27, 26, 0.9), rgba(20, 19, 18, 0.7));
}

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

.die {
  position: relative;
  height: 50px;
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(28, 27, 25, 0.12);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(30, 30, 25, 0.12);
}

.die.active {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(31, 122, 140, 0.7);
  box-shadow: 0 14px 30px rgba(31, 122, 140, 0.2);
}

[data-theme="dark"] .die {
  background-color: rgba(26, 25, 23, 0.9);
  border-color: rgba(246, 244, 240, 0.1);
}

[data-theme="dark"] .die.active {
  border-color: rgba(127, 183, 190, 0.7);
  box-shadow: 0 14px 30px rgba(127, 183, 190, 0.22);
}

.die::before,
.die::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  border: 1px solid rgba(28, 27, 25, 0.08);
  transform: translateZ(-8px);
  opacity: 0.35;
}

.die::after {
  inset: 12px;
  opacity: 0.2;
}

.die-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
}

.die-label {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(28, 27, 25, 0.55);
}

.die.rolling {
  animation: none;
}

.dice-total {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
}

.card-draw-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1.45fr);
  align-items: start;
}

.card-controls {
  display: grid;
  gap: 16px;
}

.deck-switch {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.deck-switch button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

.deck-switch button.active {
  background: rgba(31, 122, 140, 0.12);
  border-color: rgba(31, 122, 140, 0.4);
  color: var(--ink);
}

.deck-meta {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
}

.deck-badge {
  width: 72px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  display: grid;
  place-items: center;
}

.deck-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.deck-title {
  margin: 0;
  font-weight: 700;
}

.deck-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card-stage {
  min-height: 240px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 20px;
  display: grid;
  align-items: center;
}

.card-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.card-back {
  width: min(160px, 60%);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  box-shadow: 0 18px 30px rgba(30, 30, 25, 0.18);
}

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

.card-item {
  display: grid;
  gap: 10px;
  justify-items: center;
  opacity: 1;
  transform: translateY(0);
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
}

.card-item.deal {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  animation: card-deal 0.6s ease forwards;
  animation-delay: var(--delay, 0ms);
}

.card-item.revealed .card-frame {
  box-shadow: 0 16px 28px rgba(30, 30, 25, 0.22);
  transform: translateY(-2px);
}

.card-item:focus-visible .card-frame {
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.3);
}

.card-item.flipping .card-frame {
  animation: card-flip 0.52s ease;
}

.card-frame {
  width: 100%;
  aspect-ratio: var(--card-ratio);
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  box-shadow: 0 12px 24px rgba(30, 30, 25, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.card-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-frame img.reversed {
  transform: rotate(180deg);
}

@keyframes card-flip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.card-name {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.card-name .reversed-mark {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent-2);
  font-weight: 800;
}

@keyframes card-deal {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lottery-input {
  display: grid;
  gap: 14px;
}

.lottery-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lottery-field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
}

.lottery-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
}

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

.toggle-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
}

.toggle-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateX(0);
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-pill input:checked + .toggle-track {
  background: rgba(31, 122, 140, 0.12);
  border-color: rgba(31, 122, 140, 0.35);
}

.toggle-pill input:checked + .toggle-track .toggle-dot {
  transform: translateX(14px);
  background: var(--accent);
}


.hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hint.error {
  color: #c1462f;
  font-weight: 600;
}

.ball-stage {
  position: relative;
  min-height: 200px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--stroke);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.ball-wrap {
  position: relative;
  width: 100%;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  padding: 10px 0;
}

.ball-slot {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ball {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ffffff, var(--ball-color, #f5efe6) 45%, #c9b8a6 78%);
  box-shadow: 0 26px 40px rgba(30, 30, 25, 0.2);
  display: grid;
  place-items: center;
  color: #1c1b19;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 1;
}

.ball::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.ball.animate {
  animation: ball-drop 1.4s linear forwards;
  animation-fill-mode: both;
  animation-delay: var(--delay, 0ms);
  will-change: transform;
}

.ball.settled {
  opacity: 1;
}
.ball-number {
  position: relative;
  z-index: 1;
  font-size: clamp(18px, calc(54px - (var(--digits, 2) - 2) * 6px), 54px);
  line-height: 1;
}

.ball-shadow {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 120px;
  height: 26px;
  background: rgba(0, 0, 0, 0.5);
  filter: blur(16px);
  border-radius: 50%;
  transform: translateX(-50%) scale(0.7);
  opacity: 0;
}

.ball-shadow.active {
  animation: shadow-drop 1.4s linear forwards;
  animation-fill-mode: both;
  animation-delay: var(--delay, 0ms);
  will-change: transform, opacity;
}

@keyframes ball-drop {
  0% {
    opacity: 0;
    transform: translate(0, -240px) scale(0.8);
  }
  5% {
    opacity: 1;
  }
  40% {
    transform: translate(0, 0) scale(1.02);
  }
  55% {
    transform: translate(0, -120px) scale(0.98);
  }
  70% {
    transform: translate(0, 0) scale(1);
  }
  80% {
    transform: translate(0, -60px) scale(0.99);
  }
  88% {
    transform: translate(0, 0) scale(1);
  }
  93% {
    transform: translate(0, -24px) scale(0.995);
  }
  97% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

@keyframes shadow-drop {
  0% {
    transform: translateX(-50%) scale(0.1);
    opacity: 0;
  }
  40% {
    transform: translateX(-50%) scale(1.1);
    opacity: 0.7;
  }
  55% {
    transform: translateX(-50%) scale(0.5);
    opacity: 0.4;
  }
  70% {
    transform: translateX(-50%) scale(1);
    opacity: 0.52;
  }
  80% {
    transform: translateX(-50%) scale(0.72);
    opacity: 0.4;
  }
  88% {
    transform: translateX(-50%) scale(0.92);
    opacity: 0.44;
  }
  93% {
    transform: translateX(-50%) scale(0.8);
    opacity: 0.38;
  }
  97% {
    transform: translateX(-50%) scale(0.9);
    opacity: 0.42;
  }
  100% {
    transform: translateX(-50%) scale(0.85);
    opacity: 0.42;
  }
}

.roulette-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.roulette-header h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
}

.roulette-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.roulette-body {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  align-items: start;
  width: 100%;
}

.wheel-wrap {
  position: relative;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 20px;
  display: grid;
  justify-items: center;
  gap: 16px;
  box-shadow: 0 18px 40px rgba(30, 30, 25, 0.08);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  justify-self: start;
}

.wheel {
  width: min(var(--wheel-size, 360px), 100%);
  height: min(var(--wheel-size, 360px), 100%);
  will-change: transform;
}

.wheel canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pointer {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 20px solid var(--accent-2);
  z-index: 3;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.confetti {
  position: absolute;
  left: var(--start-x);
  top: var(--start-y);
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-burst 1.5s ease-out forwards;
  animation-delay: var(--delay);
}

@keyframes confetti-burst {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  15% {
    opacity: 1;
  }
  70% {
    opacity: 1;
    transform: translate(calc(var(--dx) * 0.7), var(--dy-up)) rotate(var(--rot)) scale(0.94);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 0.7), var(--dy-up)) rotate(var(--rot)) scale(0.94);
  }
}

.wheel {
  z-index: 1;
}

.current {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.current.highlight {
  color: var(--accent);
  font-weight: 700;
  transform: scale(1.04);
  text-shadow: 0 8px 20px rgba(31, 122, 140, 0.25);
  animation: result-pop 0.9s ease;
}

@keyframes result-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1.04);
  }
}

.result {
  margin: 0;
  font-weight: 600;
}

.spin {
  width: min(240px, 90%);
}

.list {
  display: grid;
  gap: 12px;
  width: 100%;
  justify-self: stretch;
  overflow-y: auto;
  padding-right: 6px;
}

.list::-webkit-scrollbar {
  width: 8px;
}

.list::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 999px;
}

.list::-webkit-scrollbar-track {
  background: transparent;
}

.row {
  display: grid;
  grid-template-columns: 1.6fr 100px 0.5fr 0.6fr 0.6fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-left: 6px solid var(--row-color, var(--stroke));
  width: 100%;
}

.row input {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
}

.row input[type="color"] {
  padding: 0;
  width: 100%;
  height: 36px;
}


.ratio {
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
}

.remove {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.footer {
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 14px;
  display: grid;
  gap: 8px;
  max-width: calc(1200px + 32px);
  width: 100%;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.footer-link {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 980px) {
  .roulette-body {
    grid-template-columns: 1fr;
  }

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

  .wheel-wrap {
    width: 100%;
  }

  .lottery-panel {
    grid-template-columns: 1fr;
  }

  .card-draw-panel {
    grid-template-columns: 1fr;
  }

  .dice-panel {
    grid-template-columns: 1fr;
  }

  .ladder-header {
    align-items: flex-start;
  }

}

@media (max-width: 1280px) {
  .lottery-panel {
    grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1.45fr);
  }

  .card-draw-panel {
    grid-template-columns: minmax(240px, 0.6fr) minmax(0, 1.4fr);
  }

  .dice-panel {
    grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  }

  .dice-stage {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1200px) {
  .lottery-panel {
    grid-template-columns: 1fr;
  }

  .card-draw-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 16px 6vw;
  }

  .content {
    padding: 32px 0 60px;
  }

  .content-inner {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

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

  .roulette {
    padding: 20px;
  }

  .lottery {
    padding: 20px;
  }

  .card-draw {
    padding: 20px;
  }

  .dice {
    padding: 20px;
  }

  .ladder {
    padding: 20px;
  }


  .lottery-fields {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

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

  .ball {
    width: 80px;
    height: 80px;
    font-size: 24px;
  }

  .ball-shadow {
    width: 80px;
  }

  .ball-slot {
    width: 80px;
    height: 80px;
    align-items: flex-end;
    justify-content: center;
  }

  .roulette-header {
    align-items: flex-start;
  }

  .wheel-wrap {
    width: 100%;
    padding: 16px;
  }

  .wheel {
    width: min(82vw, 300px);
    height: min(82vw, 300px);
  }

  .list {
    gap: 10px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .row .text,
  .row .weight,
  .row .color {
    width: 100%;
  }

  .ratio {
    font-size: 13px;
  }

  .remove {
    justify-self: start;
  }
}

@media (max-width: 440px) {
  .content {
    padding: 24px 0 50px;
  }

  .content-inner {
    padding: 0 16px;
  }

  .roulette {
    padding: 16px;
  }

  .card-draw {
    padding: 16px;
  }

  .wheel {
    width: min(78vw, 260px);
    height: min(78vw, 260px);
  }

  .row {
    padding: 10px;
  }

}


