/* Phone (portrait). Placeholder layout until F7 visuals. */

.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }

.phone-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.5rem 16px;
  text-align: center;
}

.phone-title[data-logo] img { width: min(86vw, 400px); }

.join-form { width: 100%; display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.join-form label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 700; color: var(--c-parchment); }
.join-form input {
  font: 700 1.5rem var(--font-body);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: var(--line) solid var(--c-ink);
  background: var(--c-bone);
  color: var(--c-ink);
  width: 100%;
}
.join-form input:focus { outline: none; box-shadow: var(--glow); }
#in-code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; }
.form-error { min-height: 1.4em; margin: 0; color: var(--c-blood); font-weight: 700; text-align: center; }
.btn-wide { width: 100%; font-size: 1.5rem; padding: 0.8rem; }

.avatar-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.av-pick {
  aspect-ratio: 1;
  padding: 4px;
  background: var(--c-plum);
  border: 4px solid var(--c-ink);
  border-radius: 14px;
  cursor: pointer;
}
.av-pick .avatar-img { width: 100%; height: 100%; display: block; }
.av-pick:disabled { opacity: 0.25; filter: grayscale(1); cursor: not-allowed; }
.av-pick.mine { border-color: var(--c-toxic); box-shadow: var(--glow); }

.nick-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.nick-pick {
  padding: 0.7rem 0.4rem;
  background: var(--c-plum);
  color: var(--c-bone);
  border: 4px solid var(--c-ink);
  border-radius: 14px;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}
.nick-pick:disabled { opacity: 0.25; cursor: not-allowed; text-decoration: line-through; }

.me-avatar { width: min(55vw, 220px); aspect-ratio: 1; }
.me-avatar .avatar-img { width: 100%; height: 100%; display: block; }
.me-name { margin: 0; font-size: 1.75rem; font-weight: 900; }
.btn-ghost { background: transparent; font-size: 1rem; padding: 0.4rem 1rem; border-width: 3px; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  background: color-mix(in srgb, var(--c-midnight) 92%, transparent);
  z-index: 50;
}

/* ---- Answering ---- */
.phone-question { justify-content: flex-start; padding-top: 1.25rem; }
.q-meta { margin: 0; font-weight: 800; color: var(--c-parchment); }
.pq-prompt { margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.3; color: var(--c-bone); }
.pq-prompt .blank { display: inline-block; min-width: 3em; border-bottom: 4px solid var(--c-lantern); margin: 0 0.15em; text-align: center; color: var(--c-lantern); }
.pq-wait { margin: 0; text-align: center; color: var(--c-parchment); }
.answer-area { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 1rem; justify-content: center; }
.answer-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.ans {
  display: flex; align-items: center; gap: 0.75rem;
  min-height: 4.25rem; padding: 0.6rem 0.9rem;
  border: var(--line) solid var(--c-ink); border-radius: 16px;
  color: var(--c-bone); text-align: left; cursor: pointer;
  font: 800 1.15rem var(--font-body);
  box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--c-ink) 35%, transparent);
}
.ans:active { transform: translateY(2px); }
.ans.picked { outline: 5px solid var(--c-bone); outline-offset: -11px; box-shadow: var(--glow); }
.ans-letter {
  flex: 0 0 auto; width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--c-ink); color: var(--c-bone); font-weight: 900;
}
.ans-text { text-shadow: 0 2px 0 var(--c-ink); }
.seal-bg-blue { background: var(--c-seal-blue); }
.seal-bg-orange { background: var(--c-seal-orange); }
.seal-bg-green { background: var(--c-seal-green); }
.seal-bg-red { background: var(--c-seal-red); }

.type-form { display: flex; flex-direction: column; gap: 0.9rem; }
.type-in {
  font: 700 1.5rem var(--font-body); padding: 0.7rem 0.9rem; width: 100%;
  border-radius: 12px; border: var(--line) solid var(--c-ink); background: var(--c-bone); color: var(--c-ink);
}
.type-in:focus { outline: none; box-shadow: var(--glow); }

.timer { width: 100%; height: 16px; border: 4px solid var(--c-lantern); border-radius: 999px; background: var(--c-ink); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--c-toxic); box-shadow: var(--glow); }
.timer-fill.danger { background: var(--c-blood); }

/* ---- Result / waiting ---- */
.me-avatar.small { width: min(35vw, 140px); }
.me-score { margin: 0; font-weight: 800; color: var(--c-lantern); }
.res-title { font-size: 2.25rem; }
.res-detail { margin: 0; font-size: 1.25rem; font-weight: 700; }
body.is-ghost { background: color-mix(in srgb, var(--c-midnight) 85%, var(--c-toxic)); }

/* ---- Detention ---- */
.phone-detention { justify-content: flex-start; padding-top: 1.5rem; }
.det-area { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 1rem; align-items: center; text-align: center; }
.det-area .timer { margin-top: auto; }
.det-you { font-weight: 900; color: var(--c-toxic); font-size: 1.25rem; }
.verb { margin: 0.5rem 0; font-size: 3rem; font-weight: 900; color: var(--c-lantern); }
.pick-grid { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; }
.pick {
  aspect-ratio: 1; font: 900 1.5rem var(--font-body); color: var(--c-ink);
  background: var(--c-parchment); border: 4px solid var(--c-ink); border-radius: 14px; cursor: pointer; position: relative;
}
.pick.cake { border-radius: 50% 50% 12px 12px; }
.pick.line { background: var(--c-bone); border-radius: 6px; }
.pick.chosen { box-shadow: var(--glow); border-color: var(--c-toxic); }
.pick:disabled:not(.chosen) { opacity: 0.45; }
.pick.struck::after { content: ''; position: absolute; left: 10%; right: 10%; top: 50%; height: 4px; background: var(--c-ink); transform: rotate(-10deg); }
.vote-grid { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.vote {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem;
  background: var(--c-plum); color: var(--c-bone); border: 4px solid var(--c-ink); border-radius: 14px;
  font: 800 1.1rem var(--font-body); cursor: pointer;
}
.vote .avatar { width: 72px; aspect-ratio: 1; }
.vote .avatar .avatar-img { width: 100%; height: 100%; }
.res-dead { color: var(--c-blood); font-size: 2.25rem; }
.res-alive { color: var(--c-toxic); font-size: 2.25rem; }

/* ---- Escape ---- */
.phone-escape { justify-content: flex-start; padding-top: 0.75rem; gap: 0.75rem; }
.esc-area { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; text-align: center; }
.corridor-wrap { width: 100%; aspect-ratio: 4 / 3; max-height: 34vh; border: 4px solid var(--c-ink); border-radius: 16px; overflow: hidden; }
.corridor { position: relative; width: 100%; height: 100%; background: var(--c-ink); }
.cor-view { width: 100%; height: 100%; object-fit: cover; display: block; }
.corridor.behind .cor-view { filter: brightness(0.7) saturate(0.8); }
.cor-mirror { position: absolute; top: 8px; right: 8px; width: 30%; aspect-ratio: 1; border: 4px solid var(--c-blood); border-radius: 50%; overflow: hidden; background: var(--c-ink); box-shadow: 0 0 14px var(--c-blood); animation: mirror-pulse 0.6s ease-in-out infinite alternate; }
@keyframes mirror-pulse { from { box-shadow: 0 0 6px var(--c-blood); } to { box-shadow: 0 0 18px var(--c-blood); } }
.cor-mirror img { width: 100%; height: 100%; object-fit: cover; display: block; }
.esc-where { margin: 0; font-weight: 800; color: var(--c-lantern); }
.esc-body { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 0.75rem; justify-content: center; }
.esc-body .timer { margin-top: auto; }
.esc-body h2 { margin: 0; }
.btn-shortcut { background: var(--c-lantern); color: var(--c-ink); border-color: var(--c-ink); }
.sc-prompt { margin: 0; font-size: 1.4rem; font-weight: 800; }
.caught-screen { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; }
body:has(.caught-screen:not([hidden])) .phone-escape { background: var(--c-ink); }

/* ---- F5 Detention games ---- */
.speaker { margin: 0; font-size: 3.5rem; line-height: 1; }
.plain-list { margin: 0; font-weight: 800; color: var(--c-lantern); }
.found-list { margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; }
.found-list span { background: var(--c-toxic); color: var(--c-ink); border-radius: 8px; padding: 0 0.5rem; font-weight: 800; }
.letter-grid.ph { width: 100%; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; align-content: start; flex: 0 0 auto; }
.letter-grid.ph button {
  aspect-ratio: 1; min-width: 0; width: 100%; padding: 0; font: 900 1rem var(--font-body); color: var(--c-ink);
  background: var(--c-parchment); border: 2px solid var(--c-ink); border-radius: 5px;
}
.letter-grid.ph button.hit { background: var(--c-toxic); }
.letter-grid.ph button.sel, .letter-grid.ph button.drag { background: var(--c-lantern); box-shadow: var(--glow); }
.letter-grid.ph, .letter-grid.ph button { touch-action: none; }
.lock { touch-action: none; }
/* Audience only, while a player of the running match is not connected: take that place back by name. */
.reclaim-bar {
  position: fixed; left: 50%; bottom: 0.5rem; transform: translateX(-50%); z-index: 20; white-space: nowrap;
  font: inherit; font-size: 0.85rem; padding: 0.4rem 0.9rem; border: 4px solid var(--c-ink); border-radius: 999px;
  background: var(--c-lantern); color: var(--c-ink);
}
.letter-grid.ph button.pend { background: color-mix(in srgb, var(--c-lantern) 45%, var(--c-parchment)); }
.parts { width: 100%; display: flex; flex-wrap: nowrap; gap: 0.3rem; justify-content: center; }
.part {
  flex: 1 1 0; min-width: 0; max-width: 6rem; padding: 0.8rem 0.1rem; font: 900 clamp(1rem, 6vw, 1.8rem) var(--font-body); color: var(--c-ink);
  background: var(--c-bone); border: 4px solid var(--c-ink); border-radius: 12px; cursor: pointer;
}
.parts.silent .part { padding: 0.7rem 0; text-transform: lowercase; }
.draw-pad { width: 100%; aspect-ratio: 1; border: 4px solid var(--c-ink); border-radius: 14px; background: var(--c-bone); }
.drawings.ph { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.drawings.ph canvas { width: 100%; aspect-ratio: 1; border: 3px solid var(--c-ink); border-radius: 10px; }
.lock {
  position: relative; width: 150px; height: 150px; margin: 0.5rem auto; border-radius: 24px;
  background: var(--c-plum); border: 5px solid var(--c-lantern); display: grid; place-items: center;
}
.lock.jammed { animation: shake 0.15s linear infinite; border-color: var(--c-blood); }
.keyhole { width: 26px; height: 50px; background: var(--c-ink); border-radius: 13px 13px 4px 4px; }
.lock-key {
  position: absolute; width: 56px; height: 56px; border-radius: 50%; display: none; place-items: center;
  background: var(--c-lantern); color: var(--c-ink); font-weight: 900; font-size: 1.4rem; border: 4px solid var(--c-ink);
  transition: transform 80ms linear;
}
.lock.has-key .lock-key { display: grid; }
.keyring { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; touch-action: none; }
.key {
  aspect-ratio: 1; font: 900 1.3rem var(--font-body); color: var(--c-ink); background: var(--c-lantern);
  border: 4px solid var(--c-ink); border-radius: 50% 50% 12px 12px; cursor: grab; touch-action: none;
}
.key.dragging { position: relative; z-index: 5; box-shadow: var(--glow); }
.key.tried { background: var(--c-plum); color: var(--c-parchment); text-decoration: line-through; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.obj-grid.ph { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; align-content: start; flex: 0 0 auto; }
.obj-grid.ph .obj {
  display: flex; flex-direction: column; align-items: center; padding: 0.3rem; font: 800 0.7rem var(--font-body);
  background: var(--c-midnight); color: var(--c-parchment); border: 3px solid var(--c-plum); border-radius: 10px;
}
.obj-grid.ph .obj:active { border-color: var(--c-toxic); box-shadow: var(--glow); }
.obj-grid.ph .obj.lit { border-color: var(--c-toxic); background: color-mix(in srgb, var(--c-toxic) 30%, var(--c-midnight)); box-shadow: var(--glow), 0 0 18px var(--c-toxic); }
.obj-grid.ph .obj.lit .obj-shape { fill: var(--c-toxic); stroke: var(--c-ink); }
.obj-grid.ph.dim { opacity: 0.4; }
.obj-svg { width: 100%; max-width: 56px; aspect-ratio: 1; }
.obj-shape { fill: var(--c-plum); stroke: var(--c-parchment); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }

/* Phase backgrounds: the blurred phone versions (_m), darkened (F7 2026-11-10). */
body {
  --bg-shade: linear-gradient(color-mix(in srgb, var(--c-midnight) 55%, transparent), color-mix(in srgb, var(--c-midnight) 70%, transparent));
  background-position: center; background-size: cover; background-attachment: fixed; background-repeat: no-repeat;
  background-image: var(--bg-shade), url('/assets/bg/bg_lobby_m.webp');
}
body[data-phase="question"], body[data-phase="evaluate"], body[data-phase="intro"], body[data-phase="restart"] { background-image: var(--bg-shade), url('/assets/bg/bg_classroom_m.webp'); }
body[data-phase="detention"] { background-image: var(--bg-shade), url('/assets/bg/bg_detention_m.webp'); }
body[data-phase="escape"] { background-image: var(--bg-shade), url('/assets/bg/bg_escape_m.webp'); }
body[data-phase="ended"] { background-image: var(--bg-shade), url('/assets/bg/bg_ledger_m.webp'); }
body.is-ghost { --bg-shade: linear-gradient(color-mix(in srgb, var(--c-midnight) 55%, var(--c-toxic) 12%), color-mix(in srgb, var(--c-midnight) 72%, var(--c-toxic) 10%)); }

/* Phone comfort (F7): no grey flash on tap, no double-tap zoom, no pull-to-refresh mid-match,
   and room for the notch / home bar (viewport-fit=cover). */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, .ans, .obj, .av-pick { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.phone { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* Detention props (2026-11-11): coded cakes, keys, lock, ledger lines. */
.pick.cake { display: grid; place-items: center; padding: 4px; border-radius: 12px; }
.pick.cake .cake-img { width: 100%; height: auto; display: block; }
.pick .pick-n { position: absolute; top: 2px; left: 6px; font-size: 0.8rem; font-weight: 900; }
.pick.line {
  aspect-ratio: auto; min-height: 3rem; background: var(--c-parchment); border-radius: 4px;
  display: flex; align-items: center; padding: 0 0.5rem;
}
.pick-grid:has(.pick.line) { grid-template-columns: 1fr 1fr; gap: 0.4rem 0.6rem; }
.pick.line .pick-n { position: static; margin-right: 0.5rem; }
.pick-rule { flex: 1; height: 0; border-bottom: 3px solid color-mix(in srgb, var(--c-ink) 40%, transparent); }
.pick.struck::after { display: none; }
.pick .scribble-svg { position: absolute; inset: 15% 6%; width: 88%; height: 70%; fill: none; stroke: var(--c-ink); stroke-width: 6; }
.lock { width: 150px; height: 186px; border: 0; background: none; border-radius: 0; }
.lock .lock-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.keyhole { display: none; }
.lock.jammed .lock-svg { filter: drop-shadow(0 0 10px var(--c-blood)); }
.lock-key { width: 48px; height: 86px; border: 0; border-radius: 0; background: none; top: 46px; transform-origin: 50% 70%; }
.lock-key .key-svg { width: 100%; height: 100%; }
.key { aspect-ratio: 3 / 5; padding: 4px; background: var(--c-plum); border-radius: 12px; display: grid; place-items: center; }
.key .key-svg { width: 100%; height: 100%; pointer-events: none; }
.key.tried { background: var(--c-ink); text-decoration: none; opacity: 0.4; }
/* The chosen cake / line stands out in toxic green (user, 2026-11-11). */
.pick.chosen { background: color-mix(in srgb, var(--c-toxic) 35%, var(--c-parchment)); border-color: var(--c-toxic); box-shadow: 0 0 0 3px var(--c-toxic), 0 0 18px var(--c-toxic); opacity: 1; }
