/* ============================================================
   AIEssy · Components & Screens
   ============================================================ */

/* ---------- App shell ---------- */
.device {
  width: var(--device-w);
  max-width: var(--device-max-w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}
.screen.active {
  display: flex;
}
@keyframes screen-in {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* iOS-ish status bar mock — hidden on desktop embed */
.statusbar {
  display: none;
}

/* Top bar (in-app) */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px 8px;
  position: sticky; top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-on-accent);
  letter-spacing: -0.02em;
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text-soft);
  transition: background .15s var(--ease-soft), color .15s var(--ease-soft);
}
.icon-btn:hover, .icon-btn:active { background: var(--surface); color: var(--text); }

/* Lang toggle */
.lang {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  padding: 2px;
  overflow: hidden;
}
.lang button {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  transition: color .15s, background .15s;
}
.lang button.on { background: var(--text); color: var(--bg); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform .12s var(--ease-spring), background .15s var(--ease-soft), box-shadow .15s var(--ease-soft);
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
  box-shadow: var(--glow-accent);
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-primary[disabled],
.btn-primary.is-disabled {
  background: var(--surface-2);
  color: var(--text-mute);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-ghost { color: var(--text-soft); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-block { width: 100%; }

/* Pills (scholarship type) */
.pill-group {
  display: inline-flex; gap: 8px; flex-wrap: wrap;
}
.pill-radio {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  transition: all .15s var(--ease-soft);
  cursor: pointer;
}
.pill-radio .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute);
  transition: background .15s;
}
.pill-radio[data-type="lpdp"] .dot { background: var(--lpdp); }
.pill-radio[data-type="aas"] .dot { background: var(--aas); }
.pill-radio[data-type="chev"] .dot { background: var(--chev); }
.pill-radio:hover { border-color: var(--border); color: var(--text); }
.pill-radio.on {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}
.badge.lpdp { color: var(--lpdp); border-color: rgba(255,166,107,0.24); background: rgba(255,166,107,0.06); }
.badge.aas { color: var(--aas); border-color: rgba(124,194,255,0.24); background: rgba(124,194,255,0.06); }
.badge.chev { color: var(--chev); border-color: rgba(201,166,255,0.24); background: rgba(201,166,255,0.06); }
.badge.good { color: var(--good); border-color: var(--good-border); background: var(--good-bg); }
.badge.warn { color: var(--warn); border-color: var(--warn-border); background: var(--warn-bg); }
.badge.crit { color: var(--crit); border-color: var(--crit-border); background: var(--crit-bg); }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  padding: var(--s-6);
}
.card-soft {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
}

/* Bottom nav */
.bottomnav {
  position: sticky;
  bottom: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 12px 22px;
  z-index: 30;
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px;
  color: var(--text-mute);
  border-radius: 10px;
  transition: color .15s;
}
.bn-item.on { color: var(--accent); }
.bn-item svg { width: 22px; height: 22px; }
.bn-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---------- Landing ---------- */
.hero {
  padding: 28px 20px 20px;
  display: flex; flex-direction: column; gap: 24px;
}
@media (min-width: 640px) {
  .hero {
    padding: 48px 40px 32px;
    gap: 28px;
  }
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 10px 6px 8px;
  background: var(--accent-trace);
  border: 1px solid rgba(255,166,107,0.18);
  border-radius: var(--r-pill);
}
.hero-kicker::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,166,107,0.20);
}
.hero h1 {
  font-family: var(--font-sans);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}
@media (min-width: 640px) {
  .hero h1 { font-size: 48px; }
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  font-weight: 500;
}
.hero p.lede {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.55;
  max-width: 48ch;
}
@media (min-width: 640px) {
  .hero p.lede { font-size: 17px; max-width: 56ch; }
}
.hero-cta { display: flex; flex-direction: column; gap: 10px; }
.cta-meta {
  display: flex; align-items: center; gap: 8px;
  padding-top: 4px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.cta-meta .dot-sep::before { content: "·"; padding: 0 4px; }

/* Score showcase (on landing & result hero) */
.score-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.score-card::before {
  content: "";
  position: absolute; inset: -1px;
  background: radial-gradient(180px 120px at 50% -10%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.score-card .label {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.score-card .num {
  position: relative;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 96px;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.score-card .num .denom {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: -0.01em;
}
.score-track {
  position: relative;
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  margin: 16px 0 14px;
  overflow: hidden;
}
.score-track .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 999px;
}
.score-track .mark {
  position: absolute; top: -3px;
  width: 10px; height: 10px;
  background: var(--text);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 0 3px var(--surface);
}
.score-track-axis {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.08em;
}
.score-card .verdict {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
}
.verdict-band {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}
.verdict-band.good { background: var(--good-bg); color: var(--good); border-color: var(--good-border); }
.verdict-band.crit { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-border); }
.delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--good);
  font-weight: 500;
}
.delta.down { color: var(--crit); }
.delta .tick {
  font-family: var(--font-sans);
  font-weight: 600;
}

/* Sections (landing/how-it-works) */
.section {
  padding: 48px 20px 24px;
  display: flex; flex-direction: column; gap: 24px;
}
@media (min-width: 640px) {
  .section { padding: 56px 40px 32px; }
}
.section-head .kicker { margin-bottom: 6px; }
.section-head h2 {
  font-family: var(--font-sans);
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 6px;
  text-wrap: balance;
  line-height: 1.1;
}
@media (min-width: 640px) {
  .section-head h2 { font-size: 30px; }
}
.section-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}
@media (min-width: 640px) {
  .section-head p { font-size: 16px; max-width: 56ch; }
}

/* Steps */
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 20px 0;
  border-top: 1px solid var(--border-subtle);
  position: relative;
}
.step:first-child { border-top: 1px solid var(--border); }
.step:last-child { border-bottom: 1px solid var(--border); }
.step .n {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  padding-top: 4px;
}
.step h3 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--text);
}
.step p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.55;
}

/* Comparison block (proof) */
.compare-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .compare-row { grid-template-columns: 1fr 1fr; gap: 14px; }
}
.compare-row .col {
  padding: 14px 16px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
}
@media (min-width: 640px) {
  .compare-row .col { padding: 18px 20px; font-size: 13.5px; }
}
.compare-row .col .tag {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 6px;
  opacity: 0.8;
  display: block;
}
.compare-row .before {
  background: var(--crit-bg);
  color: var(--crit);
  border: 1px solid var(--crit-border);
}
.compare-row .after {
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid var(--good-border);
}

/* Disclaimer */
.disclaim {
  margin: 16px 20px 24px;
  padding: 14px 16px;
  background: var(--accent-trace);
  border: 1px solid rgba(255,166,107,0.16);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: flex-start;
}
.disclaim svg { color: var(--accent); margin-top: 2px; }
.disclaim .text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
}
.disclaim .text strong { color: var(--text); font-weight: 600; }

/* Footer (landing) */
.foot {
  padding: 32px 20px 60px;
  border-top: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 12px;
}
.foot .row { display: flex; gap: 16px; }
.foot a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.foot .copy {
  color: var(--text-mute);
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ---------- Review form ---------- */
.form-page {
  padding: 20px 20px 100px;
  display: flex; flex-direction: column; gap: 20px;
}
@media (min-width: 640px) {
  .form-page { padding: 32px 40px 100px; gap: 24px; }
}
.form-head h1 {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 6px;
}
.form-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}
.field-label {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.field-label .name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.field-label .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}
.textarea-wrap {
  position: relative;
  border-radius: var(--r-3);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.textarea-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-trace);
}
.textarea-wrap textarea {
  display: block;
  width: 100%;
  min-height: 200px;
  padding: 16px 16px 36px;
  background: transparent;
  border: 0;
  resize: none;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  outline: none;
  font-family: var(--font-sans);
}
.textarea-wrap textarea::placeholder { color: var(--text-faint); }
.textarea-foot {
  position: absolute; left: 16px; right: 16px; bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.textarea-foot .count {
  display: inline-flex; align-items: center; gap: 6px;
}
.count-bar {
  width: 60px; height: 2px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.count-bar i {
  display: block; height: 100%;
  background: var(--accent);
  transition: width .25s var(--ease-soft);
}

/* Sticky submit (mobile keyboard-aware) */
.submit-bar {
  position: sticky;
  bottom: 0;
  padding: 14px 20px 22px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 30%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 25;
}
.submit-help {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ---------- Loading ---------- */
.loading {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 24px;
  gap: 32px;
}
.loading-orb {
  width: 92px; height: 92px;
  position: relative;
  margin: 0 auto 8px;
}
.loading-orb::before, .loading-orb::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%;
}
.loading-orb::before {
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  animation: pulse 2.4s ease-in-out infinite;
}
.loading-orb .core {
  position: absolute; inset: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 24px rgba(255,166,107,0.55);
  animation: breathe 2.4s ease-in-out infinite;
}
.loading-orb .ring {
  position: absolute; inset: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 1.4s linear infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.92); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading h2 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  text-align: center;
  text-wrap: balance;
  color: var(--text);
}
.loading .stat {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.steps-progress {
  display: flex; flex-direction: column; gap: 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.sp-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 14px;
  padding: 14px 4px;
  border-top: 1px solid var(--border-subtle);
  align-items: center;
  font-size: 14px;
}
.sp-row:first-child { border-top: none; }
.sp-row .ico {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mute);
}
.sp-row.done .ico {
  border-color: var(--good);
  background: var(--good);
  color: var(--bg);
}
.sp-row.active .ico {
  border-color: var(--accent);
  background: transparent;
}
.sp-row.active .ico::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }
.sp-row .label { color: var(--text-soft); }
.sp-row.active .label { color: var(--text); }
.sp-row.done .label { color: var(--text-soft); }
.sp-row .t {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.sp-row.done .t { color: var(--good); }

.progress-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .6s var(--ease-soft);
}
.progress-meta {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

/* ---------- Result page ---------- */
.result-progress {
  position: sticky; top: 0;
  height: 2px;
  background: transparent;
  z-index: 40;
}
.result-progress i {
  display: block; height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .05s linear;
}
.result-header {
  position: sticky; top: 2px;
  z-index: 35;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
}
.result-header .meta-mini {
  display: flex; flex-direction: column; gap: 0px;
  overflow: hidden;
}
.result-header .meta-mini .row1 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
}
.result-header .meta-mini .row1 .score-mini {
  font-variant-numeric: tabular-nums;
}
.result-header .meta-mini .row2 {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.toc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.result-page {
  display: flex; flex-direction: column;
  padding: 0 0 96px;
}

/* Result hero */
.result-hero {
  padding: 28px 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 640px) {
  .result-hero { padding: 36px 40px 32px; }
}
.result-hero .meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.result-hero .meta-line .sep { color: var(--text-faint); }
.result-hero h1 {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 18px;
  text-wrap: balance;
  color: var(--text);
}
.result-hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.actions-row {
  display: flex; gap: 8px;
  margin-top: 18px;
}
.actions-row .btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
}

/* Result section */
.rs {
  padding: 32px 20px 16px;
  scroll-margin-top: 70px;
  border-top: 1px solid var(--border-subtle);
}
@media (min-width: 640px) {
  .rs { padding: 40px 40px 24px; }
}
.rs:first-of-type { border-top: none; }
.rs-eyebrow {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.rs-eyebrow .badge { font-size: 9px; }
.rs h2 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin: 0 0 12px;
  text-wrap: balance;
}
.rs h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 24px 0 10px;
  color: var(--text);
}
.rs h3 .num {
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-right: 6px;
}
.rs p {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.6;
}
.rs p:last-child { margin-bottom: 0; }
.rs ul {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.rs ul li {
  position: relative;
  padding: 4px 0 4px 22px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}
.rs ul li::before {
  content: "";
  position: absolute; left: 6px; top: 14px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-mute);
}
.rs ul.plus li::before { background: var(--good); }
.rs ul.minus li::before { background: var(--crit); }
.rs blockquote {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--text-mute);
  background: var(--surface);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
}

/* Callouts */
.callout {
  margin: 14px 0;
  padding: 14px 14px 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.6;
}
.callout .head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}
.callout.caution { background: var(--crit-bg); border-color: var(--crit-border); color: #ffe1e5; }
.callout.caution .head, .callout.caution .ico { color: var(--crit); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border); color: #ffefd0; }
.callout.warn .head, .callout.warn .ico { color: var(--warn); }
.callout.important { background: var(--info-bg); border-color: var(--info-border); color: #d9edff; }
.callout.important .head, .callout.important .ico { color: var(--info); }
.callout.tip { background: var(--good-bg); border-color: var(--good-border); color: #d6f4e1; }
.callout.tip .head, .callout.tip .ico { color: var(--good); }
.callout p { margin: 0; color: inherit; font-size: 13.5px; }

/* Tables (criteria matrix, alignment) */
.table {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--surface);
}
.table .row-h, .table .row {
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
}
.table .row-h {
  border-top: none;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.table.t-crit .row-h, .table.t-crit .row { grid-template-columns: 1.6fr 0.6fr 0.7fr 0.6fr; }
.table.t-prio .row-h, .table.t-prio .row { grid-template-columns: 28px 1fr 60px 50px; }
.table.t-align .row-h, .table.t-align .row { grid-template-columns: 1.5fr 1fr 60px; }
.table.t-lang .row-h, .table.t-lang .row { grid-template-columns: 1fr 1fr 1fr; }
.table.t-smart .row-h, .table.t-smart .row { grid-template-columns: 1fr 1.4fr; align-items: start; }

.stars {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--warn);
  font-size: 13px;
}
.stars .empty { color: var(--text-faint); }
.gap-tag {
  display: inline-flex;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
}
.gap-tag.crit { background: var(--crit-bg); color: var(--crit); }
.gap-tag.mod { background: var(--warn-bg); color: var(--warn); }
.gap-tag.min { background: var(--good-bg); color: var(--good); }

/* Diff block (before/after) */
.diff {
  margin: 12px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.diff .row {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  border-top: 1px solid var(--border-subtle);
}
.diff .row:first-child { border-top: none; }
.diff .row.minus { background: rgba(255, 138, 149, 0.06); color: #ffd7da; }
.diff .row.plus { background: rgba(143, 224, 168, 0.05); color: #d6f4e1; }
.diff .row.minus .mk { color: var(--crit); }
.diff .row.plus .mk { color: var(--good); }
.diff .row .mk { font-weight: 600; }

/* Priority impact dots */
.impact { display: inline-flex; gap: 2px; }
.impact .d {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}
.impact .d.on { background: var(--accent); }
.impact .d.crit-on { background: var(--crit); }
.impact .d.warn-on { background: var(--warn); }
.impact .d.good-on { background: var(--good); }

/* Final verdict block */
.final-verdict {
  margin: 12px 0 0;
  padding: 24px;
  border-radius: var(--r-3);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.final-verdict::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(280px 160px at 50% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.fv-row {
  position: relative;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 0;
  border-top: 1px dashed var(--border-subtle);
}
.fv-row:first-of-type { border-top: none; }
.fv-row .name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.fv-row .val {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.fv-row .val.up { color: var(--good); }
.fv-row .arrow {
  font-family: var(--font-mono);
  color: var(--text-mute);
  font-size: 12px;
  margin: 0 6px;
}

/* TOC bottom sheet */
.sheet-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease-soft);
}
.sheet-mask.on { opacity: 1; pointer-events: all; }
.sheet {
  position: fixed; left: 50%; bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--device-max-w);
  max-height: 80vh;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  z-index: 61;
  transition: transform .32s var(--ease-out);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet.on { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 999px;
  background: var(--border-strong);
  margin: 10px auto 12px;
}
.sheet-title {
  padding: 0 20px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.sheet-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.sheet-title .close {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 8px;
}
.toc-list {
  padding: 8px 12px 24px;
  display: flex; flex-direction: column;
}
.toc-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 10px;
  text-align: left;
}
.toc-item:hover { background: var(--surface-3); }
.toc-item .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}
.toc-item .label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.toc-item .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
}
.toc-item.active .label { color: var(--accent); }
.toc-item.active .num { color: var(--accent); }

/* Floating "Jump" button */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 32;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.55);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
  pointer-events: none;
}
.fab.show { opacity: 1; transform: translateY(0); pointer-events: all; }

/* ---------- History ---------- */
.history-page {
  padding: 16px 20px 100px;
  display: flex; flex-direction: column; gap: 20px;
}
@media (min-width: 640px) {
  .history-page { padding: 32px 40px 100px; }
}
.history-head h1 {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 6px;
}
.history-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

/* Trend card */
.trend-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.trend-card .head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.trend-card .head .left .l {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.trend-card .head .left .v {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.trend-card .head .left .v .denom {
  font-size: 14px;
  color: var(--text-mute);
  margin-left: 2px;
}
.trend-chart {
  position: relative;
  height: 140px;
  padding-left: 24px;
}
.trend-chart svg { width: 100%; height: 100%; overflow: visible; }
.trend-chart .ylab {
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-mute);
}
.trend-axis {
  margin-top: 10px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  padding-left: 24px;
}

/* History list */
.h-list { display: flex; flex-direction: column; gap: 12px; }
.h-card {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.h-card:hover { border-color: var(--border); }
.h-card.active {
  border-color: rgba(255,166,107,0.40);
  background: linear-gradient(180deg, var(--surface), var(--surface));
}
.h-card.active::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 3px;
  background: var(--accent);
}
.h-card .top-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.h-card .top-row .when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.h-card .ttl {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 4px 0 6px;
  line-height: 1.3;
}
.h-card .preview {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.h-score {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  border: 1px solid var(--hairline);
}
.h-score .n {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.h-score .l {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
  color: var(--text-mute);
}
.h-score.good .n { color: var(--good); }
.h-score.warn .n { color: var(--warn); }
.h-score.crit .n { color: var(--crit); }

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 0 4px;
}

/* Tweaks panel basics */
.tweaks-fab {
  display: none;
}

/* Helper: bullet list dense */
.dense li { font-size: 13.5px; padding: 2px 0 2px 18px; }
.dense li::before { top: 12px; left: 4px; }

/* Hairlines around important blocks */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 24px 0;
}
.divider.dashed {
  background: transparent;
  border-top: 1px dashed var(--border-subtle);
}
