/* Agora Run: built from moodle5/showcase-game by tools/build.mjs. Do not edit here. */
/* Local copies of League Gothic and IBM Plex Mono (SIL Open Font License 1.1, see fonts/). */
@font-face { font-family: "League Gothic"; src: url("fonts/league-gothic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* Night launch: a deep-blue stage, real showcase components lit from within, one yellow accent. */
:root {
  --stage: #040a1e; --deep: #030e2e; --blue: #0e47cb; --blue-bright: #3e6cd5; --yellow: #ffcc00;
  --ink: #f4f6fb; --mist: #a9b8e0; --paper: #ffffff; --line: rgba(169, 184, 224, .22);
  --glow: #0e47cb; --ground-a: #0a1f5c; --ground-b: #061033;
  --display: "League Gothic", "Arial Narrow", Impact, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ui: Arial, "Helvetica Neue", Helvetica, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
body { margin: 0; background: var(--stage); color: var(--ink); font-family: var(--ui); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; overflow: hidden; background: var(--stage); touch-action: none; }

/* Stage */
#bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ground { position: absolute; inset: 0; background: radial-gradient(70% 80% at 50% 45%, var(--ground-a) 0%, var(--ground-b) 45%, var(--stage) 100%); transition: background 2s; }
#wallshade { position: absolute; inset: 0; background: radial-gradient(60% 70% at 50% 50%, rgba(4,10,30,.38), rgba(4,10,30,.86) 70%, rgba(4,10,30,.96)); transition: opacity 1.2s; }
#app.playing #wallshade { background: radial-gradient(60% 70% at 50% 45%, rgba(4,10,30,.45), rgba(4,10,30,.82) 70%, rgba(4,10,30,.94)); }
#grain { position: absolute; inset: 0; opacity: .06; background-image: repeating-radial-gradient(circle at 17% 32%, #fff 0 1px, transparent 1px 3px); mix-blend-mode: overlay; pointer-events: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(2,6,20,.7)); }
#flash { position: absolute; inset: 0; pointer-events: none; background: var(--yellow); opacity: 0; mix-blend-mode: screen; }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) 0 max(24px, env(safe-area-inset-left, 0px));
  pointer-events: none; opacity: 0; transition: opacity .6s; font-family: var(--mono); text-transform: uppercase; letter-spacing: .16em; }
#hud.on { opacity: 1; }
.rail b { color: var(--yellow); font-weight: 700; }
.rail { font-size: 15px; font-weight: 700; color: var(--mist); }
.rail small { display: block; margin-top: 6px; font-size: 11px; font-weight: 400; letter-spacing: .14em; color: var(--mist); opacity: .85; max-width: 46ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segs { display: flex; gap: 4px; margin-top: 10px; }
.segs i { display: block; width: 34px; height: 4px; border-radius: 2px; background: rgba(169,184,224,.22); overflow: hidden; position: relative; }
.segs i::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0)); background: var(--yellow); }
.counts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.count { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 19px; background: rgba(3,14,46,.72); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; color: var(--mist); font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }
.count b { color: var(--ink); font-size: 16px; }
.count svg { width: 18px; height: 18px; }
.count.bump { animation: bump .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes bump { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
#sound, #pause { pointer-events: auto; cursor: pointer; border: 0; font: inherit; color: var(--mist); }
#sound:hover, #pause:hover { color: var(--ink); }
#pause svg { width: 14px; height: 14px; }
#sound:focus-visible, #pause:focus-visible, .btn:focus-visible, .book-item:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* Toasts: ECL notifications */
#toasts { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; width: min(440px, calc(100% - 48px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: 4px 1fr; background: var(--paper); color: #171a22; border-radius: 4px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.45);
  animation: toast-in .45s cubic-bezier(.2,1.2,.3,1) both; }
.toast.out { animation: toast-out .35s ease-in both; }
.toast::before { content: ""; background: var(--blue); }
.toast.case::before { background: var(--yellow); }
.toast div { padding: 12px 16px 14px; min-width: 0; }
.toast .k { font: 700 11px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.toast h3 { margin: 4px 0 0; font: 700 17px/1.25 var(--ui); }
.toast p { margin: 6px 0 0; font: 14px/1.45 var(--ui); color: #404552; }
.toast .chip { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 10px; background: #e7edfa; color: var(--blue); }
@keyframes toast-in { from { transform: translateY(24px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(-30px); opacity: 0; } }

/* Chapter card */
#chapter { position: absolute; left: max(5vw, 24px); top: 13%; pointer-events: none; display: none; max-width: min(760px, 84vw); }
#chapter.show { display: block; }
#chapter .k { font: 700 clamp(14px, 1.6vw, 22px)/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--mist); animation: rise .5s .05s both cubic-bezier(.2,1,.3,1); }
#chapter .k b { color: var(--yellow); }
#chapter h2 { margin: 10px 0 0; font: 400 clamp(64px, 9.5vw, 150px)/.86 var(--display); white-space: nowrap; letter-spacing: .01em; text-transform: uppercase; color: var(--ink);
  text-shadow: 0 0 80px rgba(14,71,203,.9); animation: slam .55s both cubic-bezier(.16,1,.3,1); }
#chapter p { margin: 18px 0 0; font: 400 clamp(16px, 1.7vw, 24px)/1.35 var(--ui); color: var(--mist); max-width: 38ch; animation: rise .6s .25s both cubic-bezier(.2,1,.3,1); }
#chapter.out { animation: fade-out .5s both; }
@keyframes slam { 0% { transform: scale(1.35); opacity: 0; filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; transform: translateX(-40px); } }

/* Screens */
.screen { position: absolute; inset: 0; display: flex; padding-block: 32px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); overflow: auto; }
.screen[hidden] { display: none !important; }
.screen .inner { width: min(1180px, 100%); margin: auto; } /* centred while it fits, scrolls from the top when it does not */
#title { background: linear-gradient(90deg, rgba(4,10,30,.82) 0%, rgba(4,10,30,.35) 52%, transparent 75%); transition: opacity .7s; }
#title.leaving { opacity: 0; pointer-events: none; }
.eyebrow { font: 700 clamp(12px, 1.3vw, 16px)/1.3 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--mist); }
.eyebrow b { color: var(--yellow); }
#title h1 { margin: 14px 0 0; font: 400 clamp(80px, min(19vw, 23vh), 300px)/.8 var(--display); letter-spacing: .005em; text-transform: uppercase; text-shadow: 0 0 90px rgba(14,71,203,.85); }
#title h1 span { color: var(--yellow); display: block; }
#title .lede { margin: 26px 0 0; max-width: 34ch; font: 400 clamp(17px, 1.6vw, 22px)/1.45 var(--ui); color: var(--ink); text-wrap: balance; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 30px; }
.btn { appearance: none; border: 0; cursor: pointer; min-height: 52px; padding: 0 26px; border-radius: 4px; font: 700 18px/1 var(--ui); display: inline-flex; align-items: center; gap: 10px; }
.btn.cta { background: var(--yellow); color: #171a22; box-shadow: 0 10px 40px rgba(255,204,0,.25); }
.btn.cta:hover { background: #ffd633; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px rgba(244,246,251,.5); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.btn[hidden] { display: none; }
.btn.link { padding: 0 6px; background: none; color: var(--mist); text-decoration: underline; text-underline-offset: 4px; font-weight: 400; }
.btn.link:hover { color: var(--ink); }
.btn[disabled] { opacity: .55; cursor: progress; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 18px; max-width: 36rem; margin-top: 30px; font: 400 13px/1.4 var(--mono); letter-spacing: .08em; color: var(--mist); text-transform: uppercase; }
.keys kbd { display: inline-block; min-width: 26px; padding: 3px 7px; margin-right: 4px; border-radius: 4px; background: rgba(169,184,224,.14); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35); font: 700 12px/1.3 var(--mono); color: var(--ink); text-align: center; }
.facts { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.facts div { font: 400 13px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.facts b { display: block; font: 400 54px/1 var(--display); letter-spacing: .01em; color: var(--ink); margin-bottom: 6px; }
#loadbar { height: 3px; width: 220px; background: rgba(169,184,224,.2); border-radius: 2px; overflow: hidden; margin-top: 12px; }
#loadbar i { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .2s; }

/* Case book */
#book { background: rgba(3,8,26,.92); backdrop-filter: blur(10px); align-items: flex-start; }
#book h2, #end h2 { margin: 8px 0 0; font: 400 clamp(64px, 9vw, 130px)/.86 var(--display); text-transform: uppercase; letter-spacing: .01em; }
#book .lede, #end .lede { margin: 14px 0 0; max-width: 60ch; font: 16px/1.5 var(--ui); color: var(--mist); }
.book-ch { margin-top: 34px; }
.book-ch h3 { margin: 0 0 12px; font: 700 13px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--mist); }
.book-ch h3 b { color: var(--yellow); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.book-item { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-rows: auto 1fr; border-radius: 6px; overflow: hidden; background: rgba(14,71,203,.12); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.book-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; display: block; }
.book-item .t { padding: 12px 14px 14px; min-width: 0; }
.book-item .n { font: 700 11px/1 var(--mono); letter-spacing: .14em; color: var(--yellow); }
.book-item h4 { margin: 6px 0 0; font: 700 16px/1.25 var(--ui); color: var(--ink); }
.book-item p { margin: 6px 0 0; font: 13px/1.45 var(--ui); color: var(--mist); }
.book-item.locked { cursor: default; background: rgba(169,184,224,.05); }
.book-item.locked img { filter: blur(6px) grayscale(1) brightness(.35); }
.book-item.locked h4 { color: var(--mist); }
.book-item[aria-expanded="true"] { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-rows: auto; background: rgba(14,71,203,.22); }
.book-item[aria-expanded="true"] img { height: 100%; aspect-ratio: auto; }
.book-item .more { display: none; }
.book-item[aria-expanded="true"] .more { display: block; }
.more h5 { margin: 14px 0 4px; font: 700 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--mist); }
.more ul { margin: 6px 0 0; padding-left: 18px; font: 14px/1.5 var(--ui); color: var(--ink); }
.more p { color: var(--ink); opacity: .85; }
.book-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; flex-wrap: wrap; }

/* End */
#end { background: radial-gradient(80% 90% at 30% 50%, rgba(4,10,30,.55), rgba(4,10,30,.9)); }
#end h2 span { color: var(--yellow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 30px; max-width: 860px; }
.stats div { padding: 16px 18px; border-radius: 6px; background: rgba(14,71,203,.16); box-shadow: inset 0 0 0 1px var(--line); font: 400 12px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.stats b { display: block; font: 400 52px/1 var(--display); letter-spacing: .01em; color: var(--ink); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.stats .best { color: var(--yellow); }

/* Touch controls */
#touch { position: absolute; inset: auto 0 0 0; height: 160px; display: none; pointer-events: none; }
#touch.on { display: block; }
#touch button { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 78px; height: 78px; border-radius: 50%; border: 0; pointer-events: auto; touch-action: none;
  background: rgba(14,71,203,.35); box-shadow: inset 0 0 0 2px rgba(169,184,224,.4); color: var(--ink); font: 700 26px/1 var(--mono); }
#touch button.down { background: rgba(255,204,0,.5); }
#t-left { left: max(24px, env(safe-area-inset-left, 0px)); }
#t-right { left: calc(max(24px, env(safe-area-inset-left, 0px)) + 96px); }
#t-jump { right: max(24px, env(safe-area-inset-right, 0px)); width: 96px !important; height: 96px !important; }
#t-book { right: calc(max(24px, env(safe-area-inset-right, 0px)) + 112px); width: 56px !important; height: 56px !important; font-size: 13px !important; }
#rotate { position: absolute; inset: auto 0 calc(190px + env(safe-area-inset-bottom, 0px)) 0; text-align: center; font: 700 12px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mist); display: none; pointer-events: none; }
@media (orientation: portrait) and (max-width: 700px) { #touch.on + #rotate { display: block; animation: hint-out .8s 6s both; } }
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }

#app:not([data-state="play"]) #touch, #app:not([data-state="play"]) #rotate { display: none !important; }
.touch-hint { display: none; margin: 22px 0 0; max-width: 36ch; font: 400 14px/1.45 var(--ui); color: var(--mist); }
#app.touch .touch-hint { display: block; }
#app.touch .keys { display: none; }
#app.touch #toasts { bottom: calc(124px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 900px) { #c-seen { display: none; } }
@media (max-height: 520px) {
  #title h1 { font-size: 22vh; }
  #title .lede { margin-top: 14px; font-size: 15px; max-width: 46ch; }
  #title .row { margin-top: 16px; }
  .facts, .keys { display: none; }
  #chapter { top: 24%; }
  #chapter h2 { font-size: 64px; }
  #chapter p { font-size: 15px; margin-top: 10px; }
  .toast div { padding: 8px 12px 10px; }
  .toast p { font-size: 12.5px; }
  .toast h3 { font-size: 15px; }
  #toasts { width: min(360px, calc(100% - 48px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  #app.touch #toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); }
  #touch button { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 64px; height: 64px; }
  #t-right { left: calc(max(24px, env(safe-area-inset-left, 0px)) + 80px); }
  #t-jump { width: 80px !important; height: 80px !important; }
  #t-book { right: calc(max(24px, env(safe-area-inset-right, 0px)) + 96px); }
}
@media (max-width: 700px) {
  #chapter { top: 20%; }
  .facts { display: none; }
  .segs i { width: 18px; }
  .count { height: 32px; padding: 0 10px; font-size: 11px; }
  .count .lbl { display: none; }
  .rail small { max-width: 26ch; }
  #title { background: linear-gradient(180deg, rgba(4,10,30,.86) 0%, rgba(4,10,30,.55) 60%, rgba(4,10,30,.2)); align-items: flex-start; }
  .facts b { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  #chapter h2, #chapter .k, #chapter p, .toast, .count.bump { animation-duration: .01s !important; }
}
