/* Student (phone) view */
body.student { min-height: 100vh; min-height: 100dvh; background: linear-gradient(180deg, var(--bg2), var(--bg) 220px); }
.s-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.s-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.s-title { font-weight: 700; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-conn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 600; padding: 6px; flex: none; }
.s-main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(120px + env(safe-area-inset-bottom)); }

/* join + lobby */
.join { margin-top: 8vh; text-align: center; }
.join .virion { width: 72px; height: 72px; margin: 0 auto 8px; display: block; animation: drift 6s ease-in-out infinite; }
.join h1 { font-size: 1.7rem; margin: .2em 0 .1em; letter-spacing: -.01em; }
.join p { margin: .3em 0 1.4em; }
.join form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0 auto; }
.code-input { text-align: center; font-size: 1.8rem; letter-spacing: .25em; font-weight: 800; text-transform: uppercase; font-family: var(--mono); min-height: 64px; }
.err { color: var(--bad); font-weight: 600; min-height: 1.4em; }
@keyframes drift { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(14deg); } }
.lobby { text-align: center; padding-top: 6vh; }
.lobby h2 { font-size: 1.5rem; margin: .4em 0 .2em; }
.nick { display: flex; gap: 8px; max-width: 380px; margin: 26px auto 0; }
.nick .input { flex: 1; }
.dots-wait { display: inline-flex; gap: 6px; margin-top: 18px; }
.dots-wait i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); opacity: .3; animation: blink 1.4s infinite; }
.dots-wait i:nth-child(2) { animation-delay: .2s; } .dots-wait i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .25; transform: scale(.9); } 40% { opacity: 1; transform: scale(1.1); } }

/* question */
.q-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 2px 10px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.q-prompt { font-size: 1.28rem; font-weight: 700; line-height: 1.3; margin: 0 2px 16px; letter-spacing: -.005em; overflow-wrap: anywhere; }
.q-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; display: block; background: #fff; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 12px 14px; text-align: left; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); font-size: 1.04rem; font-weight: 600; line-height: 1.3; transition: border-color .15s, background .15s, transform .08s, opacity .2s; }
.opt:active:not(:disabled) { transform: scale(.985); }
.opt-key { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); color: var(--muted); font-weight: 800; font-size: .95rem; transition: background .15s, color .15s; }
.opt-text { flex: 1; overflow-wrap: anywhere; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .opt-key { background: var(--accent); color: #fff; }
.opt:disabled { cursor: default; }
.closed .opt:not(.sel) { opacity: .6; }
.opt.correct, .closed .opt.correct { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.opt.correct .opt-key { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.opt.wrong .opt-key { background: var(--bad); color: #fff; }
.multi .opt-key { border-radius: 8px; }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf .opt { flex-direction: column; justify-content: center; min-height: 130px; text-align: center; font-size: 1.3rem; }
.tf .opt-key { width: 46px; height: 46px; font-size: 1.4rem; }
.tf .opt-text { flex: none; }
.scale { display: flex; gap: 8px; }
.scale .opt { flex: 1; justify-content: center; padding: 0; min-height: 64px; font-size: 1.35rem; font-weight: 800; }
.scale-labels { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.scale-labels span:last-child { text-align: right; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; min-height: 52px; font-size: 1.05rem; }

/* estimate */
.est { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 16px; }
.est-val { text-align: center; font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.est-val small { font-size: 1rem; color: var(--muted); font-weight: 600; margin-left: .3em; }
.est-hint { text-align: center; color: var(--muted); font-size: .9rem; margin: 2px 0 10px; }
.est input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }
.est-ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); font-weight: 600; }
.est-num { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.est-num .input { flex: 1; text-align: center; font-weight: 700; }

/* order */
.order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ord { display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 6px 6px 6px 0; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; font-weight: 600; transition: border-color .15s, background .15s, box-shadow .15s; position: relative; user-select: none; -webkit-user-select: none; }
.ord.dragging { z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.25); border-color: var(--accent); transition: none; }
.ord-grip { flex: none; width: 46px; align-self: stretch; display: grid; place-items: center; color: var(--faint); touch-action: none; cursor: grab; font-size: 1.3rem; }
.ord-num { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--panel2); display: grid; place-items: center; font-size: .85rem; color: var(--muted); font-weight: 800; }
.ord-text { flex: 1; overflow-wrap: anywhere; line-height: 1.25; padding: 4px 2px; }
.ord-btns { display: flex; flex-direction: column; gap: 2px; flex: none; }
.ord-btns button { width: 40px; height: 26px; border: 1px solid var(--line); background: var(--panel2); border-radius: 7px; color: var(--muted); font-size: .8rem; padding: 0; }
.ord.ok { border-color: var(--good); background: var(--good-soft); }
.ord.no { border-color: var(--bad); background: var(--bad-soft); }
.ord-fix { font-size: .8rem; color: var(--bad); font-weight: 700; flex: none; padding-right: 8px; }

/* hotspot */
.hot { position: relative; width: 100%; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #fff; touch-action: manipulation; cursor: crosshair; }
.hot img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.marker { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #fff; background: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(0,0,0,.35); pointer-events: none; animation: pop .25s ease-out; }
.marker.hit { background: var(--good); box-shadow: 0 0 0 2px var(--good), 0 4px 12px rgba(0,0,0,.35); }
.marker.miss { background: var(--bad); box-shadow: 0 0 0 2px var(--bad), 0 4px 12px rgba(0,0,0,.35); }
.region { position: absolute; border: 3px dashed var(--good); border-radius: 50%; background: rgba(61,220,151,.18); pointer-events: none; animation: pop .35s ease-out; }
.region.rect { border-radius: 8px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hint { color: var(--muted); font-size: .9rem; margin-top: 8px; text-align: center; }

/* word cloud entry */
.wc-form { display: flex; gap: 8px; }
.wc-form .input { flex: 1; }
.wc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; min-height: 40px; }
.wc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-weight: 700; border: 1px solid transparent; animation: pop .2s ease-out; max-width: 100%; }
.wc-chip span { overflow-wrap: anywhere; }
.wc-chip button { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); font-size: 1.1rem; flex: none; }
.wc-chip.hl { background: var(--good-soft); border-color: var(--good); }
.wc-count { font-size: .85rem; color: var(--muted); margin-top: 6px; font-weight: 600; }

/* open Q&A */
.qa-form textarea { width: 100%; min-height: 92px; resize: vertical; }
.qa-list { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 8px; }
.qa-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.qa-item.answered { opacity: .6; }
.qa-vote { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); font-weight: 800; color: var(--muted); padding: 2px 0; }
.qa-vote.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.qa-vote .arrow { font-size: .8rem; line-height: 1; }
.qa-text { flex: 1; overflow-wrap: anywhere; padding-top: 4px; }
.qa-tags { display: flex; gap: 6px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 18px; }

/* feedback after reveal */
.fb { margin-top: 18px; padding: 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); animation: slideup .35s ease-out; }
.fb.good { border-color: var(--good); background: var(--good-soft); }
.fb.bad { border-color: var(--bad); background: var(--bad-soft); }
.fb-head { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; }
.fb-head .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--muted); flex: none; font-size: 1.1rem; }
.fb.good .fb-head .ic { background: var(--good); }
.fb.bad .fb-head .ic { background: var(--bad); }
.fb-detail { margin-top: 8px; font-weight: 600; }
.fb-expl { margin-top: 10px; line-height: 1.5; color: var(--text); }
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* summary */
.score { text-align: center; padding: 28px 18px; }
.score .big { font-size: 3.4rem; font-weight: 900; letter-spacing: -.03em; }
.ring { width: 160px; height: 160px; margin: 0 auto 6px; }

/* answer-received pill */
.ack { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 700; font-size: .93rem; z-index: 50; max-width: calc(100vw - 32px); }
.ack .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--muted); flex: none; }
.ack.ok .ic { background: var(--good); animation: pop .3s ease-out; }
.ack.warn .ic { background: var(--warn); }
.ack.bad .ic { background: var(--bad); }
.ack small { display: block; font-weight: 600; color: var(--muted); font-size: .78rem; }
.spin { width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- emoji "gut check" scale ---------- */
.emoji-scale { display: flex; gap: 6px; }
.emoji-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 108px; padding: 14px 4px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); transition: border-color .15s, background .15s, transform .08s; }
.emoji-opt:active:not(:disabled) { transform: scale(.96); }
.emoji-face { font-size: 3rem; line-height: 1.1; }
.emoji-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; }
.emoji-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.emoji-opt.sel .emoji-label { color: var(--accent); }
.emoji-opt:disabled { cursor: default; }

/* ---------- size comparison ---------- */
.sizer { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.sizer-scene { display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; min-height: 200px; padding: 8px 0 4px; }
.sz-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.sz-box { display: grid; place-items: center; min-height: 176px; align-content: end; }
.sz-box.tgt { touch-action: none; cursor: ns-resize; }
.sz-cap { font-size: .82rem; font-weight: 700; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.sz-read { text-align: center; font-size: 1.25rem; font-weight: 800; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.sizer input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }
.glyph { display: block; }
.glyph .g-stroke { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round; }
.glyph .g-fill { fill: var(--accent); }
.glyph .g-hinge { fill: var(--panel); }
.glyph.molecule .g-fill.mol { fill: var(--muted); }
.glyph.molecule .g-hinge { fill: var(--panel); }

/* ---------- private collector ---------- */
.collect { display: flex; flex-direction: column; gap: 14px; }
.collect-field { display: flex; flex-direction: column; gap: 6px; }
.collect-label { font-weight: 700; font-size: .98rem; }
.collect textarea.input { resize: vertical; }

/* ---------- lobby note ---------- */
.lobby-note-s { margin: 12px auto 4px; max-width: 32ch; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent); font-size: .95rem; font-weight: 600; line-height: 1.35; }
