:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b1d22;
  --muted: #6b7280;
  --line: #e6e8ec;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --ally: #2f9e44;
  --rival: #e03131;
  --unsure: #adb5bd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 460px; margin: 0 auto; padding: 24px 18px 48px; min-height: 100vh; }
.screen { display: none; animation: fade .2s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.brand { font-size: 2rem; font-weight: 700; letter-spacing: .14em; text-align: center; margin: 12px 0 2px; text-transform: uppercase; }
.tagline { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: .95rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); margin: 0 0 6px; font-weight: 600; }

input, button { width: 100%; font-size: 1rem; border-radius: var(--radius); }
input {
  padding: 14px; margin: 8px 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
input:focus { outline: none; border-color: var(--accent); }
button { padding: 14px; margin: 8px 0; border: none; cursor: pointer; font-weight: 600; transition: opacity .15s, background .15s; }
button:active { opacity: .75; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.lang-switch { display: flex; gap: 8px; justify-content: center; margin: 0 0 12px; }
.lang-opt { width: auto; flex: 1; padding: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.lang-opt.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.avatars { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.avatars span { font-size: 1.7rem; padding: 8px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; line-height: 1; }
.avatars span.sel { border-color: var(--accent); background: #eef1fe; }

.divider { text-align: center; color: var(--muted); font-size: .85rem; margin: 18px 0 4px; }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: .2em; text-align: center; }
.join-row button { width: auto; flex: 0 0 auto; padding: 14px 20px; background: var(--surface); border: 1px solid var(--line); }

.code-big { text-align: center; font-size: 2.6rem; letter-spacing: .3em; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.qr-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.qr-wrap #qr { background: #fff; padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow); line-height: 0; }
.qr-wrap #qr img, .qr-wrap #qr canvas { display: block; }

.roster { list-style: none; padding: 0; margin: 16px 0; }
.roster li { background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--radius); margin: 8px 0; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); }
.slider-label { display: block; color: var(--muted); font-size: .9rem; margin: 12px 0 4px; }
.slider-label input { margin-top: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); margin: 12px 0; box-shadow: var(--shadow); }
.card.probe { border-color: #dfe3ee; background: #f9faff; }
.card summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.world-name { font-size: 1.25rem; font-weight: 700; margin: 4px 0; }
.world-desc { color: var(--muted); font-style: italic; margin: 6px 0 12px; }
.meta { margin: 6px 0; font-size: .95rem; }
.meta-label { color: var(--muted); font-weight: 600; }
.code-q { font-weight: 600; margin: 8px 0 2px; }
.code-a { color: var(--accent); margin: 0; }

.timer { font-size: 3rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; margin: 8px 0 16px; }
.hint { color: var(--muted); font-size: .85rem; text-align: center; }
.error { color: var(--rival); text-align: center; min-height: 1.2em; }
.hidden { display: none !important; }

#map-grid .row { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); margin: 8px 0; box-shadow: var(--shadow); }
#map-grid .who { flex: 1; font-weight: 600; }
#map-grid .opt { width: auto; flex: 0 0 auto; padding: 8px 12px; background: #f1f3f5; color: var(--ink); font-size: .82rem; border: 1px solid var(--line); }
#map-grid .opt.sel-ally { background: var(--ally); color: #fff; border-color: var(--ally); }
#map-grid .opt.sel-rival { background: var(--rival); color: #fff; border-color: var(--rival); }
#map-grid .opt.sel-unsure { background: var(--unsure); color: #fff; border-color: var(--unsure); }

#reveal-headline { text-align: center; font-size: 1.4rem; margin: 8px 0 16px; }
.result-line { background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--radius); margin: 8px 0; box-shadow: var(--shadow); }
.result-line .who { font-weight: 700; }
.result-line .sub { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.mvp { color: #b08900; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem; box-shadow: var(--shadow); z-index: 10; }
