:root {
  color-scheme: dark;
  --bg: #0e1116;
  --card: #171c24;
  --card-2: #1f2630;
  --line: #2c3543;
  --text: #e7edf5;
  --muted: #9aa7b8;
  --accent: #5ad2a4;
  --accent-2: #7fc4ff;
  --hit: #ffd166;
  --hit-bg: #4a3708;
  --sel: #2f6f5b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% 0%, #18202b 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: max(1rem, env(safe-area-inset-top)) 0 max(1rem, env(safe-area-inset-bottom));
}
main { width: min(46rem, 100%); margin: 0 auto; padding: 0 .875rem; }
header { text-align: center; margin-bottom: 1rem; }
h1 { font-size: clamp(1.7rem, 7vw, 2.6rem); margin: 0 0 .25rem; letter-spacing: -.02em; }
.lede { color: var(--muted); margin: 0; font-size: .95rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: .9rem;
  padding: .9rem 1rem 1rem; margin: 0 0 .9rem;
}
.card p { margin: 0 0 .6rem; font-size: .93rem; color: var(--muted); }
.card strong, .card em { color: var(--text); }
.pi-int, .pi-dot, .pi-first {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15em; font-weight: 700;
}
.pi-int { color: var(--accent-2); }
.pi-first { color: var(--hit); }
code {
  background: var(--card-2); padding: .1em .35em; border-radius: .3em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; color: var(--text);
}
.row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .5rem; }
.field { flex: 1 1 10rem; display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
input {
  width: 100%; min-height: 44px; padding: .55rem .7rem; font-size: 1rem;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: .5rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
input:focus-visible, button:focus-visible, .digits:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
button {
  min-height: 44px; padding: .5rem .95rem; cursor: pointer; font-size: .95rem;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: .5rem;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
#search-btn, #jump-btn, #game-start { background: var(--sel); border-color: var(--sel); }
.status { font-size: .85rem; color: var(--muted); min-height: 1.3em; margin: .25rem 0 0; }
.viewer { margin-top: .6rem; }
.viewer-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .82rem; color: var(--muted); margin-bottom: .35rem;
}
.nav { display: flex; gap: .4rem; }
.nav button { min-height: 36px; padding: .2rem .7rem; font-size: 1.1rem; line-height: 1; }
.digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(.95rem, 3.6vw, 1.2rem); line-height: 1.9;
  letter-spacing: .06em; word-break: break-all;
  background: #0b0f14; border: 1px solid var(--line); border-radius: .6rem;
  padding: .6rem .65rem; user-select: text; -webkit-user-select: text;
}
.digits .g { cursor: pointer; padding: .05em 0; border-radius: .15em; }
.digits .g.hit { background: var(--hit-bg); color: var(--hit); font-weight: 700; }
.digits .g.sel { background: var(--sel); color: #fff; }
.digits .g.hit.sel { background: var(--hit); color: #22160a; }
.digits .g.first::before {
  content: "①"; font-size: .6em; vertical-align: super; color: var(--muted); margin-right: .1em;
}
.hint { font-size: .78rem; margin: .35rem 0 .1rem !important; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.scoreline { display: flex; gap: 1.2rem; font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.scoreline strong { color: var(--accent); }
.game-prompt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem;
  letter-spacing: .18em; background: #0b0f14; border: 1px solid var(--line);
  border-radius: .6rem; padding: .7rem .8rem; margin-bottom: .6rem; min-height: 2.9rem;
  word-break: break-all;
}
.game-prompt.ok { color: var(--accent); }
.game-prompt.bad { color: #ff8a8a; }
footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: .5rem; }
footer p { margin: .4rem 0; }
.source { font-size: .75rem; line-height: 1.4; }
dialog { max-width: min(28rem, 90vw); border-radius: .75rem; border: 1px solid var(--line); background: var(--card); color: var(--text); }
