:root {
  --bg: #0d1117;
  --paper: #1a1b1e;
  --ink: #d4d4d8;
  --muted: #8b8d92;
  --line: #2e2f34;
  --black: #000000;
  --active: #f5b342;
  --word: #3a5a4a;
  --wrong: #b33d3d;
  --good: #3a8a3a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; touch-action: manipulation; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at top, #161b22 0, var(--bg) 55%, #090b10 100%);
  color: var(--ink);
  overflow-x: hidden;
}
button { font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
.shell {
  width: min(100vw, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.eyebrow { margin: 0 0 1px; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(2rem, 11vw, 3rem); line-height: .9; letter-spacing: -.08em; }
.batch-status { color: var(--muted); font-size: .82rem; text-align: right; }
.status {
  min-height: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(26,27,30,.85); color: var(--muted); text-align: center;
}
.board {
  width: min(calc(100vw - 28px), 390px);
  height: min(calc(100vw - 28px), 390px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  border: 3px solid var(--black);
  background: var(--black);
  gap: 2px;
  box-shadow: 0 14px 30px rgba(0,0,0,.5);
}
.cell {
  position: relative; border: 0; padding: 0; background: var(--paper); color: var(--ink);
  display: grid; place-items: center; font-weight: 800; font-size: clamp(1.6rem, 10vw, 2.7rem);
  text-transform: uppercase;
}
.cell.black { background: var(--black); color: transparent; pointer-events: none; }
.cell.in-word { background: var(--word); }
.cell.active { background: var(--active); outline: 3px solid #d09300; outline-offset: -3px; color: #000; }
.cell.bad { background: var(--wrong); }
.cell.good { background: var(--good); }
.num { position: absolute; top: 3px; left: 4px; font-size: .62rem; font-weight: 800; color: var(--muted); }
.clue-panel { display: grid; gap: 8px; }
.clue {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(26,27,30,.85); color: var(--ink); text-align: left; padding: 8px 10px;
}
.clue.active { border-color: #c49000; background: #3a3000; box-shadow: inset 4px 0 0 #f5b342; }
.clue .label { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions button {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 8px; background: var(--paper); color: var(--ink); font-weight: 700;
}
.actions button[hidden] { display: none; }
.keyboard { display: grid; gap: 7px; margin-top: auto; }
.key-row { display: flex; justify-content: center; gap: 6px; }
.key {
  min-width: 0; height: 43px; flex: 1 1 0; border: 0; border-radius: 10px; background: #2e2f34;
  color: var(--ink); font-weight: 800; font-size: 1rem;
}
.key.wide { flex: 1.65 1 0; font-size: .85rem; }
.empty-state {
  margin: auto 0; padding: 26px 16px; border-radius: 18px; background: rgba(26,27,30,.85);
  border: 1px solid var(--line); text-align: center; color: var(--muted);
}
.empty-state strong { display: block; color: var(--ink); font-size: 1.2rem; margin-bottom: 6px; }
@media (max-height: 720px) {
  .shell { gap: 8px; }
  .status { min-height: 1.9rem; padding: 6px 8px; }
  .clue { min-height: 40px; padding: 6px 9px; }
  .key { height: 38px; }
}
