:root {
  --bg: #0e0e14;
  --surface: #191924;
  --surface-2: #22222f;
  --border: #32323f;
  --text: #f3f3f7;
  --muted: #9a9aab;
  --accent: #ff5c8a;
  --accent-2: #ffcf40;
  --ok: #2ecc71;
  --no: #e74c3c;
  --radius: 14px;
  --maxw: 480px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
body { display: flex; justify-content: center; }
.app { width: 100%; max-width: var(--maxw); min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 16px); }

.c-header { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.c-header .logo { font-weight: 800; letter-spacing: 2px; font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.c-header .meta { font-size: 12px; color: var(--muted); }

/* Ladder */
.ladder { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.rung { display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 15px; opacity: 0.6; }
.rung.active { opacity: 1; border-color: var(--accent); background: var(--surface-2); }
.rung .val { font-weight: 700; color: var(--accent-2); }

.screen { flex: 1; display: flex; flex-direction: column; }
.qnum { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.qnum b { color: var(--accent-2); }
.clue { font-size: 21px; font-weight: 600; line-height: 1.4; margin-bottom: 20px; }

.answer { width: 100%; padding: 15px; font-size: 17px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text); }
.answer:focus { outline: none; border-color: var(--accent); }
.answer:disabled { opacity: 0.7; }
.mic-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.feedback { margin-top: 14px; font-size: 15px; line-height: 1.4; min-height: 22px; }
.feedback.ok { color: var(--ok); }
.feedback.no { color: var(--no); }

.spacer { flex: 1; }

.btn { display: block; width: 100%; padding: 16px; border-radius: var(--radius); border: none;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 16px; color: #0e0e14;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: transform 0.05s; }
.btn:active { transform: scale(0.99); }

/* Center screens */
.center { flex: 1; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; gap: 10px; padding: 20px 6px; }
.center h1 { font-size: 40px; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tag { color: var(--muted); font-size: 15px; max-width: 320px; line-height: 1.5; }
.how { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 8px 0; width: 100%; font-size: 14px; color: var(--muted); }
.how .cat { font-size: 22px; font-weight: 800; color: var(--text); display: inline-block; margin: 6px 0 2px; }
.how .catblurb { font-size: 13px; }
.how2 { text-align: left; width: 100%; font-size: 14px; color: var(--muted); line-height: 1.7;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }

.bigscore { font-size: 54px; font-weight: 800; color: var(--accent-2); }
.sub { color: var(--muted); font-size: 15px; }
.grid { font-size: 28px; letter-spacing: 4px; margin: 8px 0; }
.recap { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; font-size: 14px; line-height: 1.9; }
.recap b { color: var(--text); }
.sharebox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; white-space: pre-wrap;
  width: 100%; text-align: left; line-height: 1.6; }
.foot { color: var(--muted); font-size: 11px; padding-top: 10px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 50; }
.toast.show { opacity: 1; }

/* API-driven UI additions */
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: default; }
.flagbtn {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; padding: 2px 8px; margin-left: 6px; color: var(--muted);
}
.flagbtn:disabled { opacity: 0.6; }
.answer + .answer { margin-top: 10px; }
