/* RockinEvent NFC - shared theme (customer / staff / backoffice).
   Palette from the Zacapa "Art of Rum" key visual: near-black wood browns, rum amber, aged gold, cream. */

/* Kanit = Thai + Latin, modern loopless Thai (files from AISGame2026: subset Thai+Latin, ~21KB each).
   400/900 are served locally so the event works without Google Fonts; 300/500/600 come from
   Google Fonts (same family name) so headings don't fall back to faux-bold or Black. */
@font-face {
  font-family: 'Kanit';
  src: url('/assets/fonts/Kanit-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Kanit';
  src: url('/assets/fonts/Kanit-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0d0907;
  --bg-2: #140e0a;
  --surface: #1a120d;
  --raise: #241811;
  --raise-2: #2f2016;
  --line: rgba(201, 163, 90, 0.22);
  --line-strong: rgba(201, 163, 90, 0.5);

  --gold: #c9a35a;
  --gold-hi: #e4c681;
  --gold-lo: #8c6b33;
  --amber: #9a4a17;
  --amber-glow: #d07a2c;

  --text: #f1e6cf;
  --muted: #b9a68a;
  --faint: #7d6c56;

  --ok: #8fbf6f;
  --warn: #e3ac4a;
  --bad: #e06a52;
  --info: #79a9cf;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  --gold-grad: linear-gradient(180deg, #f3dca0 0%, #d8b468 45%, #a9803a 100%);

  /* Cormorant only renders Latin (event name, #003 queue numbers); Thai always lands on Kanit */
  --font-display: 'Cormorant Garamond', 'Kanit', Georgia, serif;
  --font-head: 'Kanit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Kanit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 88% -8%, rgba(208, 122, 44, 0.26), transparent 62%),
    radial-gradient(ellipse 70% 45% at -10% 105%, rgba(154, 74, 23, 0.22), transparent 60%),
    linear-gradient(180deg, #130d09 0%, #0d0907 55%, #090604 100%);
  background-repeat: no-repeat;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
b, strong { font-weight: 600; } /* Kanit has no 700: bold would jump to Black */
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-hi); }
[hidden] { display: none !important; }

/* ---------- layout ---------- */

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.app.wide { max-width: 1180px; }

.page-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.narrow { max-width: 420px; width: 100%; }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 28px; }

/* ---------- type ---------- */

.eyebrow {
  margin: 0;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em; /* Thai must not be tracked out */
  color: var(--gold);
}
/* Latin-only labels (event name, brand line): wide tracked small caps like the key visual */
.eyebrow.caps { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.32em; text-transform: uppercase; }

.title-gold {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600; /* Kanit 700 would resolve to Black (900) */
  font-size: clamp(26px, 7vw, 36px);
  line-height: 1.25;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-hi);
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
}

h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 600; }
h2 { font-size: 22px; color: var(--gold-hi); }
h3 { font-size: 17px; color: var(--text); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ornament {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  font-size: 10px;
}
.ornament::before, .ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ---------- surfaces ---------- */

.card {
  background: linear-gradient(180deg, rgba(46, 31, 21, 0.72), rgba(26, 18, 13, 0.82));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.tight { padding: 12px 14px; }
.card.glow { border-color: var(--line-strong); box-shadow: 0 0 0 1px rgba(228, 198, 129, 0.15), 0 0 32px rgba(208, 122, 44, 0.25), var(--shadow); }

.panel {
  background: rgba(20, 14, 10, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(36, 24, 17, 0.8);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 20px;
  min-height: 46px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #ecd08f 0%, #c9a35a 55%, #a57d39 100%);
  color: #1c1108;
  box-shadow: 0 6px 18px rgba(201, 163, 90, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn.amber {
  border-color: transparent;
  background: linear-gradient(180deg, #e08a3b 0%, #b5581c 100%);
  color: #fff4e6;
}
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(224, 106, 82, 0.55); color: #ffb3a3; background: rgba(224, 106, 82, 0.08); }
.btn.block { width: 100%; }
.btn.lg { min-height: 58px; font-size: 18px; padding: 14px 24px; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn.icon { width: 46px; padding: 0; }
.btn.icon.sm { width: 36px; }

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  background: rgba(20, 14, 10, 0.6);
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--gold); color: #1c1108; font-weight: 600; }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(13, 9, 7, 0.75);
  color: var(--text);
  padding: 10px 14px;
  font-size: 16px; /* >= 16px: iOS does not zoom on focus */
}
.input:focus { outline: none; border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(228, 198, 129, 0.15); }
textarea.input { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

/* ---------- chips / badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok { color: var(--ok); border-color: rgba(143, 191, 111, 0.5); background: rgba(143, 191, 111, 0.08); }
.chip.warn { color: var(--warn); border-color: rgba(227, 172, 74, 0.5); background: rgba(227, 172, 74, 0.08); }
.chip.bad { color: var(--bad); border-color: rgba(224, 106, 82, 0.5); background: rgba(224, 106, 82, 0.08); }
.chip.info { color: var(--info); border-color: rgba(121, 169, 207, 0.5); background: rgba(121, 169, 207, 0.08); }
.chip.gold { color: #1c1108; background: var(--gold); border-color: transparent; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(143, 191, 111, 0.8); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.seq {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--gold-hi);
  line-height: 1;
  letter-spacing: 0.02em;
  /* Cormorant defaults to old-style figures (#003 reads like #OO3) - staff call these numbers out */
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: 'lnum' 1, 'tnum' 1;
}
.seq.xl { font-size: 64px; }

/* ---------- song cover / thumbs ---------- */

.cover {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
  background: linear-gradient(135deg, #3a2618, #1b120c);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--gold);
}
.cover.lg { width: 84px; height: 84px; font-size: 32px; }

.thumb-4x6 {
  aspect-ratio: 1240 / 1920;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}
.thumb-4x6 img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- progress / spinner ---------- */

.progress { height: 8px; border-radius: 99px; background: rgba(201, 163, 90, 0.15); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--gold-grad); transition: width 0.2s ease; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(201, 163, 90, 0.2);
  border-top-color: var(--gold-hi);
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast / modal ---------- */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 1000;
  padding: 0 16px;
}
.toast {
  max-width: 520px;
  background: rgba(36, 24, 17, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 15px;
  animation: toast-in 0.2s ease;
}
.toast.ok { border-color: rgba(143, 191, 111, 0.7); }
.toast.bad { border-color: rgba(224, 106, 82, 0.8); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 2, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 900;
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: auto;
}

.banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(90deg, #9a4a17, #c26a2a);
  color: #fff4e6;
  padding: 10px 16px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- list rows ---------- */

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(36, 24, 17, 0.7);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.item:active { background: rgba(47, 32, 22, 0.9); }
.item.hot { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(228, 198, 129, 0.25), 0 0 24px rgba(208, 122, 44, 0.25); animation: hot 1.6s ease-in-out 3; }
@keyframes hot { 50% { box-shadow: 0 0 0 2px rgba(228, 198, 129, 0.6), 0 0 34px rgba(208, 122, 44, 0.5); } }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 2px 10px;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--gold);
  font-weight: 600;
}
.section-title .count { color: var(--muted); letter-spacing: 0; }

.empty { text-align: center; color: var(--faint); padding: 18px 8px; font-size: 14px; }

/* ---------- tables (backoffice) ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { color: var(--gold); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; background: rgba(20, 14, 10, 0.7); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
