/* Same visual language as the Flutter app itself (dynasty888_flutter/lib/core/
   theme/app_theme.dart — "Chinese Luxury" palette: charcoal + gold), ported
   1:1 from the approved design preview. System font stack — no webfonts, no
   framework CSS, nothing to slow the first paint down. */
:root {
  --bg: #0A0A0A;
  --surface: #1A1A1A;
  --surface2: #222222;
  --surface3: #282828;
  --gold: #D4AF37;
  --gold-light: #E8CD6A;
  --gold-dark: #B8962E;
  --neon-a: #C9A84C;
  --neon-b: #F5D483;
  --red: #EF4444;
  --amber: #F59E0B;
  --text: #F5F5F5;
  --text-muted: #9E9E9E;
  --text-dim: #616161;
  --border: #2A2A2A;
  --border-light: #333333;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* most traffic here is a thumb on a phone screen, not a mouse */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* kills the 300ms tap delay + accidental double-tap zoom */
}

a { color: inherit; }
button, input { -webkit-tap-highlight-color: transparent; }

/* ---- ambient stage glow (cheap: plain radial-gradients, no filter:blur) ---- */
body {
  background-image:
    radial-gradient(560px 560px at 15% -10%, rgba(212, 175, 55, 0.10), transparent 60%),
    radial-gradient(480px 480px at 110% 30%, rgba(46, 125, 50, 0.09), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
header.top .logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}
header.top .logo span { color: var(--gold); }

/* ---- "back" links: a proper thumb-sized pill everywhere it's used, not
   bare underlined text — header nav gets a quiet variant. ---- */
.back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-decoration: none; padding: 9px 16px;
  border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  min-height: 38px; box-sizing: border-box;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .1s ease;
  cursor: pointer;
}
.back:active { transform: scale(0.96); }
.back:hover { color: var(--gold-light); border-color: rgba(212, 175, 55, 0.4); background: rgba(212, 175, 55, 0.1); }
header.top a.back {
  padding: 8px 14px; margin-bottom: 0; min-height: 34px;
  background: transparent; border-color: transparent; font-weight: 600;
}
header.top a.back:hover { background: var(--surface); border-color: var(--border); }

h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.4px; margin: 4px 0 6px; }
h2 { font-size: 19px; font-weight: 800; margin: 0 0 12px; }
p.hint { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 0 0 20px; }

.venue-switch {
  display: flex; gap: 8px; margin: 4px 0 22px; flex-wrap: wrap;
}
.venue-switch button {
  padding: 9px 14px; min-height: 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 12.5px;
  font-weight: 700; cursor: pointer; font-family: inherit;
}
.venue-switch button.active {
  background: rgba(212, 175, 55, 0.14); color: var(--gold-light); border-color: rgba(212, 175, 55, 0.4);
}

/* ---- generic flex list container (categories, tables) ---- */
.grid { display: flex; flex-direction: column; gap: 12px; }

/* ============ category cards — gradient per type ============ */
.cat-card {
  position: relative;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid;
  cursor: pointer;
  opacity: 0;
  animation: cardIn .5s cubic-bezier(.2,.7,.3,1) forwards;
  transition: transform .1s ease;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.cat-card:active { transform: scale(0.98); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-card.disabled { cursor: default; opacity: 0.5 !important; animation: none; }

.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cat-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.cat-name { font-weight: 800; font-size: 16px; letter-spacing: -0.2px; }
.cat-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.cat-strip {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,0,0,0.22); border-radius: 12px; padding: 9px 12px; margin-bottom: 12px;
}
.cat-tags { display: flex; gap: 6px; }
.cat-tag { font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 999px; border: 1px solid; }
.cat-price { font-weight: 800; font-size: 12px; white-space: nowrap; }
.cat-cta {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--gold); color: #0A0A0A; font-weight: 800; font-size: 12.5px;
  padding: 9px; border-radius: 12px; letter-spacing: 0.2px;
}
.cat-card.disabled .cat-cta { background: var(--surface2); color: var(--text-dim); }

/* ============ table cards — icon tile + price pill + gradient CTA ============ */
.tbl-card {
  display: flex; align-items: center; gap: 14px;
  border-radius: 20px; padding: 12px;
  border: .5px solid rgba(212, 175, 55, 0.15);
  cursor: pointer;
  opacity: 0;
  animation: cardIn .5s cubic-bezier(.2,.7,.3,1) forwards;
  transition: transform .1s ease;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.tbl-card:active { transform: scale(0.98); }
.tbl-card.disabled { cursor: default; opacity: 0.5 !important; animation: none; }

.tbl-icon {
  width: 60px; height: 60px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.tbl-body { flex: 1; min-width: 0; }
.tbl-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.tbl-price-pill {
  display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 800; color: var(--gold);
  background: rgba(212, 175, 55, 0.12); border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 3px 9px; border-radius: 8px;
}
.tbl-cta {
  flex-shrink: 0; font-size: 12px; font-weight: 800; color: #0A0A0A;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  padding: 9px 14px; border-radius: 10px;
  box-shadow: 0 6px 16px -4px rgba(212, 175, 55, 0.4);
}
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(239,68,68,0.14); color: var(--red);
}

/* ============ date switcher — arrows + scroll-snap strip, no bare
   native scrollbar ============ */
.date-nav { display: flex; align-items: center; gap: 6px; margin: 16px 0; }
.date-nav-btn {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 17px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
  transition: color .15s ease, border-color .15s ease, background .15s ease, opacity .15s ease, transform .1s ease;
}
.date-nav-btn:active { transform: scale(0.92); }
.date-nav-btn:hover:not(:disabled) { color: var(--gold-light); border-color: rgba(212, 175, 55, 0.4); background: rgba(212, 175, 55, 0.1); }
.date-nav-btn:disabled { opacity: 0.25; cursor: default; }

.date-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex: 1; min-width: 0;
  scroll-behavior: smooth; scroll-snap-type: x proximity;
  scrollbar-width: none; -ms-overflow-style: none;
}
.date-row::-webkit-scrollbar { display: none; }
.date-pill {
  flex-shrink: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 12.5px; cursor: pointer;
  font-family: inherit; text-align: center; min-width: 60px; scroll-snap-align: start;
}
.date-pill .dow { display: block; color: var(--text-muted); font-size: 10.5px; margin-bottom: 2px; }
.date-pill.active { background: rgba(212, 175, 55, 0.14); border-color: rgba(212, 175, 55, 0.45); color: var(--gold-light); }

/* touch-action stays at its default (auto) here — a finger swipe starting
   on a slot must scroll the page like everywhere else, since the grid
   commonly fills most of a phone screen (a none/pan-y override here traps
   the page: you can no longer scroll past the grid to reach "Далее" below
   it). This only gives up drag-select on touch, not on mouse — the browser
   never consults touch-action for mouse drags, so desktop drag-to-select
   (app.js's pointer handlers) is unaffected; touch keeps tap-to-select,
   which is the primary, Flutter-faithful interaction anyway. */
.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 24px; }
.slot {
  padding: 11px 4px; border-radius: 8px; border: 1px solid #3a4a3a;
  background: #1C2A1C; color: var(--text); font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit; text-align: center;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background .1s ease, box-shadow .1s ease;
}
.slot.previewing { background: rgba(212, 175, 55, 0.30); border-color: rgba(212, 175, 55, 0.6); color: var(--text); }
.slot.selected { background: var(--gold); color: #0A0A0A; border-color: transparent; box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22); }
.slot.taken { background: #2A2A2A; color: #555555; border-color: transparent; text-decoration: line-through; }
.slot.past { opacity: 0.28; cursor: not-allowed; }

.summary-bar {
  position: sticky; bottom: max(0px, env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px; padding: 14px 16px; margin: 24px 0 0; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 -8px 24px -8px rgba(0, 0, 0, 0.5);
}
.summary-bar .price { font-size: 20px; font-weight: 800; color: var(--gold); }
.summary-bar .price small { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 500; }

/* ============ neon gold CTA button ============ */
.neon-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; border-radius: 14px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--neon-a), var(--neon-b), var(--neon-a));
  background-size: 220% 100%;
  color: #0A0A0A; font-weight: 800; font-size: 14px; letter-spacing: 0.4px;
  box-shadow: 0 10px 26px -8px rgba(201, 168, 76, 0.55);
  animation: neonShift 5s ease-in-out infinite;
  transition: transform .15s ease;
  font-family: inherit;
}
.neon-btn:active { transform: scale(0.97); }
.neon-btn:disabled { opacity: 0.4; cursor: not-allowed; animation: none; }
.neon-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 3.4s ease-in-out infinite;
}
@keyframes neonShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes sheen { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

.outline-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; border-radius: 14px;
  background: transparent; color: var(--text); font-weight: 700; font-size: 13.5px;
  border: 1px solid rgba(212, 175, 55, 0.5); cursor: pointer; font-family: inherit;
  transition: transform .15s ease;
}
.outline-btn:active { transform: scale(0.97); }

/* ============ glass form card ============ */
.glass {
  position: relative;
  border-radius: 22px; padding: 20px; margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6);
  overflow: hidden;
}
.glass::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 45%, rgba(255,255,255,0.06));
}
.glass .field:last-child { margin-bottom: 0; }

.field { margin-bottom: 14px; position: relative; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.3); color: var(--text); font-family: inherit;
  position: relative;
  /* iOS Safari auto-zooms the page on focus if an input's font-size is
     under 16px — this is the actual minimum, not a design choice. */
  font-size: 16px;
}
.field input:focus { outline: none; border-color: rgba(212, 175, 55, 0.5); }
.field-error { color: var(--red); font-size: 12px; margin-top: 6px; }

/* ============ ticket ============ */
.ticket {
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid rgba(212, 175, 55, 0.22); border-radius: 22px; padding: 30px 22px 24px; text-align: center;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6);
}
.check-ring {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.05));
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.3), 0 0 30px rgba(212, 175, 55, 0.25);
  animation: pop .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.check-ring svg { width: 30px; height: 30px; }
.check-ring path {
  stroke: var(--gold); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 32; stroke-dashoffset: 32;
  animation: draw .5s .35s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.ticket h2 { margin-bottom: 4px; }
.ticket .row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px dashed var(--border); font-size: 13px; text-align: left; }
.ticket .row:first-of-type { border-top: none; }
.ticket .row .k { color: var(--text-muted); }
.ticket .row .v { font-weight: 700; }
.ticket .row .v.gold { color: var(--gold); }

.order-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  background: rgba(212, 175, 55, 0.10); border: 1px solid rgba(212, 175, 55, 0.3); color: var(--gold-light);
  font-size: 12.5px; font-weight: 700; padding: 9px 18px; border-radius: 999px; cursor: pointer;
  font-family: inherit; transition: transform .1s ease, background .15s ease;
}
.order-chip:active { transform: scale(0.96); }
.order-chip:hover { background: rgba(212, 175, 55, 0.16); }
.order-chip span { font-weight: 800; color: var(--gold); }

/* ============ post-booking: guest info + next steps + hint ============ */
.guest-card { display: flex; gap: 10px; margin: 16px 0; }
.guest-tile { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.guest-tile .gk { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.guest-tile .gv { font-size: 14px; font-weight: 700; overflow-wrap: break-word; }

.next-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.next-card h3 { font-size: 14px; font-weight: 800; margin: 0 0 14px; }
.next-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.next-step:last-child { margin-bottom: 0; }
.next-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: rgba(212, 175, 55, 0.14); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.next-step b { display: block; font-size: 13.5px; font-weight: 700; }
.next-step small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.hint-card { background: rgba(212, 175, 55, 0.07); border: 1px solid rgba(212, 175, 55, 0.22); border-radius: 16px; padding: 14px 16px; margin-bottom: 20px; }
.hint-card b { display: block; font-size: 12.5px; color: var(--gold-light); margin-bottom: 5px; }
.hint-card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin: 0; }

.tg-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 12px; padding: 12px; font-size: 13px; font-weight: 700; color: #5FB2E8;
  text-decoration: none; border-radius: 14px; border: 1px solid rgba(95, 178, 232, 0.3); background: rgba(95, 178, 232, 0.08);
  transition: transform .1s ease;
}
.tg-link:active { transform: scale(0.98); }

.toast {
  position: fixed; left: 50%; bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
  transform: translateX(-50%) translateY(12px);
  background: var(--surface2); border: 1px solid rgba(212, 175, 55, 0.3); color: var(--text);
  padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.error-banner {
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: var(--red);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px;
}

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--gold-light);
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- view transition: replays automatically whenever [hidden] is removed,
   since that re-enters the section in the render tree ---- */
section:not([hidden]) { animation: viewIn .32s cubic-bezier(.2,.7,.3,1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .cat-card, .tbl-card, .neon-btn, .neon-btn::after, .check-ring, .check-ring path, section:not([hidden]) {
    animation: none !important;
  }
}
