/* ============================================================================
   MapleLock — Reservation Engine live demo console
   Design language extends the customer prototype (brand red #e63946), pushed
   toward a premium "engine console" feel.
   ============================================================================ */
:root {
  --brand: #e63946;
  --brand-shade: #c1121f;
  --brand-tint: #fde7e9;

  --ink: #15161d;
  --ink-2: #565a66;
  --ink-3: #8b909c;

  --page: #f5f5f8;
  --card: #ffffff;
  --line: #e8e8ef;
  --line-2: #f0f0f4;

  --free: #16a34a;   --free-bg: #e7f6ec;   --free-line: #c1e8cd;
  --held: #d97706;   --held-bg: #fdf1dc;   --held-line: #f4dcae;
  --active: #e63946; --active-bg: #fde7e9; --active-line: #f6c6cc;
  --offline: #9aa1ad;--offline-bg: #eef0f3;--offline-line: #e0e3e9;
  --oos: #b42318;    --oos-bg: #fdeceb;    --oos-line: #f3c9c6;
  --gold: #f0a020;   --gold-glow: rgba(240,160,32,.55);

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20,22,30,.04), 0 1px 3px rgba(20,22,30,.06);
  --shadow: 0 4px 14px rgba(20,22,30,.06), 0 2px 6px rgba(20,22,30,.05);
  --shadow-lg: 0 18px 50px rgba(20,22,30,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "SF Pro Text", sans-serif;

  --maxw: 1120px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 520px at 78% -8%, rgba(230,57,70,.06), transparent 60%),
    radial-gradient(900px 480px at 4% 2%, rgba(80,90,220,.05), transparent 55%),
    var(--page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; background: #f0f0f4; padding: .12em .4em; border-radius: 6px; color: #b5121e; }
em { font-style: normal; color: var(--brand); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--brand), #ff6b74); box-shadow: 0 2px 8px rgba(230,57,70,.4); }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand-sub { color: var(--ink-3); font-size: 13px; font-weight: 600; padding-left: 9px; margin-left: 3px; border-left: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; letter-spacing: .01em; }
.pill-test { color: #7a5b00; background: #fff2cf; border: 1px solid #f2d98a; }

/* ---------- buttons ---------- */
.btn { font-family: inherit; font-weight: 700; border: none; border-radius: 999px; cursor: pointer; transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--brand); color: #fff; padding: 13px 22px; font-size: 15px; box-shadow: 0 6px 18px rgba(230,57,70,.32); }
.btn-primary:hover { background: var(--brand-shade); box-shadow: 0 8px 22px rgba(230,57,70,.4); }
.btn-primary:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--line); padding: 12px 20px; }
.btn-outline:hover { background: #fafafc; }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: #d9d9e2; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 40px) 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.card-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.section-sub { color: var(--ink-2); font-size: 14px; margin: 6px 0 16px; max-width: 46ch; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: clamp(18px, 4vw, 40px) 0 clamp(26px, 4vw, 40px); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; color: var(--brand); margin-bottom: 14px; }
.hero h1 { font-size: clamp(30px, 5.4vw, 52px); line-height: 1.05; font-weight: 850; letter-spacing: -.03em; }
.lede { color: var(--ink-2); font-size: clamp(15px, 2vw, 18px); max-width: 60ch; margin: 18px auto 0; }

/* ============ THE RACE ============ */
.race { padding: clamp(20px, 3vw, 30px); margin-bottom: 26px; overflow: hidden; }
.race-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

.race-stage { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: clamp(16px, 4vw, 44px); padding: 8px 0 6px; }
.guests { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }
.chip {
  aspect-ratio: 1; border-radius: 8px; background: #f1f1f6; border: 1px solid #e7e7ef;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); position: relative;
  transition: transform .28s cubic-bezier(.2,.9,.3,1.3), background .25s, border-color .25s, opacity .3s, box-shadow .3s;
}
.chip svg { width: 13px; height: 13px; opacity: .6; }
.chip.firing { animation: chipPulse .5s ease; }
.chip.win { background: linear-gradient(135deg, #fff4dc, #ffe6ad); border-color: var(--gold); color: #8a5a00; transform: scale(1.16); box-shadow: 0 0 0 3px var(--gold-glow), 0 8px 20px rgba(240,160,32,.4); z-index: 2; }
.chip.win::after { content: "★"; font-size: 12px; font-weight: 800; }
.chip.win svg { display: none; }
.chip.lose { background: #fbecec; border-color: #f3d2d2; opacity: .5; }
.chip.lose svg { display: none; }
.chip.lose::after { content: "×"; font-size: 13px; font-weight: 800; color: #cf6a6a; }

.target { display: flex; align-items: center; gap: 10px; }
.target-arrow { width: 40px; height: 24px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.target-box {
  width: 148px; min-height: 150px; border-radius: 16px; background: var(--free-bg); border: 1.5px solid var(--free-line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  transition: background .35s, border-color .35s, transform .35s, box-shadow .35s;
}
.tb-lock { width: 30px; height: 30px; fill: none; stroke: var(--free); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; transition: stroke .35s; }
.tb-label { font-size: 30px; font-weight: 850; letter-spacing: -.02em; }
.tb-sub { font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 0 8px; }
.target-box.taken { background: linear-gradient(135deg, #fff6e2, #ffe9b8); border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-glow), var(--shadow-lg); transform: scale(1.04); }
.target-box.taken .tb-lock { stroke: #b5820f; }

/* race controls + box pool */
.race-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #f1f1f6; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-btn { border: none; background: transparent; padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.seg-btn.is-on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; min-width: 150px; max-width: 320px; }
.pool.single { grid-template-columns: 1fr; }
.pbox { border-radius: 13px; background: var(--free-bg); border: 1.5px solid var(--free-line); padding: 12px 6px; text-align: center; transition: background .35s, border-color .35s, transform .3s, box-shadow .35s; }
.pool.single .pbox { padding: 30px 12px; }
.pbox-label { font-weight: 850; letter-spacing: -.02em; font-size: 17px; color: #0f7a37; }
.pool.single .pbox-label { font-size: 34px; }
.pbox-sub { font-size: 10px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.pbox.taken { background: linear-gradient(135deg, #fff6e2, #ffe9b8); border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); transform: scale(1.04); }
.pbox.taken .pbox-label { color: #8a5a00; }

.race-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.stat { background: #fafafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: center; }
.stat-num { font-size: 32px; font-weight: 850; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-label { font-size: 12px; color: var(--ink-2); font-weight: 600; margin-top: 7px; }
.stat-ok .stat-num { color: var(--free); }
.stat-ok.zero .stat-num::after { content: " ✓"; font-size: 20px; }
.stat-muted .stat-num { color: var(--ink-2); }
.stat.pop { animation: statPop .4s ease; }

.race-caption { margin-top: 20px; color: var(--ink-2); font-size: 13.5px; text-align: center; max-width: 74ch; margin-left: auto; margin-right: auto; }

/* ============ two column ============ */
.two-col { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: clamp(20px, 4vw, 40px); margin-top: 34px; align-items: start; }

/* ---------- phone ---------- */
.phone {
  width: 300px; max-width: 100%; margin-top: 4px; aspect-ratio: 300 / 620;
  background: #0d0d12; border-radius: 40px; padding: 10px;
  box-shadow: var(--shadow-lg), inset 0 0 0 2px #22232c; position: relative;
}
.phone-notch { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: 110px; height: 22px; background: #0d0d12; border-radius: 0 0 14px 14px; z-index: 3; }
.phone-inner { background: #fff; border-radius: 31px; height: 100%; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.p-top { display: flex; align-items: center; justify-content: space-between; padding: 30px 18px 12px; flex-shrink: 0; }
.p-logo { font-weight: 850; color: var(--brand); letter-spacing: -.02em; font-size: 16px; }
.p-venue { font-size: 12px; color: var(--ink-3); font-weight: 600; }

.p-screen { display: none; padding: 6px 18px 20px; overflow-y: auto; flex: 1; animation: screenIn .32s ease; }
.p-screen.is-active { display: block; }
.p-zone { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.p-hint { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 16px; }

.p-products { display: flex; flex-direction: column; gap: 10px; }
.p-product { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: #fafafc; border: 1px solid var(--line-2); cursor: pointer; transition: background .12s, transform .1s, border-color .12s; }
.p-product:hover { background: #f4f4f8; }
.p-product:active { transform: scale(.985); }
.p-product.sold { opacity: .5; cursor: not-allowed; }
.p-ic { width: 46px; height: 46px; border-radius: 11px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.p-ic svg { width: 24px; height: 24px; fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.p-pinfo { flex: 1; min-width: 0; }
.p-pname { font-weight: 700; font-size: 15px; }
.p-pmeta { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.p-pprice { font-weight: 800; font-size: 15px; }
.p-badge { font-size: 10.5px; font-weight: 800; color: #b42318; background: var(--oos-bg); padding: 3px 7px; border-radius: 6px; }

.p-back { background: none; border: none; color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; padding: 2px 0 10px; }
.p-h { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 12px; }
.p-h.center { text-align: center; }
.p-summary-card { background: #fafafc; border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; }
.p-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; font-weight: 700; }
.p-divider { height: 1px; background: var(--line); margin: 12px -14px; }
.p-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 7px; }
.p-meta span:last-child { color: var(--ink); font-weight: 600; }

.p-hold { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); width: 84px; height: 84px; }
.ring-bg { fill: none; stroke: #eeeef3; stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--brand); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 22px; font-weight: 850; font-variant-numeric: tabular-nums; }
.ring-lbl { font-size: 10px; color: var(--ink-3); font-weight: 600; }
.p-hold-note { font-size: 12px; color: var(--ink-2); }

.p-btn { width: 100%; margin-top: 8px; padding: 15px; }
.p-link { display: block; width: 100%; text-align: center; background: none; border: none; color: var(--ink-3); font-weight: 600; font-size: 13px; margin-top: 12px; cursor: pointer; }
.p-link:hover { color: var(--brand); }

.p-success { display: flex; justify-content: center; margin: 14px 0 6px; }
.p-check { width: 56px; height: 56px; fill: none; stroke: var(--free); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; background: var(--free-bg); border-radius: 50%; padding: 12px; }
.p-boxnum { font-size: 52px; font-weight: 850; text-align: center; letter-spacing: -.03em; margin-top: 6px; }
.p-boxsub { font-size: 13px; color: var(--ink-2); text-align: center; }
.p-boxsub.center { text-align: center; padding: 0 6px; }
.slide { position: relative; height: 54px; border-radius: 999px; background: #f1f1f6; border: 1px solid var(--line); margin: 22px 0 4px; overflow: hidden; user-select: none; }
.slide-thumb { position: absolute; top: 3px; left: 3px; width: 48px; height: 46px; border-radius: 999px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; cursor: grab; transition: left .18s ease, background .2s; box-shadow: 0 3px 10px rgba(230,57,70,.4); }
.slide-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; font-weight: 700; pointer-events: none; }
.slide.open .slide-thumb { background: var(--free); left: calc(100% - 51px); }
.slide.open .slide-text { color: var(--free); }
.p-expired-ic { font-size: 44px; text-align: center; margin: 24px 0 4px; }

/* ---------- zone board ---------- */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--free); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: livePulse 1.8s infinite; }
.counts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.count { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 600; }
.count b { font-weight: 850; font-variant-numeric: tabular-nums; }
.count .sw { width: 9px; height: 9px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.sw.free { background: var(--free); } .sw.held { background: var(--held); } .sw.active { background: var(--active); } .sw.offline { background: var(--offline); } .sw.oos { background: var(--oos); }

.lockers { display: flex; flex-direction: column; gap: 16px; }
.locker { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); }
.locker-h { font-size: 13px; font-weight: 800; color: var(--ink-2); margin-bottom: 10px; letter-spacing: -.01em; }
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; }
.box {
  aspect-ratio: 1; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; border: 1px solid transparent; transition: background .4s, border-color .4s, color .4s, transform .2s;
}
.box .bsz { font-size: 8px; font-weight: 700; opacity: .7; margin-top: 1px; letter-spacing: .04em; }
.box.free { background: var(--free-bg); border-color: var(--free-line); color: #0f7a37; }
.box.held { background: var(--held-bg); border-color: var(--held-line); color: #a15c05; }
.box.active { background: var(--active-bg); border-color: var(--active-line); color: var(--brand-shade); }
.box.offline { background: var(--offline-bg); border-color: var(--offline-line); color: var(--offline); }
.box.oos { background: var(--oos-bg); border-color: var(--oos-line); color: var(--oos); background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(180,35,24,.07) 5px, rgba(180,35,24,.07) 10px); }
.box.flash { animation: boxFlash .6s ease; }

/* ---------- under the hood ---------- */
.under { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.under-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.under-k { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.under-card p { font-size: 13px; color: var(--ink-2); }
.foot { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 40px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: #15161d; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- animations ---------- */
@keyframes chipPulse { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes statPop { 0% { transform: scale(1); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes screenIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@keyframes boxFlash { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .phone { margin: 0 auto; }
  .race-stage { grid-template-columns: 1fr; }
  .target { justify-content: center; }
  .under { grid-template-columns: 1fr; }
  .race-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .guests { grid-template-columns: repeat(10, 1fr); gap: 5px; }
  .brand-sub { display: none; }
}
