/* LevelLens — dark editorial theme.
   One accent (amber), warm paper text on near-black, serif display type.
   System font stacks only: the page makes no external requests. */

:root {
  --bg: #14110d;
  --bg-panel: #1d1913;
  --bg-panel-2: #241f16;
  --ink: #ede4d3;
  --ink-soft: #c9bda6;
  --ink-mute: #9a8b71;
  --line: #38311f;
  --accent: #e8a33d;
  --accent-deep: #b97a1e;
  --accent-pale: #f5cf87;
  --danger: #d96f4e;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(232, 163, 61, 0.07), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; padding-top: 26px; padding-bottom: 26px;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark { color: var(--accent); display: inline-flex; }
.wordmark {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: 2rem; letter-spacing: 0.01em; line-height: 1;
}
.tagline { margin: 4px 0 0; color: var(--ink-soft); font-size: 1.02rem; }
.privacy-note {
  margin: 0; text-align: right; color: var(--accent-pale);
  font-size: 0.92rem; line-height: 1.45;
}

/* ---------- layout ---------- */

.layout {
  display: grid; grid-template-columns: minmax(340px, 5fr) 7fr;
  gap: 28px; padding-top: 32px; padding-bottom: 16px; align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .privacy-note { display: none; }
}

/* ---------- panels & type ---------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 24px;
}
.panel-title {
  margin: 0 0 6px; font-family: var(--serif);
  font-size: 1.45rem; font-weight: 700;
}
.panel-sub { margin: 0 0 18px; color: var(--ink-soft); font-size: 0.98rem; }
.panel-kicker {
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.78rem; color: var(--ink-mute); font-weight: 600;
}
.panel-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }

.input-col { position: sticky; top: 24px; }
@media (max-width: 960px) { .input-col { position: static; } }

.input-tools { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.input-tools-row { display: flex; margin-bottom: 16px; }
textarea.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.35);
}
#text-input-b { min-height: 200px; }

/* ---------- input ---------- */

.sample-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.sample-label { color: var(--ink-mute); font-size: 0.92rem; }
.sample-buttons { display: inline-flex; flex-wrap: wrap; gap: 8px; }

.btn {
  font: inherit; font-size: 0.95rem; cursor: pointer;
  border-radius: 999px; padding: 8px 18px;
  border: 1px solid var(--line); background: var(--bg-panel-2); color: var(--ink);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-pale); }
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: #1c1405; font-weight: 650;
}
.btn-accent:hover { background: var(--accent-pale); color: #1c1405; }
.btn-ghost { background: transparent; }
.btn-sample { padding: 6px 14px; font-size: 0.9rem; }
.btn-sample[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #1c1405; font-weight: 650;
}

.textarea-label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 0.95rem; }
textarea {
  width: 100%; min-height: 320px; resize: vertical;
  background: #100d09; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; font-family: var(--serif); font-size: 1.06rem; line-height: 1.65;
}
textarea::placeholder { color: var(--ink-mute); font-family: var(--sans); font-size: 0.98rem; }
textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(232, 163, 61, 0.25); }

.input-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
}
.input-counts { margin: 0; color: var(--ink-mute); font-size: 0.92rem; font-variant-numeric: tabular-nums; }

.how-box { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.how-box h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.12rem; }
.how-box ul { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 0.95rem; }
.how-box li { margin-bottom: 7px; }
.how-box strong { color: var(--ink); }

/* ---------- results ---------- */

.empty-state { text-align: left; padding: 40px 30px; }
.empty-big { font-family: var(--serif); font-size: 1.7rem; margin: 0 0 8px; }
.empty-state p { color: var(--ink-soft); margin: 0; max-width: 46ch; }

.verdict-panel {
  background: linear-gradient(150deg, var(--bg-panel-2), var(--bg-panel) 65%);
  border-color: var(--accent-deep);
}
.verdict-level {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.3rem, 4.5vw, 3.4rem); line-height: 1.05; color: var(--accent-pale);
}
.verdict-detail { margin: 10px 0 0; font-size: 1.12rem; color: var(--ink); max-width: 58ch; }
.estimate-chip {
  text-transform: none; letter-spacing: 0.02em; font-weight: 600;
  color: #1c1405; background: var(--accent);
  border-radius: 999px; padding: 2px 10px; margin-left: 8px; font-size: 0.75rem;
  vertical-align: 2px;
}

/* metric tiles */
.tiles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 14px;
}
.tile-value {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums;
}
.tile-label { margin: 9px 0 2px; font-weight: 620; font-size: 0.97rem; }
.tile-hint { margin: 0; color: var(--ink-mute); font-size: 0.85rem; }

/* band bar */
.band-bar {
  display: flex; height: 44px; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line); background: #100d09;
}
.band-seg { height: 100%; min-width: 0; transition: width 0.3s ease; }
.band-0 { background: #f7dc9f; }
.band-1 { background: #f0c168; }
.band-2 { background: #e8a33d; }
.band-3 { background: #cf7f22; }
.band-4 { background: #a85f14; }
.band-5 { background: #d96f4e; }

.band-legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 28px; }
@media (max-width: 640px) { .band-legend { grid-template-columns: 1fr; } }
.band-legend li { display: flex; align-items: baseline; gap: 10px; font-size: 0.96rem; }
.band-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; position: relative; top: 1px; }
.band-name { color: var(--ink); }
.band-figures { margin-left: auto; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* rhythm strip */
#rhythm svg { display: block; width: 100%; height: auto; }
#rhythm .bar { fill: var(--accent); }
#rhythm .bar:hover { fill: var(--accent-pale); }

/* stat grid */
.stat-grid {
  margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px;
}
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-grid dt { color: var(--ink-mute); font-size: 0.88rem; margin-bottom: 3px; }
.stat-grid dd {
  margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* compare mode */
.compare-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td {
  padding: 9px 10px; border-top: 1px solid var(--line); text-align: right;
}
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.compare-table thead th {
  border-top: none; color: var(--ink-mute); font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.compare-table td:first-child { color: var(--ink-soft); }
.delta-easier { color: var(--accent-pale); font-weight: 650; }
.delta-harder { color: var(--danger); font-weight: 650; }
.delta-flat { color: var(--ink-mute); }
.compare-rhythms { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 640px) { .compare-rhythms { grid-template-columns: 1fr; } }
.compare-rhythm-label { margin: 0 0 6px; color: var(--ink-mute); font-size: 0.88rem; }
.compare-rhythms svg { display: block; width: 100%; height: auto; }
.compare-rhythms .bar { fill: var(--accent); }

.stat-note { margin: 16px 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.stat-note strong { color: var(--accent-pale); font-family: var(--serif); }
.version-line { color: var(--ink-mute); font-size: 0.85rem; margin-top: 10px !important; }

/* heatmap */
.heatmap {
  font-family: var(--serif); font-size: 1.07rem; line-height: 1.75;
  background: #100d09; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px;
}
.heatmap p { margin: 0 0 14px; }
.heatmap p:last-child { margin-bottom: 0; }
.w-late {
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.w-off { background: rgba(217, 111, 78, 0.32); border-radius: 3px; padding: 0 1px; }
.hm-late-key { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.hm-off-key { background: rgba(217, 111, 78, 0.32); border-radius: 3px; padding: 0 4px; }

/* glossary */
.glossary { list-style: none; margin: 0; padding: 0; }
.glossary li { padding: 11px 0; border-top: 1px solid var(--line); }
.glossary li:first-child { border-top: none; padding-top: 2px; }
.glossary .g-word { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; color: var(--accent-pale); }
.glossary .g-sentence { display: block; color: var(--ink-soft); font-size: 0.95rem; margin-top: 2px; }
.glossary-empty { color: var(--ink-soft); margin: 0; }

.actions { display: flex; gap: 12px; margin-bottom: 24px; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 12px; }
.footer-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px;
  padding-top: 30px; padding-bottom: 44px;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 1.15rem; }
.footer-grid p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }

/* ---------- print: a clean light report ---------- */

@media print {
  body { background: #fff; color: #111; font-size: 12pt; }
  .no-print, .site-header .privacy-note, .how-box { display: none !important; }
  .layout { display: block; padding-top: 8px; }
  .wrap { max-width: none; padding: 0; }
  .site-header { border-bottom: 2px solid #111; }
  .wordmark, .tagline { color: #111; }
  .brand-mark { color: #111; }
  .panel, .tile {
    background: #fff; border: 1px solid #bbb; break-inside: avoid; margin-bottom: 14px;
  }
  .verdict-panel { background: #fff; border: 2px solid #111; }
  .verdict-level { color: #111; font-size: 26pt; }
  .verdict-detail, .panel-sub, .tile-hint, .glossary .g-sentence, .footer-grid p { color: #333; }
  .panel-kicker, .band-figures, .stat-grid dt, .tile-label { color: #111; }
  .estimate-chip { background: #111; color: #fff; }
  .band-bar { border-color: #999; }
  .heatmap { background: #fff; border-color: #bbb; color: #111; }
  .glossary .g-word { color: #111; }
  .site-footer { border-top: 1px solid #bbb; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
