:root {
  --bg: #0b2a1c;
  --bg2: #0f3825;
  --card: #123f2a;
  --line: #1f5a3d;
  --fg: #eef6f0;
  --mut: #9fc2ad;
  --gold: #f5c84c;
  --green: #4ade80;
  --red: #f87171;
  --deep: #7dd3fc;
  --r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    repeating-linear-gradient(90deg, transparent 0 60px, rgba(255,255,255,.018) 60px 120px),
    radial-gradient(ellipse at top, #134a31, var(--bg) 60%);
  background-attachment: fixed;
  display: flex; flex-direction: column;
}
button, input, .btn { font: inherit; color: inherit; }
button, .btn {
  cursor: pointer; border: 1px solid var(--line); background: var(--bg2);
  border-radius: 10px; padding: .6em 1em; text-decoration: none; text-align: center;
}
button:hover, .btn:hover { border-color: var(--mut); }
button:focus-visible, input:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.primary { background: var(--gold); color: #1a1405; border-color: var(--gold); font-weight: 700; }
.primary:hover { filter: brightness(1.06); border-color: var(--gold); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 600px; width: 100%; margin: 0 auto; padding: 14px 16px;
}
.brand { border: 0; background: none; padding: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; }
.brand b { color: var(--gold); }
.top nav { display: flex; gap: 8px; }
.top nav button { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

main { max-width: 600px; width: 100%; margin: 0 auto; padding: 0 16px 24px; flex: 1; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg2); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.modes button { border: 0; background: none; border-radius: 9px; padding: .55em; color: var(--mut); }
.modes button[aria-selected="true"] { background: var(--card); color: var(--fg); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button { padding: .3em .8em; border-radius: 99px; font-size: .9rem; color: var(--mut); }
.chips button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.banner { margin-top: 10px; padding: .6em 1em; border-radius: 10px; background: rgba(245,200,76,.12); border: 1px solid rgba(245,200,76,.35); font-size: .95rem; }
.banner b { color: var(--gold); }

.card { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.meta { display: flex; justify-content: space-between; align-items: baseline; color: var(--mut); font-size: .9rem; }
.total { color: var(--gold); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.clock { height: 6px; background: var(--bg); border-radius: 99px; margin: 12px 0 4px; overflow: hidden; }
.clock i { display: block; height: 100%; width: 100%; background: var(--green); border-radius: 99px; transition: width .2s linear; }
.clock i.low { background: var(--red); }

.kind { margin: 14px 0 2px; color: var(--mut); font-size: .85rem; }
.q { margin: 0 0 16px; font-size: 1.35rem; line-height: 1.35; }

.combo { position: relative; }
.combo input {
  width: 100%; padding: .8em 1em; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-size: 1.05rem;
}
.combo input::placeholder { color: #6f957f; }
#sugg {
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #0d3121; border: 1px solid var(--line); border-radius: 10px;
  max-height: 260px; overflow: auto;
}
#sugg li { padding: .5em .7em; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
#sugg li small { color: var(--mut); }
#sugg li:hover, #sugg li[aria-selected="true"] { background: var(--line); }

.row { display: flex; gap: 8px; margin-top: 10px; }
.row > * { flex: 1; }
.wide { width: 100%; margin-top: 14px; }

.tries { display: flex; gap: 6px; margin-top: 12px; }
.tries i { width: 26px; height: 6px; border-radius: 99px; background: var(--bg); }
.tries i.on { background: var(--gold); }
.msg { min-height: 1.5em; margin: 8px 0 0; color: var(--mut); font-size: .95rem; }

.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } .clock i { transition: none; } }

.pick { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0; padding: 14px 16px; border-radius: 12px; font-size: 1.1rem; font-weight: 700; }
.pick small { display: block; font-weight: 400; color: var(--mut); font-size: .85rem; }
.pick b { font-size: 1.3rem; }
.pick.deep { background: rgba(125,211,252,.14); border: 1px solid rgba(125,211,252,.45); }
.pick.solid { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.4); }
.pick.obvious { background: rgba(245,200,76,.12); border: 1px solid rgba(245,200,76,.4); }
.pick.zero { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.4); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cols h2 { margin: 0 0 6px; font-size: .8rem; color: var(--mut); font-weight: 600; }
.cols ol, .all, .review, .archive { list-style: none; margin: 0; padding: 0; }
.cols li, .all li, .review li {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.cols li small, .all li small, .review li small { display: block; color: var(--mut); font-size: .78rem; }
.cols li b, .all li b, .review li b { white-space: nowrap; font-variant-numeric: tabular-nums; }
li.mine { color: var(--gold); font-weight: 700; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--mut); font-size: .9rem; }
.all { margin-top: 6px; max-height: 320px; overflow: auto; }

#end { text-align: center; }
.endlabel { margin: 0; color: var(--mut); }
.big { font-size: 3rem; font-weight: 900; color: var(--gold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; margin-top: 8px; padding: .3em 1em; border-radius: 99px; background: var(--gold); color: #1a1405; font-weight: 800; }
.grid { font-size: 1.8rem; letter-spacing: .1em; margin: 12px 0; }
.review { text-align: left; margin-bottom: 8px; }
.challenge input { flex: 1.2; padding: .6em 1em; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); min-width: 0; }
.next { color: var(--mut); font-variant-numeric: tabular-nums; margin: 6px 0 0; }


dialog {
  width: min(92vw, 460px); border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--fg); padding: 20px; position: relative;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 12px; }
.x { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 1.2rem; }
.how { padding-left: 1.2em; margin: 0 0 12px; }
.how li { margin: 6px 0; }
.how strong { color: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .9rem; color: var(--mut); margin-bottom: 14px; }
.switch { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--gold); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.stats div { background: var(--bg2); border-radius: 10px; padding: 10px; text-align: center; }
.stats dt { color: var(--mut); font-size: .8rem; }
.stats dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 800; }
.archive { max-height: 60vh; overflow: auto; }
.archive button { width: 100%; display: flex; justify-content: space-between; margin-bottom: 6px; text-align: left; }
.archive small { margin-left: 10px; color: var(--mut); }

@media (max-width: 420px) {
  .q { font-size: 1.18rem; }
  .cols { grid-template-columns: 1fr; }
  .big { font-size: 2.5rem; }
}
