/* ==========================================================================
   Wheel Bolo — shared stylesheet
   Plain CSS, no build step. Light + dark themes via CSS custom properties.
   ========================================================================== */

/* ----- Self-hosted fonts (latin + devanagari subsets) -------------------- */
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/baloo2-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/baloo2-devanagari.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC,
    U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/mukta-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/mukta-400-devanagari.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC,
    U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/mukta-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/mukta-600-devanagari.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC,
    U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}

/* ----- Design tokens ----------------------------------------------------- */
:root {
  /* Brand accents — shared across both themes */
  --c-marigold: #FF8A1E;
  --c-marigold-deep: #F2740A;
  --c-saffron: #FFC53D;
  --c-magenta: #E5247B;
  --c-teal: #0FA3A3;
  --c-aubergine: #2B0A3D;

  /* Light theme surfaces (default) */
  --bg: #FFF7EC;
  --bg-soft: #FFEFD8;
  --surface: #FFFFFF;
  --surface-2: #FCF3E6;
  --border: #EAD9C2;
  --text: #2B0A3D;
  --text-soft: #6E5A78;
  --link: #C81C68;
  --link-hover: #E5247B;
  --brand-accent: #C2410C;   /* AA-contrast deep marigold for the logo on cream */
  --eyebrow-ink: #C81C68;    /* AA-contrast magenta for small accent text */
  --hero-glow: rgba(255, 138, 30, 0.28);
  --shadow-sm: 0 2px 8px rgba(43, 10, 61, 0.08);
  --shadow-md: 0 10px 30px rgba(43, 10, 61, 0.12);
  --shadow-lg: 0 18px 50px rgba(43, 10, 61, 0.18);
  --pointer-fill: #2B0A3D;

  /* Typography */
  --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Mukta', system-ui, 'Segoe UI', Roboto, sans-serif;

  /* Layout */
  --maxw: 1120px;
  --radius: 16px;
  --radius-lg: 26px;
  --gap: clamp(1rem, 3vw, 2rem);
  --header-h: 64px;
}

:root[data-theme='dark'] {
  --bg: #160A1F;
  --bg-soft: #1D0F29;
  --surface: #241334;
  --surface-2: #2C1840;
  --border: #3A2350;
  --text: #F3E9DE;
  --text-soft: #B9A6C9;
  --link: #FFB3D3;
  --link-hover: #FF7DB3;
  --brand-accent: #FF9E3D;
  --eyebrow-ink: #FFB3D3;
  --hero-glow: rgba(255, 138, 30, 0.22);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
  --pointer-fill: #FFC53D;
}

/* Follow OS preference until a theme is explicitly chosen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand-accent: #FF9E3D;
    --eyebrow-ink: #FFB3D3;
    --bg: #160A1F;
    --bg-soft: #1D0F29;
    --surface: #241334;
    --surface-2: #2C1840;
    --border: #3A2350;
    --text: #F3E9DE;
    --text-soft: #B9A6C9;
    --link: #FFB3D3;
    --link-hover: #FF7DB3;
    --hero-glow: rgba(255, 138, 30, 0.22);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
    --pointer-fill: #FFC53D;
  }
}

/* ----- Reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.85rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
p { margin: 0 0 1rem; }

a { color: var(--link); text-decoration: none; font-weight: 600; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img, canvas { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 3px solid var(--c-magenta);
  outline-offset: 2px;
  border-radius: 6px;
}

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 1000;
  background: var(--c-marigold); color: #2B0A3D; padding: 10px 16px;
  border-radius: 10px; font-weight: 700; transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ----- Header / nav ------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 0.75rem;
  min-height: var(--header-h);
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.35rem;
  color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 0.4rem;
  margin-right: auto; letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; color: var(--brand-accent); }
.brand .brand-dot { color: var(--brand-accent); }

.main-nav { display: flex; gap: 0.25rem; }
.main-nav a {
  color: var(--text-soft); padding: 0.4rem 0.7rem; border-radius: 10px; font-size: 0.95rem;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.header-tools { display: flex; gap: 0.4rem; align-items: center; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 10px; cursor: pointer;
  height: 40px; min-width: 40px; padding: 0 0.6rem; font-size: 0.95rem; font-weight: 700;
  font-family: var(--font-body); display: inline-flex; align-items: center; justify-content: center;
  gap: 0.3rem; transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--c-marigold); }
.icon-btn:active { transform: scale(0.94); }
.lang-toggle .lang-off { opacity: 0.6; }

/* mobile nav: collapse links into a row that wraps */
@media (max-width: 560px) {
  .brand { font-size: 1.15rem; }
  .main-nav { display: none; }
}

/* ----- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font-family: var(--font-display); font-weight: 700; font-size: 0.98rem;
  border: none; border-radius: 12px; padding: 0.6rem 1.05rem; cursor: pointer;
  text-decoration: none; transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--c-marigold) 0%, var(--c-marigold-deep) 100%);
  color: #2B0A3D; box-shadow: 0 8px 20px rgba(242, 116, 10, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 12px 26px rgba(242, 116, 10, 0.42); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 2px solid var(--border);
}
.btn-secondary:hover { border-color: var(--c-magenta); color: var(--c-magenta); }
.btn-block { width: 100%; }
.btn-lg { font-size: 1.08rem; padding: 0.72rem 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn-primary, .icon-btn { transition: none !important; }
  .btn-primary:hover { transform: none; }
}

/* ----- Hero / app layout ------------------------------------------------- */
.hero { position: relative; padding: clamp(1rem, 2.5vw, 1.8rem) 0 1rem; overflow: clip; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(closest-side at 70% 35%, var(--hero-glow), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero .container { position: relative; z-index: 1; }
.hero-eyebrow {
  display: inline-block; background: var(--surface-2); color: var(--eyebrow-ink);
  font-weight: 700; font-size: 0.85rem; padding: 0.3rem 0.8rem; border-radius: 999px;
  margin-bottom: 0.8rem; border: 1px solid var(--border);
}
.hero-lead { font-size: 1.1rem; color: var(--text-soft); max-width: 46ch; margin-bottom: 1.2rem; }
.hero h1 { margin-bottom: 0.35em; }
.hero-eyebrow { margin-bottom: 0.6rem; }

.app-grid { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1fr); }
.app-grid > * { min-width: 0; }         /* let columns shrink below content size (prevents overflow) */
.app-grid .wheel-col { order: 1; }      /* mobile: wheel first, right after the H1 */
.app-grid .controls-col { order: 2; }
@media (min-width: 900px) {
  .app-grid { grid-template-columns: minmax(300px, 1fr) minmax(380px, 540px); }
  .app-grid .controls-col { order: 1; } /* desktop: controls left … */
  .app-grid .wheel-col { order: 2; position: sticky; top: calc(var(--header-h) + 1rem); } /* … wheel right */
}

/* ----- Wheel ------------------------------------------------------------- */
.wheel-col { display: flex; flex-direction: column; align-items: center; }
.wheel-stage {
  position: relative;
  /* the wheel is the hero — kept large, but capped by viewport height so the
     whole thing still fits without zooming on short laptops and phones */
  width: min(86vw, 500px, 74vh);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  margin-right: 18px; /* leave room for the pointer sitting outside the rim */
}
.wheel-canvas {
  width: 100%; height: 100%;
  filter: drop-shadow(var(--shadow-lg));
  border-radius: 50%;
}
.wheel-pointer {
  position: absolute; top: 50%; right: -30px; transform: translateY(-50%);
  width: 46px; height: 54px; z-index: 3;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.45));
}
.wheel-pointer svg { width: 100%; height: 100%; display: block; }
.wheel-hub-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 21%; height: 21%; border-radius: 50%; z-index: 2;
  border: 4px solid var(--surface);
  background: radial-gradient(circle at 35% 30%, var(--c-saffron), var(--c-marigold-deep));
  color: #2B0A3D; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(0.7rem, 2.5vw, 0.95rem); cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25); transition: transform 0.12s ease;
}
.wheel-hub-btn:hover { transform: translate(-50%, -50%) scale(1.06); }
.wheel-hub-btn:active { transform: translate(-50%, -50%) scale(0.96); }
.wheel-hub-btn:disabled { cursor: not-allowed; filter: grayscale(0.4) brightness(0.9); }

.confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 200;
}

.winner-banner {
  margin-top: 1.1rem; min-height: 2.5rem; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.1rem, 4vw, 1.6rem);
  color: var(--c-magenta); width: 100%;
}
.winner-banner .winner-name {
  display: inline-block; padding: 0.1rem 0.6rem; border-radius: 10px;
  background: color-mix(in srgb, var(--c-saffron) 35%, transparent);
  animation: pop 0.5s ease;
}
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .winner-banner .winner-name { animation: none; } }

/* ----- Controls panel ---------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.1rem, 3vw, 1.6rem);
  box-shadow: var(--shadow-md);
}
.field-label { display: block; font-weight: 700; margin-bottom: 0.4rem; font-family: var(--font-display); }
.entries-input {
  width: 100%; min-height: 132px; resize: vertical;
  font-family: var(--font-body); font-size: 1.05rem; line-height: 1.6;
  padding: 0.8rem 0.9rem; border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.entries-input:focus { border-color: var(--c-marigold); background: var(--surface); outline: none; }
.entries-meta { font-size: 0.9rem; color: var(--text-soft); margin: 0.4rem 0 0.9rem; }

.controls-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }

/* segmented mode toggle */
.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; gap: 4px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  cursor: pointer; padding: 0.45rem 0.85rem; border-radius: 9px; font-weight: 600;
  font-size: 0.95rem; color: var(--text-soft); transition: background 0.2s, color 0.2s;
}
.segmented input:checked + label { background: var(--c-marigold); color: #2B0A3D; box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + label { outline: 3px solid var(--c-magenta); outline-offset: 2px; }

.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.action-row .btn-primary { flex: 1 1 160px; }

/* ----- Results history --------------------------------------------------- */
.history { margin-top: 1.3rem; }
.history h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; margin-bottom: 0.7rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.history-list li {
  display: flex; align-items: center; gap: 0.6rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 0.55rem 0.85rem;
}
.history-list .h-index {
  font-family: var(--font-display); font-weight: 800; color: var(--c-marigold-deep);
  min-width: 1.5rem;
}
.history-list .h-name { font-weight: 600; }
.history-empty { color: var(--text-soft); font-style: italic; }

/* ----- Sections / cards -------------------------------------------------- */
.section { padding: clamp(2rem, 6vw, 4rem) 0; }
.section-tinted { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 60ch; margin: 0 auto clamp(1.5rem, 4vw, 2.5rem); }
.section-head p { color: var(--text-soft); font-size: 1.1rem; }

.template-grid {
  display: grid; gap: clamp(0.9rem, 2.5vw, 1.4rem);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.template-card {
  display: flex; flex-direction: column; gap: 0.5rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.template-card:hover {
  text-decoration: none; transform: translateY(-4px); border-color: var(--c-marigold);
  box-shadow: var(--shadow-md);
}
.template-card .tc-emoji { font-size: 2rem; line-height: 1; }
.template-card .tc-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.template-card .tc-desc { color: var(--text-soft); font-size: 0.95rem; margin: 0; }
@media (prefers-reduced-motion: reduce) { .template-card:hover { transform: none; } }

/* ----- Article / SEO copy ------------------------------------------------ */
.prose { max-width: 70ch; margin-inline: auto; }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { margin-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose a { text-decoration: underline; }

.related-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 1rem; }

.breadcrumbs { font-size: 0.9rem; color: var(--text-soft); padding: 1rem 0 0; }
.breadcrumbs a { color: var(--text-soft); font-weight: 600; }
.breadcrumbs a:hover { color: var(--c-magenta); }
.breadcrumbs span[aria-current] { color: var(--text); }

/* ----- Ad slots (reserved to avoid CLS) ---------------------------------- */
.ad-slot {
  margin: clamp(1.5rem, 4vw, 2.5rem) auto; max-width: 970px; min-height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px;
  color: var(--text-soft); font-size: 0.8rem; overflow: hidden;
}
.ad-slot::before { content: 'Advertisement'; letter-spacing: 0.08em; text-transform: uppercase; }
.ad-slot ins { display: block; width: 100%; }
.ad-slot ins[data-ad-status='filled'] ~ ::before,
.ad-slot:has(ins[data-ad-status='filled'])::before { content: none; }

/* ----- Footer ------------------------------------------------------------ */
.site-footer {
  background: var(--c-aubergine); color: #E8DAF0; margin-top: 2rem;
  padding: clamp(2rem, 5vw, 3rem) 0 1.5rem;
}
:root[data-theme='dark'] .site-footer { background: #0F0617; }
.site-footer .container { display: grid; gap: 1.5rem; }
@media (min-width: 720px) { .site-footer .container { grid-template-columns: 1.5fr 1fr 1fr; } }
.site-footer h2 { color: #fff; font-size: 1.05rem; margin-bottom: 0.6rem; }
.site-footer a { color: #E8DAF0; font-weight: 500; }
.site-footer a:hover { color: var(--c-saffron); }
.footer-brand .brand { color: #fff; }
.footer-brand .brand-dot { color: var(--c-marigold); } /* bright on the always-dark footer */
.footer-brand p { color: #C9B6D8; font-size: 0.95rem; max-width: 34ch; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); margin-top: 0.5rem; padding-top: 1.2rem;
  color: #C9B6D8; font-size: 0.88rem; text-align: center;
}

/* ----- Utilities --------------------------------------------------------- */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.tag-row .btn-secondary { font-size: 0.95rem; padding: 0.5rem 1rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--c-aubergine); color: #fff; padding: 0.7rem 1.2rem; border-radius: 12px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  z-index: 300; font-weight: 600; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----- Intro copy (moved below the tool) --------------------------------- */
.hero-copy { padding-top: clamp(1.25rem, 3vw, 2rem); padding-bottom: 0; text-align: center; }
.hero-copy .hero-eyebrow { margin-bottom: 0.6rem; }
.hero-copy .hero-lead { margin-inline: auto; }

/* ----- Language button label --------------------------------------------- */
.lang-toggle .lang-name { max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .lang-toggle .lang-name { display: none; } }

/* ----- Winner / eliminated banner states --------------------------------- */
.winner-banner.is-elim { color: var(--text-soft); }
.winner-banner.is-elim .winner-name {
  background: color-mix(in srgb, var(--c-magenta) 18%, transparent);
  text-decoration: line-through; text-decoration-thickness: 2px;
}

/* ----- History badges ---------------------------------------------------- */
.history-list li { justify-content: flex-start; }
.h-tag {
  margin-inline-start: auto; font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 0.14rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.h-win .h-tag { background: color-mix(in srgb, var(--c-saffron) 45%, transparent); color: var(--text); }
.h-elim .h-tag { background: color-mix(in srgb, var(--c-magenta) 22%, transparent); color: var(--link); }
.h-elim .h-name { opacity: 0.65; text-decoration: line-through; }

/* ----- Modals (language picker + winner popup) --------------------------- */
.wb-modal {
  position: fixed; inset: 0; z-index: 600; display: none;
  align-items: center; justify-content: center; padding: 1rem;
  background: rgba(20, 8, 30, 0.6);
}
.wb-modal.open { display: flex; }
.wb-dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 86vh; overflow-y: auto;
  padding: clamp(1.1rem, 3vw, 1.8rem); animation: wbpop 0.18s ease;
}
@keyframes wbpop { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wb-dialog { animation: none; } }
.wb-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wb-modal-title { margin: 0; font-size: 1.4rem; }
.wb-close {
  flex: none; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 0.95rem;
}
.wb-close:hover { border-color: var(--c-magenta); color: var(--c-magenta); }
.wb-section-title {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-soft); margin: 1.1rem 0 0.6rem;
}
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.4rem; }
.lang-option {
  display: flex; flex-direction: column; gap: 0.1rem; text-align: start; cursor: pointer;
  background: transparent; border: 1.5px solid transparent; border-radius: 12px;
  padding: 0.5rem 0.7rem; color: var(--text); font-family: var(--font-body);
}
.lang-option:hover { background: var(--surface-2); }
.lang-option.active { border-color: var(--c-marigold); background: var(--surface-2); }
.lang-option .lo-native { font-weight: 700; }
.lang-option .lo-en { font-size: 0.8rem; color: var(--text-soft); }
.lang-search {
  width: 100%; padding: 0.6rem 0.85rem; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: var(--font-body); font-size: 1rem;
}
.lang-search:focus { outline: none; border-color: var(--c-marigold); background: var(--surface); }

/* Winner popup (random mode) */
.winner-dialog { max-width: 440px; text-align: center; padding: 0; overflow: hidden; }
.winner-pop-head {
  background: linear-gradient(135deg, var(--c-marigold), var(--c-magenta)); color: #fff;
  padding: 1.05rem 1.4rem; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
}
.winner-pop-body { padding: 1.8rem 1.4rem 1.4rem; }
.wp-name {
  display: block; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 7vw, 3rem); color: var(--c-marigold-deep); word-break: break-word; line-height: 1.1;
}
:root[data-theme='dark'] .wp-name { color: var(--c-saffron); }
.winner-pop-actions { display: flex; gap: 0.6rem; justify-content: center; padding: 0 1.4rem 1.5rem; }
