/* Look taken from the government's billboard campaigns: royal-blue fields, heavy italic white capitals,
   a yellow highlight, red stamp labels and a white strip along the bottom. Hard offset shadows, no blur. */
:root {
  --blue: #1b4fa8;
  --blue-hi: #2f6fd6;
  --blue-deep: #0d2f6e;
  --ink-blue: #061638;
  --yellow: #ffd200;
  --red: #e30f1b;
  --white: #ffffff;
  --sky: #d7e5ff;
  --bg: var(--ink-blue);
  --panel: var(--blue-deep);
  --line: #ffffff;
  --text: #ffffff;
  --muted: var(--sky);
  --accent: var(--yellow);
  --on-accent: var(--ink-blue);
  --bad: #ff8a80;
  --paper: #f6efdc;
  --ink: #111111;
  --shadow: 5px 5px 0 #000000;
  --head: "Archivo", "Arial Black", Impact, system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 500 16px/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
canvas { display: block; touch-action: none; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; }

/* the poster headline: heavy, slanted, capitals */
.poster-type, .box h2, h1, .kind, .btn, .tag, #label, .room .no { font-family: var(--head); font-style: italic; text-transform: uppercase; letter-spacing: -.01em; word-spacing: .14em; }

/* HUD */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud button, .hud .chip, .hud #stick { pointer-events: auto; }
.topbar { position: absolute; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tag { padding: 7px 14px; background: var(--blue); border: 3px solid var(--white); font-weight: 900; font-stretch: 85%; box-shadow: var(--shadow); max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbtns { display: flex; gap: 8px; }
.hb { min-width: 48px; padding: 8px 12px; white-space: nowrap; }
.inv { position: absolute; right: 12px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 8px; flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 62vw; }
.chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 44px; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink-blue); background: var(--white); border: 3px solid var(--ink-blue); box-shadow: var(--shadow); cursor: pointer; }
.chip .ico { font-size: 22px; line-height: 1; }
.chip.new { animation: pop .6s; background: var(--yellow); }
.touch .chip .lbl { display: none; }

/* message strip: white bar with a red stamp, like the bottom band of the posters */
.toast { position: absolute; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 14px) skewX(-6deg); width: min(580px, calc(100% - 32px)); display: flex; align-items: stretch; background: var(--white); color: var(--ink-blue); border: 3px solid var(--ink-blue); box-shadow: 7px 7px 0 #000000; font-size: 17px; font-weight: 700; line-height: 1.35; opacity: 0; transition: opacity .18s, transform .18s; }
.toast .ti { flex: none; display: flex; align-items: center; justify-content: center; width: 54px; font-size: 24px; background: var(--red); border-right: 3px solid var(--ink-blue); }
.toast .tt { padding: 12px 16px; transform: skewX(6deg); }
.toast.show { opacity: 1; transform: translate(-50%, 0) skewX(-6deg); }
#label { position: absolute; transform: translateX(-50%) skewX(-6deg); padding: 5px 12px; background: var(--yellow); color: var(--ink-blue); border: 3px solid var(--ink-blue); font-weight: 900; font-size: 16px; display: none; white-space: nowrap; box-shadow: 4px 4px 0 #000000; }
#stick { position: absolute; left: 24px; bottom: calc(24px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; border: 3px solid #ffffffaa; background: #0d2f6e88; display: none; }
#knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--ink-blue); }
.touch #stick { display: block; }
.touch .inv { max-width: calc(100vw - 180px); }

/* buttons: chunky, hard shadow, they press down */
.btn { font-weight: 900; font-size: 17px; font-stretch: 90%; color: var(--ink-blue); background: var(--white); border: 3px solid var(--ink-blue); border-radius: 0; padding: 9px 18px; cursor: pointer; min-height: 46px; box-shadow: var(--shadow); transition: transform .06s, box-shadow .06s; }
.btn:hover:not(:disabled) { background: var(--sky); }
.btn:active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 1px 1px 0 #000000; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ok { background: var(--yellow); color: var(--ink-blue); }
.btn.ok:hover:not(:disabled) { background: #ffe14d; }
.btn.bad { background: var(--red); color: var(--white); width: 100%; margin-top: 12px; }
.btn.big { font-size: 20px; padding: 11px 24px; }
.btn.link { background: none; border: none; box-shadow: none; color: var(--muted); text-decoration: underline; font-family: inherit; font-style: normal; text-transform: none; font-weight: 600; }

/* dialogs: a billboard */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadein .15s;
  background: repeating-linear-gradient(-45deg, #061638e8 0 14px, #0a2150e8 14px 28px); }
.box { position: relative; color: var(--white); background: linear-gradient(165deg, var(--blue-hi) 0%, var(--blue) 45%, var(--blue-deep) 100%); border: 4px solid var(--white); outline: 3px solid var(--ink-blue); padding: 16px 20px 0; width: min(400px, 100%); max-height: calc(100% - 16px); overflow: auto; text-align: left; box-shadow: 12px 12px 0 #000000; animation: slam .22s cubic-bezier(.2, 1.4, .4, 1); }
.box > :last-child { margin-bottom: 20px; }
.box::after { content: ""; display: block; position: sticky; bottom: 0; height: 12px; margin: 16px -20px 0; background: linear-gradient(90deg, var(--red) 0 33.3%, var(--white) 33.3% 66.6%, #2a8a3e 66.6%); }
.box.wide { width: min(640px, 100%); }
.box.center { text-align: center; }
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 10px 0; min-height: 40px; }
.kind { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 900; color: var(--white); padding: 4px 12px 4px 8px; background: var(--red); border: 3px solid var(--white); box-shadow: 3px 3px 0 #000000; transform: rotate(-3deg); }
.kico { font-size: 18px; font-style: normal; }
.x { width: 42px; height: 42px; border: 3px solid var(--ink-blue); background: var(--white); color: var(--ink-blue); font-size: 20px; font-weight: 900; cursor: pointer; box-shadow: 3px 3px 0 #000000; }
.x:hover { background: var(--yellow); }
.box h2 { margin: 0 0 14px; font-size: 30px; font-weight: 900; font-stretch: 88%; line-height: 1.02; text-shadow: 3px 3px 0 var(--ink-blue); }
.box .close { margin-top: 18px; width: 100%; }
.prompt { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.prompt mark, .doc mark { background: var(--yellow); color: var(--ink-blue); padding: 0 4px; }
.how { color: var(--sky); font-size: 14px; margin: 12px 0 0; text-align: center; }
img.zoom { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: #000000; border: 3px solid var(--white); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.doc { line-height: 1.6; font-size: 17px; }
.doc p { margin: 0 0 10px; }
.doc.paper, .doc .paper { background: var(--paper); color: var(--ink); padding: 20px 22px; font-family: Georgia, "Times New Roman", serif; box-shadow: 6px 6px 0 #000000; transform: rotate(-.6deg); }
.doc .stamp { display: inline-block; border: 3px solid #b3261e; color: #b3261e; padding: 2px 10px; font-weight: 800; transform: rotate(-6deg); letter-spacing: .08em; }
.doc .lcd { background: var(--ink-blue); color: var(--yellow); padding: 14px; border: 3px solid var(--white); font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
.doc table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; }
.doc td, .doc th { border: 1px solid #00000033; padding: 4px 8px; text-align: left; }
.doc .big { font-size: 22px; font-weight: 800; }
.gain { display: inline-block; color: var(--ink-blue); background: var(--yellow); font-weight: 800; padding: 4px 10px; box-shadow: 3px 3px 0 #000000; }
.hint { text-align: left; color: var(--ink-blue); background: var(--white); border-left: 8px solid var(--yellow); padding: 10px 12px; margin: 0 0 10px; font-weight: 600; }
.hints .btn.ok { width: 100%; }
ul.ev { list-style: none; padding: 0; columns: 2; }

/* locks */
.lock .doc { text-align: left; margin-bottom: 12px; }
.disp { font: 800 34px ui-monospace, Consolas, monospace; letter-spacing: .14em; padding: 10px; margin-bottom: 14px; text-align: center; background: var(--ink-blue); color: var(--yellow); border: 3px solid var(--white); box-shadow: inset 0 0 0 3px var(--ink-blue); }
.wrong { animation: shake .4s; }
.disp.wrong { color: var(--bad); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { font-size: 24px; min-height: 56px; font-style: normal; }
.key.clr { background: var(--sky); }
.word { width: 100%; font: 800 22px ui-monospace, Consolas, monospace; text-transform: uppercase; text-align: center; padding: 12px; margin-bottom: 12px; color: var(--yellow); background: var(--ink-blue); border: 3px solid var(--white); -webkit-user-select: text; user-select: text; }
.word:focus { outline: 3px solid var(--yellow); outline-offset: 2px; }
.word.wrong { border-color: var(--bad); }
.dials { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.dial { width: 64px; min-height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 28px; color: var(--ink-blue); background: var(--white); border: 3px solid var(--ink-blue); border-bottom: 8px solid var(--c, var(--ink-blue)); box-shadow: 4px 4px 0 #000000; cursor: pointer; }
.dial small { font-size: 14px; font-weight: 800; color: var(--ink-blue); }
.lock .btn.ok { width: 100%; margin-top: 10px; }

/* screens */
.screen { position: fixed; inset: 0; z-index: 20; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: radial-gradient(ellipse at 20% 0%, var(--blue-hi) 0%, var(--blue) 40%, var(--blue-deep) 100%); }
#done { align-items: center; background: repeating-linear-gradient(-45deg, #061638ee 0 14px, #0a2150ee 14px 28px); }
.menu-inner { width: min(900px, 100%); }
.kicker { display: inline-block; padding: 4px 12px; background: var(--red); color: var(--white); border: 3px solid var(--white); box-shadow: 3px 3px 0 #000000; font-family: var(--head); font-style: italic; font-weight: 900; text-transform: uppercase; font-size: 14px; margin: 0; transform: rotate(-2deg); }
h1 { font-size: clamp(48px, 11vw, 92px); font-weight: 900; font-stretch: 80%; line-height: .92; margin: 14px 0 14px; text-shadow: 5px 5px 0 var(--ink-blue); }
h1 em { font-style: inherit; color: var(--ink-blue); background: var(--yellow); padding: 0 .12em; text-shadow: none; }
.lead { color: var(--white); font-size: 18px; font-weight: 600; max-width: 640px; margin: 0 0 20px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.room { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; min-height: 108px; text-align: left; font: inherit; color: var(--ink-blue); background: var(--white); border: 3px solid var(--ink-blue); box-shadow: var(--shadow); cursor: pointer; transition: transform .06s, box-shadow .06s; }
.room:hover:not(:disabled) { background: var(--sky); }
.room:active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 1px 1px 0 #000000; }
.room.current { background: var(--yellow); }
.room .no { font-size: 15px; font-weight: 900; min-width: 30px; padding: 1px 8px; text-align: center; background: var(--red); color: var(--white); }
.room.locked { cursor: default; background: #ffffff1f; color: var(--white); border-color: #ffffff66; box-shadow: none; }
.room.locked .no { background: #ffffff33; }
.room .t { font-weight: 800; line-height: 1.25; flex: 1; }
.room .st { color: inherit; letter-spacing: .05em; }
.room.locked .t, .room.locked .st { color: var(--sky); }
.howto { background: var(--white); color: var(--ink-blue); border: 3px solid var(--ink-blue); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.howto summary { font-family: var(--head); font-style: italic; text-transform: uppercase; font-weight: 900; cursor: pointer; }
.howto p { color: #24365e; }
.howto b { color: var(--ink-blue); }
.disclaimer { color: var(--sky); font-size: 14px; }
.stars { font-size: 44px; color: var(--yellow); letter-spacing: .1em; text-shadow: 3px 3px 0 var(--ink-blue); }
#done .btn { width: 100%; margin-top: 12px; }
#fade { position: fixed; inset: 0; background: #000000; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 25; }
#fade.on { opacity: 1; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes slam { from { transform: scale(.86) rotate(-2deg); opacity: 0; } }
@keyframes pop { 40% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .box, .overlay { animation: none; } }
