* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --line: #2a2f3a;
  --fg: #e6e8ec;
  --muted: #8b93a1;
  --accent: #4f8cff;
  --accent-dim: #25406e;
  --good: #3fb950;
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; /* no scroll: everything fits one screen */
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: #ff6b6b; min-height: 1.2em; margin-top: 8px; }

/* ---- Overlays (welcome / done) ---- */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 10; padding: 20px;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px; max-width: 560px; width: 100%;
}
.card h1 { font-size: 22px; margin-bottom: 14px; }
.card p { margin-bottom: 12px; line-height: 1.5; }
.legend { list-style: none; margin: 14px 0; display: grid; gap: 8px; }
.legend li { color: var(--muted); }
/* ---- Consent / disclosure ---- */
.consent {
  margin: 16px 0; padding: 14px 16px;
  max-height: 30vh; overflow-y: auto;
  background: #0c0e12; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; line-height: 1.5;
}
.consent h2 { font-size: 14px; margin-bottom: 8px; }
.consent p { margin-bottom: 8px; }
.consent ul { margin: 0 0 6px 18px; display: grid; gap: 6px; }
.consent li { color: var(--fg); }
#consent-check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 14px; cursor: pointer; margin-bottom: 12px;
}
#consent-check input { margin-top: 3px; width: 16px; height: 16px; cursor: pointer; }
.email-row { display: flex; gap: 10px; }
.email-row input { flex: 1; }
#email-form { margin-top: 18px; }
#email {
  flex: 1; padding: 12px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #0c0e12; color: var(--fg); font-size: 15px;
}
button {
  padding: 12px 20px; border: none; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: white; font-size: 15px; font-weight: 600;
}
button:disabled { background: var(--accent-dim); color: #9fb3d6; cursor: not-allowed; }

kbd {
  background: #0c0e12; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 7px; font-family: ui-monospace, monospace; font-size: 12px;
}

/* ---- App layout: header / stage / controls stacked to full height ---- */
#app { display: flex; flex-direction: column; height: 100vh; }

#topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
  flex: 0 0 auto; font-size: 14px;
}
.stat { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stat.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.hints { margin-left: auto; }
.bar { width: 140px; height: 7px; background: #0c0e12; border-radius: 4px; overflow: hidden; }
#progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

#stage {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 18px;
}
.imgwrap {
  position: relative; min-height: 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.imgwrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.imglabel {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.6); padding: 3px 9px; border-radius: 6px;
  font-size: 12px; color: var(--muted);
}

#controls {
  flex: 0 0 auto; padding: 12px 18px 16px;
  border-top: 1px solid var(--line); background: var(--panel);
  display: flex; align-items: center; gap: 14px;
}
#options { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.option {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 18px; border: 1px solid var(--line); border-radius: 10px;
  background: #0c0e12; cursor: pointer; font-size: 16px; user-select: none;
}
.option .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px; background: var(--line);
  font-size: 12px; font-family: ui-monospace, monospace;
}
.option.selected { border-color: var(--accent); background: var(--accent-dim); }
.option.selected .num { background: var(--accent); color: white; }
#next-btn { flex: 0 0 auto; }
