/* 13th Bell: the night picker, briefing card, callouts, results, and the minimal HUD for phones.
   Loaded last, so its HUD rules win over the older media queries. */

/* ---- menu and lobby: choosing a night ---- */
.menu-panel { max-width: 520px; }
.night-block { display: grid; gap: 8px; }
.night-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 14px; }
.star-total { color: #e7bf7d; font-size: 12px; }
.night-picker { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #4c6468 transparent; }
.night-picker::-webkit-scrollbar { height: 6px; }
.night-picker::-webkit-scrollbar-thumb { background: #4c6468; border-radius: 3px; }
.night-picker::-webkit-scrollbar-track { background: transparent; }
.night-tile { flex: none; width: 92px; min-height: 104px; display: grid; justify-items: center; align-content: start; gap: 2px; padding: 8px 6px; border-radius: 10px; border: 1px solid #60716c55; background: #0b1519; color: var(--ink); font: inherit; cursor: pointer; scroll-snap-align: center; position: relative; }
.night-tile b { position: absolute; left: 7px; top: 5px; font-size: 11px; color: #a8c1b3; }
.night-tile .nt-icon { font-size: 26px; margin-top: 8px; }
.night-tile .nt-title { font-size: 11px; font-weight: 600; line-height: 1.25; text-align: center; min-height: 2.5em; display: grid; place-items: center; }
.night-tile.sel { border-color: #e7bf7d; background: #1a2227; box-shadow: 0 0 0 1px #e7bf7d inset; }
.night-tile.locked { opacity: .45; cursor: default; }
.night-tile:disabled:not(.locked) { cursor: default; }
.stars { color: #e7bf7d; letter-spacing: 1px; font-size: 13px; }
.stars i { font-style: normal; color: #ffffff22; }
.night-sum { background: #0b1519; border: 1px solid #60716c44; border-left: 4px solid #e7bf7d; border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.night-sum small { font-size: 10px; letter-spacing: 1.5px; color: #a8c1b3; }
.night-sum h3 { margin: 0; font: 600 20px Georgia, serif; }
.ns-rule { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 0; }
.ns-rule span { font-size: 20px; }
.toggle-btn { display: grid; gap: 3px; text-align: left; font-size: 13px; font-weight: 600; background: #17282c; border: 1px solid #4c6468; padding: 10px 12px; }
.toggle-btn small { font-weight: 400; font-size: 11px; color: #a8b9b5; line-height: 1.35; }
.toggle-btn[aria-pressed="true"] { border-color: #86efac; background: #12301f; }
.toggle-btn[aria-pressed="true"] b { color: #86efac; }
.comms .toggle-btn { flex: 1 1 180px; }
.mic-on { margin-left: 6px; font-size: 13px; }

/* ---- briefing: one rule, three tips ---- */
.briefing { z-index: 18; background: #03070bd9; }
.brief-panel { max-width: 440px; text-align: center; gap: 10px; }
.brief-panel small { font-size: 10px; letter-spacing: 2px; color: #a8c1b3; }
.brief-panel h2 { font: 600 clamp(26px, 6vw, 36px) Georgia, serif; margin: 4px 0 0; }
.brief-entity { color: #e7bf7d; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.brief-rule { display: grid; gap: 6px; justify-items: center; background: #1b0f0fcc; border: 1px solid #b7794d88; border-radius: 12px; padding: 14px; margin: 6px 0; }
.brief-rule span { font-size: 40px; line-height: 1; }
.brief-rule b { font-size: 17px; line-height: 1.35; }
.brief-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.brief-tips li { background: #0b1519; border: 1px solid #60716c55; border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.brief-char { font-size: 12px; color: #b9c7c3; }
.brief-more { background: transparent; border: 1px solid #4c6468; font-size: 12px; font-weight: 600; padding: 8px; }

/* ---- in the night ---- */
.rule-card { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); z-index: 9; display: grid; gap: 4px; text-align: center; pointer-events: none; background: #1b0f0fe6; border: 1px solid #e7936c; border-radius: 10px; padding: 12px 18px; max-width: min(520px, 88vw); animation: rulein .3s ease; }
.rule-card b { font: 700 clamp(18px, 4vw, 26px) Georgia, serif; color: #ffd7af; letter-spacing: 1px; }
.rule-card span { font-size: clamp(13px, 2.6vw, 16px); color: #f1e6da; font-weight: 600; }
@keyframes rulein { from { opacity: 0; transform: translate(-50%, -8px); } }
.comfort .rule-card { animation: none; }
.spectate { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 9; background: #0b1519e6; border: 1px solid #60716c88; border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.spectate span { color: #a8b9b5; font-size: 11px; }
.journal-body .entry-card.rule { background: #2a1512; color: #ffd7af; border: 1px solid #b7794d88; }
.journal-body .entry-card.rule b { color: #ffb38a; }
#voiceChip.loud { border-color: #ef4444; box-shadow: 0 0 10px #ef4444; animation: blink .4s steps(2) infinite; }
.touch-only { display: none; }
body.hud-min .touch-only:not([hidden]) { display: inline-block; }
.no-map #mapToggle, .no-map #mapBtn { display: none !important; }

/* callouts */
#pingFeed { position: absolute; left: 20px; top: 150px; z-index: 8; display: grid; gap: 4px; pointer-events: none; }
.ping-line { display: flex; align-items: center; gap: 6px; background: #091319e0; border-radius: 999px; padding: 4px 10px 4px 6px; font-size: 12px; width: max-content; max-width: 70vw; animation: rulein .2s ease; }
.ping-line i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ping-line.ghostly { font-style: italic; opacity: .85; }
#pingWheel { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 16; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: #0b1519f2; border: 1px solid #60716c88; border-radius: 12px; padding: 8px; width: min(560px, 94vw); }
#pingWheel button { display: grid; justify-items: center; gap: 2px; font: 600 12px Inter, sans-serif; color: var(--ink); background: #17282c; border: 1px solid #4c6468; border-radius: 8px; padding: 8px 4px; cursor: pointer; position: relative; min-height: 54px; }
#pingWheel button span { font-size: 20px; }
#pingWheel kbd { position: absolute; right: 4px; top: 2px; font: 10px ui-monospace, monospace; color: #a8c1b3; }
@media (pointer: coarse) { #pingWheel kbd { display: none; } }

/* ---- results ---- */
.end-night { font-size: 11px; letter-spacing: 2px; }
.end-stars { display: flex; justify-content: center; align-items: center; gap: 14px; }
.end-stars .stars { font-size: 38px; letter-spacing: 6px; }
.grade { font: 800 26px Georgia, serif; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; }
.grade-S { color: #e7bf7d; } .grade-B { color: #86efac; } .grade-C { color: #93c5fd; } .grade-F { color: #f87171; }
.end-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; color: #8b8fa3; justify-items: center; }
.end-checks li.ok { color: #e7dbc4; }
.unlock { text-align: center; background: #12301f; border: 1px solid #86efac66; border-radius: 10px; padding: 8px; font-size: 14px; }

/* =====================================================================================
   Minimal HUD. On by default on phones (Settings → On-screen panels). The rule: nothing
   wordy sits over the school. Panels shrink to a line, labels become icons, the goal
   steps aside after a few seconds, and the button you need lights up instead of a prompt.
   ===================================================================================== */
body.hud-min .hud.top { padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)) !important; gap: 3px; background: linear-gradient(#050b10b0, transparent) !important; }
body.hud-min .clock { font-size: 13px !important; pointer-events: auto; white-space: nowrap; }
body.hud-min .inv { gap: 4px; }
body.hud-min .pages { gap: 3px; }
body.hud-min .pages span { width: 19px !important; height: 25px !important; font-size: 13px; }
body.hud-min .inv-icon { font-size: 11px !important; padding: 3px 6px !important; }
body.hud-min .char-chip { display: none; }
body.hud-min .journal-btn { min-width: 36px !important; min-height: 36px !important; font-size: 16px; padding: 0 6px; }
body.hud-min .bars { gap: 8px; }
body.hud-min .bar { font-size: 10px; }
body.hud-min .bar i { width: 42px; height: 5px; }
body.hud-min .where { display: none; }
body.hud-min .objective { font-size: 11px !important; line-height: 1.3 !important; padding: 4px 8px !important; max-width: min(72vw, 420px) !important; width: max-content; background: #050b10b8 !important; border: 0 !important; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; transition: opacity .6s; }
body.hud-min .objective b { display: none !important; }
body.hud-min .objective.faded { opacity: 0; }
body.hud-min #awareness { top: calc(max(6px, env(safe-area-inset-top)) + 40px) !important; bottom: auto !important; left: auto !important; right: max(8px, env(safe-area-inset-right)) !important; transform: none !important; width: min(190px, 48vw) !important; max-width: none !important; padding: 3px 8px 4px !important; background: #050b1099 !important; border: 0 !important; font-size: 9px !important; letter-spacing: .6px; text-align: right; }
body.hud-min #awareness small { display: none !important; }
body.hud-min .detection-track { margin: 3px 0 0; }
body.hud-min .map-widget { width: 92px !important; left: max(8px, env(safe-area-inset-left)) !important; top: 100px !important; bottom: auto !important; padding: 3px !important; opacity: .72; border-radius: 6px; }
body.hud-min .map-title, body.hud-min .map-caption { display: none !important; }
body.hud-min #minimap { margin: 0; }
body.hud-min #routeHint, body.hud-min .exp-toolbar, body.hud-min #soundCaption { display: none !important; }
body.hud-min .no-map #routeHint { display: block !important; top: 100px; bottom: auto !important; left: 8px !important; font-size: 9px !important; max-width: 60vw !important; }
body.hud-min #scoutLine { top: 76px !important; right: 8px !important; font-size: 9px !important; padding: 3px 7px !important; max-width: 52vw; }
body.hud-min .toast { top: 178px !important; font-size: 12px !important; font-weight: 600; padding: 6px 10px; max-width: 84vw; width: max-content; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; border-radius: 8px; }
body.hud-min .toast[hidden] { display: none !important; }
body.hud-min .prompt { bottom: 196px !important; font-size: 11px !important; padding: 5px 9px !important; max-width: 70vw !important; }
body.hud-min .subtitle { bottom: 204px !important; font-size: 13px !important; padding: 4px 10px; max-width: 86vw; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
body.hud-min .subtitle[hidden] { display: none !important; }
body.hud-min .chapter-card { top: 216px !important; width: max-content !important; max-width: 86vw; padding: 5px 12px !important; border: 0; }
body.hud-min .chapter-card h2 { font-size: 15px !important; letter-spacing: 1px !important; }
body.hud-min .chapter-card p { display: none; }
body.hud-min .page-card { top: auto !important; bottom: 196px !important; left: 8px !important; right: 8px !important; width: auto !important; max-height: 36vh !important; min-height: 0 !important; font-size: 13px !important; padding: 14px 14px 10px !important; }
body.hud-min .page-card .digit { font-size: 34px; margin: 2px 0; }
body.hud-min .gate-timer { top: 30%; font-size: 15px; }
body.hud-min .gate-timer b { font-size: 46px; }
body.hud-min #pingFeed { left: 8px; top: 250px; }
body.hud-min .spectate { top: 178px; font-size: 12px; }
body.hud-min .spectate span { display: none; }
body.hud-min .rule-card { top: 20%; }
/* touch controls: icons only */
body.hud-min .buttons { grid-template-columns: repeat(3, 48px) !important; gap: 8px !important; right: max(10px, env(safe-area-inset-right)) !important; bottom: 18px !important; }
body.hud-min .tbtn { width: 48px !important; height: 48px !important; font-size: 21px !important; background: #0b151999; border-color: #ffffff26; }
body.hud-min .tbtn small { display: none; }
body.hud-min .tbtn.ready { border-color: #86efac; box-shadow: 0 0 0 3px #86efac55, 0 0 16px #86efac88; background: #12301fcc; animation: ready 1s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 5px #86efac33, 0 0 22px #86efacaa; } }
body.comfort .tbtn.ready { animation: none; }
body.hud-min .joy { width: 104px !important; height: 104px !important; left: max(18px, env(safe-area-inset-left)); bottom: 22px !important; background: #ffffff0c; }
body.hud-min .knob { left: 29px !important; top: 29px !important; width: 46px; height: 46px; }
body.hud-min #pingWheel { bottom: 190px; grid-template-columns: repeat(4, 1fr); }
/* phones held sideways: everything hugs the edges */
@media (max-height: 520px) {
  body.hud-min .bars { display: flex !important; }
  body.hud-min .objective { max-width: 46vw !important; -webkit-line-clamp: 1; }
  body.hud-min #awareness { top: 40px !important; width: min(200px, 28vw) !important; }
  body.hud-min .map-widget { top: 88px !important; width: 84px !important; }
  body.hud-min #scoutLine { top: 66px !important; }
  body.hud-min .toast { top: 44px !important; max-width: 46vw; }
  body.hud-min .chapter-card { top: 78px !important; }
  body.hud-min .prompt { bottom: 12px !important; max-width: 36vw !important; }
  body.hud-min .subtitle { bottom: 14px !important; max-width: 44vw; }
  body.hud-min .page-card { left: auto !important; right: 190px !important; bottom: 12px !important; width: min(300px, 40vw) !important; max-height: 70vh !important; }
  body.hud-min .buttons { grid-template-columns: repeat(4, 46px) !important; }
  body.hud-min .tbtn { width: 46px !important; height: 46px !important; }
  body.hud-min #pingFeed { top: 74px; left: 110px; }
  body.hud-min #pingWheel { bottom: 12px; width: min(520px, 60vw); }
  .brief-panel { max-height: calc(100dvh - 16px); overflow-y: auto; padding: 14px; gap: 6px; }
  .brief-rule { padding: 8px; margin: 2px 0; }
  .brief-rule span { font-size: 26px; }
  .brief-panel h2 { font-size: 24px; }
}

/* ---- wide screens: the menu and the lobby in two columns, every night visible at once ---- */
.menu-cols, .menu-col { display: contents; }
@media (min-width: 1100px) and (min-height: 600px) {
  .panel.menu-panel, .panel.lobby-panel { max-width: 1160px; padding: 28px 32px; }
  .menu-cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  .menu-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .menu-panel .tag { max-width: 760px; margin: 0 auto 6px; font-size: 16px; }
  .menu-panel .night-picker, .lobby-panel .night-picker { flex-wrap: wrap; overflow: visible; }
  .menu-panel .night-tile, .lobby-panel .night-tile { width: calc((100% - 6 * 8px) / 7); }
  .menu-panel .night-sum h3 { font-size: 24px; }
}
