/* ==========================================================================
   Tournament Hub — Design System
   Modern Sports / Broadcast Graphic look. Dark theme, glass surfaces,
   big clear type, subtle motion. Mobile-first.
   ========================================================================== */

:root {
  /* RoyalMedia brand theme -- dark / gold */
  --bg: #111318;
  --bg-elevated: #15171d;
  --surface: #1B1F27;
  --surface-strong: #232936;
  --border: #2A303C;
  --border-strong: #3A4252;
  --text: #F5F3EC;
  --text-muted: #A7ADBB;
  --text-faint: #6E7585;
  --accent: #E5B52B;
  --accent-strong: #F2C752;
  --accent-ink: #1B1F27;
  --success: #3DDC84;
  --live: #E5484D;
  --danger: #E5484D;
  --warn: #F0A93B;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --header-h: 64px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(229,181,43,0.07), transparent), var(--bg);
  color: var(--text);
  font-family: "Prompt", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3, h4, .display {
  font-family: "Kanit", "Prompt", "Noto Sans Thai", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 .4em;
  letter-spacing: 0.01em;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------------- Top nav ---------------- */
.topnav {
  position: sticky; top: 0; z-index: 40;
  min-height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(17,19,24,0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
/* Item 2 (feedback pass): the header specifically spans the FULL window
   width with its own comfortable side padding, rather than sitting inside
   the shared 1180px-max-width .container like the page content below it.
   On a wide monitor a max-width container leaves dead space on both
   sides, which put the login button somewhere in the middle of the
   screen instead of genuinely flush against the right edge -- this fixes
   that specifically for the header while leaving every other page's
   content width untouched (they still use the shared .container as-is). */
.topnav .container { max-width: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; flex-wrap: wrap; }
@media (min-width: 900px) { .topnav .container { padding-left: 32px; padding-right: 32px; } }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Kanit", sans-serif; font-weight: 700; font-size: 1.15rem; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: dotGlow 2.6s ease-in-out infinite; }
@keyframes dotGlow { 0%, 100% { box-shadow: 0 0 10px var(--accent); } 50% { box-shadow: 0 0 18px var(--accent), 0 0 4px var(--accent); } }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo-lg { height: 56px; }
@media (max-width: 620px) { .brand-logo { height: 26px; } }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; font-size: 1.2rem;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { padding: 8px 14px; border-radius: 999px; color: var(--text-muted); font-size: .92rem; font-weight: 500; transition: .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-ink); background: var(--accent); }

/* Item 1: on the main public top nav specifically (not the admin sidebar
   pills, not the tournament sub-nav from item 2), give links a slim gold
   underline that slides in on hover/focus and stays for the active page --
   a small extra touch on top of the existing pill-highlight, not a
   replacement for it. */
.topnav .nav-links a { position: relative; }
.topnav .nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  background: var(--accent-ink); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease; opacity: .85;
}
.topnav .nav-links a:hover::after, .topnav .nav-links a.active::after { transform: scaleX(1); }
.topnav .nav-links a.active::after { background: transparent; } /* active already has a solid gold fill -- no need for a second underline on top of it */

/* Item 2: the organizer login entry point is a labeled top-right button
   ("👤 ลงชื่อเข้าใช้") -- not an icon-only corner button, so a first-time
   visitor can tell what it does without a tooltip. Deliberately given the
   same solid-gold .btn-primary treatment used for the app's other real
   call-to-action buttons (not .btn-ghost, the quiet/grey style used for
   secondary actions like the logout button right next to it once signed
   in) -- feedback was that a plain ghost-style button here read as vague
   and could be mistaken for some secondary action rather than a clear
   "sign in" entry point. Same /admin/login destination and permission
   system as always; public browsing needs no login either way. Sits
   flush against the header's own right edge (see .topnav .container
   above) rather than the narrower page-content width. */
.topnav-right { display: flex; align-items: center; gap: 10px; }

/* Item 2: when an admin is still signed in while browsing the public
   site, "จัดการรายการ" + their name/role + a logout button sit inline in
   the same collapsible nav as the rest of the menu (folds into the
   hamburger on mobile automatically -- no extra breakpoint needed here). */
.nav-admin-link { font-weight: 600; }
.nav-admin-me { padding: 8px 6px; color: var(--text-faint); font-size: .85rem; white-space: nowrap; }
.nav-logout-form { display: inline-flex; align-items: center; margin: 0; }
@media (max-width: 640px) {
  .nav-admin-me { padding: 4px 14px 10px; }
  .nav-logout-form { padding: 0 14px 6px; }
  .nav-logout-form .btn { width: 100%; }
}

@media (max-width: 640px) {
  .topnav { position: relative; }
  .nav-toggle { display: flex; }
  .topnav .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px 16px 16px; box-shadow: var(--shadow); z-index: 41;
  }
  .topnav .nav-links.open { display: flex; }
  .topnav .nav-links a { padding: 12px 14px; border-radius: var(--radius-sm); }
  .topnav .nav-admin-link { margin-left: 0; }
}
/* admin per-tournament tab bar: horizontal scroll instead of wrap on narrow screens */
@media (max-width: 640px) {
  .admin-main > .nav-links {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .admin-main > .nav-links a { white-space: nowrap; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, filter .15s ease, background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }

/* Item 1: a quiet diagonal light-sweep on the homepage tournament cards'
   primary CTA on hover -- scoped to .t-card specifically rather than every
   .btn-primary in the app, so admin screens and other pages keep their
   plain hover behavior. Pure CSS transform/opacity (cheap on mobile), and
   turned off entirely under prefers-reduced-motion below. */
.t-card .btn-primary { position: relative; overflow: hidden; }
.t-card .btn-primary::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-20deg); opacity: 0; pointer-events: none;
}
.t-card:hover .btn-primary::before { animation: btnSweep .9s ease forwards; }
@keyframes btnSweep { 0% { left: -60%; opacity: 0; } 15% { opacity: .9; } 100% { left: 120%; opacity: 0; } }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-strong); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: var(--live); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-icon { padding: 10px; border-radius: 999px; }

/* ---------------- Cards / surfaces ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.card-pad { padding: 20px; }
.card-hover { transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.card-hover:hover { border-color: var(--border-strong); transform: translateY(-4px); box-shadow: var(--shadow); }

.section { padding: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; animation: fadeInUp .5s cubic-bezier(.16,1,.3,1) both; }
.section-head h2 { font-size: 1.4rem; margin: 0; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* ---------------- Badges / status ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-strong); border: 1px solid var(--border); color: var(--text-muted);
}
.badge-live {
  background: rgba(229,72,77,0.15); border-color: rgba(229,72,77,0.4); color: #f5a5a8;
}
.badge-live .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
.badge-done { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-upcoming { background: rgba(240,169,59,0.14); color: var(--warn); border-color: rgba(240,169,59,0.35); }
.badge-qualified { background: rgba(61,220,132,0.15); color: var(--success); border-color: rgba(61,220,132,0.35); }
.badge-out { background: rgba(255,255,255,0.05); color: var(--text-faint); }

/* Medal badges — champion gets a subtle animated shimmer, the little bit
   of "sporty/premium" sparkle a trophy result deserves. */
.badge-champion {
  background: linear-gradient(100deg, #7a5a00, #d4af37 35%, #fff3c4 50%, #d4af37 65%, #7a5a00);
  background-size: 220% 100%;
  color: #2b1d00; border-color: rgba(212,175,55,0.6); font-weight: 700;
  animation: shimmer 3.2s linear infinite;
}
.badge-silver { background: linear-gradient(135deg, #cfd6dd, #f2f5f7 50%, #b9c1c9); color: #23272b; border-color: rgba(200,206,212,0.6); font-weight: 700; }
.badge-bronze { background: linear-gradient(135deg, #8a4a1f, #d38a4e 50%, #7a3f18); color: #fff2e6; border-color: rgba(211,138,78,0.6); font-weight: 700; }
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: -220% 0; } }

/* Item 14: account role badges */
.badge-acct-owner { background: rgba(229,181,43,0.16); color: var(--accent-strong); border-color: rgba(229,181,43,0.4); }
.badge-acct-organizer { background: rgba(61,180,220,0.14); color: #7fd4ee; border-color: rgba(61,180,220,0.35); }
.badge-acct-scorekeeper { background: rgba(167,173,187,0.12); color: var(--text-muted); border-color: var(--border-strong); }
.badge-acct-inactive { background: rgba(229,72,77,0.12); color: #f5a5a8; border-color: rgba(229,72,77,0.32); }

@keyframes pulse { 0%,100% { opacity:1; transform:scale(1);} 50% { opacity:.35; transform:scale(1.3);} }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.live-tag {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--live); color: #fff; font-weight: 700; font-size: .78rem;
  padding: 5px 12px; border-radius: 999px; letter-spacing: .04em;
  box-shadow: 0 0 18px rgba(239,68,68,0.55);
}
.live-tag .pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }

/* ---------------- Item 9: LIVE section split by venue ---------------- */
.venue-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.venue-tabs::-webkit-scrollbar { display: none; }
.venue-tab {
  flex: none; padding: 11px 18px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
}
.venue-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.venue-tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.2s infinite; flex: none; }
.venue-tab.active .venue-tab-dot { background: var(--live); }
.venue-panel { display: none; }
.venue-panel.active { display: block; }
.venue-panel-label { font-weight: 700; color: var(--text-muted); font-size: .85rem; margin-bottom: 10px; letter-spacing: .02em; }
.live-link-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0 18px; }
.live-link-btn { text-decoration: none; }

@media (min-width: 900px) {
  .venue-tabs { display: none; }
  .venue-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
  .venue-panel { display: block; }
  .venue-panel-label { text-align: center; }
}

/* ---------------- Welcome popup (item 1) ---------------- */
.welcome-popup-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(10,11,13,0.72); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .2s ease;
}
/* Must win over the plain .welcome-popup-backdrop{display:flex} rule above
   (same specificity, but this one has an extra attribute selector) so that
   setting the element's `hidden` property from JS actually hides it --
   without this, `hidden` only flips a DOM property with no visual effect,
   because an author stylesheet's unconditional `display` beats the
   browser's default [hidden]{display:none} at equal specificity. */
.welcome-popup-backdrop[hidden] { display: none; }
.welcome-popup-backdrop.open { opacity: 1; }
.welcome-popup {
  position: relative; max-width: 440px; width: 100%; padding: 0; overflow: hidden;
  transform: translateY(10px) scale(.98); transition: transform .2s ease;
}
.welcome-popup-backdrop.open .welcome-popup { transform: translateY(0) scale(1); }
.welcome-popup-img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.welcome-popup-body { padding: 22px 24px 26px; }
.welcome-popup-body h2 { font-size: 1.25rem; margin-bottom: 8px; }
.welcome-popup-body p { color: var(--text-muted); margin: 0; line-height: 1.6; }
.welcome-popup-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: rgba(10,11,13,0.55); color: #fff; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.welcome-popup-close:hover { background: rgba(10,11,13,0.8); }

/* ---------------- Homepage hero banner (item 1) ---------------- */
.home-hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 52px 0 40px; border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 900px 420px at 50% -25%, rgba(229,181,43,0.16), transparent), linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.home-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(229,181,43,0.10) 45%, rgba(255,255,255,0.16) 50%, rgba(229,181,43,0.10) 55%, transparent 70%);
  background-size: 220% 100%; background-position: -120% 0;
  animation: heroGoldSweep 9s ease-in-out infinite;
}
@keyframes heroGoldSweep { 0%, 55% { background-position: -120% 0; } 100% { background-position: 120% 0; } }
.home-hero-inner { position: relative; z-index: 1; }
.home-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 8px; }
.home-hero p { color: var(--text-muted); font-size: 1rem; max-width: 520px; margin: 0 auto; }
/* Item 3: the heading text is now Owner-editable and can be longer than
   the original fixed string, so it must wrap safely on narrow phones
   instead of overflowing; a soft reveal-on-load using the same fadeInUp
   convention already used for the tournament cards below. */
.home-hero-heading { overflow-wrap: break-word; word-break: break-word; animation: fadeInUp .6s cubic-bezier(.16,1,.3,1) both; }

/* ---------------- Item 3: site-wide ambient background ----------------
   A handful of very-low-opacity diagonal gold lines, fixed behind every
   page (see base.html), drifting slowly. Pure ambiance -- never a focal
   element, never intercepts clicks (pointer-events:none, z-index:-1).
   Faded out with a mask past the first ~1500px so it stays soft near the
   top (behind headers/hero banners) rather than competing with them, and
   is lighter still on mobile (fewer lines, lower opacity). Panel/
   certificate images are rendered server-side with plain PIL
   (panel_generator.py) and never touch CSS at all, so this has zero
   effect on those regardless of settings here. */
.bg-fx {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.9) 0, rgba(0,0,0,.9) 420px, rgba(0,0,0,.35) 900px, transparent 1500px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9) 0, rgba(0,0,0,.9) 420px, rgba(0,0,0,.35) 900px, transparent 1500px);
}
.bg-fx-line {
  position: absolute; top: -20%; width: 1px; height: 140%;
  background: linear-gradient(180deg, transparent, rgba(229,181,43,0.22) 40%, rgba(229,181,43,0.22) 60%, transparent);
  transform: rotate(18deg);
  animation: bgFxDrift 16s ease-in-out infinite;
}
.bg-fx-line.l1 { left: 8%;  animation-delay: 0s;   }
.bg-fx-line.l2 { left: 34%; animation-delay: -4s;  }
.bg-fx-line.l3 { left: 62%; animation-delay: -9s;  }
.bg-fx-line.l4 { left: 86%; animation-delay: -13s; }
@keyframes bgFxDrift {
  0%, 100% { opacity: .35; transform: rotate(18deg) translateY(0); }
  50%      { opacity: .75; transform: rotate(18deg) translateY(26px); }
}
@media (max-width: 640px) {
  .bg-fx-line.l2, .bg-fx-line.l4 { display: none; }
  .bg-fx-line { opacity: .5; }
}

/* ---------------- Tournament cards (home) ---------------- */
.t-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.t-card { overflow: hidden; position: relative; animation: fadeInUp .55s cubic-bezier(.16,1,.3,1) both; }
.t-grid .t-card:nth-child(1) { animation-delay: .04s; }
.t-grid .t-card:nth-child(2) { animation-delay: .1s; }
.t-grid .t-card:nth-child(3) { animation-delay: .16s; }
.t-grid .t-card:nth-child(4) { animation-delay: .22s; }
.t-grid .t-card:nth-child(5) { animation-delay: .28s; }
.t-grid .t-card:nth-child(6) { animation-delay: .34s; }
.t-grid .t-card:nth-child(n+7) { animation-delay: .38s; }
.t-card-banner {
  height: 110px; display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: linear-gradient(135deg, var(--tcolor, var(--accent)) 0%, transparent 130%);
  position: relative; transition: transform .4s cubic-bezier(.16,1,.3,1);
}
.t-card-banner::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.card-hover:hover .t-card-banner { transform: scale(1.05); }
.t-card-logo { width: 52px; height: 52px; border-radius: 12px; background: #fff2; object-fit: cover; border: 1px solid rgba(255,255,255,.25); position: relative; z-index: 1; flex-shrink:0; }
.t-card-title { position: relative; z-index: 1; font-family: "Kanit"; font-weight: 700; font-size: 1.15rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.t-card-body { padding: 16px 20px 20px; }
.t-card-meta { display: flex; flex-direction: column; gap: 6px; font-size: .87rem; color: var(--text-muted); margin-bottom: 14px; }
.t-card-meta span { display: flex; align-items: center; gap: 8px; }
.t-card .btn-primary { transition: transform .18s ease, filter .15s ease; }
.card-hover:hover .btn-primary { transform: translateX(3px); }

/* Item 1: a soft gold glow around a tournament card's border on hover --
   layered on top of the existing lift/border-color transition from
   .card-hover, distinct from (and much subtler than) the LIVE badge's red
   pulsing dot, which is left completely untouched. */
.t-card { transition: border-color .2s ease, transform .2s ease, box-shadow .3s ease; }
.t-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(229,181,43,0.5), 0 0 24px rgba(229,181,43,0.22); }

/* ---------------- Item 4: featured tournaments (home) ----------------
   A small number of large, high-visibility cards for LIVE tournaments (or
   the single soonest upcoming one when nothing is live right now) --
   bigger banner + logo than the regular grid card below, so the one
   tournament people actually came to find never gets lost among a dozen
   others. */
.t-featured-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; margin-bottom: 8px; }
.t-featured-card { overflow: hidden; position: relative; animation: fadeInUp .55s cubic-bezier(.16,1,.3,1) both; transition: border-color .2s ease, transform .2s ease, box-shadow .3s ease; }
.t-featured-card:hover { box-shadow: 0 10px 34px rgba(0,0,0,0.5), 0 0 0 1px rgba(229,181,43,0.55), 0 0 28px rgba(229,181,43,0.26); }
.t-featured-banner {
  min-height: 150px; display: flex; align-items: center; gap: 18px; padding: 24px 26px;
  background: linear-gradient(135deg, var(--tcolor, var(--accent)) 0%, transparent 130%);
  position: relative; transition: transform .4s cubic-bezier(.16,1,.3,1);
}
.t-featured-banner::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0.38); }
.card-hover:hover .t-featured-banner { transform: scale(1.04); }
.t-featured-logo { width: 72px; height: 72px; border-radius: 16px; background: #fff2; object-fit: cover; border: 1px solid rgba(255,255,255,.28); position: relative; z-index: 1; flex-shrink: 0; }
.t-featured-title { position: relative; z-index: 1; font-family: "Kanit"; font-weight: 700; font-size: 1.45rem; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.t-featured-meta { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: .85rem; color: rgba(255,255,255,.85); text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.t-featured-body { padding: 18px 26px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.t-featured-body .btn-primary { transition: transform .18s ease, filter .15s ease; }
.card-hover:hover .t-featured-body .btn-primary { transform: translateX(3px); }

/* ---------------- Item 4: compact tournament list (home) ----------------
   Everything that isn't featured -- a scannable row per tournament
   instead of a full card, so a real install with a dozen-plus
   tournaments doesn't turn the homepage into an endless grid scroll. */
.t-list { display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.t-list-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); transition: background .15s ease;
}
.t-list-row:last-child { border-bottom: none; }
.t-list-row:hover { background: var(--surface-strong); }
.t-list-logo { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-strong); border: 1px solid var(--border); flex-shrink: 0; }
.t-list-main { flex: 1; min-width: 0; }
.t-list-name { font-weight: 600; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-list-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.t-list-cta { flex-shrink: 0; }
@media (max-width: 640px) {
  .t-list-meta span:nth-child(2) { display: none; } /* keep the row to one line on phones -- date only */
  .t-list-cta { display: none; } /* the whole row is already a link; the button becomes redundant at this width */
}

/* ---------------- Item 6 (this round): photo crop/zoom overlay ----------------
   Previously styled entirely with one-off inline CSS in image-crop.js
   (including a totally unstyled browser-default zoom slider that looked
   out of place against this theme) -- moved into the stylesheet like
   every other component, and the zoom slider is now themed to match. */
.crop-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.78); z-index: 200;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; padding: 16px;
}
.crop-frame {
  width: 300px; height: 300px; border-radius: 16px; overflow: hidden; position: relative;
  background: #111; touch-action: none; border: 2px solid rgba(255,255,255,.25); cursor: grab;
}
.crop-frame:active { cursor: grabbing; }
/* max-width:none overrides the site-wide "img{max-width:100%}" reset
   (line ~51) -- that global rule resolves percentages against the
   nearest positioned ancestor, which for this absolutely-positioned image
   is the 300px .crop-frame itself, silently capping the image at 300px
   wide no matter what width the cover-fit zoom math set inline. That's a
   real bug found while verifying this round's changes: it has been
   quietly clipping/letterboxing every cropped photo instead of the
   intended cover-fit crop, for as long as the global reset has existed. */
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
/* Rule-of-thirds guide -- only visible briefly while actively dragging or
   zooming (a common photo-editing convention), so it never clutters the
   frame the rest of the time. */
.crop-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.crop-grid-visible { opacity: 1; }
.crop-grid span { position: absolute; background: rgba(255,255,255,.35); }
.crop-grid span:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.crop-grid span:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.crop-grid span:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.crop-grid span:nth-child(4) { top: 66.666%; left: 0; right: 0; height: 1px; }

.crop-zoom-row { display: flex; align-items: center; gap: 10px; width: 300px; }
.crop-zoom-btn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface-strong); color: var(--text); font-size: 1rem; font-weight: 700; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.crop-zoom-btn:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.crop-zoom-pct { flex: none; width: 3.4em; font-size: .8rem; color: var(--text-muted); text-align: right; font-family: "Kanit"; }

/* Themed range slider -- both engines need their own pseudo-elements. */
.crop-zoom {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px;
  background: var(--border-strong); outline: none; cursor: pointer;
}
.crop-zoom::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--accent-ink); box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer;
}
.crop-zoom::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer;
}
.crop-zoom::-moz-range-track { height: 4px; border-radius: 999px; background: var(--border-strong); }

.crop-hint { width: 300px; text-align: center; font-size: .74rem; color: var(--text-faint); margin: 0; }
.crop-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------- Live scoreboard ---------------- */
.hero {
  padding: 28px 0 8px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.hero-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-logo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--surface-strong); border: 1px solid var(--border); }
.hero-title { font-size: 1.6rem; margin: 0; }
.hero-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-muted); font-size: .88rem; margin-top: 4px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Item 2: persistent tournament sub-nav, shared by every tournament page */
.hero-compact { padding: 18px 0 10px; }
.hero-compact .hero-logo { width: 48px; height: 48px; border-radius: 12px; }
.hero-compact .hero-title { font-size: 1.25rem; }
.t-subnav { flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px; display: inline-flex; max-width: 100%; }
@media (max-width: 760px) {
  .t-subnav { display: flex; flex-wrap: nowrap; overflow-x: auto; border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100vw; }
  .t-subnav::-webkit-scrollbar { display: none; }
  .t-subnav a { white-space: nowrap; flex: none; }
}

.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 26px 20px; margin: 18px 0;
}
.scoreboard .team { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.scoreboard .team img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--surface-strong); }
.scoreboard .team-name { font-weight: 700; font-size: 1.05rem; }
.scoreboard .score { display: flex; align-items: center; gap: 14px; font-family: "Kanit"; font-size: 2.6rem; font-weight: 700; }
.scoreboard .score .dash { color: var(--text-faint); font-size: 1.6rem; }
.score-num { min-width: 46px; text-align: center; transition: transform .25s; }
.score-num.bump { animation: bump .4s ease; }
@keyframes bump { 0% { transform: scale(1);} 40% { transform: scale(1.35); color: var(--accent);} 100% { transform: scale(1);} }

/* ---------------- Match list ---------------- */
.match-row {
  display: grid; grid-template-columns: 56px 1fr auto 1fr 90px; align-items: center; gap: 10px;
  padding: 14px 16px;
}
.match-row + .match-row { border-top: 1px solid var(--border); }
.match-time { font-weight: 700; font-family: "Kanit"; font-size: .95rem; color: var(--text-muted); text-align: center; }
.match-team { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.match-team img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; background: var(--surface-strong); flex-shrink: 0; }
.match-team.right { flex-direction: row-reverse; text-align: right; }
.match-score { font-family: "Kanit"; font-weight: 700; font-size: 1.1rem; text-align: center; min-width: 54px; }
.match-venue { font-size: .78rem; color: var(--text-faint); text-align: right; }
@media (max-width: 620px) {
  .match-row { grid-template-columns: 44px 1fr auto 1fr; }
  .match-venue { display: none; }
}

/* ---------------- Standings table ---------------- */
.table-wrap { overflow-x: auto; }
table.standings { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 480px; }
table.standings th { text-align: center; color: var(--text-faint); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.standings td { text-align: center; padding: 11px 8px; border-bottom: 1px solid var(--border); }
table.standings th:first-child, table.standings td:first-child { text-align: left; padding-left: 14px; }
table.standings td.team-cell { text-align: left; display: flex; align-items: center; gap: 10px; font-weight: 600; }
table.standings td.team-cell img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; background: var(--surface-strong); }
table.standings td.pts { font-weight: 700; color: var(--text); }
tr.qualify-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rank-num { display: inline-flex; align-items:center; justify-content:center; width: 22px; height: 22px; border-radius: 6px; font-weight:700; font-size:.78rem; background: var(--surface-strong); }

/* ---------------- Bracket ---------------- */
.bracket-scroll { overflow-x: auto; padding: 20px 4px 30px; }
.bracket { display: flex; gap: 46px; align-items: stretch; min-width: max-content; }
.bracket-round { display: flex; flex-direction: column; justify-content: space-around; gap: 22px; min-width: 220px; }
.bracket-round-title { text-align: center; font-size: .78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; font-weight: 700; }
.bmatch { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.bmatch::after { content:""; position:absolute; right:-24px; top:50%; width:24px; height:1px; background: var(--border-strong); }
.bracket-round:last-child .bmatch::after { display:none; }
.bslot { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; font-size: .85rem; font-weight: 600; gap: 8px; }
.bslot + .bslot { border-top: 1px solid var(--border); }
.bslot.winner { color: var(--accent); }
.bslot .bscore { font-family:"Kanit"; font-weight:700; }
.bslot .bname { display:flex; align-items:center; gap:8px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bslot .bname img { width:20px;height:20px;border-radius:5px;object-fit:cover;flex-shrink:0; background: var(--surface-strong);}
.bslot.tbd { color: var(--text-faint); font-style: normal; }

/* Item 2 (usability pass): admin login page -- soft radial gold glow
   behind the card (purely decorative, pointer-events:none so it never
   intercepts clicks), a show/hide toggle inside the password field, and
   a "back to home" link that didn't exist before (browser-back was the
   only way out). */
.admin-login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.admin-login-page::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(229,181,43,0.16), transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
}
.admin-login-card { width: 100%; max-width: 380px; position: relative; z-index: 1; }
.admin-login-pw-wrap { position: relative; }
.admin-login-pw-wrap input { padding-right: 44px; }
.admin-login-pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; font-size: 1rem; cursor: pointer;
  color: var(--text-faint); padding: 8px; line-height: 1;
}
.admin-login-pw-toggle:hover { color: var(--text); }
.admin-login-back { display: block; text-align: center; margin-top: 18px; font-size: .85rem; color: var(--text-muted); }
.admin-login-back:hover { color: var(--accent-ink); }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 18px; }
.field label { display:block; font-size:.85rem; font-weight:600; margin-bottom:7px; color: var(--text-muted); }
.field .hint { font-size:.76rem; color: var(--text-faint); margin-top:6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], textarea, select {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text);
  font-size: .95rem; font-family: inherit; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.input-row { display:flex; gap:12px; flex-wrap:wrap; }
.input-row > * { flex:1; min-width:140px; }
.hint { color: var(--text-muted); font-size: .85rem; line-height:1.6; }

/* Item 14: account tournament-access checklists */
.access-box { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.access-checks { display:flex; flex-wrap:wrap; gap: 8px; }
.access-chip { display:flex; align-items:center; gap:7px; background: var(--surface-strong); border:1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: .82rem; cursor:pointer; }
.access-chip:has(input:checked) { border-color: var(--accent); color: var(--accent-strong); }

/* ---------------- Player card (submission) ---------------- */
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.player-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; position: relative; }
.player-photo-btn {
  width: 100%; aspect-ratio: 1/1; border-radius: var(--radius-sm); border: 1.5px dashed var(--border-strong);
  background: var(--bg-elevated); display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; color: var(--text-faint); cursor:pointer; overflow:hidden; position:relative;
}
.player-photo-btn img { width:100%; height:100%; object-fit:cover; }
.player-photo-btn .icon { font-size: 1.6rem; }
.player-card input[type=text], .player-card input[type=number] { margin-top: 8px; padding: 9px 10px; font-size: .85rem; }
.player-remove { position:absolute; top:8px; right:8px; width:26px; height:26px; border-radius:50%; background:rgba(0,0,0,.55); color:#fff; border:none; display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:2; font-size: .9rem;}
.add-player-btn {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: transparent;
  color: var(--text-muted); display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; min-height: 210px; cursor:pointer; font-weight:600; transition:.15s;
}
.add-player-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- Panel preview ---------------- */
.panel-preview-wrap { display:flex; justify-content:center; background:#1c1d21; border-radius: var(--radius); padding: 22px; }
.panel-preview-wrap img { box-shadow: 0 12px 40px rgba(0,0,0,.5); border-radius: 4px; max-height: 74vh; }

/* ---------------- Deadline banner ---------------- */
.deadline-banner { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 18px; border-radius: var(--radius); flex-wrap:wrap; }
.deadline-ok { background: rgba(61,220,132,.1); border:1px solid rgba(61,220,132,.3); }
.deadline-soon { background: rgba(245,158,11,.1); border:1px solid rgba(245,158,11,.3); }
.deadline-over { background: rgba(239,68,68,.1); border:1px solid rgba(239,68,68,.3); }
.countdown { font-family:"Kanit"; font-weight:700; font-size:1.05rem; }

/* ---------------- Admin ---------------- */
.admin-shell { display:flex; min-height:100vh; }
.admin-side { width: 220px; flex-shrink:0; border-right:1px solid var(--border); padding: 18px 12px; position:sticky; top:0; height:100vh; overflow-y:auto; }
.admin-side .brand { padding: 6px 10px 22px; }
.admin-side a { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-size:.9rem; font-weight:600; margin-bottom:2px; }
.admin-side a:hover, .admin-side a.active { background: var(--surface); color: var(--text); }
.admin-main { flex:1; min-width:0; padding: 28px 30px 60px; }
.admin-topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:24px; gap:12px; flex-wrap:wrap; }
.side-me { padding: 4px 12px 14px; }
.side-me-name { font-size:.85rem; font-weight:700; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.side-me-role { font-size:.72rem; color:var(--accent); font-weight:600; margin-top:2px; }
@media (max-width: 860px) {
  .admin-shell { flex-direction:column; }
  .admin-side { width:100%; height:auto; position:static; display:flex; overflow-x:auto; gap:4px; padding:10px; }
  .admin-side .brand { display:none; }
  .admin-side .side-me, .admin-side .divider { display:none; }
  .admin-main { padding: 18px 16px 50px; }
}

.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-bottom: 26px; }
.stat-card { padding: 18px; }
.stat-card .num { font-family:"Kanit"; font-size:1.7rem; font-weight:700; }
.stat-card .label { color: var(--text-muted); font-size:.8rem; margin-top:4px; }

table.admin-table { width:100%; border-collapse:collapse; font-size:.88rem; }
table.admin-table th { text-align:left; font-size:.74rem; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); padding:10px 12px; border-bottom:1px solid var(--border); }
table.admin-table td { padding:12px; border-bottom:1px solid var(--border); vertical-align:middle; }
table.admin-table tr:hover td { background: rgba(255,255,255,.02); }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom:18px; font-size:.9rem; font-weight:600; }
.flash-ok { background: rgba(61,220,132,.12); border:1px solid rgba(61,220,132,.35); color:var(--success); }
.flash-error { background: rgba(239,68,68,.12); border:1px solid rgba(239,68,68,.35); color:#fca5a5; }

/* ---------------- Wheel ---------------- */
.wheel-stage { display:flex; flex-direction:column; align-items:center; gap:26px; padding: 30px 0 50px; }
.wheel-wrap { position:relative; width:min(84vw, 480px); aspect-ratio:1/1; }
.wheel-wrap canvas { width:100%; height:100%; filter: drop-shadow(0 14px 40px rgba(0,0,0,.5)); }
.wheel-pointer { position:absolute; top:-4px; left:50%; transform:translateX(-50%); width:0; height:0; border-left:16px solid transparent; border-right:16px solid transparent; border-top:28px solid var(--accent); z-index:5; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.wheel-result-banner { font-family:"Kanit"; font-size:2rem; font-weight:700; text-align:center; min-height:2.4em; }
.wheel-history-list { display:flex; flex-direction:column; gap:8px; max-width:520px; width:100%; }
.wheel-history-row { display:flex; justify-content:space-between; padding:10px 14px; font-size:.85rem; }
.wheel-history-row.voided { text-decoration: line-through; opacity: .5; }

/* ---------------- Misc ---------------- */
.empty-state { text-align:center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.6rem; margin-bottom: 12px; }
.qr-box { display:inline-flex; padding:12px; background:#fff; border-radius: var(--radius-sm); }
.footer { padding: 40px 0 70px; text-align:center; color: var(--text-faint); font-size:.82rem; }
.divider { height:1px; background:var(--border); border:none; margin: 24px 0; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:700px){ .grid-2 { grid-template-columns:1fr; } }
.sticky-actionbar { position: sticky; bottom: 0; background: rgba(10,11,13,.9); backdrop-filter: blur(10px); border-top:1px solid var(--border); padding: 14px 16px; display:flex; gap:10px; z-index: 30; }
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background: var(--surface-strong); border:1px solid var(--border-strong); padding:12px 20px; border-radius:999px; font-size:.85rem; font-weight:600; z-index:100; box-shadow: var(--shadow); }

/* ---------------- Loading / busy state ---------------- */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; color: inherit;
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after, .btn-danger.is-loading::after { border-color: var(--accent-ink); border-top-color: transparent; }
.btn-ghost.is-loading::after, .btn-outline.is-loading::after { border-color: var(--text); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-strong) 37%, var(--surface) 63%); background-size: 400% 100%; animation: skeleton-wave 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-wave { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- Bulk select ---------------- */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-strong); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px;
}
.bulk-bar .count { font-weight: 600; font-size: .88rem; }
input[type=checkbox].row-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------------- Role / gold-card badges ---------------- */
.badge-role { background: rgba(167,173,187,0.12); color: var(--text-muted); border-color: var(--border-strong); }
.badge-gold-card {
  background: linear-gradient(100deg, #7a5a00, var(--accent) 35%, #fff3c4 50%, var(--accent) 65%, #7a5a00);
  background-size: 220% 100%; color: #2b1d00; border-color: rgba(229,181,43,0.6); font-weight: 700;
  animation: shimmer 3.2s linear infinite;
}
.gold-card-slot { border: 2px solid var(--accent) !important; box-shadow: 0 0 0 3px rgba(229,181,43,0.18); position: relative; }
.gold-card-slot::before {
  content: "★ การ์ดทอง"; position: absolute; top: -11px; left: 10px; background: var(--accent); color: var(--accent-ink);
  font-size: .66rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; z-index: 3;
}

/* Respect the OS-level "reduce motion" setting -- keep the visual states
   (the lift, the color) but drop anything that moves or loops. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .t-card, .section-head { animation: none !important; opacity: 1; transform: none; }
  .card-hover:hover { transform: none; }
  .card-hover:hover .t-card-banner, .card-hover:hover .btn-primary { transform: none; }
  .bg-fx-line { animation: none !important; opacity: .35; transform: rotate(18deg); }
  .home-hero-heading { animation: none !important; opacity: 1; transform: none; }
}

/* ---------------- Items 4/5/8: date & time pickers (rewrite) ----------------
   The date field is the REAL, fully visible <input type="date"> (no
   invisible overlay hack) so a click on it is always a click on the real
   control.
   Item 8 (this round): the time field is now an iPhone-style vertical
   scroll wheel -- two snapping columns (HH / MM), always visible inline,
   never a popup -- continuing this file's established rule that nothing
   here may render as a dropdown/list that a browser can position off-
   screen or draw with unreadable default contrast (that was the original
   root cause this whole file was rewritten to fix; see datetime-picker.js).
   Mouse wheel / touch drag / clicking a nearby row all move the wheel;
   ↑/↓ arrow keys work once a column has focus, for keyboard users. */
.dt-wrap { display: inline-flex; align-items: stretch; max-width: 100%; }
.dt-date-wrap2 { position: relative; min-width: 168px; }
.dt-date-input {
  color-scheme: dark; /* native calendar popup follows the site's dark theme */
  width: 100%; min-height: 44px; margin: 0;
  background: var(--surface-strong); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 12px; color: var(--text); font-size: .95rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.dt-date-input::-webkit-calendar-picker-indicator { filter: invert(78%) sepia(46%) saturate(600%) hue-rotate(1deg) brightness(1.05); cursor: pointer; }
.dt-date-input:disabled { opacity: .5; cursor: not-allowed; }
.dt-date-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.dt-wheel-box {
  position: relative; display: inline-flex; align-items: stretch; gap: 2px;
  background: var(--surface-strong); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  height: 102px; overflow: hidden; padding: 0 6px;
}
.dt-wheel-box.dt-disabled { opacity: .5; }
.dt-wheel-highlight {
  position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%);
  height: 34px; background: rgba(229,181,43,.12);
  border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong);
  border-radius: 8px; pointer-events: none; z-index: 1;
}
.dt-wheel-col {
  width: 2.3em; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none; -ms-overflow-style: none; text-align: center; position: relative;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28%, #000 72%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 28%, #000 72%, transparent 100%);
}
.dt-wheel-col::-webkit-scrollbar { display: none; }
.dt-wheel-col:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.dt-wheel-item {
  height: 34px; line-height: 34px; font-family: "Kanit"; font-size: 1rem; color: var(--text-faint);
  scroll-snap-align: center; cursor: pointer; user-select: none; font-weight: 600; transition: color .15s, font-size .15s;
}
.dt-wheel-item.dt-wheel-selected { color: var(--text); font-size: 1.22rem; }
.dt-wheel-pad { scroll-snap-align: none; }
.dt-wheel-sep { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-weight: 700; font-size: 1.1rem; padding: 0 1px; }
.dt-datetime-wrap { flex-wrap: wrap; gap: 8px; align-items: center; }
.dt-datetime-wrap .dt-date-wrap2 { min-width: 150px; }

@media (max-width: 640px) {
  .dt-wrap { width: 100%; }
  .dt-date-wrap2 { min-width: 0; width: 100%; }
  .dt-time-wrap { justify-content: center; }
  .dt-datetime-wrap { flex-direction: column; align-items: center; }
}
