/* SeedPhrase Assistant — dark, minimal, mobile-first. System fonts only (no external requests). */
:root {
  --bg: #0a0f0d;
  --surface: #121916;
  --surface-2: #18211d;
  --line: #24302b;
  --text: #ffffff;
  --muted: #a7b1ac;
  --gold: #d6b56d;
  --gold-soft: rgba(214, 181, 109, 0.12);
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.12);
  --bad: #ef6b6b;
  --bad-soft: rgba(239, 107, 107, 0.12);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}
a { color: var(--gold); }
code { font-family: var(--mono); color: var(--gold); font-size: 0.92em; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 0.4rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.gold { color: var(--gold); }
.muted { color: var(--muted); font-size: 0.93rem; }
.center { text-align: center; }
.lead { color: var(--muted); margin-bottom: 1.1rem; }
[hidden] { display: none !important; }

/* ---------- header / nav ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 15, 13, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--gold); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 4px; right: 4px; height: 2px; background: var(--gold); border-radius: 2px; }
.brand-mark::before { top: 5px; }
.brand-mark::after { top: 11px; right: 7px; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: 0.95rem;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--bg); background: var(--gold); font-weight: 600; }

main { padding-top: 18px; padding-bottom: 24px; }

/* ---------- warning ---------- */
.warning {
  border: 1px solid rgba(214, 181, 109, 0.45);
  background: var(--gold-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.92rem;
  color: #e9e3d4;
  margin-bottom: 22px;
}
.warning strong { display: block; color: var(--gold); margin-bottom: 4px; }

/* ---------- controls ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.wrap-row { flex-wrap: wrap; justify-content: flex-start; }
.btn {
  appearance: none; border: 1px solid var(--gold); background: var(--gold); color: #0a0f0d;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block;
  min-height: 44px;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); }
.btn:focus-visible, .seg-btn:focus-visible, .tabs a:focus-visible, .chip:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.95rem;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; min-height: 38px;
}
.seg-btn[aria-checked="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }

/* ---------- word grid ---------- */
.grid {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cell {
  display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; transition: border-color .15s;
}
.cell .num {
  flex: 0 0 34px; text-align: center; font: 600 0.8rem var(--mono); color: var(--muted);
  border-right: 1px solid var(--line); align-self: stretch; display: flex; align-items: center; justify-content: center;
}
.cell input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: 16px var(--mono); padding: 11px 10px; outline: none;
}
.cell input::placeholder { color: #55625c; }
.cell.first { border-color: rgba(214, 181, 109, 0.55); }
.cell.first .num { color: var(--gold); }
.cell.empty { border-style: dashed; }
.cell.ok { border-color: rgba(76, 195, 138, 0.55); }
.cell.ok .num { color: var(--ok); }
.cell.bad { border-color: var(--bad); background: var(--bad-soft); }
.cell.bad .num { color: var(--bad); }
.cell:focus-within { border-color: var(--gold); border-style: solid; }

/* ---------- status / results ---------- */
.status { font-size: 0.93rem; color: var(--muted); margin-bottom: 12px; }
.status .count { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font: 600 0.8rem var(--mono); padding: 4px 9px; border-radius: 999px; border: 1px dashed var(--line);
  color: var(--muted); background: transparent; cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.word { border-style: solid; color: var(--text); font-weight: 500; }

.result { border-radius: var(--radius); padding: 14px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.result h2 { margin-bottom: 4px; }
.result.ok { border-color: rgba(76, 195, 138, 0.6); background: var(--ok-soft); }
.result.ok h2 { color: var(--ok); }
.result.bad { border-color: rgba(239, 107, 107, 0.6); background: var(--bad-soft); }
.result.bad h2 { color: var(--bad); }
.result.info h2 { color: var(--gold); }
.result p:last-child { margin-bottom: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.tag { font: 700 0.7rem var(--mono); letter-spacing: 0.08em; color: var(--gold); border: 1px solid var(--gold); padding: 3px 7px; border-radius: 6px; }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 0.88rem var(--mono); margin: 4px 0 10px; }
.formula span:not(.plus) { background: var(--surface-2); border: 1px solid var(--line); padding: 5px 9px; border-radius: 8px; }
.formula .plus { color: var(--muted); }
.ticks { margin: 0; padding-left: 1.1rem; }
.ticks li { margin-bottom: 0.5rem; }
.ticks li::marker { color: var(--gold); }

.phrase-list {
  list-style: none; margin: 0 0 14px; padding: 0; counter-reset: w;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
}
@media (min-width: 560px) { .phrase-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) { .phrase-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.phrase-list li { counter-increment: w; font: 0.95rem var(--mono); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.phrase-list li::before { content: counter(w) "."; color: var(--muted); margin-right: 6px; font-size: 0.8rem; }

.candidate-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 260px; overflow-y: auto; }

.table-wrap { overflow-x: auto; margin: 0 -4px 12px; }
.bits { width: 100%; border-collapse: collapse; font: 0.85rem var(--mono); }
.bits th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.bits td { padding: 5px 4px; border-bottom: 1px solid #1a231f; white-space: nowrap; }
.bits .cs { color: var(--gold); font-weight: 700; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: var(--mono); word-break: break-all; }

.foot { color: var(--muted); font-size: 0.85rem; padding-top: 10px; padding-bottom: 32px; border-top: 1px solid var(--line); }
.foot p { margin: 8px 0 0; }

@media (min-width: 560px) {
  h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
