/* HUD pieces added with the review fixes: the message queue, the connection banner, the first-night
   coaching line, the one-line status on phones, and the result screen's unlock card. */

/* ---- messages: up to three, stacked, on every screen ---- */
.toasts { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 112px); transform: translateX(-50%); z-index: 70;
  display: grid; gap: 6px; justify-items: center; width: min(92vw, 560px); pointer-events: none; }
.toasts[hidden] { display: none; }
.toast-item { max-width: 100%; padding: 8px 14px; border-radius: 8px; background: #05090dde; border: 1px solid #ffffff22; color: #e8ece6;
  font: 600 14px/1.35 Inter, system-ui, sans-serif; text-align: center; text-wrap: balance; box-shadow: 0 6px 24px #0008;
  animation: toast-in .18s ease-out; zoom: var(--font-scale, 1); }
.toast-item.p3 { border-color: #e7936c; background: #1b0f0fe8; color: #ffe2cf; }
.toast-item.p2 { border-color: #8edcbc66; }
.toast-item.p0 { opacity: .82; font-weight: 500; }
.toast-item.out { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.capturing ~ .toasts, body:has(.capturing) .toasts { visibility: hidden; }
/* Phones: small text along the top edge, clear of the middle of the screen. */
body.touch .toasts { top: calc(max(6px, env(safe-area-inset-top)) + 58px); width: min(70vw, 420px); gap: 4px; }
body.touch .toast-item { font-size: 11.5px; padding: 5px 10px; border-radius: 6px; }
@media (max-height: 520px) { body.touch .toasts { top: calc(max(4px, env(safe-area-inset-top)) + 40px); width: min(46vw, 420px); } }

/* ---- connection lost / back in ---- */
.net-banner { position: fixed; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 90; padding: 8px 16px;
  border-radius: 999px; background: #2a1408f2; border: 1px solid #e7936c; color: #ffe2cf; font: 700 13px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: .02em; box-shadow: 0 8px 30px #000a; }
.net-banner[hidden] { display: none; }

/* ---- first night: one line that teaches the next control ---- */
.coach { position: absolute; left: 50%; bottom: 176px; transform: translateX(-50%); z-index: 8; display: flex; gap: 10px; align-items: center;
  padding: 8px 14px; border-radius: 10px; background: #071115e6; border: 1px solid #b4f1cc55; color: #dfe9e0; pointer-events: none;
  font: 600 13px/1.3 Inter, system-ui, sans-serif; white-space: nowrap; animation: toast-in .25s ease-out; zoom: var(--font-scale, 1); }
.coach[hidden] { display: none; }
.coach kbd { display: inline-block; min-width: 22px; padding: 2px 7px; border-radius: 5px; background: #1d2f33; border: 1px solid #52686c; border-bottom-width: 2px;
  color: #f2f4df; font: 700 12px/1.3 ui-monospace, Consolas, monospace; text-align: center; }
.coach.urgent { border-color: #e7936c; background: #1b0f0ff0; color: #ffe2cf; }
.capturing .coach { visibility: hidden; }
body.touch .coach { display: none; } /* phones get the touch tutorial instead */

/* ---- one short line at the top (phones); desktop keeps the objective panel ---- */
.status-line { display: none; }

/* ---- the clock at midnight: nothing but the time ---- */
.clock.midnight { color: #ff6b5e !important; letter-spacing: .12em; animation: midnight-pulse 1.6s ease-in-out infinite; }
@keyframes midnight-pulse { 50% { opacity: .55; } }
.comfort .clock.midnight, .reduced-flashing .clock.midnight { animation: none; }

/* ---- result screen ---- */
.unlock-card { display: grid; gap: 4px; margin: 14px 0; padding: 14px 16px; border-radius: 12px; text-align: center;
  background: linear-gradient(160deg, #1d2f2a, #10201c); border: 1px solid #8edcbc88; box-shadow: 0 0 0 1px #8edcbc22, 0 10px 40px #0007; }
.unlock-card small { color: #8edcbc; font: 700 11px/1 Inter, sans-serif; letter-spacing: .16em; }
.unlock-card b { font: 400 clamp(22px, 5vw, 30px)/1.1 "Creepster", Georgia, serif; color: #f2f4df; letter-spacing: 1px; }
.unlock-card span { color: #b9c7bd; font-size: 13px; }
.ink-count { text-align: center; color: #7fd6a4; font: 600 12px/1.4 Inter, sans-serif; margin: 6px 0 0; }
@media (prefers-reduced-motion: reduce) { .toast-item, .coach { animation: none; } }

#chatBtn.unread { color: #fde68a; border-color: #fde68a88; }
#fsBtn { color: #d7e2dd; display: inline-grid; place-items: center; }
#fsBtn[hidden] { display: none; }
.entry-card.green-ink { border-left: 3px solid #34d399; color: #a7f3d0; font-family: "Special Elite", Georgia, serif; }

/* Clean feed for clips and thumbnails (H by default): only the school and the subtitles stay. */
body.hud-off #game .hud, body.hud-off #expedition, body.hud-off #gadgetBar, body.hud-off #prompt, body.hud-off #coach,
body.hud-off #toasts, body.hud-off .speakers, body.hud-off #chat[data-phase="play"], body.hud-off #touchUI, body.hud-off #fx,
body.hud-off #fpsCounter, body.hud-off #soundCaption { display: none !important; }
/* The cursed room: your eyes close and the panels go with the light (game.js toggles it). */
body.eyes-shut #game .hud, body.eyes-shut #expedition, body.eyes-shut #gadgetBar, body.eyes-shut #prompt, body.eyes-shut #coach,
body.eyes-shut #toasts, body.eyes-shut .speakers, body.eyes-shut #touchUI, body.eyes-shut #soundCaption { opacity: 0 !important; transition: opacity .5s; }
/* Streamer mode: the room code is masked on screen. */
.room-code.masked { letter-spacing: 18px; color: #7f1d1d; }
