:root {
  --bg: #353535;
  --fg: #ffffff;
  --att: #00ffff;
  --err: #ff7070;
  --line: #8a8a8a;
  --draft: #ffcc66;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overscroll-behavior: none; }
body { font: 18px/1.5 Arial, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }

.page { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
h1, h2 { font-size: 1.4em; margin: 0 0 16px; }
fieldset { border: 0; margin: 0 0 20px; padding: 0; min-width: 0; }
legend { padding: 0 0 6px; font-weight: bold; }
label.opt, label.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: 22px; height: 22px; margin: 3px 0 0; flex: none; }
input[type=number], select { width: 100%; font: inherit; padding: 8px; border-radius: 6px; border: 1px solid var(--line); }
button { display: block; width: 100%; margin-top: 20px; padding: 14px; font: inherit; font-weight: bold;
  border: 0; border-radius: 8px; background: var(--fg); color: var(--bg); cursor: pointer; }
.hint { text-align: center; font-size: 0.85em; opacity: 0.75; }
.draft { color: var(--draft); font-weight: bold; }
/* The old-browser notice appears only if app.js has not replaced it after 8 s. */
.nojs { visibility: hidden; animation: reveal 0s 8s forwards; }
@keyframes reveal { to { visibility: visible; } }

.cat { color: var(--fg); }
.att { color: var(--att); }
.x { color: var(--err); font-weight: bold; }
.names { text-align: center; font-size: 1.2em; }
.counter { text-align: center; opacity: 0.8; }
.notice { font-weight: bold; }

/* Left/right are physical sides even though the page is RTL. */
.labels { display: flex; justify-content: space-between; align-items: flex-start; direction: ltr; gap: 12px; }
.label { direction: rtl; text-align: center; font-size: clamp(20px, 5vw, 28px); line-height: 1.3; min-width: 30%; }
.label .key { font-size: 15px; opacity: 0.75; }
.labels.preview { margin: 12px 0; }
.vs { align-self: center; opacity: 0.7; }

#stage { position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; padding: 16px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; }
/* min-height 0 lets the photo box shrink, so the tap zones stay on screen and in place in landscape. */
#stim { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; visibility: hidden; }
#stim img { width: 195px; max-width: 55vw; max-height: 100%; height: auto; object-fit: contain; }
#stim .word { color: var(--att); font-size: clamp(30px, 8vw, 40px); }
#err { flex: none; text-align: center; color: var(--err); font-size: 52px; line-height: 1; height: 56px; visibility: hidden; }
.zones { flex: none; display: flex; direction: ltr; gap: 12px; height: 26vh; min-height: 56px; margin-top: 8px; }
.zone { flex: 1; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line);
  border-radius: 12px; }
.zone:active { background: rgba(255, 255, 255, 0.12); }

@media (pointer: coarse) {
  #stim { align-items: flex-end; padding-bottom: 8px; }
}

@media (pointer: fine) {
  #stage { top: 24px; right: 24px; bottom: 24px; left: 24px; max-width: 900px; max-height: 700px; margin: auto;
    border: 3px solid var(--fg); }
}
