:root {
  --bg: #05070d;
  --glass: rgba(14, 16, 24, 0.72);
  --glass-hi: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f3f2f6;
  --muted: #9b9daf;
  --dim: #6c6f80;
  --gold: #f2c35b;
  --gold-2: #c8902a;
  --mint: #3cf0c0;
  --danger: #ff5d73;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --panel-w: 348px;
  --mm-w: 218px;
  --gap: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.hidden { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 18px; justify-items: center;
  background: radial-gradient(circle at 50% 40%, #151a2e, #05070d 70%); transition: opacity 0.8s ease;
  color: var(--muted); letter-spacing: 0.02em;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-mark {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid rgba(242, 195, 91, 0.18); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 10; top: var(--gap); left: var(--gap); right: var(--gap);
  height: 60px; border-radius: var(--r-lg); padding: 0 10px 0 10px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #1b1407;
  background: linear-gradient(140deg, #ffe3a1, var(--gold) 45%, var(--gold-2));
}
.brand-mark svg { width: 22px; height: 22px; }
.brand strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.session { display: flex; align-items: center; gap: 10px; }
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; font: inherit; font-weight: 700; color: var(--text); cursor: pointer;
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 38px 9px 14px; min-width: 210px;
}
.select-wrap select option { background: #12141c; }
.select-wrap svg { position: absolute; right: 12px; top: 50%; translate: 0 -50%; pointer-events: none; color: var(--muted); }
.chips { display: flex; gap: 6px; }
.chip {
  padding: 8px 13px; border-radius: 11px; font-weight: 700; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); background: var(--glass-hi); transition: 0.2s;
}
.chip:hover { color: var(--text); }
.chip.active { color: #1b1407; background: linear-gradient(140deg, #ffe3a1, var(--gold)); border-color: transparent; }

.top-actions { justify-self: end; display: flex; gap: 6px; }
.icon-btn {
  height: 38px; min-width: 38px; padding: 0 11px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--glass-hi); font-weight: 700; font-size: 12.5px; color: var(--muted); transition: 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn.active { color: var(--gold); border-color: rgba(242, 195, 91, 0.45); }

/* ---------- hint ---------- */
.hint {
  position: fixed; z-index: 9; top: calc(60px + var(--gap) * 2); left: var(--gap);
  padding: 12px 34px 12px 14px; border-radius: var(--r-md); font-size: 11.5px; line-height: 1.75; color: #c9cad6;
}
.hint b { color: var(--gold); font-weight: 700; }
.hint-x { position: absolute; top: 6px; right: 8px; color: var(--muted); font-size: 16px; line-height: 1; padding: 4px; }

.exit-seat {
  position: fixed; z-index: 11; top: calc(60px + var(--gap) * 2); left: calc((100vw - var(--panel-w) - var(--gap)) / 2);
  translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 10px 18px 10px 12px; border-radius: 99px;
  background: rgba(10, 11, 16, 0.85); border: 1px solid var(--line-2); font-weight: 700; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: pop 0.35s ease;
}
.exit-seat:hover { border-color: var(--gold); color: var(--gold); }
.seat-badge {
  position: fixed; z-index: 11; bottom: 92px; left: calc((100vw - var(--panel-w) - var(--gap)) / 2); translate: -50% 0;
  padding: 9px 16px; border-radius: 12px; background: rgba(10, 11, 16, 0.8); border: 1px solid var(--line);
  font-size: 12.5px; color: #d6d7e0; white-space: nowrap; animation: pop 0.35s ease;
}
.seat-badge b { color: var(--mint); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- panel ---------- */
.panel {
  position: fixed; z-index: 10; right: var(--gap); top: calc(60px + var(--gap) * 2); bottom: var(--gap);
  width: var(--panel-w); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden;
}
.sheet-handle { display: none; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: #2a2c38 transparent; }

.event-card {
  position: relative; overflow: hidden; border-radius: 16px; padding: 16px; margin-bottom: 14px; isolation: isolate;
  border: 1px solid var(--line);
}
.event-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 140% at 100% 0%, var(--ev2) 0%, transparent 55%), radial-gradient(90% 120% at 0% 100%, var(--ev1) 0%, transparent 60%), var(--ev3);
  opacity: 0.9;
}
.event-card .tag {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; padding: 4px 9px; border-radius: 99px;
  background: var(--gold); color: #1b1407; margin-bottom: 10px;
}
.event-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.event-card p { font-size: 12px; color: rgba(255, 255, 255, 0.75); margin-top: 2px; }
.event-card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; font-size: 11.5px; color: rgba(255, 255, 255, 0.85); }
.event-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-card .meta svg { width: 13px; height: 13px; color: var(--gold); }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px 8px; }
.panel-head h3 { font-size: 13px; font-weight: 800; }

.cats { list-style: none; display: grid; gap: 4px; }
.cat {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 11px; border-radius: 12px; border: 1px solid transparent; background: var(--glass-hi); transition: 0.18s;
}
.cat:hover { border-color: var(--line-2); }
.cat.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.cat.dim { opacity: 0.4; }
.cat i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); }
.cat b { display: block; font-size: 12.5px; font-weight: 700; }
.cat small { display: block; font-size: 10.5px; color: var(--dim); }
.cat .price { font-weight: 800; color: var(--gold); font-size: 13px; }

.legend { display: flex; gap: 14px; margin: 10px 4px 14px; font-size: 10.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.avail { background: #5d6577; }
.lg.pick { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.lg.sold { background: #22242b; border: 1px solid #3a3d48; }

.timer { font-size: 11.5px; font-weight: 800; color: var(--gold); display: inline-flex; gap: 5px; align-items: center; }
.timer.warn { color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

.cart { list-style: none; display: grid; gap: 6px; }
.cart .empty {
  padding: 22px 14px; text-align: center; border: 1px dashed var(--line-2); border-radius: 14px; color: var(--dim); font-size: 12px; line-height: 1.6;
}
.cart-item {
  display: grid; grid-template-columns: 36px 1fr auto auto auto; align-items: center; gap: 9px;
  padding: 8px 8px 8px 8px; border-radius: 13px; background: var(--glass-hi); border: 1px solid var(--line); animation: pop 0.3s ease;
}
.cart-item .num {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--c); color: #120f08;
}
.cart-item b { display: block; font-size: 12px; font-weight: 700; line-height: 1.3; }
.cart-item small { display: block; font-size: 10.5px; color: var(--dim); }
.cart-item .p { font-weight: 800; color: var(--gold); font-size: 12.5px; }
.cart-item button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: 0.15s; }
.cart-item button:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.cart-item button.eye:hover { color: var(--mint); }
.cart-item button svg { width: 16px; height: 16px; }

.panel-foot { padding: 12px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.18); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; font-size: 12px; }
.total-row strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }

.btn-gold {
  width: 100%; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 800; font-size: 14px; color: #1b1407;
  background: linear-gradient(140deg, #ffe7ad, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 8px 26px rgba(242, 195, 91, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5); transition: 0.2s;
}
.btn-gold:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(242, 195, 91, 0.35); }
.btn-gold:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  height: 48px; border-radius: 14px; font-weight: 800; border: 1px solid var(--line-2); background: var(--glass-hi); padding: 0 22px;
}
.btn-ghost:hover { border-color: var(--text); }

/* ---------- minimap ---------- */
.minimap { position: fixed; z-index: 9; left: var(--gap); bottom: var(--gap); padding: 8px 8px 6px; border-radius: var(--r-md); }
.mm-head { display: flex; justify-content: space-between; gap: 20px; font-size: 10.5px; font-weight: 700; margin: 0 2px 4px; }
#minimap { width: 200px; height: 150px; display: block; cursor: crosshair; }

/* ---------- toolbar ---------- */
.toolbar {
  --free: calc(100vw - var(--mm-w) - var(--panel-w) - var(--gap) * 4);
  position: fixed; z-index: 10; bottom: var(--gap); left: calc(var(--mm-w) + var(--gap) * 2 + var(--free) / 2); translate: -50% 0;
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 16px; max-width: var(--free);
  overflow-x: auto; scrollbar-width: none;
}
.tb {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 11px;
  font-size: 12px; font-weight: 700; color: #c3c4d0; white-space: nowrap; transition: 0.18s;
}
.tb svg { width: 15px; height: 15px; }
.tb:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.tb.active { color: var(--gold); background: rgba(242, 195, 91, 0.1); }
.tb-gold { color: #1b1407 !important; background: linear-gradient(140deg, #ffe3a1, var(--gold)) !important; }
.tb-gold.active { box-shadow: 0 0 0 2px rgba(242, 195, 91, 0.35), 0 0 20px rgba(242, 195, 91, 0.4); }
.tb-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; flex: none; }

/* ---------- labels, tooltip, toasts ---------- */
.section-label {
  padding: 4px 9px; border-radius: 8px; font-size: 11px; font-weight: 800; white-space: nowrap; color: #fff;
  background: rgba(8, 9, 14, 0.72); border: 1px solid var(--line-2); transition: opacity 0.25s;
}
.section-label small { font-weight: 600; color: var(--muted); margin-left: 4px; }

.tooltip {
  position: fixed; z-index: 30; pointer-events: none; min-width: 180px; padding: 11px 12px; border-radius: 13px;
  background: rgba(10, 11, 16, 0.92); border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  font-size: 12px;
}
.tooltip .tt-head { display: flex; align-items: center; gap: 7px; font-weight: 800; margin-bottom: 8px; }
.tooltip .tt-head i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tooltip .tt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tooltip .tt-grid small { display: block; font-size: 9.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.tooltip .tt-grid b { font-size: 15px; }
.tooltip .tt-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.tooltip .tt-foot b { color: var(--gold); font-size: 14px; }
.tooltip .tt-foot span { font-size: 10.5px; color: var(--muted); }
.tooltip .tt-foot span.sold { color: var(--danger); }

.toasts { position: fixed; z-index: 60; top: 90px; left: 50%; translate: -50% 0; display: grid; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; background: rgba(12, 13, 19, 0.94);
  border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: pop 0.3s ease; transition: opacity 0.4s;
}
.toast.err { border-color: rgba(255, 93, 115, 0.5); }
.toast.ok { border-color: rgba(60, 240, 192, 0.45); }

/* ---------- checkout ---------- */
.modal-wrap {
  position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 4, 8, 0.6); backdrop-filter: blur(6px); animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal { scrollbar-width: thin; scrollbar-color: #2a2c38 transparent; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 22px; padding: 18px; background: rgba(13, 14, 20, 0.94); animation: pop 0.3s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-head .close { font-size: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.steps i { height: 3px; border-radius: 3px; background: var(--line-2); transition: 0.3s; }
.steps i.on { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

.summary { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--glass-hi); margin-bottom: 14px; font-size: 12.5px; }
.summary .row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.summary .row span:first-child { color: var(--muted); }
.summary .row b { text-align: right; }
.summary .codes { color: var(--dim); font-size: 11.5px; margin: 4px 0 8px; line-height: 1.6; }
.summary .tot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.summary .tot b { font-size: 21px; color: var(--gold); }

.field { display: block; margin-bottom: 11px; }
.field span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; height: 44px; border-radius: 12px; padding: 0 13px; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); outline: none; transition: 0.2s;
}
.field input:focus { border-color: rgba(242, 195, 91, 0.6); box-shadow: 0 0 0 3px rgba(242, 195, 91, 0.12); }
.field input.bad { border-color: var(--danger); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.pm {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 13px; text-align: left;
  border: 1px solid var(--line); background: var(--glass-hi); transition: 0.2s;
}
.pm.active { border-color: var(--gold); background: rgba(242, 195, 91, 0.07); }
.pm b { display: block; font-size: 13px; }
.pm small { display: block; font-size: 10.5px; color: var(--dim); }
.pm svg { color: var(--gold); }
.wallets { display: grid; gap: 10px; margin-bottom: 14px; }
.wallet-btn { height: 48px; border-radius: 13px; font-weight: 800; background: #fff; color: #000; display: flex; align-items: center; justify-content: center; gap: 8px; }
.wallet-btn.g { background: #1f1f1f; color: #fff; border: 1px solid var(--line-2); }
.wallet-btn.sel { outline: 2px solid var(--gold); outline-offset: 2px; }

.actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.note { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; margin-top: 12px; font-size: 11px; color: var(--dim); }
.note svg { width: 13px; height: 13px; color: var(--gold); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(0, 0, 0, 0.2); border-top-color: #1b1407; animation: spin 0.7s linear infinite; }

.success { text-align: center; padding: 6px 0 4px; }
.success .check {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center;
  background: rgba(60, 240, 192, 0.12); color: var(--mint); box-shadow: 0 0 30px rgba(60, 240, 192, 0.25);
}
.success .check svg { width: 28px; height: 28px; }
.success h3 { font-size: 19px; font-weight: 800; }
.success p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tickets { display: grid; gap: 10px; margin: 16px 0; text-align: left; }
.ticket {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 12px 12px 16px; border-radius: 14px;
  background: linear-gradient(120deg, rgba(242, 195, 91, 0.1), rgba(255, 255, 255, 0.03)); border: 1px solid var(--line-2);
  position: relative;
}
.ticket::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--c); }
.ticket b { display: block; font-size: 13px; }
.ticket small { display: block; font-size: 11px; color: var(--muted); }
.ticket canvas { width: 64px; height: 64px; border-radius: 6px; background: #fff; }

@media (max-width: 1360px) {
  .tb span { display: none; }
  .tb { padding: 0 11px; }
  .tb-gold span { display: inline; }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  :root { --gap: 10px; }
  .topbar { grid-template-columns: auto 1fr auto; height: 56px; }
  .brand > div:last-child { display: none; }
  .session { min-width: 0; }
  .select-wrap { min-width: 0; flex: 1; }
  .select-wrap select { min-width: 0; width: 100%; }
  .chips .chip { padding: 8px 9px; }
  #fsBtn { display: none; }
  .hint { display: none; }
  .minimap { display: none; }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 22px 22px 0 0; max-height: 72vh;
    transition: transform 0.35s cubic-bezier(.2,.8,.2,1); transform: translateY(calc(100% - 132px));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.open { transform: none; }
  .sheet-handle { display: grid; place-items: center; height: 22px; flex: none; order: -2; }
  .sheet-handle span { width: 42px; height: 4px; border-radius: 4px; background: var(--line-2); }
  .panel-foot { order: -1; border-top: 0; border-bottom: 1px solid var(--line); padding-top: 4px; }
  .total-row { margin-bottom: 8px; }
  .btn-gold { height: 44px; }

  .toolbar { left: 50%; bottom: 142px; max-width: calc(100vw - 20px); }
  .tb span { display: none; }
  .tb { padding: 0 11px; }
  .exit-seat { left: 50%; top: 76px; }
  .seat-badge { left: 50%; bottom: 196px; }
  .tooltip { display: none; }
  .section-label { font-size: 9.5px; padding: 3px 6px; }
  .section-label small { display: none; }
}
