@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,400;0,600;0,700;0,800;0,900;1,700;1,800;1,900&display=swap');

:root {
  color-scheme: dark;
  --bg: rgba(7, 10, 18, 0.28);
  --card: rgba(12, 18, 30, 0.56);
  --card-strong: rgba(15, 22, 38, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.72);
  --accent: #69e2ff;
  --accent-2: #8f7cff;
  --accent-3: #ffcc66;
  --gold-1: #ffe08a;
  --gold-2: #f0a829;
  --gold-3: #c97e12;
  --success: #71f7b1;
  --thai-font: "Prompt", "Noto Sans Thai", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  font-family: var(--thai-font);
}

/* live overlay page — lock scroll, green screen bg */
body[data-page="program"] {
  height: 100%;
  overflow: hidden;
  background: #00ff00;
}
html:has(body[data-page="program"]) {
  height: 100%;
  overflow: hidden;
}

/* admin page — allow scroll, dark bg */
body[data-page="admin"] {
  min-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(105, 226, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(143, 124, 255, 0.18), transparent 32%),
    linear-gradient(135deg, #05070d 0%, #0b1020 45%, #05070d 100%);
}
body { color: var(--text); }

a { color: inherit; }

.glass-card {
  background: linear-gradient(180deg, rgba(18, 27, 44, 0.72), rgba(11, 16, 28, 0.66));
  border: 1px solid var(--line);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  width: 100vw;
  height: 100vh;
  padding: 24px;
}
body[data-page="program"] .app-shell {
  grid-template-columns: 1fr;
}
body[data-page="program"] .program-feed {
  width: 100%;
  min-height: calc(100vh - 48px);
}
body[data-page="program"] .top-row,
body[data-page="program"] .bottom-strip {
  width: 100%;
}
.program-feed { position: relative; min-width: 0; }
.top-row, .bottom-strip { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
/* ── Race timer (under category bar) ────────────────────── */
.race-timer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 6px 14px;
  background: linear-gradient(120deg, rgba(20,14,4,0.95), rgba(12,9,3,0.95));
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  align-self: flex-start;
  width: fit-content;
}
.rt-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--gold-1);
}
.rt-clock {
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(255,204,102,0.4);
  min-width: 92px;
}
/* timer inside the ranking table banner */
.table-timer {
  display: flex;
  align-items: center;
  padding: 0 18px;
  margin-left: -1px;
  background: linear-gradient(120deg, rgba(20,14,4,0.95), rgba(12,9,3,0.95));
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%);
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  color: var(--gold-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ── MotoGP-style race identity (no box) ───────────────── */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.race-id {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
}

/* the transparent logo, floating — no container box */
.race-id-logo {
  position: relative;
  animation: logoEnter 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.race-id-logo img {
  height: 100px;
  width: auto;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
}
/* light streak that sweeps across the logo */
.race-id-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,0.45) 50%, transparent 62%);
  mix-blend-mode: overlay;
  transform: translateX(-120%);
  animation: logoShine 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes logoEnter {
  from { opacity: 0; transform: translateX(-48px) scale(0.92) skewX(-6deg); }
  to   { opacity: 1; transform: translateX(0) scale(1) skewX(0); }
}
@keyframes logoShine {
  0%, 70%  { transform: translateX(-120%); }
  100%     { transform: translateX(120%); }
}

/* stack: meta on top, timer below */
.race-id-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-self: center;
}
/* dark bar holding meta text */
.race-id-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 24px 6px 14px;
  background: linear-gradient(120deg, rgba(14,20,34,0.97), rgba(8,12,22,0.95));
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  animation: barEnter 0.8s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.race-id-accent {
  width: 4px;
  height: 22px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 0 12px var(--gold-2);
  animation: accentGlow 2s ease-in-out infinite;
}
@keyframes barEnter {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes accentGlow {
  0%, 100% { box-shadow: 0 0 8px var(--gold-2); }
  50%      { box-shadow: 0 0 18px var(--gold-2); }
}
.race-id-meta {
  position: relative;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0;
}
.logo-tab { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 18px; }

.spon-tab {
  width: 200px;
  height: 90px;
  flex: 0 0 200px;
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  position: relative;
  margin-left: auto;
  margin-right: -48px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
.spon-slider {
  position: relative;
  width: 100%;
  height: 100%;
}
.spon-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.spon-slide.active {
  opacity: 1;
}
.spon-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: brightness(1.1);
}
.logo-mark { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #08111f; }
.logo-copy { line-height: 1.05; }
.logo-text { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.logo-subtext { margin-top: 4px; color: var(--muted); font-size: 12px; }

.center-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 90%);
}
.hero {
  display: block;
  padding: 0;
  background: none !important;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}
.table-banner {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 0;
}
/* gold heat badge — LEFT */
.panel-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 30px 0 18px;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2) 60%, var(--gold-3));
  color: #1a0e00;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 100%, 0 100%);
  box-shadow: 4px 0 12px rgba(0,0,0,0.4);
  z-index: 1;
}
/* dark bar — left edge angled to meet gold pill */
.table-banner-left {
  flex: 0 0 auto;
  position: relative;
  padding: 12px 36px 12px 28px;
  background: linear-gradient(120deg, rgba(14,20,34,0.97), rgba(8,12,22,0.95));
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
  margin-left: -20px;
  z-index: 0;
}
.panel-kicker { font-size: 10px; letter-spacing: 0.22em; color: var(--gold-1); font-weight: 700; }
.panel-title { font-size: 22px; font-weight: 900; font-style: italic; margin-top: 3px; text-transform: uppercase; white-space: nowrap; }
.race-table-wrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(16,22,38,0.96), rgba(8,12,22,0.96));
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.race-table-head,
.rider-row {
  display: grid;
  grid-template-columns: 60px 130px 1fr 1.5fr 150px;
  align-items: center;
}
.col-time {
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  color: var(--gold-1);
  letter-spacing: 0.01em;
}
.race-table-head .col-time { color: #06101e; }
/* ซ่อน TIME column เมื่อปิดสวิตช์จับเวลา */
.race-table-wrap.timer-hidden .col-time { display: none; }
.race-table-wrap.timer-hidden .race-table-head,
.race-table-wrap.timer-hidden .rider-row {
  grid-template-columns: 60px 130px 1fr 1.5fr;
}
.race-table-head {
  background: linear-gradient(90deg, var(--gold-1), var(--gold-2) 60%, var(--gold-3));
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
}
.race-table-head > div { padding: 0 7px; }
.race-table-head > div { font-size: 15px; color: #06101e; }
.rider-grid { display: block; position: relative; }

@keyframes rowSlideIn {
  0%   { opacity: 0; transform: translateX(-40px) scaleX(0.96); filter: blur(2px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateX(0) scaleX(1); filter: blur(0); }
}
@keyframes rowSlideOut {
  from { opacity: 1; transform: translateX(0) scaleY(1); max-height: 60px; }
  to   { opacity: 0; transform: translateX(18px) scaleY(0.5); max-height: 0; padding-top: 0; padding-bottom: 0; }
}
@keyframes cellFlash {
  0%   { background: rgba(105, 226, 255, 0); }
  25%  { background: rgba(105, 226, 255, 0.28); }
  100% { background: rgba(105, 226, 255, 0); }
}
@keyframes textPop {
  0%   { opacity: 0.2; transform: translateY(-4px); }
  100% { opacity: 1;   transform: translateY(0); }
}

.rider-row.row-in  { animation: rowSlideIn  0.5s cubic-bezier(0.22,1,0.36,1) both; }
.rider-row.row-out { animation: rowSlideOut 0.28s ease-in both; overflow: hidden; pointer-events: none; }
.cell-flash        { animation: cellFlash 0.6s ease-out; }
.text-updated      { animation: textPop 0.3s ease-out; }
.rider-row {
  min-height: 28px;
  padding: 0 16px;
  color: #fff;
  border-top: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.rider-row:nth-child(odd) { background: rgba(255,255,255,0.025); }
.rider-row.leader {
  background: linear-gradient(90deg, rgba(255,204,102,0.18), rgba(240,168,41,0.06) 60%, transparent);
}
/* accent slash on leader */
.rider-row.leader::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 0 12px var(--gold-2);
}
.rider-row > div { padding: 9px 7px; font-weight: 700; }
.col-no { font-size: 18px; font-weight: 900; font-style: italic; color: var(--gold-1); }
.col-bib { font-size: 22px; font-weight: 900; }
/* racing bib tag — centered, gold underline */
.bib-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 4px 14px;
  background: rgba(255,255,255,0.08);
  border-bottom: 2px solid var(--gold-2);
  font-style: italic;
  text-align: center;
}
.col-nickname { font-size: 20px; font-weight: 800; }
.col-name { font-size: 17px; color: rgba(255,255,255,0.88); }
.bottom-strip { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; }

/* ── Sponsor premium bar (static) ──────────────────────── */
.spon-bar {
  flex: 0 1 auto;
  align-self: center;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 24px 16px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 160% at 50% -40%, rgba(105, 226, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(12, 18, 32, 0.94), rgba(7, 11, 20, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}
/* slow light sweep across the whole bar */
.spon-bar::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  left: -50%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.06), transparent);
  transform: skewX(-18deg);
  animation: sponSweep 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sponSweep {
  0%, 100% { left: -60%; }
  50%      { left: 120%; }
}

.spon-bar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.spon-bar-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
}
.spon-bar-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
}
.spon-bar-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--accent);
  text-transform: uppercase;
}

.spon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.spon-logo {
  flex: 0 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  animation: sponReveal 0.6s cubic-bezier(0.22,1,0.36,1) forwards;
}
.spon-logo img {
  max-height: 100%;
  max-width: 180px;
  object-fit: contain;
}

@keyframes sponReveal {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Cover image overlay ─────────────────────────────────── */
.cover-image-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s 0.9s;
}
.cover-image-overlay.cover-show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}
.cover-image-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Gate Display — brutal MotoGP start grid ────────────── */
.gate-display {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 7;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1), opacity 0.4s ease;
  filter: drop-shadow(0 16px 40px rgba(0,0,0,0.6));
}
.gate-display.gd-show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* header strip — centered tab with angled ends */
.gd-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: fit-content;
  margin: 0 auto -2px;
  padding: 0 50px;
  background: linear-gradient(90deg, rgba(255,204,102,0.95), rgba(255,170,40,0.95));
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
  position: relative;
  z-index: 2;
}
.gd-header-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #1a0e00;
  white-space: nowrap;
}
.gd-header-line { display: none; }

/* gates row — angled racing end caps */
.gd-gates {
  display: flex;
  width: 100%;
  gap: 3px;
  align-items: stretch;
  background: linear-gradient(180deg, #000 0%, #0a0e18 100%);
  padding: 3px;
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 100%, 0 100%);
}

/* individual gate slot */
.gd-slot {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 6px 18px;
  background: linear-gradient(180deg, #0c1120 0%, #060b14 100%);
  border-top: 4px solid var(--accent);
  overflow: visible;
  opacity: 0;
  transform: translateY(28px);
  animation: gateSlotIn 0.45s cubic-bezier(0.22,1,0.36,1) forwards;
}

/* alternate accent color */
.gd-slot:nth-child(even) { border-top-color: var(--accent-3); }

/* stagger */
.gd-slot:nth-child(1) { animation-delay: 0.00s; }
.gd-slot:nth-child(2) { animation-delay: 0.05s; }
.gd-slot:nth-child(3) { animation-delay: 0.10s; }
.gd-slot:nth-child(4) { animation-delay: 0.15s; }
.gd-slot:nth-child(5) { animation-delay: 0.20s; }
.gd-slot:nth-child(6) { animation-delay: 0.25s; }
.gd-slot:nth-child(7) { animation-delay: 0.30s; }
.gd-slot:nth-child(8) { animation-delay: 0.35s; }

@keyframes gateSlotIn {
  to { opacity: 1; transform: translateY(0); }
}

/* diagonal speed lines */
.gd-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 14px,
    rgba(255,255,255,0.022) 14px 16px
  );
  pointer-events: none;
}

/* glow line at top of slot matching border */
.gd-slot::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
  filter: blur(2px);
}
.gd-slot:nth-child(even)::after { background: var(--accent-3); }

/* gate number */
.gd-gate-no {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.26em;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
}

/* BIB number — large, italic, punchy */
.gd-bib {
  font-size: 46px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 24px rgba(105,226,255,0.45);
}
.gd-slot:nth-child(even) .gd-bib {
  text-shadow: 0 0 24px rgba(255,204,102,0.45);
}

/* nickname */
.gd-nick {
  font-size: 15px;
  font-weight: 800;
  color: rgba(255,255,255,0.85);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  width: 100%;
  line-height: 1.3;
  letter-spacing: 0.01em;
  padding: 0 2px 2px;
}

/* empty slot */
.gd-slot.gd-empty { border-top-color: rgba(255,255,255,0.12); }
.gd-slot.gd-empty .gd-bib { color: rgba(255,255,255,0.15); text-shadow: none; }
.gd-slot.gd-empty .gd-nick { color: rgba(255,255,255,0.15); }

/* ── Visibility toggle (live elements) ─────────────────── */
/* transition อยู่ที่ตัว element เอง → มีโมชั่นทั้งตอนซ่อนและโชว์ */
body[data-page="program"] #elRaceLogo,
body[data-page="program"] #elRaceMeta,
body[data-page="program"] #elSponTop,
body[data-page="program"] #elRiderTable,
body[data-page="program"] #elSponBottom,
body[data-page="program"] #elRaceTimer {
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;     /* โชว์: visibility เปลี่ยนทันที แล้วค่อยเฟดเข้า */
}
body[data-page="program"] .is-hidden {
  /* ปลดล็อก animation-fill-mode:both ที่ค้าง opacity ไว้ → ให้ transition เฟดได้ */
  animation: none !important;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  visibility: hidden;
  pointer-events: none;
  /* ซ่อน: รอเฟดออกจบก่อนค่อย set visibility:hidden */
  transition:
    opacity 0.45s cubic-bezier(0.55, 0, 0.45, 1),
    transform 0.45s cubic-bezier(0.55, 0, 0.45, 1),
    visibility 0s 0.45s;
}
/* ตารางแข่งจัดกลางด้วย translate(-50%,-50%) — ต้องคงค่ากลางไว้ตอนซ่อน */
body[data-page="program"] #elRiderTable.is-hidden {
  transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
}

/* ── Lower third — premium centered name card ──────────── */
.lower-third {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 26px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s cubic-bezier(0.22,1,0.36,1), transform 0.55s cubic-bezier(0.22,1,0.36,1);
  z-index: 6;
}
.lower-third.lt-show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.lt-panel {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 16px 36px 20px 20px;
  border-radius: 18px;
  background:
    radial-gradient(140% 180% at 50% -30%, rgba(255, 204, 102, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(14, 20, 34, 0.96), rgba(8, 12, 22, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.07);
  overflow: visible;
}
/* gold accent top edge */
.lt-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--accent-3), #fff, var(--accent-3), transparent);
  box-shadow: 0 0 16px rgba(255, 204, 102, 0.7);
}
/* slow shimmer sweep */
.lt-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 42%, rgba(255,255,255,0.06) 50%, transparent 58%);
  transform: translateX(-100%);
  animation: ltSweep 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ltSweep {
  0%, 72% { transform: translateX(-100%); }
  100%    { transform: translateX(100%); }
}

.lt-logo {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding-right: 0;
  animation: ltLogoIn 0.6s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}
.lt-logo img {
  height: 70px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}
/* thin divider between logo and text */
.lt-divider {
  width: 1px;
  height: 48px;
  background: linear-gradient(180deg, transparent, rgba(255,204,102,0.5), transparent);
  margin: 0 20px;
  flex: 0 0 auto;
}
@keyframes ltLogoIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lt-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  overflow: visible;
}
.lt-name {
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.4;        /* เพิ่ม line-height ให้สระมีที่ */
  padding-top: 4px;        /* padding บนสำหรับสระบน */
  color: #fff;
  white-space: nowrap;
  animation: ltNameIn 0.6s 0.15s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes ltNameIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lt-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-3);
  animation: ltTitleIn 0.6s 0.25s cubic-bezier(0.22,1,0.36,1) both;
}
.lt-title-line {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-3));
}
.lt-title-line:last-child {
  background: linear-gradient(90deg, var(--accent-3), transparent);
}
@keyframes ltTitleIn {
  from { opacity: 0; letter-spacing: 0.4em; }
  to   { opacity: 1; letter-spacing: 0.22em; }
}

/* ── โมชั่นสลับรายการ (swap) — เฟดออกขึ้น / สไลด์เข้าจากล่าง ── */
.lt-text.lt-out {
  animation: ltSwapOut 0.22s cubic-bezier(0.55, 0, 0.85, 0.3) forwards;
}
.lt-text.lt-in {
  animation: ltSwapIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes ltSwapOut {
  to { opacity: 0; transform: translateY(-12px); filter: blur(3px); }
}
@keyframes ltSwapIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* ════════════════════════════════════════════════════════
   CONTROL ROOM (admin)
   ════════════════════════════════════════════════════════ */
.admin-page {
  width: 100%;
  padding: 28px 24px 110px;
}
.admin-wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.admin-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid rgba(105,226,255,0.35);
  border-radius: 6px;
}
.admin-top-id h1 { margin: 10px 0 4px; font-size: 30px; font-weight: 900; font-style: italic; letter-spacing: 0.01em; }
.admin-top-id p { margin: 0; color: var(--muted); font-size: 13px; }
.admin-link {
  color: #06101e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.card {
  padding: 20px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18,26,42,0.7), rgba(11,16,28,0.66));
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 16px 44px rgba(0,0,0,0.32);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.card-hint { font-size: 12px; color: var(--muted); }

/* fields */
.field { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field:last-child { margin-bottom: 0; }
.field input, .field select, .rider-editor input, .lt-people input {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 11px 13px;
  font-family: var(--thai-font);
  font-size: 14px;
}
.field input:focus, .field select:focus, .rider-editor input:focus, .lt-people input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(105,226,255,0.16);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* toggle switches */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  user-select: none;
}
.toggle input { display: none; }
.toggle-track {
  flex: 0 0 auto;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  position: relative;
  transition: background 0.25s ease;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
}
.toggle input:checked + .toggle-track { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }
.toggle-text { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.2; }
.toggle-text small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.toggle-accent { border-color: rgba(255,204,102,0.4); background: rgba(255,204,102,0.06); }

/* buttons */
.btn-soft, .btn-ghost, .btn-primary {
  border: 0; border-radius: 11px; padding: 10px 16px;
  font-weight: 800; cursor: pointer; font-family: var(--thai-font); font-size: 14px;
}
.btn-soft { background: rgba(105,226,255,0.14); color: var(--accent); border: 1px solid rgba(105,226,255,0.25); }
.btn-soft:hover { background: rgba(105,226,255,0.24); }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid rgba(255,255,255,0.12); }
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06101e; padding: 11px 22px; }
.btn-primary:hover { filter: brightness(1.08); }

/* rider editor */
.rider-editor { display: grid; gap: 12px; }
.rider-editor-row { padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); }
.rider-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.rider-editor label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.btn-delete-rider { border: 1px solid rgba(255,80,80,0.3); border-radius: 8px; background: rgba(255,60,60,0.12); color: #ff6b6b; padding: 4px 11px; font-size: 13px; font-weight: 800; cursor: pointer; }
.btn-delete-rider:hover { background: rgba(255,60,60,0.3); }

/* lower third manager */
.lt-logo-controls { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.lt-logo-preview {
  flex: 0 0 84px; width: 84px; height: 84px;
  border-radius: 14px; display: grid; place-items: center;
  background: repeating-conic-gradient(rgba(255,255,255,0.06) 0 25%, transparent 0 50%) 0 0 / 16px 16px, #fff;
  overflow: hidden;
}
.lt-logo-preview img { max-width: 76px; max-height: 76px; object-fit: contain; }
.lt-logo-fields { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.lt-logo-fields .field, .lt-logo-fields .toggle { margin-bottom: 0; }
.lt-active-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.lt-active-row .field { flex: 1; margin-bottom: 0; }
.lt-active-row .btn-soft { white-space: nowrap; }
.lt-people { display: grid; gap: 10px; }
.lt-person-row { padding: 13px; border-radius: 13px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); }
.lt-person-row.active { border-color: rgba(255,204,102,0.5); background: rgba(255,204,102,0.07); }
.lt-person-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.lt-person-actions { display: flex; gap: 8px; }
.lt-show-btn { border: 1px solid rgba(105,226,255,0.3); border-radius: 8px; background: rgba(105,226,255,0.12); color: var(--accent); padding: 4px 12px; font-size: 13px; font-weight: 800; cursor: pointer; }
.lt-show-btn:hover { background: rgba(105,226,255,0.24); }
.lt-people label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

/* sticky save bar */
.admin-savebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: rgba(8,12,20,0.92);
  border-top: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(14px);
  z-index: 50;
}
.save-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.save-status strong { color: var(--accent-3); }
.save-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.save-actions { display: flex; gap: 10px; }

@media (max-width: 1000px) {
  .admin-cols { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
