/* =========================================================
   Lucky Draw — taste-skill redesign pass
   VARIANCE 5 · MOTION 4 · DENSITY 5
   Keep data-theme tokens; tighten surfaces, type, motion.
   ========================================================= */

:root,
[data-theme="neon-night"] {
  /* Cool charcoal, one warm accent (rose). Less rainbow. */
  --bg: #12141f;
  --bg-elev: #1a1d2b;
  --bg-soft: #232738;
  --line: rgba(236, 232, 224, 0.09);
  --text: #f2efe8;
  --muted: #9b9faf;
  --pink: #e85d6a;
  --coral: #d46b5c;
  --gold: #e0b85a;
  --mint: #5fad8a;
  --violet: #7a74b8;
  --shadow: 0 18px 48px rgba(8, 10, 20, 0.45);
  --radius: 18px;
  --radius-sm: 10px;
  --font: "Outfit", "Noto Sans TC", "Noto Sans JP", system-ui, sans-serif;
  --display: "Outfit", "Noto Sans TC", "Noto Sans JP", system-ui, sans-serif;
  --glow-1: rgba(232, 93, 106, 0.14);
  --glow-2: rgba(122, 116, 184, 0.12);
  --glow-3: rgba(224, 184, 90, 0.06);
  --card-front-bg: #22263a;
  --card-front-text: #f0d78c;
  --card-back: linear-gradient(155deg, #5c568f, #c24f5c);
  --result-grad-from: #fff8ea;
  --result-grad-to: #e0b85a;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--gold) 55%, transparent);
  color-scheme: dark;
}

[data-theme="lucky-envelope"] {
  --bg: #faf3ee;
  --bg-elev: #ffffff;
  --bg-soft: #f3e4dc;
  --line: rgba(140, 48, 48, 0.12);
  --text: #3a1a16;
  --muted: #8a5f57;
  --pink: #b91c35;
  --coral: #d45448;
  --gold: #b8952e;
  --mint: #3a6b52;
  --violet: #8a2a38;
  --shadow: 0 16px 40px rgba(90, 35, 28, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Noto Sans TC", "Noto Sans JP", "Outfit", system-ui, sans-serif;
  --display: "ZCOOL XiaoWei", "Noto Sans TC", "Noto Sans JP", "Outfit", system-ui, sans-serif;
  --glow-1: rgba(185, 28, 53, 0.08);
  --glow-2: rgba(184, 149, 46, 0.1);
  --glow-3: rgba(212, 84, 72, 0.06);
  --card-front-bg: #fffaf7;
  --card-front-text: #8a2a38;
  --card-back: linear-gradient(155deg, #b91c35, #b8952e);
  --result-grad-from: #8a2a38;
  --result-grad-to: #b8952e;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--pink) 40%, transparent);
  color-scheme: light;
}

[data-theme="clean-studio"] {
  --bg: #eef1f4;
  --bg-elev: #ffffff;
  --bg-soft: #e4e9ef;
  --line: rgba(15, 23, 42, 0.09);
  --text: #0f172a;
  --muted: #64748b;
  --pink: #0f766e;
  --coral: #14b8a6;
  --gold: #0369a1;
  --mint: #16a34a;
  --violet: #334155;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.07);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(15, 118, 110, 0.07);
  --glow-2: rgba(3, 105, 161, 0.06);
  --glow-3: rgba(51, 65, 85, 0.05);
  --card-front-bg: #f8fafc;
  --card-front-text: #0f172a;
  --card-back: linear-gradient(155deg, #334155, #0f766e);
  --result-grad-from: #0f172a;
  --result-grad-to: #0369a1;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--pink) 35%, transparent);
  color-scheme: light;
}

[data-theme="midnight-gold"] {
  --bg: #0c0b0a;
  --bg-elev: #161412;
  --bg-soft: #1f1c18;
  --line: rgba(240, 230, 200, 0.1);
  --text: #f5f0e6;
  --muted: #a89b84;
  --pink: #d4a017;
  --coral: #b8860b;
  --gold: #f0d78c;
  --mint: #8b9a6d;
  --violet: #6b5b45;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(212, 160, 23, 0.12);
  --glow-2: rgba(184, 134, 11, 0.08);
  --glow-3: rgba(240, 215, 140, 0.05);
  --card-front-bg: #1a1714;
  --card-front-text: #f0d78c;
  --card-back: linear-gradient(155deg, #3d3428, #d4a017);
  --result-grad-from: #fff8e7;
  --result-grad-to: #d4a017;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--gold) 45%, transparent);
  color-scheme: dark;
}

[data-theme="ocean-breeze"] {
  --bg: #f0f9ff;
  --bg-elev: #ffffff;
  --bg-soft: #e0f2fe;
  --line: rgba(14, 116, 144, 0.12);
  --text: #0c4a6e;
  --muted: #64748b;
  --pink: #0e7490;
  --coral: #0891b2;
  --gold: #0284c7;
  --mint: #14b8a6;
  --violet: #0369a1;
  --shadow: 0 14px 36px rgba(12, 74, 110, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(14, 116, 144, 0.08);
  --glow-2: rgba(56, 189, 248, 0.1);
  --glow-3: rgba(2, 132, 199, 0.06);
  --card-front-bg: #f8fcff;
  --card-front-text: #0c4a6e;
  --card-back: linear-gradient(155deg, #0369a1, #22d3ee);
  --result-grad-from: #0c4a6e;
  --result-grad-to: #0891b2;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--pink) 35%, transparent);
  color-scheme: light;
}

[data-theme="forest-night"] {
  --bg: #0c1410;
  --bg-elev: #121c16;
  --bg-soft: #1a2820;
  --line: rgba(190, 242, 200, 0.1);
  --text: #e8f5e9;
  --muted: #8aa894;
  --pink: #4ade80;
  --coral: #22c55e;
  --gold: #a3e635;
  --mint: #86efac;
  --violet: #3f6212;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(74, 222, 128, 0.1);
  --glow-2: rgba(34, 197, 94, 0.08);
  --glow-3: rgba(163, 230, 53, 0.05);
  --card-front-bg: #152019;
  --card-front-text: #bbf7d0;
  --card-back: linear-gradient(155deg, #14532d, #4ade80);
  --result-grad-from: #ecfccb;
  --result-grad-to: #4ade80;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--pink) 40%, transparent);
  color-scheme: dark;
}

[data-theme="candy-pop"] {
  --bg: #fff1f7;
  --bg-elev: #ffffff;
  --bg-soft: #fce7f3;
  --line: rgba(236, 72, 153, 0.14);
  --text: #4a044e;
  --muted: #9d174d;
  --pink: #ec4899;
  --coral: #f472b6;
  --gold: #a78bfa;
  --mint: #2dd4bf;
  --violet: #c084fc;
  --shadow: 0 14px 36px rgba(157, 23, 77, 0.1);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(236, 72, 153, 0.1);
  --glow-2: rgba(167, 139, 250, 0.1);
  --glow-3: rgba(251, 113, 133, 0.08);
  --card-front-bg: #fffafc;
  --card-front-text: #9d174d;
  --card-back: linear-gradient(155deg, #ec4899, #a78bfa);
  --result-grad-from: #9d174d;
  --result-grad-to: #c084fc;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--pink) 35%, transparent);
  color-scheme: light;
}

[data-theme="mono-ink"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-soft: #f0f0f0;
  --line: rgba(23, 23, 23, 0.12);
  --text: #171717;
  --muted: #737373;
  --pink: #171717;
  --coral: #404040;
  --gold: #525252;
  --mint: #737373;
  --violet: #262626;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --glow-1: rgba(0, 0, 0, 0.03);
  --glow-2: rgba(0, 0, 0, 0.04);
  --glow-3: rgba(0, 0, 0, 0.02);
  --card-front-bg: #ffffff;
  --card-front-text: #171717;
  --card-back: linear-gradient(155deg, #262626, #737373);
  --result-grad-from: #171717;
  --result-grad-to: #525252;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: color-mix(in srgb, var(--text) 25%, transparent);
  color-scheme: light;
}

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

html {
  color-scheme: inherit;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  background: var(--pink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 420px at 8% -8%, var(--glow-1), transparent 55%),
    radial-gradient(640px 360px at 92% 4%, var(--glow-2), transparent 50%),
    radial-gradient(520px 320px at 50% 100%, var(--glow-3), transparent 55%);
  z-index: 0;
}

/* Subtle film grain — breaks digital flatness */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="lucky-envelope"] .grain,
[data-theme="clean-studio"] .grain,
[data-theme="ocean-breeze"] .grain,
[data-theme="candy-pop"] .grain,
[data-theme="mono-ink"] .grain {
  opacity: 0.028;
  mix-blend-mode: multiply;
}

/* Entry motion */
.reveal {
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 70ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Header ---------- */
.site-header {
  padding: 1.75rem 0 0.5rem;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
  margin-left: auto;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.65rem 0.85rem;
}

.lang-select {
  min-width: 7.5rem;
  padding-left: 0.85rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

/* Logo top-right: image only, no frame */
.header-logo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 140px;
  max-height: 52px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.header-logo img {
  display: block;
  max-height: 48px;
  max-width: 128px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.logo-tools {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--pink), color-mix(in srgb, var(--pink) 40%, var(--coral)));
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--pink) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--muted);
}

.site-header h1 {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.75rem, 4.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-wrap: balance;
}

.tagline {
  margin: 0.85rem 0 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 450;
  line-height: 1.5;
}

.logo-pick {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.logo-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Stage logo: top-right corner of stage panel */
.stage-logo {
  display: none;
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 3;
  max-width: min(120px, 26vw);
  max-height: 52px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}

.stage-logo.is-visible {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.stage-logo img {
  display: block;
  max-height: 48px;
  max-width: 112px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none;
}

.stage-panel.has-logo .stage-head {
  padding-right: min(148px, 32vw);
}

/* Theme dropdown */
.theme-picker {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 11.5rem;
}

.theme-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.theme-swatch-dot {
  position: absolute;
  left: 0.7rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

.theme-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 11.5rem;
  border: 1px solid var(--line);
  background: var(--bg-elev)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 0.75rem center / 10px;
  color: var(--text);
  border-radius: 12px;
  padding: 0.55rem 2rem 0.55rem 1.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s;
}

.theme-select:hover {
  border-color: color-mix(in srgb, var(--text) 16%, var(--line));
}

.theme-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--pink) 45%, var(--line));
  box-shadow: 0 0 0 3px var(--focus);
}

.theme-select option {
  background: var(--bg-elev);
  color: var(--text);
}

/* ---------- Mode nav: segmented control ---------- */
.mode-nav {
  margin: 1.15rem 0 0;
}

.mode-track {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.28rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  width: fit-content;
  max-width: 100%;
}

.mode-track::-webkit-scrollbar {
  display: none;
}

.mode-tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.2s, background 0.2s var(--ease-out), box-shadow 0.2s;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--text);
}

.mode-tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mode-tab.is-active {
  color: var(--text);
  background: var(--bg-elev);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text) 8%, transparent),
    0 6px 16px color-mix(in srgb, var(--text) 6%, transparent);
}

[data-theme="neon-night"] .mode-tab.is-active,
[data-theme="midnight-gold"] .mode-tab.is-active,
[data-theme="forest-night"] .mode-tab.is-active {
  color: #1a1420;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 80%, white), var(--gold));
}

[data-theme="mono-ink"] .mode-tab.is-active {
  color: #fafafa;
  background: #171717;
}

/* ---------- Layout ---------- */
.layout {
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 840px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .theme-picker {
    align-items: flex-end;
    min-width: 10rem;
  }

  .mode-track {
    width: 100%;
  }

  .stage-logo {
    top: 0.7rem;
    right: 0.7rem;
    max-height: 48px;
  }

  .stage-logo img {
    max-height: 40px;
    max-width: 88px;
  }
}

/* Glass-ish panels with edge refraction */
.panel {
  position: relative;
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--bg-elev) 100%, transparent),
      color-mix(in srgb, var(--bg-elev) 94%, var(--bg))
    );
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 1.2rem 1.2rem 1.15rem;
  backdrop-filter: blur(12px);
}

[data-theme="lucky-envelope"] .panel,
[data-theme="clean-studio"] .panel,
[data-theme="ocean-breeze"] .panel,
[data-theme="candy-pop"] .panel,
[data-theme="mono-ink"] .panel {
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.stage-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 560px;
  /* Stage is the visual hero — slightly elevated */
  padding: 1.35rem 1.35rem 1.2rem;
}

.stage-head {
  width: 100%;
  text-align: left;
}

.panel-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.panel-head h2,
.stage-title,
.panel-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stage-title {
  font-size: 1.25rem;
}

.count-pill {
  margin-left: auto;
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  border: 1px solid var(--line);
}

.hint {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 40ch;
}

.hint.center {
  text-align: center;
  max-width: none;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--bg-elev));
  color: var(--text);
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:hover {
  border-color: color-mix(in srgb, var(--text) 14%, var(--line));
}

textarea:focus,
input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--pink) 45%, var(--line));
  box-shadow: 0 0 0 3px var(--focus);
}

.entry-actions,
.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
  align-items: center;
}

.entries-panel .entry-actions {
  justify-content: flex-start;
}

.mode-view .inline-controls {
  justify-content: center;
}

.number-fields {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.number-fields.is-hidden,
.is-hidden {
  display: none !important;
}

.number-fields label,
.inline-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.inline-controls label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.number-fields input[type="number"],
.inline-controls input[type="number"] {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 40%, var(--bg-elev));
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.inline-controls input[type="number"] {
  width: 4rem;
}

label.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
}

/* Buttons */
.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.72rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition:
    transform 0.15s var(--ease-out),
    opacity 0.15s,
    filter 0.15s,
    box-shadow 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98) translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(165deg, var(--pink), var(--coral));
  color: #fff;
  box-shadow:
    0 10px 26px color-mix(in srgb, var(--pink) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn.ghost {
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.ghost:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--text) 16%, var(--line));
  background: var(--bg-soft);
}

.btn.tiny {
  padding: 0.32rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 550;
  border-radius: 8px;
  margin-left: 0;
}

.history-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

/* Mode views */
.mode-view {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  flex: 1;
  width: 100%;
  justify-content: center;
}

.mode-view.is-active {
  display: flex;
}

.wheel-wrap {
  position: relative;
  width: min(340px, 82vw);
  height: min(340px, 82vw);
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--text) 4%, transparent),
    0 0 0 1px var(--line),
    0 22px 44px color-mix(in srgb, var(--text) 12%, transparent);
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 24px solid var(--gold);
  z-index: 2;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.28));
}

.spin-btn {
  min-width: 168px;
}

/* Result stage */
.result-stage {
  width: min(100%, 400px);
  min-height: 148px;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 55%),
    color-mix(in srgb, var(--bg) 35%, var(--bg-elev));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 1.35rem;
}

.stage-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.big-result {
  margin: 0.55rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 5.5vw, 2.65rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.12;
  word-break: break-word;
  color: var(--gold);
  background: linear-gradient(135deg, var(--result-grad-from), var(--result-grad-to));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}

/* Soft appear only — no slot machine */
.big-result.pop {
  animation: result-in 0.35s var(--ease-out);
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.elim-count #elimRemaining.pop,
.sub-result.pop {
  animation: result-in 0.3s var(--ease-out);
}

@supports not (background-clip: text) {
  .big-result {
    color: var(--gold);
    -webkit-text-fill-color: var(--gold);
    background: none;
  }
}

.sub-result {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 100%;
  word-break: break-word;
}

.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  max-width: 520px;
}

.chip-list li {
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 500;
}

.chip-list li.out,
.elim-alive li.out {
  opacity: 0.32;
  text-decoration: line-through;
  filter: grayscale(0.55);
  font-weight: 500;
}

/* Eliminate: remaining items are the hero */
.elim-board {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.elim-alive {
  min-height: 3rem;
  max-width: 100%;
  justify-content: center;
}

.elim-alive li {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
}

.elim-count {
  margin: 0.15rem 0 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 500;
}

.elim-count #elimRemaining {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}

.elim-count-label {
  font-size: 0.85rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}


/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 0.7rem;
  width: 100%;
  max-width: 540px;
}

.flip-card {
  position: relative;
  aspect-ratio: 3 / 4;
  min-height: 118px;
  perspective: 1000px;
  -webkit-perspective: 1000px;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease-out);
}

.flip-card:hover:not(.is-flipped) {
  transform: translateY(-3px);
}

.flip-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 14px;
}

.flip-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.55s var(--ease-out);
  -webkit-transition: -webkit-transform 0.55s var(--ease-out);
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem;
  text-align: center;
  font-weight: 650;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.25;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-face.back {
  background: var(--card-back);
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text) 12%, transparent);
}

.flip-face.front {
  background: var(--card-front-bg);
  border: 1.5px solid color-mix(in srgb, var(--gold) 40%, var(--line));
  color: var(--card-front-text);
  -webkit-text-fill-color: var(--card-front-text);
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text) 8%, transparent);
}

/* History */
.history-box {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: auto;
  width: 100%;
}

.history-head {
  margin-bottom: 0.35rem;
}

.history-list {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  max-height: 128px;
  overflow: auto;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.history-list li {
  margin: 0.28rem 0;
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

.muted {
  opacity: 0.9;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(130%);
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.72rem 1.15rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease-out);
  z-index: 50;
  max-width: min(92vw, 400px);
  text-align: center;
  font-weight: 600;
  font-size: 0.92rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
