/* Phone-first staff pages for venues. */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #1d1747;
  --muted: #6b6b85;
  --line: #e3e4ef;
  --brand: #6a3df0;
  --brand-ink: #ffffff;
  --danger: #d92d4b;
  --ok: #138a4a;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12111c;
    --card: #1e1c2c;
    --ink: #eceaf7;
    --muted: #a3a1b8;
    --line: #34314a;
    --brand: #8f6bff;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--brand);
  color: var(--brand-ink);
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { font-weight: 400; opacity: 0.85; }
.who { font-size: 14px; text-align: right; }
.who button { margin-left: 8px; }
.who .go-game { font-size: 18px; font-weight: 700; padding: 12px 24px; min-height: 48px; border-radius: 12px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.tabs a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.tabs a.active { background: var(--brand); color: var(--brand-ink); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 18px; margin: 0 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.note {
  font-size: 14px;
  color: var(--muted);
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 10px;
  margin: 10px 0;
}

label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.inline { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

button, .button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary, .button.secondary { background: transparent; color: var(--brand); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.danger.armed { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.6; cursor: default; }
.top button { background: rgba(255,255,255,0.2); color: #fff; padding: 6px 12px; font-size: 14px; }
.top .badge { background: rgba(255,255,255,0.22); border-color: transparent; color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.error { color: var(--danger); font-weight: 600; margin-top: 10px; }

/* children */
.child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.child .face { font-size: 40px; line-height: 1; }
.child .info { flex: 1; min-width: 140px; }
.child .name { font-weight: 700; font-size: 18px; }
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.badge.warn { color: #b45309; }

.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatar-grid label { margin: 0; }
.avatar-grid input { position: absolute; opacity: 0; }
.avatar-grid span {
  display: grid;
  place-items: center;
  font-size: 30px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid var(--line);
  cursor: pointer;
}
.avatar-grid input:checked + span { border-color: var(--brand); background: var(--bg); }
.avatar-grid input:focus-visible + span { outline: 2px solid var(--brand); }
input.pin { letter-spacing: 0.4em; max-width: 140px; -webkit-text-security: disc; text-security: disc; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

.keys span {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  margin: 1px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  max-width: calc(100% - 32px);
}

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.badge-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 600;
}
/* The badge's rule, under its name. */
.badge-chip small { display: block; font-weight: 400; font-size: 12px; color: var(--muted, #666); margin-top: 2px; }
.badge-chip:has(small) { border-radius: 12px; }

/* ---------- progress: times-table grid and insights ---------- */
.tt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.tt-cell {
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  line-height: 1.2;
  color: #fff;
}
.tt-cell b { display: block; font-size: 16px; }
.tt-cell span { display: block; font-size: 18px; font-weight: 700; }
.tt-cell small { display: block; font-size: 11px; opacity: 0.9; }
.tt-cell.good { background: #16a34a; }
.tt-cell.ok { background: #d97706; }
.tt-cell.weak { background: #dc2626; }
.tt-cell.none { background: var(--line); color: var(--muted); }
.insights { margin: 0; padding-left: 20px; }
.insights li { margin: 4px 0; }

/* Log in | Create account switch above the sign-in form. */
.auth-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 4px 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.auth-switch button {
  flex: 1;
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
}
.auth-switch button.active { background: var(--brand); color: var(--brand-ink); }
/* A field only bots fill in: off-screen, not just hidden, so simple bots still see it. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* A button that looks like a link ("Forgot password?", "Back to log in"). */
button.link { background: transparent; color: var(--brand); padding: 10px 4px; font-weight: 600; text-decoration: underline; }
.resend { margin-top: 12px; }
/* "Please verify your email" across the top until they do. */
/* "Please verify your email": a warning bubble that pops up in the top-right corner. */
.bubble-stack {
  position: fixed; top: 64px; right: 16px; z-index: 20;
  width: min(360px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.verify-bubble {
  position: relative; pointer-events: auto;
  padding: 14px 40px 14px 16px;
  background: #fff7e6; color: #5c3b00;
  border: 2px solid #f59e0b; border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
  font-size: 15px;
  animation: bubble-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.verify-bubble::before { /* little pointer up towards the account name */
  content: ''; position: absolute; top: -9px; right: 28px; width: 14px; height: 14px;
  background: #fff7e6; border-left: 2px solid #f59e0b; border-top: 2px solid #f59e0b; transform: rotate(45deg);
}
.verify-bubble p { margin: 6px 0 0; }
.verify-bubble .bubble-title { font-weight: 700; font-size: 16px; }
.verify-bubble .bubble-warn { color: #9a3412; }
.verify-bubble .bubble-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.verify-bubble .bubble-actions button { background: #d97706; }
.verify-bubble .bubble-actions .muted { color: #8a6a2f; }
.verify-bubble .bubble-close {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; padding: 0;
  background: transparent; color: #5c3b00; font-size: 22px; line-height: 1; border-radius: 50%;
}
.verify-bubble .bubble-close:hover { background: rgb(0 0 0 / 0.06); }
@keyframes bubble-pop { from { opacity: 0; transform: translateY(-12px) scale(0.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .verify-bubble { animation: none; } }
@media (prefers-color-scheme: dark) {
  .verify-bubble, .verify-bubble::before { background: #3a2a0a; }
  .verify-bubble { color: #fde7b0; }
  .verify-bubble .bubble-warn { color: #fdba74; }
  .verify-bubble .bubble-close { color: #fde7b0; }
  .verify-bubble .bubble-actions .muted { color: #e9c77f; }
}

/* ---- Activity (super admin) ---- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 14px; }
.filters label { margin: 0; }
.filters input[type=text] { flex: 1 1 200px; width: auto; }
.filters input[type=date], .filters select { width: auto; }
.filters input[type=date] { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; }
.subtabs button { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.subtabs button.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
td code { font-size: 13px; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-top: 8px; }

/* Line chart: categorical slots 1-3 of the reference palette, stepped separately for dark mode. */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; }
@media (prefers-color-scheme: dark) { :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; } }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
i.key { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
i.key.s1 { border-color: var(--s1); } i.key.s2 { border-color: var(--s2); } i.key.s3 { border-color: var(--s3); }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap .grid { stroke: var(--line); stroke-width: 1; }
.chart-wrap .axis { fill: var(--muted); font-size: 11px; }
.chart-wrap .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .line.s1, .chart-wrap .dot.s1 { stroke: var(--s1); } .chart-wrap .dot.s1 { fill: var(--s1); }
.chart-wrap .line.s2, .chart-wrap .dot.s2 { stroke: var(--s2); } .chart-wrap .dot.s2 { fill: var(--s2); }
.chart-wrap .line.s3, .chart-wrap .dot.s3 { stroke: var(--s3); } .chart-wrap .dot.s3 { fill: var(--s3); }
.chart-wrap .dot { stroke: var(--card); stroke-width: 2; paint-order: stroke; }
.chart-wrap .dot.s1, .chart-wrap .dot.s2, .chart-wrap .dot.s3 { stroke: var(--card); }
.chart-wrap .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-wrap .hit { fill: transparent; cursor: crosshair; outline: none; }
.chart-wrap .hit:focus-visible { stroke: var(--brand); stroke-width: 1; }
.chart-wrap svg .hidden { display: none; }
.tip { position: absolute; top: 4px; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.12); white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }

/* Play time (every grown-up) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
tr.pick { cursor: pointer; }
tr.pick:hover td, tr.pick:focus-visible td { background: var(--bg); }
tr.pick.active td { background: var(--bg); font-weight: 600; }
tr.pick:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }


/* Account -> Subscription (billing) */
.billing .billing-plan { margin: 4px 0; }
/* Payment history, under the subscription buttons. */
.pay-history h3 { margin: 18px 0 6px; font-size: 16px; }
.pay-list { list-style: none; margin: 0; padding: 0; }
.pay-row {
  display: grid; grid-template-columns: 110px 1fr auto auto 90px; align-items: center; gap: 4px 12px;
  padding: 8px 0; border-top: 1px solid rgba(127, 127, 127, 0.25); font-size: 14px;
}
.pay-amount { font-weight: 700; text-align: right; }
.pay-link { text-align: right; white-space: nowrap; }
.pay-row .badge { justify-self: start; }
@media (max-width: 520px) {
  .pay-row { grid-template-columns: 1fr auto; grid-template-areas: "date amount" "plan plan" "status link"; }
  .pay-date { grid-area: date; font-weight: 600; }
  .pay-amount { grid-area: amount; }
  .pay-plan { grid-area: plan; color: var(--muted, #666); }
  .pay-row .badge { grid-area: status; }
  .pay-link { grid-area: link; }
}
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 4px; }
button.plan {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
button.plan:hover, button.plan:focus-visible { border-color: var(--brand); }
.plan-name { font-weight: 700; }
.plan-price { font-size: 22px; font-weight: 800; color: var(--brand); }
.plan-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-note { font-size: 13px; color: var(--muted); font-weight: 500; }

/* Free days / Free plan bubble: the same shape as the warnings, in a friendly green. */
.verify-bubble.info, .verify-bubble.info::before { background: #ecfdf3; }
.verify-bubble.info { border-color: #16a34a; color: #14532d; }
.verify-bubble.info .bubble-actions button { background: #16a34a; }
.verify-bubble.info .bubble-close { color: #14532d; }
@media (prefers-color-scheme: dark) {
  .verify-bubble.info, .verify-bubble.info::before { background: #0f2e1d; }
  .verify-bubble.info { color: #bbf7d0; }
  .verify-bubble.info .bubble-close { color: #bbf7d0; }
}
.verify-bubble:not(.hidden) ~ .pay-bubble::before { display: none; } /* only the top bubble points at the account name */

/* Super admin: a red label in the header and a red strip under it. */
.badge.super-badge { background: #dc2626; color: #fff; border-color: #b91c1c; }
.super-strip {
  background: #dc2626; color: #fff; text-align: center;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
}

/* Red "← Back" on the right of the log-in and create-account buttons */
.actions .back-btn { margin-left: auto; background: #dc2626; color: #fff; }
.actions .back-btn:hover { background: #b91c1c; }
.super-strip .strip-link { color: #fff; font-weight: 700; margin-left: 10px; white-space: nowrap; }
/* First-run setup: this account becomes the super admin */
.super-note { background: #dc2626; color: #fff; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 14px; font-size: 15px; }
/* Terms, Privacy, Refunds and Contact links under every admin page */
.site-footer { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 16px 28px; }
.site-footer a { color: var(--muted); }

/* Questions (super admin) */
textarea { resize: vertical; }
.warn-text { color: var(--danger); font-weight: bold; }
.question-card .q-text { margin: 4px 0; }
.question-card.off { opacity: 0.6; }
.question-card input[type=text] + input[type=text] { margin-top: 6px; }
#add-q-card summary { cursor: pointer; }
#add-q-card form { margin-top: 10px; }
a.button { display: inline-block; text-decoration: none; }

/* ---- My quizzes: pictures and sounds on a venue's own questions ---- */
.row-fields { display: flex; flex-wrap: wrap; gap: 0 12px; }
.row-fields > div { flex: 1 1 220px; }
.row-fields > div.narrow { flex: 0 1 150px; }
.media-pick { margin-top: 4px; }
.media-preview img { display: block; max-width: 100%; max-height: 180px; border-radius: 8px; margin: 4px 0 8px; border: 1px solid var(--line); }
.media-preview audio, .my-q audio { display: block; width: 100%; max-width: 360px; margin: 6px 0; }
.media-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
label.file-button { display: inline-block; margin: 0; cursor: pointer; font-weight: 600; }
label.file-button input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
label.file-button:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.my-q { display: flex; gap: 12px; align-items: flex-start; }
.my-q-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; border: 1px solid var(--line); }

details.card summary { cursor: pointer; }
details.card > form { margin-top: 10px; }
