/* ============================================================
   ISK-NG Web Scorer — NFAA brand skin
   Tokens, fonts, colors and motion come from the self-hosted
   NFAA Design System (ds/). This file maps the app onto that
   brand: NFAA Navy + Red, warm-stone surfaces, Rift display
   caps + Interstate Compressed body, squared corners, hard
   navy-tinted shadows, 3px accent rules.
   ============================================================ */

@import url("ds/styles.css");

:root {
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --app-head-h: 52px;
  /* WA target-ring keypad tokens come inline from ianseo; the
     "active end" highlight uses the brand yellow. */
  --end-hi:      var(--nfaa-yellow-tint);
  --end-hi-edge: #E6C766;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--surface-page);
  color: var(--text-body);
  height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── shared type helpers ─────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-size: 12px;
  color: var(--brand-accent);
  margin: 0;
}

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 15px; line-height: 1;
  padding: 13px 22px;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
  color: var(--text-on-dark);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn:hover  { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }
.btn:active { transform: translateY(1px); background: var(--brand-primary-press); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-accent  { background: var(--brand-accent); border-color: var(--brand-accent); }
.btn-accent:hover  { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }
.btn-accent:active { background: var(--brand-accent-press); }

.btn-outline { background: transparent; color: var(--brand-primary); border: 1.5px solid var(--brand-primary); }
.btn-outline:hover { background: var(--nfaa-navy-tint); border-color: var(--brand-primary); }
.btn-outline:active { background: var(--nfaa-navy-tint); transform: translateY(1px); }

.btn-ghost { background: var(--surface-sunken); color: var(--brand-primary); border-color: var(--surface-sunken); }
.btn-ghost:hover { background: var(--nfaa-navy-tint); border-color: var(--nfaa-navy-tint); }
.btn-ghost:active { background: var(--nfaa-navy-tint); transform: translateY(1px); }

.btn-inverse { background: var(--text-on-dark); color: var(--brand-primary); border-color: var(--text-on-dark); }
.btn-inverse:hover { background: var(--stone-100); border-color: var(--stone-100); }
.btn-inverse:active { background: var(--stone-200); transform: translateY(1px); }

.btn-stop { background: var(--brand-accent); border-color: var(--brand-accent); }
.btn-lg   { font-size: 17px; padding: 17px 28px; }

/* ── app header: navy bar, 3px red rule, brand mark ─────────────────────── */
.app-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  background: var(--brand-primary);
  color: var(--text-on-dark);
  border-bottom: var(--border-accent) solid var(--brand-accent);
  padding: 9px 14px; padding-top: calc(9px + var(--safe-t));
  min-height: var(--app-head-h);
}
.hmb { width: 34px; height: 34px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 6px; background: none; border: none; cursor: pointer; }
.hmb span { display: block; width: 22px; height: 2px; border-radius: 0; background: var(--text-on-dark); }
.hmb:active { opacity: .6; }

.head-brand { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.head-emblem { width: 24px; height: 24px; flex: 0 0 auto; object-fit: contain; }
.head-app {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 18px; line-height: 1;
  color: var(--text-on-dark);
  white-space: nowrap;
}
.head-dev {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--text-on-dark-muted);
  letter-spacing: 0;
}

.conn {
  position: relative; width: 30px; height: 30px; flex: 0 0 auto;
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-on-dark); background: var(--stone-500);
  transition: background var(--dur-base);

  svg { width: 21px; height: 21px; }
  &::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px dashed transparent; }

  &[data-state=off]        { background: var(--stone-500); }
  &[data-state=err]        { background: var(--status-danger); }
  &[data-state=ok]         { background: var(--status-success); }
  &[data-state=connecting] { background: var(--nfaa-yellow); color: var(--nfaa-dark-navy);
    &::after { border-color: var(--nfaa-yellow); animation: conn-spin 1.6s linear infinite; } }
  &[data-state=saving]     { background: var(--status-success);
    &::after { border-color: var(--nfaa-green); animation: conn-spin 1.1s linear infinite; } }
}
@keyframes conn-spin { to { transform: rotate(360deg); } }

/* ── views ───────────────────────────────────────────────────────────────── */
.view { flex: 1 1 auto; min-height: 0; display: none; }
.view.on { display: flex; flex-direction: column; }
.view-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0 24px; max-width: 720px; width: 100%; margin: 0 auto;
}

/* ════════════════════════════════════════════════════════════════════════
   START PAGE  (redesigned)
   ════════════════════════════════════════════════════════════════════════ */

/* Slim brand band: a short navy strip with a faint stump-emblem watermark. */
.setup-band {
  position: relative; overflow: hidden;
  background: var(--surface-inverse); color: var(--text-on-dark);
  padding: 16px 22px 18px;
  border-bottom: var(--border-accent) solid var(--brand-accent);
}
.setup-band::after {
  content: ''; position: absolute; right: -38px; top: 50%; transform: translateY(-50%);
  width: 150px; height: 150px;
  background: url("ds/assets/logos/nfaa-stump-emblem-white.png") no-repeat center / contain;
  opacity: 0.08; pointer-events: none;
}
.band-eyebrow {
  position: relative; z-index: 1; margin: 0 0 5px;
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-label);
  font-size: 12px; color: var(--nfaa-cyan);
}
.band-tagline {
  position: relative; z-index: 1; margin: 0;
  font-family: var(--font-display); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: .02em;
  font-size: 22px; line-height: 1; color: var(--text-on-dark);
}

/* Add a target: one card grouping the three add methods. */
.add-section { padding: 20px 16px 0; }
.add-section > .eyebrow { color: var(--text-muted); margin: 0 0 10px; }
.add-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-top: var(--border-accent) solid var(--brand-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
/* Scan + Upload sit side by side, equal width */
.add-row { display: flex; gap: 10px; }
.add-row > .btn { flex: 1 1 0; min-width: 0; width: auto; padding-left: 12px; padding-right: 12px; }
.scan-cta { width: 100%; }
.add-sep { display: flex; align-items: center; gap: 12px; color: var(--text-faint); }
.add-sep::before, .add-sep::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }
.add-sep span { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.sec-btn { width: 100%; }
.paste-wrap { display: flex; gap: 10px; }
.paste-wrap input {
  flex: 1; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-card); color: var(--text-strong);
  font-family: var(--font-mono); font-size: 14px;
  box-shadow: var(--shadow-inset);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.paste-wrap input::placeholder { color: var(--text-faint); font-family: var(--font-body); }
.paste-wrap input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--nfaa-navy-tint); }
.paste-wrap .sec-btn { width: auto; flex: 0 0 auto; }

/* Camera capture (sits inside the Add-a-target section) */
.cam-wrap { margin: 14px 0 0; display: flex; justify-content: center; }
.cam-wrap[hidden] { display: none; }
.cam-container {
  position: relative; width: 100%; max-width: 380px; aspect-ratio: 4/5;
  border-radius: var(--radius-md); overflow: hidden; background: #000;
  box-shadow: var(--shadow-lg); border: var(--border-accent) solid var(--brand-accent);
}
.cam-container video { width: 100%; height: 100%; object-fit: cover; }
.cam-reticle { position: absolute; inset: 42px; border: 2px solid rgba(255,255,255,0.25); border-radius: var(--radius-sm); pointer-events: none; }
.ret-corner { position: absolute; width: 30px; height: 30px; border: 4px solid var(--nfaa-cyan); }
.ret-tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.ret-tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.ret-bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.ret-br { bottom: -2px; right: -2px; border-left: none; border-top: none; }
.cam-close {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(16,24,32,0.82); border: 1px solid var(--border-inverse);
  color: #fff; border-radius: var(--radius-sm); padding: 11px 20px; font-size: 13px; white-space: nowrap;
}

/* Loaded targets */
.loaded-head { display: flex; align-items: center; gap: 10px; padding: 22px 16px 10px; }
.loaded-head .eyebrow { color: var(--text-muted); }
.count-badge {
  font-family: var(--font-display); font-weight: var(--fw-bold);
  background: var(--brand-primary); color: var(--text-on-dark);
  font-size: 12px; border-radius: var(--radius-pill); padding: 2px 10px; min-width: 24px; text-align: center;
}
.loaded-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }

.loaded-empty {
  position: relative; text-align: center; color: var(--text-muted);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  padding: 40px 22px 44px; background: var(--surface-card);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
}
.loaded-empty::before {
  content: ''; display: block; width: 56px; height: 56px; margin: 0 auto 14px;
  background: url("ds/assets/logos/nfaa-stump-emblem.png") no-repeat center / contain;
  opacity: 0.5;
}

.loaded-item { display: flex; align-items: stretch; gap: 10px; }
.li-main {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-top: var(--border-accent) solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.li-main:hover { box-shadow: var(--shadow-md); }
.li-main:active { transform: translateY(1px); }
.li-main b {
  font-family: var(--font-display); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.02em;
  font-size: 19px; color: var(--text-strong);
}
.li-main small { font-family: var(--font-body); color: var(--text-muted); font-size: 13px; }
.li-remove {
  width: 48px; flex: 0 0 48px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--status-danger);
  border-radius: var(--radius-md); font-size: 18px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.li-remove:hover { background: var(--nfaa-red-tint); border-color: var(--nfaa-red-tint); }
.li-remove:active { transform: translateY(1px); }

.adder-hint { color: var(--text-faint); font-size: 11px; font-family: var(--font-mono); margin: 18px 16px 0; text-align: center; }

/* Setup footer (Go to scoring) */
.setup-footer {
  flex: 0 0 auto; padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--surface-page); border-top: 1px solid var(--border-subtle);
  max-width: 720px; width: 100%; margin: 0 auto;
}
.setup-footer:empty, .setup-footer[hidden] { display: none; }
.btn-go { width: 100%; background: var(--brand-accent); border-color: var(--brand-accent); font-size: 17px; padding: 17px; }
.btn-go:hover { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }
@keyframes pulse-accent {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--nfaa-red) 45%, transparent); }
  70%  { box-shadow: 0 0 0 12px color-mix(in srgb, var(--nfaa-red) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--nfaa-red) 0%, transparent); }
}
.btn-go.pulse { animation: pulse-accent 2s infinite; }

/* ── exit-session button (small, in the Loaded-targets header) ───────────── */
.loaded-exit {
  margin-left: auto; cursor: pointer;
  border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 6px 11px;
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 11px;
  transition: color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.loaded-exit:hover { color: var(--brand-accent); border-color: var(--brand-accent); background: var(--nfaa-red-tint); }
.loaded-exit:active { transform: translateY(1px); }

/* ════════════════════════════════════════════════════════════════════════
   SCORE VIEW
   ════════════════════════════════════════════════════════════════════════ */
.empty { position: relative; text-align: center; color: var(--text-muted); padding: 56px 24px; font-family: var(--font-body); }
.empty-emoji { display: block; width: 64px; height: 64px; margin: 0 auto 12px; font-size: 0;
  background: url("ds/assets/logos/nfaa-stump-emblem.png") no-repeat center / contain; opacity: .55; }
.empty-title { font-family: var(--font-display); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .02em; font-size: 22px; color: var(--text-strong); margin: 0 0 6px; }
.empty p { margin: 0 0 4px; }
.empty .btn { margin-top: 16px; }

/* context header */
.score-top { flex: 0 0 auto; }
.ctx-comp {
  background: var(--surface-inverse); color: var(--text-on-dark);
  font-family: var(--font-display); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .04em;
  font-size: 13px; padding: 8px 16px;
}
.ctx-round { display: flex; align-items: center; justify-content: space-between; background: var(--surface-card); padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.ctx-round span { font-family: var(--font-display); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .02em; font-size: 20px; color: var(--text-strong); }
.scico { width: 22px; height: 22px; color: var(--brand-primary); flex: 0 0 auto; }
.ctx-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle);
  padding: 7px 16px; font-family: var(--font-body); font-size: 12px; color: var(--text-muted);
}
.ctx-sub b { color: var(--text-strong); font-weight: var(--fw-semibold); }
.ctx-dist { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ctx-dist-1 b { color: var(--text-strong); }
.dchip {
  padding: 6px 13px; border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-body);
  border-radius: var(--radius-pill); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: 12px;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.dchip.on { background: var(--brand-primary); color: var(--text-on-dark); border-color: var(--brand-primary); }

/* archer cards */
.archer-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; display: flex; flex-direction: column; gap: 10px; max-width: 720px; width: 100%; margin: 0 auto; }
.arch-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-top: var(--border-accent) solid var(--brand-primary);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  padding: 13px 15px;
  transition: transform var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.arch-card:hover { box-shadow: var(--shadow-md); }
.arch-card:active { transform: translateY(1px); }
.arch-card:disabled { opacity: .55; }
.ac-head { display: flex; align-items: center; gap: 12px; }
.ac-face { flex: 0 0 auto; display: flex; }
.tface { width: 30px; height: 30px; display: block; }
.ac-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ac-id b { font-family: var(--font-display); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .01em; font-size: 17px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-id small { font-family: var(--font-body); font-size: 12px; color: var(--text-muted); }
.ac-total { flex: 0 0 auto; font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 26px; color: var(--text-strong); line-height: 1; }
.ac-noscore { color: var(--text-muted); font-size: 13px; margin-top: 8px; font-family: var(--font-body); }

.mini-card { width: 100%; border-collapse: collapse; margin-top: 10px; font-family: var(--font-mono); }
.mini-card th { font-weight: 600; color: var(--text-faint); font-size: 11px; padding: 2px 0 4px; border-bottom: 1px solid var(--border-subtle); text-align: center; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.mini-card td { text-align: center; padding: 4px 0 0; font-weight: 600; font-size: 14px; color: var(--text-body); }
.mini-card .mc-no { color: var(--text-faint); font-weight: 600; border-right: 1px solid var(--border-subtle); width: 22px; }
.mini-card .mc-end { font-weight: 700; color: var(--text-strong); }
.mini-card .mc-tot { font-weight: 700; color: var(--brand-primary); }

/* scoring page */
.score-page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: var(--surface-page); max-width: 720px; width: 100%; margin: 0 auto; }
.score-page[hidden] { display: none; }
.sp-round { flex: 0 0 auto; background: var(--surface-inverse); color: var(--text-on-dark); font-family: var(--font-display); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .04em; font-size: 14px; padding: 9px 16px; }
.sp-who { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; background: var(--surface-card); padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
.sp-back { width: 36px; height: 36px; border: none; background: none; font-size: 26px; line-height: 1; color: var(--brand-primary); cursor: pointer; font-weight: 700; padding: 0; }
.sp-back:active { transform: translateY(1px); }
.sp-name { flex: 1; font-family: var(--font-display); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .01em; font-size: 17px; color: var(--text-strong); }
.sp-icons { display: flex; align-items: center; gap: 10px; color: var(--brand-primary); }
.sp-icons .tface { width: 24px; height: 24px; }

.sp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--surface-card); padding: 4px 12px 10px; }
.sp-card { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 16px; }
.sp-card thead th { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-size: 12px; padding: 8px 0 5px; border-bottom: 1px solid var(--border-default); text-align: center; }
.sp-card th.sc-no { width: 22px; }
.sp-card .sc-distrow td { padding: 7px 0 2px; }
.sp-card .sc-dist { text-align: left; color: var(--text-muted); font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: 12px; }
.sp-card td { text-align: center; padding: 8px 0; font-weight: 600; color: var(--text-body); }
.sp-card td.sc-no { color: var(--text-faint); border-right: 2px solid var(--border-default); width: 22px; }
.sp-card td.sc-end { font-weight: 700; color: var(--text-strong); }
.sp-card td.sc-tot { font-weight: 700; color: var(--brand-primary); }
.sp-card td.sc-cell { padding: 3px; }
.sp-card .cbox { display: flex; align-items: center; justify-content: center; height: 38px; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm); background: var(--surface-card); }
.sp-card tbody tr.active { background: var(--end-hi); }
.sp-card tbody tr.active td.sc-no { border-right-color: var(--end-hi-edge); color: #8A6D18; }
.sp-card tbody tr.active .cbox { border-color: var(--end-hi-edge); }
.sp-card td.sc-cell.active .cbox { border-color: var(--nfaa-yellow); box-shadow: 0 0 0 2px color-mix(in srgb, var(--nfaa-yellow) 40%, transparent); background: #fffdf4; }

.sp-keypad { flex: 0 0 auto; background: var(--surface-sunken); padding: 9px 10px; border-top: 1px solid var(--border-subtle); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  height: 58px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 24px; letter-spacing: .01em;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-standard), filter var(--dur-fast) var(--ease-standard);
}
.key:active { transform: translateY(1px); filter: brightness(.94); }

.sp-cmd { flex: 0 0 auto; display: flex; background: var(--surface-inverse-2); padding: 11px 8px calc(11px + var(--safe-b)); }
.cmd-btn { flex: 1; background: none; border: none; color: var(--text-on-dark); font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; padding: 4px; }
.cmd-btn:active { opacity: .55; }
.cmd-ic { font-size: 17px; }

.note { color: var(--status-warning); padding: 14px 16px; font-size: 14px; font-family: var(--font-body); }

@media (max-height: 640px) {
  .key { height: 48px; font-size: 21px; }
  .sp-card td { padding: 6px 0; }
  .ctx-round span { font-size: 18px; }
  .setup-band { padding: 12px 22px 13px; }
  .band-tagline { font-size: 20px; }
}

/* ── side drawer menu ────────────────────────────────────────────────────── */
.menu-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(16,24,32,.5); opacity: 0; transition: opacity .3s; }
.menu-backdrop.open { opacity: 1; }
.menu-backdrop[hidden] { display: none; }

.drawer {
  position: fixed; z-index: 51; top: 0; left: 0; bottom: 0;
  width: 290px; max-width: 82vw; display: flex; flex-direction: column;
  background: var(--surface-page);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform .3s var(--ease-standard);
}
.drawer.open { transform: translateX(0); }
.drawer[hidden] { display: block; pointer-events: none; }

.drawer-head {
  flex: 0 0 auto; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  gap: 4px; padding: calc(26px + var(--safe-t)) 20px 18px;
  background: var(--surface-inverse);
  border-bottom: var(--border-accent) solid var(--brand-accent);
}
.drawer-head::after {
  content: ''; position: absolute; right: -34px; bottom: -34px; width: 150px; height: 150px;
  background: url("ds/assets/logos/nfaa-stump-emblem-white.png") no-repeat center / contain; opacity: .08;
}
.drawer-close {
  position: absolute; z-index: 3; top: calc(12px + var(--safe-t)); right: 12px;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-pill);
  color: var(--text-on-dark); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-standard);
}
.drawer-close svg { width: 22px; height: 22px; }
.drawer-close:hover { background: rgba(255,255,255,0.12); }
.drawer-close:active { background: rgba(255,255,255,0.20); transform: translateY(1px); }
.drawer-close:focus-visible { outline: 2px solid var(--nfaa-cyan); outline-offset: 2px; }
.drawer-logo { position: relative; z-index: 1; height: 30px; margin-bottom: 4px; }
.drawer-logo img { height: 100%; width: auto; display: block; }
.drawer-brand { position: relative; z-index: 1; font-family: var(--font-display); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-label); font-size: 12px; color: var(--nfaa-cyan); text-transform: uppercase; }

.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 10px 0; }
.drawer-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: none; border: none; padding: 14px 20px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 15px;
  color: var(--text-strong);
  transition: background var(--dur-fast) var(--ease-standard);
}
.drawer-item:hover { background: var(--surface-sunken); }
.drawer-item:active { background: var(--nfaa-navy-tint); }
.drawer-item.danger { color: var(--brand-accent); }
.drawer-ic { width: 22px; height: 22px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: currentColor; }
.drawer-ic svg { width: 20px; height: 20px; }
.drawer-sep { height: 1px; background: var(--border-subtle); margin: 6px 20px; }

.drawer-foot {
  flex: 0 0 auto; padding: 14px 20px calc(14px + var(--safe-b));
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
  display: flex; flex-direction: column; gap: 3px;
}

/* ── choice modal ────────────────────────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(16,24,32,.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-wrap[hidden] { display: none; }
.modal {
  background: var(--surface-card); border-radius: var(--radius-md); max-width: 380px; width: 100%; padding: 22px;
  box-shadow: var(--shadow-lg); border-top: var(--border-accent) solid var(--brand-accent);
}
.modal-msg { font-family: var(--font-body); font-size: 15px; line-height: 1.5; color: var(--text-body); margin-bottom: 18px; }
.modal-msg b { color: var(--brand-primary); font-weight: var(--fw-semibold); }
.modal-btns { display: flex; flex-direction: column; gap: 9px; }
.modal-btns .btn { width: 100%; }
.modal-btns .btn-ghost { background: var(--surface-sunken); color: var(--text-strong); border-color: var(--surface-sunken); }

/* ── activity log ─────────────────────────────────────────────────────────── */
.log-fab {
  position: fixed; right: 14px; bottom: calc(14px + var(--safe-b)); z-index: 40;
  width: 42px; height: 42px; border-radius: var(--radius-pill); border: none;
  background: var(--brand-primary); color: var(--text-on-dark); font-size: 18px;
  box-shadow: var(--shadow-md); cursor: pointer; opacity: .9;
}
.log-fab:active { transform: translateY(1px); }
.logwrap {
  position: fixed; left: 12px; right: 12px; bottom: 64px; z-index: 41;
  background: var(--surface-inverse-2); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border-inverse);
}
.logwrap[hidden] { display: none; }
.log-head { display: flex; justify-content: space-between; align-items: center; color: var(--stone-300); padding: 11px 14px; font-family: var(--font-display); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.log-head button { background: none; border: none; color: var(--stone-300); font-size: 20px; cursor: pointer; }
.log { color: var(--stone-400); padding: 0 14px 12px; font-family: var(--font-mono); font-size: 12px; max-height: 40vh; overflow-y: auto; }
.log-line.ok { color: #6FCF7E; } .log-line.err { color: #F08A7E; } .log-line.warn { color: var(--nfaa-yellow); }

/* ── update toast ─────────────────────────────────────────────────────────── */
.update-toast {
  position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  background: var(--surface-inverse); color: var(--text-on-dark); padding: 12px 14px; border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); z-index: 999;
  border-bottom: var(--border-accent) solid var(--brand-accent);
  animation: slide-up .4s var(--ease-out);
}
.update-toast[hidden] { display: none; }
.update-toast .toast-text { font-family: var(--font-body); font-size: 14px; font-weight: 600; white-space: nowrap; }
.update-toast .btn { padding: 9px 14px; font-size: 13px; }
@keyframes slide-up { from { transform: translate(-50%, 120%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
