:root {
  --bg: #0b131e;
  --slate: #111b29;
  --card: #131e2d;
  --elevated: #182538;
  --accent: #18a2d6;
  --accent-hi: #38bdf8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(203, 213, 225, 0.16);
  --border-hi: rgba(56, 189, 248, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100dvh;
  max-width: 100vw; overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 80% 18%, rgba(24, 162, 214, 0.15), transparent 44%),
    radial-gradient(circle at 18% 82%, rgba(148, 163, 184, 0.07), transparent 46%),
    linear-gradient(to right, rgba(24, 162, 214, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(24, 162, 214, 0.045) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3, h4 {
  font-family: "Plus Jakarta Sans", Inter, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.kicker {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: #22d3ee;
}

.shell { max-width: 1420px; margin: 0 auto; padding: 14px 20px 90px; }

/* Top Nav */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: #0f172a; }
.brand-name { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 20px; color: #fff; }
.brand-sub { font-size: 11px; color: #38bdf8; font-family: "JetBrains Mono", monospace; letter-spacing: 0.1em; }

.nav-pills {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--slate); border: 1px solid var(--border); border-radius: 999px;
}
.nav-pill {
  border: none; background: transparent; color: var(--muted);
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 14px; transition: all 140ms ease;
}
.nav-pill:hover { color: #fff; }
.nav-pill.active {
  background: var(--accent); color: #020617; font-weight: 800;
  box-shadow: 0 0 14px rgba(24, 162, 214, 0.55);
}

.nav-util { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nav-link {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 13px; text-decoration: none;
  transition: all 120ms ease;
}
.nav-link:hover { color: #fff; background: rgba(148, 163, 184, 0.1); }
.nav-link.active { color: #38bdf8; background: rgba(24, 162, 214, 0.14); font-weight: 700; }

details.clean-fold {
  background: rgba(11, 19, 30, 0.55); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 12px;
}
details.clean-fold > summary {
  cursor: pointer; font-weight: 700; font-size: 15px; color: var(--ink);
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
details.clean-fold > summary::-webkit-details-marker { display: none; }
details.clean-fold > summary::after { content: "▾"; color: var(--muted); font-size: 14px; transition: transform 150ms ease; }
details.clean-fold[open] > summary::after { transform: rotate(180deg); color: var(--accent-hi); }
details.clean-fold[open] > summary { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

.guide-tip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; font-weight: 600;
  background: rgba(24, 162, 214, 0.1); border: 1px solid rgba(56, 189, 248, 0.35); color: #bae6fd;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-badge { text-align: right; line-height: 1.15; }
.user-badge .name { font-weight: 700; font-size: 14px; }
.user-badge .role { font-size: 10px; font-family: "JetBrains Mono", monospace; color: #22d3ee; text-transform: uppercase; letter-spacing: 0.12em; }

/* Command Header + Stepper */
.cmd-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(155deg, rgba(24, 37, 56, 0.92), rgba(13, 22, 34, 0.97));
  border: 1px solid var(--border); border-radius: 18px; padding: 14px 18px;
  margin-bottom: 16px;
}
.cmd-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cmd-title { font-size: 22px; font-weight: 800; }
.cmd-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.cmd-meta strong { color: var(--ink); }
.cmd-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.5); color: #a7f3d0;
}
.live-pill.final { background: rgba(148, 163, 184, 0.15); border-color: rgba(148, 163, 184, 0.4); color: #e2e8f0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }

.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.step {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(15, 23, 42, 0.8); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer;
}
.step.done { background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.45); color: #6ee7b7; }
.step.now { background: rgba(24, 162, 214, 0.2); border-color: var(--accent-hi); color: #7dd3fc; }
.step-arrow { color: #475569; font-size: 12px; }

.practice-banner {
  background: #fbbf24; color: #020617; font-weight: 800; font-size: 16px;
  text-align: center; padding: 10px 16px; border-radius: 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}

/* Cards & Grids */
.card {
  background: linear-gradient(155deg, rgba(24, 37, 56, 0.88), rgba(13, 22, 34, 0.96));
  border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  margin-bottom: 16px;
}
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.help-grid { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.span-2 { grid-column: span 2; }

.kpi {
  background: rgba(11, 19, 30, 0.72); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .val { font-family: "Plus Jakarta Sans", sans-serif; font-size: 24px; font-weight: 800; margin-top: 2px; }

/* Sub-tabs */
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.subtab {
  border: 1px solid var(--border); background: var(--bg); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.subtab.active { background: var(--accent); color: #020617; border-color: var(--accent); font-weight: 800; }

/* Buttons & Inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 9px 15px; font-weight: 700; font-size: 14px;
  cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--ink);
  transition: all 120ms ease; text-decoration: none;
}
.btn:hover { border-color: var(--accent-hi); color: #fff; }
.btn-primary { background: var(--accent); color: #020617; border-color: var(--accent); font-weight: 800; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #020617; }
.btn-danger { background: rgba(244, 63, 94, 0.14); border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }
.btn-danger:hover { background: rgba(244, 63, 94, 0.25); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

label.field-label { display: block; font-size: 13px; font-weight: 600; color: #cbd5e1; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
  width: 100%; max-width: 100%; background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px;
  font-family: Inter, sans-serif; font-size: 14px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-hi); border-color: var(--accent-hi); }

/* Fast Spreadsheet Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: rgba(11, 19, 30, 0.72); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 10px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8;
  background: rgba(17, 27, 41, 0.95); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 7px 9px; border-bottom: 1px solid rgba(203, 213, 225, 0.08); vertical-align: middle; }
tr:hover td { background: rgba(24, 162, 214, 0.05); }
.cell-input {
  width: 100%; background: rgba(15, 23, 42, 0.85); color: #fff;
  border: 1px solid rgba(203, 213, 225, 0.14); border-radius: 7px;
  padding: 6px 8px; font-size: 14px; font-weight: 600;
}
.cell-input.num { width: 78px; text-align: center; font-family: "JetBrains Mono", monospace; font-weight: 700; }
.cell-input.score-saved { border-color: rgba(52, 211, 153, 0.55); background: rgba(6, 78, 59, 0.25); }

/* Badges & Chips */
.chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px;
  font-weight: 700; font-family: "JetBrains Mono", monospace; text-transform: uppercase;
  border: 1px solid var(--border); background: rgba(15, 23, 42, 0.8); color: #cbd5e1;
}
.chip-ok { background: rgba(16, 185, 129, 0.16); border-color: rgba(52, 211, 153, 0.5); color: #6ee7b7; }
.chip-warn { background: rgba(245, 158, 11, 0.16); border-color: rgba(251, 191, 36, 0.5); color: #fde68a; }
.chip-blue { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.5); color: #7dd3fc; }
.chip-rose { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }

/* Lane Lights */
.lane-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.lane-tile {
  min-width: 72px; padding: 8px 10px; border-radius: 12px; text-align: center;
  border: 1px solid var(--border); background: var(--bg);
}
.lane-tile.finished { background: #064e3b; border-color: #34d399; color: #d1fae5; }
.lane-tile.bowling { background: linear-gradient(155deg, #0b3a5b, #18a2d6); border-color: #38bdf8; color: #fff; }
.lane-tile .ln { font-weight: 800; font-size: 18px; }
.lane-tile .st { font-size: 10px; font-family: "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; }

/* Checklist */
.checklist { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.check-item { padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 700; border: 1px solid var(--border); }
.check-item.ok { background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.5); color: #6ee7b7; }
.check-item.wait { background: rgba(245, 158, 11, 0.12); border-color: rgba(251, 191, 36, 0.45); color: #fde68a; }

/* Login */
.login-wrap { max-width: 440px; margin: 60px auto; }

/* Floating Prism AI Dock (modeled after Legacy Computing Assistant) */
.ai-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: flex; align-items: center; gap: 9px; padding: 9px 16px 9px 11px;
  border-radius: 999px; background: linear-gradient(135deg, #22b8eb, #0ea5e9); color: #020617;
  font-weight: 800; font-size: 14px; border: 1px solid rgba(125, 211, 252, 0.45); cursor: pointer;
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.42);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ai-fab:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(14, 165, 233, 0.55); }
.ai-fab img { width: 24px; height: 24px; border-radius: 7px; object-fit: contain; }

.ai-panel {
  position: fixed; right: 20px; bottom: 78px; z-index: 910;
  width: min(410px, calc(100vw - 28px)); max-height: 76vh;
  display: flex; flex-direction: column;
  background: #0d1522;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 22px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}
.ai-head {
  padding: 16px 18px 14px;
  background: #0f1827;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.ai-head-brand { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.ai-head-logo {
  width: 44px; height: 44px; border-radius: 12px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(14, 165, 233, 0.28));
}
.ai-head-title { font-size: 17px; font-weight: 800; color: #f8fafc; line-height: 1.2; }
.ai-head-sub { font-size: 12.5px; color: #94a3b8; line-height: 1.4; margin-top: 3px; }
.ai-head-sub .ai-flyer-tag { color: #34d399; font-weight: 700; }
.ai-close-btn {
  background: transparent; border: none; color: #cbd5e1;
  font-size: 20px; line-height: 1; padding: 4px 6px; cursor: pointer; border-radius: 8px;
}
.ai-close-btn:hover { color: #fff; background: rgba(148, 163, 184, 0.14); }

.ai-mode-bar {
  display: flex; gap: 6px; padding: 8px 16px;
  background: #0c1320;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.ai-mode-pill {
  flex: 1; padding: 6px 10px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: transparent; border: 1px solid rgba(148, 163, 184, 0.18); color: #94a3b8;
  cursor: pointer; transition: all 0.15s ease;
}
.ai-mode-pill:hover { color: #e2e8f0; border-color: rgba(56, 189, 248, 0.4); }
.ai-mode-pill.active {
  background: rgba(24, 162, 214, 0.2); border-color: rgba(56, 189, 248, 0.55); color: #7dd3fc;
}

.ai-body {
  padding: 16px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
  background: #0b111d;
}
.ai-msg-row { display: flex; align-items: flex-start; gap: 10px; }
.ai-msg-row.user { justify-content: flex-end; }
.ai-msg-avatar {
  width: 28px; height: 28px; border-radius: 8px; object-fit: contain;
  flex-shrink: 0; margin-top: 2px;
}
.ai-msg {
  padding: 13px 15px; border-radius: 16px; font-size: 14px;
  white-space: pre-wrap; line-height: 1.5; color: #f1f5f9;
}
.ai-msg.user {
  background: rgba(14, 165, 233, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.35);
  max-width: 84%;
}
.ai-msg.bot {
  background: #060a12;
  border: 1px solid rgba(148, 163, 184, 0.18);
  flex: 1;
}

.ai-foot {
  padding: 12px 14px;
  background: #0d1522;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex; gap: 10px; align-items: center;
}
.ai-foot input {
  flex: 1; background: #070c16; color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 13px; padding: 11px 14px; font-size: 14px;
}
.ai-foot input::placeholder { color: #64748b; }
.ai-foot input:focus { outline: none; border-color: #22b8eb; }
.ai-send-btn {
  padding: 11px 20px; border-radius: 13px; border: none;
  background: #1ab2e8; color: #020617; font-weight: 800; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
}
.ai-send-btn:hover { background: #38bdf8; }
.ai-send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Toasts */
.toast-root { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 13px;
  background: #131e2d; border: 1px solid var(--border-hi); color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}
.toast.err { border-color: var(--rose); background: #2d121c; color: #fecdd3; }
.toast.ok { border-color: var(--emerald); background: #0c2c22; color: #a7f3d0; }

/* Visual Bracket Tree (Bowler Portal & Desk) */
.br-tree { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; overflow-x: auto; margin-top: 10px; }
.br-col { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.br-col-title { font-size: 11px; font-family: "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: 0.12em; color: #22d3ee; text-align: center; margin-bottom: 4px; }
.br-match { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.br-slot { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; font-size: 13px; border-bottom: 1px solid rgba(203, 213, 225, 0.08); }
.br-slot:last-child { border-bottom: none; }
.br-slot.me { background: rgba(24, 162, 214, 0.16); color: #7dd3fc; font-weight: 800; }
.br-slot.win { color: #6ee7b7; font-weight: 800; }

/* Public Kiosk & Marquee */
.kiosk-shell { max-width: 1600px; margin: 0 auto; padding: 18px 24px; }
.kiosk-table th { font-size: 14px; padding: 12px; }
.kiosk-table td { font-size: 18px; font-weight: 700; padding: 12px; }
.kiosk-cut td { border-bottom: 3px solid var(--accent-hi) !important; }

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mb-1 { margin-bottom: 8px; }

@media (max-width: 860px) {
  .grid-2, .grid-3, .help-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .span-2 { grid-column: span 1; }
  .shell { padding: 10px 10px 84px; }

  /* Mobile Topbar: Brand + User + Sign Out on row 1, swipeable pills on row 2, utilities on row 3 */
  .topbar { gap: 8px; margin-bottom: 10px; }
  .brand { order: 1; margin-right: auto; }
  .brand img { width: 32px; height: 32px; }
  .brand-name { font-size: 18px; }
  .topbar-right { display: contents; }
  .user-badge { order: 2; }
  #btn-logout { order: 3; }
  .nav-pills {
    order: 4; width: 100%;
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; border-radius: 14px; padding: 4px; gap: 4px;
  }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-pill {
    flex: 0 0 auto; white-space: nowrap;
    padding: 8px 12px; font-size: 13px; border-radius: 10px;
  }
  .nav-util {
    order: 5; width: 100%;
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; gap: 4px; padding-bottom: 2px;
  }
  .nav-util::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; white-space: nowrap; padding: 6px 10px; font-size: 12.5px; }

  /* Command bar stacks cleanly with full-width event selector */
  .cmd-bar { padding: 12px 13px !important; gap: 10px; border-radius: 14px; margin-bottom: 12px; }
  .cmd-bar > .row { width: 100%; gap: 10px !important; }
  .cmd-bar img { max-height: 38px !important; max-width: 130px !important; }
  .cmd-title { font-size: 17px !important; line-height: 1.25; }
  .cmd-meta { font-size: 12px; line-height: 1.45; }
  .cmd-actions { width: 100%; gap: 6px; }
  .cmd-actions select { flex: 1 1 100%; min-width: 0 !important; width: 100% !important; }
  .cmd-actions .btn { flex: 1 1 auto; }

  /* Horizontal swipeable subtabs */
  .subtabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; gap: 6px; margin-bottom: 12px; padding-bottom: 2px;
  }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtab { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 13px; }

  /* Cards, KPIs & Foldouts */
  .card { padding: 14px 12px; border-radius: 14px; margin-bottom: 12px; }
  .card-header { gap: 8px; margin-bottom: 10px; }
  .kpi { padding: 10px 11px; border-radius: 12px; }
  .kpi .label { font-size: 11px; }
  .kpi .val { font-size: 20px; }
  details.clean-fold { padding: 10px 12px; border-radius: 12px; }
  details.clean-fold > summary { font-size: 14px; }
  .practice-banner { font-size: 13.5px; padding: 9px 12px; gap: 8px; }
  .guide-tip { font-size: 12.5px; padding: 9px 11px; }

  /* Touch-friendly controls + 16px inputs to prevent iOS Safari auto-zoom */
  .btn { min-height: 40px; padding: 8px 12px; font-size: 13.5px; }
  .btn-sm { min-height: 34px; padding: 6px 10px; font-size: 12.5px; }
  input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
    font-size: 16px; min-height: 42px; padding: 9px 10px;
  }
  input[type="file"] { max-width: 100% !important; width: 100%; font-size: 13px; }

  /* Tables: smooth horizontal touch scroll & compact cells */
  .table-wrap { -webkit-overflow-scrolling: touch; border-radius: 12px; }
  table { font-size: 13px; }
  th { padding: 8px 7px; font-size: 10.5px; }
  td { padding: 6px 7px; }
  .cell-input { font-size: 16px; padding: 6px 6px; min-height: 38px; }
  .cell-input.num { width: 64px; }

  /* Lane Heat Map: clean 2 pairs per row on phones */
  .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hm-pair { padding: 6px; border-radius: 12px; }
  .hm-lane { padding: 7px 4px 6px; }
  .hm-num { font-size: 15px; }
  .hm-game { font-size: 10px; }

  /* Floating Prism A.I. Dock as mobile bottom sheet */
  .ai-fab {
    right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    padding: 8px 13px 8px 10px; font-size: 13px; gap: 7px;
  }
  .ai-fab img { width: 20px; height: 20px; }
  .ai-panel {
    left: 10px; right: 10px; width: auto;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    max-height: 75dvh; border-radius: 18px;
  }
  .ai-head { padding: 12px 14px; }
  .ai-head-logo { width: 34px; height: 34px; }
  .ai-head-title { font-size: 15px; }
  .ai-head-sub { font-size: 11.5px; }
  .ai-body { padding: 12px; }
  .ai-msg { padding: 10px 12px; font-size: 13.5px; }
  .ai-foot { padding: 10px; gap: 8px; }
  .ai-foot input { font-size: 16px; padding: 9px 11px; }
  .ai-send-btn { padding: 10px 14px; font-size: 13.5px; }

  /* Toasts, Login, Kiosk & Footer */
  .toast-root { left: 10px; right: 10px; top: 10px; }
  .toast { font-size: 12.5px; text-align: center; }
  .login-wrap { margin: 18px auto; }
  .kiosk-shell { padding: 10px 10px 64px; }
  .kiosk-table th { font-size: 11px; padding: 8px 6px; }
  .kiosk-table td { font-size: 14px; padding: 8px 6px; }
}

@media (max-width: 480px) {
  .brand-sub, .user-badge .role { display: none; }
  .user-badge .name { font-size: 12.5px; max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hm-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
 * PRISM A.I. ANIMATED BOWLING BALL & PINS LOADER
 * ========================================================================== */
.ai-loader-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  padding: 20px;
  animation: aiFadeIn 0.18s ease-out;
}
@keyframes aiFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ai-loader-card {
  width: min(440px, 100%);
  background: linear-gradient(165deg, #131e2d 0%, #0b1220 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 20px;
  padding: 22px 24px 20px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.72), 0 0 36px rgba(24, 162, 214, 0.18);
  text-align: center;
}
.ai-loader-title {
  font-size: 18px; font-weight: 800; color: #f8fafc; margin: 4px 0 4px;
}
.ai-loader-step {
  font-size: 13px; color: #94a3b8; min-height: 20px; margin-bottom: 14px;
}

/* Bowling alley stage */
.bowl-lane {
  position: relative;
  height: 82px;
  margin: 6px 0 16px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(180deg, rgba(251, 191, 36, 0.06) 0 8px, rgba(15, 23, 42, 0.12) 8px 16px),
    linear-gradient(90deg, #0b1628 0%, #17253b 55%, #0f1d33 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  overflow: hidden;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.45);
}
.bowl-lane::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 13px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.45), rgba(251, 191, 36, 0.4), transparent);
}
.bowl-arrows {
  position: absolute; left: 32%; bottom: 18px;
  font-size: 11px; letter-spacing: 6px; color: rgba(56, 189, 248, 0.35);
  user-select: none;
}

/* Rolling glossy bowling ball */
.bowl-ball {
  position: absolute; left: 16px; bottom: 15px;
  width: 34px; height: 34px;
  animation: bowlRoll 2.2s cubic-bezier(0.32, 0.02, 0.58, 1) infinite;
  filter: drop-shadow(0 6px 10px rgba(24, 162, 214, 0.45));
}
@keyframes bowlRoll {
  0%   { transform: translateX(0) rotate(0deg); opacity: 0; }
  8%   { transform: translateX(12px) rotate(60deg); opacity: 1; }
  56%  { transform: translateX(228px) rotate(720deg); opacity: 1; }
  74%  { transform: translateX(270px) rotate(880deg); opacity: 0; }
  100% { transform: translateX(270px) rotate(880deg); opacity: 0; }
}

/* Pin deck */
.bowl-pins {
  position: absolute; right: 34px; bottom: 14px;
  width: 58px; height: 50px;
}
.bowl-pin {
  position: absolute; bottom: 0; width: 16px; height: 40px;
  transform-origin: bottom center;
}
.bowl-pin.p1 { left: 4px;  z-index: 3; animation: pinFly1 2.2s ease-out infinite; }
.bowl-pin.p2 { left: 20px; z-index: 2; bottom: 3px; animation: pinFly2 2.2s ease-out infinite; }
.bowl-pin.p3 { left: 34px; z-index: 1; bottom: 1px; animation: pinFly3 2.2s ease-out infinite; }

@keyframes pinFly1 {
  0%, 54% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  74%     { transform: translate(26px, -26px) rotate(135deg); opacity: 0; }
  86%     { transform: translate(0, -14px) rotate(0deg); opacity: 0; }
  96%,100%{ transform: translate(0, 0) rotate(0deg); opacity: 1; }
}
@keyframes pinFly2 {
  0%, 56% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  76%     { transform: translate(34px, -16px) rotate(95deg); opacity: 0; }
  86%     { transform: translate(0, -14px) rotate(0deg); opacity: 0; }
  96%,100%{ transform: translate(0, 0) rotate(0deg); opacity: 1; }
}
@keyframes pinFly3 {
  0%, 58% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  78%     { transform: translate(22px, -32px) rotate(-120deg); opacity: 0; }
  86%     { transform: translate(0, -14px) rotate(0deg); opacity: 0; }
  96%,100%{ transform: translate(0, 0) rotate(0deg); opacity: 1; }
}

.bowl-impact {
  position: absolute; right: 24px; top: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  color: #fbbf24; text-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
  opacity: 0;
  animation: strikePop 2.2s ease-out infinite;
}
@keyframes strikePop {
  0%, 53% { opacity: 0; transform: scale(0.5) translateY(8px); }
  62%     { opacity: 1; transform: scale(1.12) translateY(0); }
  78%     { opacity: 0; transform: scale(1.25) translateY(-6px); }
  100%    { opacity: 0; }
}

/* Smooth progress bar */
.ai-progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(203, 213, 225, 0.15);
  overflow: hidden;
}
.ai-progress-fill {
  height: 100%; width: 12%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8, #818cf8);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.65);
  transition: width 0.35s ease;
  position: relative;
}
.ai-progress-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: aiShimmer 1.2s linear infinite;
}
@keyframes aiShimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.ai-loader-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 11px; color: #64748b;
  font-family: "JetBrains Mono", monospace;
}

/* Compact inline bowling loader for Prism A.I. chat dock */
.ai-mini-loader {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(24, 162, 214, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 13px; color: #bae6fd;
}
.ai-mini-ball {
  display: inline-block; font-size: 18px;
  animation: miniRoll 1.1s ease-in-out infinite;
}
@keyframes miniRoll {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50%      { transform: translateX(8px) rotate(180deg); }
}

/* ============================================================================
 * LIVE BOWLING CENTER LANE HEAT MAP (BIRD'S-EYE HOUSE VIEW)
 * ========================================================================== */
.hm-legend {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-size: 12px; color: var(--muted); margin: 10px 0 14px;
}
.hm-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle;
}
.hm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 10px;
}
.hm-pair {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 8px;
}
.hm-pair-hdr {
  font-size: 10px; font-family: "JetBrains Mono", monospace; letter-spacing: 0.1em;
  color: #64748b; text-transform: uppercase; text-align: center; margin-bottom: 6px;
}
.hm-pair-lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.hm-lane {
  position: relative;
  border-radius: 10px; padding: 8px 6px 7px;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.65);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.hm-lane.clickable { cursor: pointer; }
.hm-lane.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45); }

.hm-lane.idle { opacity: 0.34; background: #090e1a; }
.hm-lane.waiting { background: rgba(30, 41, 59, 0.85); border-color: rgba(148, 163, 184, 0.32); color: #cbd5e1; }
.hm-lane.bowling {
  background: linear-gradient(160deg, rgba(12, 74, 110, 0.92), rgba(14, 165, 233, 0.52));
  border-color: rgba(56, 189, 248, 0.75);
  color: #f0f9ff;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.22);
}
.hm-lane.lagging {
  background: linear-gradient(160deg, rgba(120, 53, 15, 0.92), rgba(217, 119, 6, 0.55));
  border-color: rgba(251, 191, 36, 0.85);
  color: #fef3c7;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}
.hm-lane.finished {
  background: linear-gradient(160deg, rgba(6, 78, 59, 0.92), rgba(16, 185, 129, 0.42));
  border-color: rgba(52, 211, 153, 0.75);
  color: #ecfdf5;
}

.hm-num { font-size: 16px; font-weight: 800; line-height: 1.1; }
.hm-game {
  font-size: 11px; font-weight: 800; font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em; margin-top: 3px;
}
.hm-sub { font-size: 10px; opacity: 0.82; margin-top: 2px; font-family: "JetBrains Mono", monospace; }
.hm-bar {
  height: 4px; border-radius: 999px; background: rgba(2, 6, 23, 0.55);
  margin-top: 6px; overflow: hidden;
}
.hm-bar > span { display: block; height: 100%; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
.hm-unver {
  position: absolute; top: 4px; right: 5px;
  font-size: 10px; line-height: 1; color: #fde047;
}

/* Fixed bottom-left badge — Legacy Computing Services LLC */
.legacy-footer {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 850;
  pointer-events: none;
}
.legacy-badge {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 11.5px; font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.legacy-badge:hover {
  color: #f8fafc;
  border-color: rgba(56, 189, 248, 0.55);
}
.legacy-badge img {
  width: 24px; height: 24px; border-radius: 6px; object-fit: cover;
}
.legacy-badge strong { color: #e2e8f0; font-weight: 700; }
@media (max-width: 860px) {
  body { display: flex; flex-direction: column; }
  #app { flex: 1 0 auto; }
  .shell { padding-bottom: 20px; }
  .legacy-footer {
    position: static;
    left: auto; bottom: auto;
    pointer-events: auto;
    padding: 4px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    display: flex; justify-content: flex-start;
  }
  .legacy-badge { font-size: 11px; padding: 5px 10px 5px 7px; max-width: calc(100vw - 145px); }
  .legacy-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
