/* seed-crossword — base + dark mode. */

:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e0e0d8;
  --grid-line: #1a1a1a;
  --cell-bg: #ffffff;
  --cell-bg-active-entry: #fff7c2;
  --cell-bg-active-cell: #ffd966;
  --cell-bg-black: #1a1a1a;
  --cell-fg: #1a1a1a;
  --accent: #2a6df4;
  --clue-bg: #f1f1ed;
  --clue-active-bg: #fff7c2;
  --btn-bg: transparent;
  --btn-bg-hover: #e8e8e0;
  --max-grid-px: 560px;
}

:root[data-theme="dark"] {
  --bg: #0f0f10;
  --fg: #ececec;
  --muted: #8a8a8a;
  --border: #2b2b2c;
  --grid-line: #b0b0b0;
  --cell-bg: #1d1d1f;
  --cell-bg-active-entry: #3a3318;
  --cell-bg-active-cell: #6c5b22;
  --cell-bg-black: #050506;
  --cell-fg: #f0f0f0;
  --accent: #6aa3ff;
  --clue-bg: #1d1d1f;
  --clue-active-bg: #3a3318;
  --btn-bg: transparent;
  --btn-bg-hover: #2b2b2c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  transition: background 120ms ease, color 120ms ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 4ch;
  text-align: right;
}
.status {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 1em;
}
.icon-btn {
  background: var(--btn-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--btn-bg-hover); }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, var(--max-grid-px)) minmax(260px, 1fr);
  gap: 24px;
  padding: 24px 20px;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .topbar { padding: 10px 12px; }
  .timer { display: none; }   /* save space; timer still ticks in title */
}

.grid-pane { display: flex; flex-direction: column; gap: 12px; }
.grid {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  background: var(--grid-line);
  gap: 1px;
  border: 2px solid var(--grid-line);
  user-select: none;
}
.cell {
  position: relative;
  background: var(--cell-bg);
  color: var(--cell-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4vw, 28px);
  font-weight: 600;
  cursor: pointer;
  caret-color: transparent;
  outline: none;
}
.cell.black { background: var(--cell-bg-black); cursor: default; }
.cell.active-entry { background: var(--cell-bg-active-entry); }
.cell.active-cell { background: var(--cell-bg-active-cell); }
.cell .num {
  position: absolute;
  top: 1px; left: 2px;
  font-size: clamp(8px, 1.6vw, 11px);
  font-weight: 500;
  color: var(--muted);
  pointer-events: none;
}
.cell .letter { line-height: 1; pointer-events: none; }

.active-clue {
  background: var(--clue-active-bg);
  color: var(--fg);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.95rem;
  min-height: 1.4em;
}
.active-clue .label {
  color: var(--muted);
  margin-right: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.clues-pane { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .clues-pane { grid-template-columns: 1fr; } }

.clue-list h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.clue-list ol { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; line-height: 1.4; }
.clue-list li {
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  gap: 8px;
}
.clue-list li:hover { background: var(--clue-bg); }
.clue-list li.active { background: var(--clue-active-bg); }
.clue-list li .num { color: var(--muted); font-weight: 500; min-width: 1.6em; flex-shrink: 0; }


/* Score display in topbar */
.score {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
  min-width: 3ch;
  text-align: right;
}
.score::before { content: "★ "; opacity: 0.6; }
@media (max-width: 760px) { .score { display: none; } }

/* BIP-39 entry marker in clue lists */
.clue-list li.bip39 .num::after {
  content: "·";
  color: var(--accent);
  margin-left: 2px;
  font-weight: 700;
}

/* Strike through clue text once the entry is correctly filled in. */
.clue-list li.solved .text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  color: var(--muted);
}

/* Hidden input that summons the on-screen keyboard on touch devices when a cell is tapped.
   Off-screen but still a real, focusable <input> — iOS Safari only opens the soft keyboard
   for input/textarea elements. font-size:16px prevents iOS from zooming the viewport on focus. */
#mobile-input {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 16px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}
