/* ============================================================
   Digisnap score-tracker — page styles
   Built on FTRPRF design tokens.
   ============================================================ */

body {
  background:
    radial-gradient(50% 35% at 12% 0%, color-mix(in oklab, var(--blue-500) 14%, transparent) 0%, transparent 60%),
    radial-gradient(45% 35% at 92% 6%, color-mix(in oklab, var(--coral-500) 10%, transparent) 0%, transparent 60%),
    radial-gradient(55% 40% at 70% 100%, color-mix(in oklab, var(--plum-500) 10%, transparent) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ---- Layout ------------------------------------------------ */
.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 120px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-mark { width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---- Tabs (top right) ------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-pill);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font: 600 13px/1 var(--font-sans);
  cursor: pointer;
  transition: all var(--dur-short) var(--ease-in-out);
}
.tab:hover:not(.tab--on) { color: var(--fg); background: var(--surface-2); }
.tab--on {
  background: var(--fg);
  color: var(--bg);
}
.tab-icon { display: inline-flex; }
.tab-icon svg { width: 15px; height: 15px; }
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.18);
  color: inherit;
  padding: 2px 7px;
  border-radius: 99px;
}
.tab:not(.tab--on) .tab-count { background: var(--surface-sunken); color: var(--fg-muted); }

/* ---- Page intro ------------------------------------------- */
.page-intro {
  margin-bottom: 32px;
  max-width: 760px;
}
.page-intro h1 {
  font-size: clamp(2rem, 3.5vw + 0.5rem, 3rem);
  margin: 8px 0 14px;
}
.page-intro .lead {
  font-size: 18px;
  color: var(--fg-muted);
  line-height: 1.55;
}

/* ---- Test view -------------------------------------------- */
.test {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 32px 24px;
  box-shadow: var(--elev-1);
}
@media (max-width: 720px) { .test { padding: 20px; } }

.test-head { margin-bottom: 22px; }
.test-progress { display: flex; flex-direction: column; gap: 10px; }
.test-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.test-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--cat-color, var(--primary)) 12%, transparent);
  color: var(--cat-color, var(--primary));
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.test-cat-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.test-counter {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 600;
}
.test-progress-bar {
  position: relative;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.test-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--plum-500));
  border-radius: 999px;
  transition: width 280ms var(--ease-out-expo);
}
.test-progress-foot {
  font-size: 11px;
  color: var(--fg-subtle);
  text-align: right;
  font-weight: 600;
}

.test-question { margin-bottom: 24px; }
.test-question h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2vw + 0.6rem, 2rem);
  letter-spacing: -0.01em;
  margin: 6px 0 16px;
  text-wrap: balance;
}

.test-examples {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
}
.test-examples-label {
  font: 700 10px/1 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.test-examples ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.test-examples li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--fg);
  line-height: 1.5;
}
.test-examples li::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--fg-subtle);
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.test-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  transition: all var(--dur-short) var(--ease-in-out);
}
.test-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.test-option--on {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 6%, var(--surface-1));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 14%, transparent);
}
.test-option-radio {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface-1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-short) var(--ease-in-out);
}
.test-option--on .test-option-radio {
  border-color: var(--primary);
}
.test-option-radio-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.test-option-label {
  flex: 1;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
}
.test-option-score {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-subtle);
  background: var(--surface-sunken);
  padding: 4px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.test-option--on .test-option-score {
  background: var(--primary);
  color: #fff;
}

.test-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.test-nav-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Method toggle ---------------------------------------- */
.method-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 26px;
}
@media (max-width: 640px) {
  .method-toggle { grid-template-columns: 1fr; }
}
.method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface-1);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--fg);
  transition: all var(--dur-short) var(--ease-in-out);
}
.method:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--elev-1); }
.method--on {
  border-color: var(--primary);
  background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 6%, var(--surface-1)) 0%, var(--surface-1) 100%);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 12%, transparent);
}
.method-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.method-icon svg { width: 22px; height: 22px; }
.method-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}
.method-sub {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---- Card blocks ------------------------------------------ */
.card-block {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--elev-1);
}

/* ---- Manual form ------------------------------------------ */
.manual-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
}
@media (max-width: 720px) {
  .manual-form { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.field-head label {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
}
.field-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.field-band {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="number"] {
  width: 80px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font: 600 15px/1 var(--font-mono);
  color: var(--fg);
  background: var(--surface-1);
  transition: border-color var(--dur-short), box-shadow var(--dur-short);
  text-align: center;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 14%, transparent);
}

.field-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(to right,
    var(--track-color, var(--primary)) 0%,
    var(--track-color, var(--primary)) var(--track-fill, 0%),
    var(--surface-sunken) var(--track-fill, 0%),
    var(--surface-sunken) 100%);
  border-radius: 99px;
  outline: none;
  transition: background 0.15s;
}
.field-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--track-color, var(--primary));
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform 0.12s;
}
.field-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.field-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.2); }
.field-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--track-color, var(--primary));
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* ---- How-to ----------------------------------------------- */
.howto {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--blue-500) 8%, transparent) 0%,
    color-mix(in oklab, var(--plum-500) 6%, transparent) 100%);
  border: 1px solid color-mix(in oklab, var(--primary) 18%, transparent);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
}
.howto-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 10px;
}
.howto-head svg { width: 18px; height: 18px; }
.howto-steps {
  margin: 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
}
.howto-steps li { margin-bottom: 4px; }
.howto-steps code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
}

/* ---- Paste zone ------------------------------------------- */
.paste-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--dur-short) var(--ease-in-out);
  position: relative;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.paste-zone:hover {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 4%, var(--surface-2));
}
.paste-zone--drag {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 8%, var(--surface-2));
  transform: scale(1.005);
}
.paste-zone--has {
  border-style: solid;
  border-color: var(--border-subtle);
  background: var(--surface-1);
  cursor: default;
  padding: 0;
}

.paste-empty {
  text-align: center;
  padding: 36px 20px;
}
.paste-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.paste-icon svg { width: 28px; height: 28px; }
.paste-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.paste-sub {
  font-size: 13px;
  color: var(--fg-muted);
  max-width: 380px;
  margin: 0 auto 14px;
}
.paste-sub kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-weight: 600;
}
.paste-shortcut {
  display: flex; gap: 8px; justify-content: center;
}
.shortcut-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--fg-muted);
}

.paste-preview { position: relative; width: 100%; }
.paste-preview img {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: contain;
  background: var(--surface-sunken);
}
.paste-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 14px;
  pointer-events: none;
}
.paste-overlay > * { pointer-events: auto; }
.paste-clear {
  background: rgba(11,18,32,0.78);
  color: #fff;
  backdrop-filter: blur(8px);
}
.paste-clear:hover { background: rgba(11,18,32,0.92); color: #fff; }
.paste-clear svg { width: 14px; height: 14px; }

/* Analyzing overlay */
.analyzing {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: auto;
}
.analyzing-bar {
  width: 200px;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-sunken);
  overflow: hidden;
  position: relative;
}
.analyzing-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: scan 1.4s ease-in-out infinite;
  border-radius: 99px;
}
@keyframes scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(450%); }
}
.analyzing-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}
.analyzing-text svg { width: 16px; height: 16px; }

/* Recognized banner */
.recognized-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin: 18px 0;
  background: var(--success-soft);
  border: 1px solid color-mix(in oklab, var(--success) 30%, transparent);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--fg);
}
.recognized-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.recognized-icon svg { width: 16px; height: 16px; }

/* ---- Average card ----------------------------------------- */
.avg-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
  padding: 22px 26px;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--blue-500) 6%, var(--surface-1)) 0%,
    var(--surface-1) 60%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
}
@media (max-width: 720px) {
  .avg-card { grid-template-columns: 1fr; gap: 18px; }
}
.avg-main { display: flex; align-items: center; gap: 22px; }
.avg-num-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-display);
  line-height: 1;
}
.avg-num {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--fg);
  font-variation-settings: "opsz" 144;
}
.avg-max {
  font-size: 20px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-weight: 500;
}
.avg-meta { display: flex; flex-direction: column; gap: 6px; }
.avg-band-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 99px;
  background: color-mix(in oklab, var(--band-color) 14%, transparent);
  color: var(--band-color);
  border: 1px solid color-mix(in oklab, var(--band-color) 30%, transparent);
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: fit-content;
}
.avg-band-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--band-color);
}
.avg-label {
  font-size: 13px;
  color: var(--fg-muted);
}
.avg-extras {
  display: flex; gap: 28px;
  padding-left: 28px;
  border-left: 1px solid var(--border-subtle);
}
@media (max-width: 720px) {
  .avg-extras { padding-left: 0; border-left: 0; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
}
.avg-extra-label {
  font: 700 10px/1 var(--font-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 4px;
}
.avg-extra-val {
  font-size: 14px;
  font-weight: 600;
}
.avg-extra-val .mono {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ---- Bar chart -------------------------------------------- */
.chart-block-head {
  margin-bottom: 18px;
}
.chart-block-head h2 {
  font-size: 32px;
  margin: 6px 0 0;
}
.chart {
  margin-top: 10px;
}

.band-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 12px;
}
.band-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.band-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
}
.band-label {
  font-weight: 600;
  color: var(--fg-muted);
}

.chart-grid {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bands {
  position: absolute;
  left: 220px; right: 0;
  top: 0; bottom: 0;
  pointer-events: none;
}
@media (max-width: 720px) { .chart-bands { left: 0; top: 28px; } }
.chart-band {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.chart-band-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: -14px;
  opacity: 0.7;
}

.bar-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
  position: relative;
  z-index: 1;
}
@media (max-width: 720px) {
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
}

.bar-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.bar-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
  font-weight: 700;
}
.bar-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}

.bar-track {
  position: relative;
  height: 30px;
  background: var(--surface-sunken);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.bar-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bar-tick {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  position: relative;
  transition: width 700ms var(--ease-out-expo);
  transition-delay: var(--delay, 0ms);
  min-width: 32px;
}

.bar-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.bar-value-band {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.22);
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.chart--gradient .bar-fill { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.chart--solid .bar-fill { box-shadow: none; }

/* ---- Submit bar ------------------------------------------- */
.submit-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  margin: 28px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 14px 22px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--elev-3);
  flex-wrap: wrap;
  isolation: isolate;
}
.submit-status {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}
.submit-status .status-pending,
.submit-status .status-ready {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.submit-status .status-ready { color: var(--green-600); font-weight: 600; }
.submit-status svg { width: 15px; height: 15px; }

/* ---- Buttons ---------------------------------------------- */
.btn {
  font: 600 14px/1 var(--font-sans);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--dur-short) var(--ease-in-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px -6px color-mix(in oklab, var(--primary) 60%, transparent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 10px 24px -8px color-mix(in oklab, var(--primary) 55%, transparent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-1);
  border-color: var(--border-strong);
  color: var(--fg);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-ghost { background: transparent; color: var(--fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--fg); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.btn-lg { padding: 14px 22px; font-size: 15px; }

.btn-flash { background: var(--green-500) !important; box-shadow: 0 0 0 6px color-mix(in oklab, var(--green-500) 22%, transparent) !important; }

/* ---- History view ----------------------------------------- */
.empty-history {
  text-align: center;
  padding: 60px 20px;
  max-width: 520px;
  margin: 0 auto;
}
.empty-illu {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-soft);
}
.empty-illu img { width: 80px; height: 80px; }
.empty-history h3 { font-size: 28px; margin-bottom: 10px; }
.empty-history p { color: var(--fg-muted); font-size: 16px; margin-bottom: 22px; }

.history-head {
  margin-bottom: 22px;
}
.history-head h3 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.history-head .lead {
  font-size: 15px;
  color: var(--fg-muted);
  margin: 0;
}

.history-chart {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 22px;
  box-shadow: var(--elev-1);
}
.history-chart-head { margin-bottom: 10px; }
.history-svg {
  width: 100%;
  height: auto;
  display: block;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-entry {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur-short), box-shadow var(--dur-short);
}
.history-entry:hover { border-color: var(--border-strong); }
.history-entry--open { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 10%, transparent); }

.history-entry-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.history-date {
  text-align: center;
  padding: 8px 6px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  line-height: 1;
}
.history-day {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
}
.history-month {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-top: 2px;
}
.history-year {
  font-size: 10px;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.history-meta { min-width: 0; }
.history-meta-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.history-method {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 99px;
}
.history-method svg { width: 12px; height: 12px; }
.history-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
}

.history-mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 44px;
}
.mini-bar {
  width: 8px;
  border-radius: 2px 2px 0 0;
  flex-shrink: 0;
}

.history-score {
  display: flex;
  align-items: center;
  gap: 14px;
}
.history-avg {
  text-align: right;
}
.history-avg-num {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.history-avg-band {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.history-trend {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 99px;
}
.history-trend--up { color: var(--green-600); background: var(--success-soft); }
.history-trend--down { color: var(--coral-600); background: var(--danger-soft); }

.history-expand {
  border-top: 1px solid var(--border-subtle);
  padding: 18px 22px 16px;
  background: var(--surface-2);
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 22px;
  margin-bottom: 14px;
}
@media (max-width: 720px) { .history-grid { grid-template-columns: 1fr; } }
.history-cell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.history-cell-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  grid-column: 1;
}
.history-cell-bar {
  grid-column: 1;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: 99px;
  overflow: hidden;
}
.history-cell-fill {
  height: 100%;
  border-radius: 99px;
}
.history-cell-value {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  font-weight: 700;
  gap: 1px;
}
.history-cell-value .mono {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--fg);
}
.history-cell-band {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.history-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.history-actions .btn { padding: 8px 14px; font-size: 13px; }
