/* ─────────────────────────────────────────────
   PWW — Claude-inspired design system (DARK)
   warm dark surface · serif display · coral accent
   ───────────────────────────────────────────── */

:root {
  /* surfaces — warm dark, layered */
  --bg:          #1c1916;          /* warm near-black */
  --bg-soft:     #221e1a;
  --surface:     #262220;
  --surface-2:   #2d2825;
  --surface-3:   #34302c;

  /* lines */
  --border:      #3a342f;
  --border-soft: #322d29;
  --border-strong:#4a4239;

  /* text */
  --text:        #f3eee7;
  --text-2:      #d8d2ca;
  --muted:       #9a9189;
  --faint:       #6e665f;

  /* accents — Perplexity teal-blue, tuned for dark */
  --accent:      #20b8cd;
  --accent-soft: #5fd3e0;
  --accent-bg:   #0f2e34;
  --good:        #6fbf85;
  --good-bg:     #1f2e23;
  --bad:         #d97a7a;
  --bad-bg:      #2e1d1d;

  /* shape */
  --radius:      14px;
  --radius-sm:   10px;
  --radius-pill: 999px;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:      0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg:   0 12px 32px rgba(0, 0, 0, 0.5);

  /* type */
  --serif: "Charter", "Iowan Old Style", "Source Serif Pro", "Georgia", "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

/* ── layout ── */
.app {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.75rem 6rem;
}

/* ── topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.6rem 0 1.4rem;
  margin-bottom: 2.6rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--text);
}
.brand-mark {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 7px;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.brand-mark::after {
  content: ""; position: absolute;
  inset: 6px; border-radius: 3px;
  background: var(--bg);
  opacity: 0.95;
  -webkit-mask: radial-gradient(circle at 50% 60%, transparent 35%, #000 36%);
          mask: radial-gradient(circle at 50% 60%, transparent 35%, #000 36%);
}
.brand-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
}
.brand-tag { color: var(--muted); font-size: 0.85rem; margin-left: 0.45rem; }

.nav {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem;
  box-shadow: var(--shadow-sm);
}
.nav a {
  font-size: 0.85rem; color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-pill);
  transition: background 120ms, color 120ms;
}
.nav a:hover  { color: var(--text); }
.nav a.active {
  color: var(--text);
  background: var(--bg-soft);
  font-weight: 500;
}

/* ── headings ── */
.page-head { margin-bottom: 2rem; }
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
  color: var(--text);
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: -0.005em;
  margin: 0 0 0.7rem;
  color: var(--text);
}
.lede {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  max-width: 62ch;
}

/* ── form controls ── */
input[type="text"],
input[type="number"],
input[type="file"],
textarea, select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 120ms, box-shadow 120ms, background 120ms;
  box-shadow: var(--shadow-sm);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(32, 184, 205, 0.18);
}
textarea {
  width: 100%; min-height: 6rem;
  resize: vertical; line-height: 1.55;
  font-size: 1.02rem;
  padding: 0.95rem 1.05rem;
  color: var(--text);
}
textarea::placeholder { color: var(--faint); }

input[type="file"] {
  padding: 0.45rem 0.6rem; cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-family: inherit; font-size: 0.85rem;
  margin-right: 0.7rem; cursor: pointer;
  transition: background 120ms;
}
input[type="file"]::file-selector-button:hover { background: var(--bg-soft); }

button {
  background: var(--accent); color: #04181c;
  border: none; border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem; font-size: 0.9rem;
  font-family: inherit; font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 120ms, transform 60ms, box-shadow 120ms;
}
button:hover:not(:disabled) {
  background: #3ec8db;
  box-shadow: var(--shadow);
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
button.ghost {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border);
}
button.ghost:hover:not(:disabled) {
  background: var(--bg-soft); color: var(--text);
}

/* ── badges & status ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}
.status {
  color: var(--muted); font-size: 0.88rem;
  min-height: 1.4em;
}
.status code {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 0.08rem 0.45rem;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.85em;
}

/* ── prediction list (live page) ── */
.pred-card {
  margin-top: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  box-shadow: var(--shadow-sm);
}
.pred-list .row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  border-radius: 8px;
  transition: background 100ms;
}
.pred-list .row:last-child { border-bottom: none; }
.pred-list .row:hover { background: var(--bg-soft); }
.pred-list .rank {
  color: var(--faint); width: 1.6rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.8rem;
  font-family: var(--mono);
}
.pred-list .word {
  flex: 1; font-weight: 500; font-size: 0.98rem;
  color: var(--text);
}
.pred-list .score {
  color: var(--accent); width: 3.4rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.82rem;
  font-family: var(--mono);
}
.pred-list .bar {
  width: 72px; height: 4px;
  background: var(--surface-3); border-radius: 2px; overflow: hidden;
}
.pred-list .bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transition: width 140ms;
}

/* ── upload row ── */
.upload-row {
  display: flex; gap: 0.7rem; align-items: center;
  flex-wrap: wrap;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 1.2rem 0 1rem;
}
.field-label {
  color: var(--muted); font-size: 0.85rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.field-label input[type="number"] {
  width: 5.2rem; padding: 0.45rem 0.6rem; font-size: 0.9rem;
}

/* ── progress ── */
.progress-wrap {
  margin: 1.4rem 0 0.55rem;
  background: var(--surface-3); border-radius: 4px;
  height: 5px; overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  width: 0%; transition: width 200ms ease-out;
}
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.55rem;
}

/* ── card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin-top: 1.4rem;
  box-shadow: var(--shadow-sm);
}

/* ── step card ── */
.step-meta {
  display: flex; gap: 1.4rem; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--muted);
  margin-bottom: 1rem;
  font-variant-numeric: tabular-nums;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-soft);
}
.step-meta code {
  background: var(--accent-bg); color: var(--accent);
  padding: 0.05rem 0.45rem; border-radius: 5px;
  font-family: var(--mono); font-size: 0.85em;
}
.sentence-display {
  font-family: var(--serif);
  font-size: 1.08rem; line-height: 1.7;
  margin-bottom: 1.1rem; word-wrap: break-word;
  padding: 1rem 1.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.sentence-display .past   { color: var(--text); }
.sentence-display .target {
  color: var(--accent); font-weight: 600;
  background: var(--accent-bg);
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.sentence-display .future { color: var(--faint); }

.target-row {
  display: flex; align-items: center; gap: 0.8rem;
  font-size: 0.95rem; margin-bottom: 1rem;
  flex-wrap: wrap;
}
.target-row .label { color: var(--muted); font-size: 0.85rem; }
.target-row .word  {
  font-family: var(--serif);
  font-weight: 600; color: var(--text);
  font-size: 1.1rem;
}

.verdict {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.7rem; border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.verdict.hit  { background: var(--good-bg); color: var(--good); }
.verdict.miss { background: var(--bad-bg);  color: var(--bad); }
.verdict .dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.verdict.hit  .dot { background: var(--good); }
.verdict.miss .dot { background: var(--bad); }

/* ── top-25 grid ── */
.top-list-head {
  font-size: 0.75rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0.2rem 0 0.5rem;
}
.top-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.2rem 0.6rem;
}
.top-list .row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.55rem; border-radius: 6px;
  font-size: 0.85rem;
  transition: background 80ms;
}
.top-list .row:hover { background: var(--bg-soft); }
.top-list .row.match {
  background: var(--good-bg);
  outline: 1px solid rgba(111, 191, 133, 0.35);
}
.top-list .rank {
  color: var(--faint); width: 1.6rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.74rem;
  font-family: var(--mono);
}
.top-list .word { flex: 1; color: var(--text-2); }
.top-list .row.match .word { color: var(--good); font-weight: 500; }
.top-list .score {
  color: var(--accent); width: 2.7rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.74rem;
  font-family: var(--mono);
}
.top-list .bar {
  width: 32px; height: 3px;
  background: var(--surface-3); border-radius: 2px; overflow: hidden;
}
.top-list .bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}

/* ── summary grid ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}
.summary-grid .cell {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}
.summary-grid .label {
  font-size: 0.7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}
.summary-grid .value {
  font-family: var(--serif);
  font-size: 1.55rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
}
.summary-grid .cell.accent {
  background: var(--accent-bg);
  border-color: rgba(32, 184, 205, 0.3);
}
.summary-grid .cell.accent .value { color: var(--accent); }

/* ── empty / utility ── */
.empty {
  padding: 1.2rem; color: var(--muted); font-size: 0.9rem;
  text-align: center;
  font-style: italic;
  font-family: var(--serif);
}
hr.sep {
  border: none; border-top: 1px solid var(--border-soft);
  margin: 2.2rem 0;
}

/* tiny stat row above the textarea */
.toolbar {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 0.4rem 0 0.9rem;
  flex-wrap: wrap;
}

/* selection */
::selection { background: var(--accent-bg); color: var(--accent); }

/* scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 2px solid var(--bg);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
