:root {
  --paper: #f4f1ea;
  --paper-2: #e8e3d8;
  --ink: #141414;
  --muted: #55524c;
  --line: #141414;
  --yes: #17804a;
  --no: #c2352b;
  --a: #1f5fbf;
  --b: #b4590d;
  --mark: #f2c230;
  --off: #9c988f;
  --font: 'Archivo', 'Arial Narrow', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.btn {
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 4px;
  padding: 0.6em 1.4em;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.btn:disabled { background: var(--off); border-color: var(--off); cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn:focus-visible, .field:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

.field {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  padding: 0.55em 0.7em;
  font-size: 1.15em;
}
.error { color: var(--no); font-weight: 700; min-height: 1.4em; }

/* ---------- HOST ---------- */
.host { min-height: 100vh; display: flex; flex-direction: column; }
.host-bar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.9rem 2rem;
  border-bottom: 3px solid var(--line);
  font-weight: 700;
}
.brand { font-weight: 900; font-size: 1.6rem; letter-spacing: -0.02em; }
.host-bar .spacer { flex: 1; }
.host-main { flex: 1; display: flex; flex-direction: column; padding: 2rem; gap: 1.5rem; }

.start { margin: auto; max-width: 40rem; display: grid; gap: 1.2rem; }
.start h1 { font-size: clamp(4rem, 12vw, 9rem); font-weight: 900; letter-spacing: -0.04em; line-height: 0.9; }
.start p { font-size: 1.4rem; color: var(--muted); }
.start .btn { justify-self: start; font-size: 1.4rem; }

.lobby { flex: 1; display: grid; grid-template-columns: minmax(18rem, 30rem) 1fr; gap: 3rem; }
.join-card { display: grid; gap: 1rem; align-content: start; }
.join-card img { width: 100%; aspect-ratio: 1; background: #fff; border: 3px solid var(--ink); padding: 0.6rem; }
.join-link { font-size: 1.3rem; font-weight: 700; word-break: break-all; }
.join-code { font-size: clamp(3rem, 7vw, 5.5rem); font-weight: 900; letter-spacing: 0.12em; line-height: 1; }
.label { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.roster { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.roster h2 { font-size: 2rem; font-weight: 900; }
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; align-content: flex-start; }
.chip {
  border: 2px solid var(--ink); border-radius: 4px; background: #fff;
  padding: 0.35em 0.8em; font-size: 1.3rem; font-weight: 700;
}
.chip.off { color: var(--off); border-color: var(--off); }
.chip:hover { background: var(--paper-2); }
.lobby-controls { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-top: auto; }
.lobby-controls label { display: grid; gap: 0.3rem; min-width: 18rem; }
.lobby-controls .btn { font-size: 1.4rem; }
.empty { color: var(--muted); font-size: 1.3rem; }

.q-head { display: flex; align-items: center; gap: 1.5rem; font-size: 1.4rem; font-weight: 800; }
.q-head .spacer { flex: 1; }
.timer {
  min-width: 4.5rem; height: 4.5rem; display: grid; place-items: center;
  border: 4px solid var(--ink); border-radius: 50%;
  font-size: 2rem; font-weight: 900;
}
.timer.reading { border-style: dashed; color: var(--muted); }
.q-text {
  font-size: clamp(2.2rem, 5vw, 4.6rem); font-weight: 800; line-height: 1.1;
  letter-spacing: -0.02em; max-width: 22ch;
}
.q-status { font-size: 1.4rem; color: var(--muted); font-weight: 700; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: auto; }
.opt {
  position: relative; color: #fff; border-radius: 4px;
  padding: 1.4rem 1.6rem; min-height: 9rem;
  display: flex; flex-direction: column; justify-content: center; gap: 0.4rem;
  transition: opacity 200ms ease-out;
}
.opt .sym { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.opt .txt { font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 800; }
.opt .count { position: absolute; right: 1.6rem; top: 50%; transform: translateY(-50%); font-size: 3.4rem; font-weight: 900; }
.opt.yes { background: var(--yes); }
.opt.no { background: var(--no); }
.opt.a { background: var(--a); }
.opt.b { background: var(--b); }
.opt.dim { opacity: 0.28; }
.opt.win { outline: 6px solid var(--mark); outline-offset: 4px; }
.opt .names { font-size: 1.15rem; font-weight: 600; opacity: 0.95; }
.opt .bar { position: absolute; left: 0; bottom: 0; height: 10px; background: rgba(255, 255, 255, 0.85); transition: width 600ms ease-out; }

.board h2, .end h2 { font-size: 3rem; font-weight: 900; letter-spacing: -0.02em; }
.rank-list { list-style: none; padding: 0; display: grid; gap: 0.6rem; max-width: 46rem; }
.rank-list li {
  display: grid; grid-template-columns: 3rem 1fr auto; align-items: baseline; gap: 1rem;
  border-bottom: 2px solid var(--ink); padding: 0.5rem 0; font-size: 2rem; font-weight: 800;
}
.rank-list .pos { color: var(--muted); }
.end { display: grid; gap: 2rem; }
.podium { display: flex; align-items: flex-end; gap: 1.2rem; }
.step { width: 14rem; display: grid; gap: 0.5rem; text-align: center; }
.step .who { font-size: 1.8rem; font-weight: 900; word-break: break-word; }
.step .score { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.step .block { background: var(--ink); color: var(--paper); font-size: 3rem; font-weight: 900; display: grid; place-items: center; border-radius: 4px 4px 0 0; }
.step.p1 .block { height: 13rem; background: var(--mark); color: var(--ink); }
.step.p2 .block { height: 9rem; }
.step.p3 .block { height: 6.5rem; }
.rest { columns: 2; max-width: 50rem; }
.rest li { font-size: 1.3rem; }
.footer-actions { display: flex; gap: 1rem; justify-content: flex-end; align-items: center; }
.footer-actions .hint { color: var(--muted); font-weight: 700; }
.thanks { font-size: clamp(3rem, 8vw, 6rem); font-weight: 900; letter-spacing: -0.03em; margin: auto 0; }

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .host-main { padding: 1rem; }
}

/* ---------- PEMAIN ---------- */
.play {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.play .top {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 1rem; font-weight: 800; font-size: 0.95rem; border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.play .top .me { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 1.5rem; gap: 0.8rem; }
.screen .big { font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; }
.screen .sub { font-size: 1.15rem; font-weight: 700; color: inherit; opacity: 0.85; }
.screen.wait { background: var(--paper); }
.screen.reading { background: var(--paper-2); color: var(--muted); }
.screen.yes { background: var(--yes); color: #fff; }
.screen.no { background: var(--no); color: #fff; }
.screen.a { background: var(--a); color: #fff; }
.screen.b { background: var(--b); color: #fff; }
.screen.ink { background: var(--ink); color: var(--paper); }

.join { width: min(26rem, 100%); display: grid; gap: 0.9rem; text-align: left; }
.join h1 { font-size: 3.2rem; font-weight: 900; letter-spacing: -0.03em; }
.join label { display: grid; gap: 0.3rem; font-weight: 800; }
.join .code { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 900; }
.join .btn { font-size: 1.3rem; padding: 0.75em; }

.pad { flex: 1; display: flex; flex-direction: column; }
.pad button {
  flex: 1; border: 0; color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.4rem; padding: 1rem;
}
.pad button:active { filter: brightness(0.88); }
.pad .sym { font-size: clamp(3rem, 16vmin, 6rem); font-weight: 900; line-height: 1; }
.pad .txt { font-size: clamp(1.5rem, 7vmin, 2.6rem); font-weight: 800; }
.pad .yes { background: var(--yes); }
.pad .no { background: var(--no); }
.pad .a { background: var(--a); }
.pad .b { background: var(--b); }
@media (orientation: landscape) { .pad { flex-direction: row; } }

/* upload soal di lobi */
.upload { display: grid; gap: 0.6rem; }
.upload-actions { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.link { color: var(--ink); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.upload-msg { list-style: none; padding: 0.7rem 1rem; border-left: 6px solid var(--ink); background: #fff; font-weight: 600; display: grid; gap: 0.2rem; }
.upload-msg li:first-child { font-weight: 800; }
.upload-msg.ok { border-color: var(--yes); }
.upload-msg.error { border-color: var(--no); }
.upload-msg.busy { color: var(--muted); }
