:root {
  --bg: #11151c;
  --panel: #1a202b;
  --panel2: #222a37;
  --text: #e8ecf2;
  --muted: #98a2b3;
  --accent: #f5b301;
  --ok: #2fbf71;
  --bad: #e5484d;
  --radius: 14px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; position: sticky; top: 0; background: var(--bg); z-index: 2;
  border-bottom: 1px solid var(--panel2);
}
.conn { color: var(--accent); font-size: 14px; }

main { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: var(--gap); }

h1 { font-size: 26px; margin: 8px 0 0; }
h2 { font-size: 20px; margin: 4px 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

.card { background: var(--panel); border-radius: var(--radius); padding: 16px; display: grid; gap: var(--gap); }

button, .btn {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 2px solid transparent; border-radius: var(--radius);
  padding: 14px 16px; min-height: 52px; cursor: pointer; text-align: left;
  touch-action: manipulation;
}
button:disabled { opacity: .55; cursor: default; }
.options button.right:disabled, .options button.wrong:disabled, .options button.chosen:disabled { opacity: 1; }
button.primary { background: var(--accent); color: #1a1300; font-weight: 700; text-align: center; }
button.big { min-height: 88px; font-size: 20px; font-weight: 700; text-align: center; }
button.link { background: none; padding: 4px 0; min-height: 0; color: var(--text); font-weight: 700; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.row { display: flex; gap: var(--gap); flex-wrap: wrap; }
.row > * { flex: 1 1 0; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 0; text-align: center; min-height: 46px; padding: 10px; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: #2b2614; }

label { display: grid; gap: 6px; font-size: 15px; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 2px solid var(--panel2); border-radius: 10px; padding: 12px; min-height: 50px; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
input.code { text-transform: uppercase; letter-spacing: .3em; font-size: 24px; text-align: center; }

.progress { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.question { font-size: 19px; font-weight: 600; }

.options { display: grid; gap: 10px; }
.options button { width: 100%; }
.options button.chosen { border-color: var(--accent); }
.options button.right { border-color: var(--ok); background: #143524; }
.options button.wrong { border-color: var(--bad); background: #3a1719; }

.feedback { border-left: 4px solid var(--muted); padding: 8px 12px; background: var(--panel2); border-radius: 8px; }
.feedback.ok { border-color: var(--ok); }
.feedback.bad { border-color: var(--bad); }
.source a { color: var(--accent); word-break: break-word; }

.timer { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.timer > div { height: 100%; background: var(--accent); width: 100%; transition: width .25s linear; }
.timer.low > div { background: var(--bad); }

.bigcode { font-size: 48px; font-weight: 800; letter-spacing: .25em; text-align: center; color: var(--accent); }

ul.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.list li { display: flex; justify-content: space-between; gap: 8px; background: var(--panel2); padding: 10px 12px; border-radius: 10px; }
ul.list li.me { outline: 2px solid var(--accent); }
.pill { font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }

.bar { height: 10px; background: var(--panel2); border-radius: 5px; overflow: hidden; }
.bar > div { height: 100%; background: var(--ok); }

.error { background: #3a1719; border: 1px solid var(--bad); padding: 10px 12px; border-radius: 10px; }

.sticky-bottom { position: sticky; bottom: 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -12px 12px var(--bg); }

@media (min-width: 700px) {
  body { font-size: 18px; }
}

/* road signs */
.signbox { display: flex; justify-content: center; padding: 8px 0; }
img.sign { max-width: 70%; max-height: 190px; height: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.card img.sign { max-height: 120px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 12px 8px; font-size: 15px; }
.tile img { width: 88px; height: 88px; object-fit: contain; }
