/* The Sealed Palace. One stage (the 320x208 game screen, scaled up in whole pixels) centred on a dark field.
   Title, level card, pause, death and ending sit on the stage; the code panels cover the whole window. */
:root {
  --field: #08070d;
  --stone: #17161f;
  --stone-2: #211f2c;
  --rule: #39344a;
  --ink: #ece5d3;
  --ink-dim: #a49c8a;
  --gold: #e8bf62;
  --gold-deep: #9c7426;
  --azure: #86b6ff;
  --ember: #e86a4a;
  --jade: #78d19a;
  --parch: #e9d8b0;
  --parch-edge: #c9ae78;
  --parch-ink: #35241a;
  --code-bg: #0e0d14;
  --f-display: "IM Fell English SC", "IM Fell English", Georgia, "Times New Roman", serif;
  --f-prose: "IM Fell English", Georgia, "Times New Roman", serif;
  --f-ui: "VT323", "Courier New", ui-monospace, monospace;
  --f-code: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --vm-accent: var(--gold);
  --vm-muted: var(--ink-dim);
  --vm-width: 20rem;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--field); color: var(--ink); font-family: var(--f-ui); font-size: 20px; overflow: hidden; -webkit-tap-highlight-color: transparent; }
#app { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px max(8px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px)); box-sizing: border-box; }
#stage { position: relative; width: min(100%, calc((100dvh - 60px) * 320 / 208)); aspect-ratio: 320 / 208; background: #000; box-shadow: 0 0 0 1px #1d1b26, 0 20px 60px #000; container-type: inline-size; }
#view { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
#keysline { font-size: 18px; color: var(--ink-dim); letter-spacing: 0.04em; text-align: center; }
#keysline b { color: var(--gold); font-weight: normal; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#btnMenu { position: absolute; top: 1.2cqw; right: 1.2cqw; z-index: 3; background: rgba(8, 7, 13, 0.6); border: 1px solid var(--rule); color: var(--ink-dim); font-family: var(--f-ui); font-size: clamp(14px, 2.4cqw, 20px); padding: 0 0.5em; cursor: pointer; }
#title:not([hidden]) ~ #btnMenu, #levelCard:not([hidden]) ~ #btnMenu, #pause:not([hidden]) ~ #btnMenu, #ending:not([hidden]) ~ #btnMenu { display: none; }
#btnMenu:hover { color: var(--gold); border-color: var(--gold-deep); }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 3, 8, 0.72); z-index: 5; padding: 12px; box-sizing: border-box; overflow: auto; }
.overlay.solid { background: rgba(4, 3, 8, 0.9); }
.overlay.clear { background: linear-gradient(90deg, rgba(4, 3, 8, 0.85) 0%, rgba(4, 3, 8, 0.55) 55%, rgba(4, 3, 8, 0.2) 100%); }
.overlay.full { position: fixed; z-index: 20; }

.btn { background: transparent; border: 1px solid var(--rule); color: var(--ink); padding: 4px 14px 5px; font-family: var(--f-ui); font-size: 21px; cursor: pointer; letter-spacing: 0.03em; }
.btn:hover { border-color: var(--gold-deep); color: var(--gold); }
.btn.main { background: var(--gold); border-color: var(--gold); color: #1b130a; }
.btn.main:hover { background: #f3d283; color: #1b130a; }
.btn.small { font-size: 16px; padding: 0 8px; }
.btn[disabled] { opacity: 0.4; cursor: default; }
kbd { font-family: var(--f-ui); border: 1px solid var(--rule); border-bottom-width: 2px; padding: 0 5px; color: var(--gold); font-size: 0.95em; }

/* title: words on the left, the palace showing through on the right */
#title { justify-content: flex-start; align-items: stretch; padding: clamp(10px, 3cqw, 32px) clamp(12px, 4cqw, 44px); flex-direction: column; }
.title-col { display: grid; gap: clamp(6px, 1.4cqw, 14px); justify-items: start; align-content: center; flex: 1; max-width: min(30em, 62cqw); }
#title h1 { font-family: var(--f-display); font-weight: normal; font-size: clamp(28px, 7cqw, 68px); line-height: 0.95; margin: 0; color: var(--gold); text-wrap: balance; letter-spacing: 0.01em; text-shadow: 0 2px 0 #3a2508, 0 0 24px rgba(232, 191, 98, 0.25); }
#title .tag { font-family: var(--f-prose); font-style: italic; font-size: clamp(14px, 2.1cqw, 20px); line-height: 1.35; color: var(--ink); margin: 0; max-width: 28em; }
#title .tag-code { font-family: var(--f-code); font-style: normal; font-size: clamp(13px, 1.8cqw, 18px); line-height: 1.6; }
#title .tag-code span { display: block; white-space: nowrap; }
#title .tag-code i { font-style: normal; color: var(--ink-dim); margin-right: 0.4em; }
#title .tag-code .py { color: var(--gold); }
#title .tag-code .sql { color: var(--azure); }
#title .studio { font-size: clamp(13px, 1.6cqw, 16px); color: var(--ink-dim); letter-spacing: 0.18em; text-transform: uppercase; }
#titleMenu { width: 100%; max-width: var(--vm-width); font-size: clamp(16px, 2.2cqw, 21px); }
#titleMenu, #titleMenu.vm-menu { margin: 0; --vm-gap: clamp(3px, 0.7cqw, 7px); }
#titleMenu .btn { padding: clamp(0px, 0.3cqw, 4px) 14px; font-size: clamp(16px, 2.2cqw, 21px); }
.legal { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: clamp(12px, 1.5cqw, 15px); }
.legal a { color: var(--ink-dim); text-decoration: none; }
.legal a:hover { color: var(--gold); text-decoration: underline; }
/* (2026-10-13: footer on the main menu only): How to play, the track picker and the journal open over the title, so its links step aside there too */
body:has(.overlay:not(#title):not([hidden])) #title .legal { visibility: hidden; }
.loaderr { color: var(--ember); margin: 6px 0 0; }
.vim-live--palace { position: absolute; top: clamp(8px, 2cqw, 20px); right: clamp(10px, 2.4cqw, 26px); font-family: var(--f-prose); font-style: italic; font-size: clamp(13px, 1.7cqw, 17px); color: var(--ink-dim); }
.vim-live--palace .vim-live__dot { background: var(--gold); animation-name: vim-live-torch; }
@keyframes vim-live-torch { 0% { box-shadow: 0 0 0 0 rgba(232, 191, 98, 0.55); } 70%, 100% { box-shadow: 0 0 0 0.55em rgba(232, 191, 98, 0); } }

.controls { display: grid; grid-template-columns: auto auto; gap: 2px 18px; font-size: clamp(15px, 2cqw, 19px); color: var(--ink-dim); text-align: left; }
.controls span:nth-child(odd) { color: var(--gold); }

/* level card, pause, death, ending */
.card { text-align: center; display: grid; gap: 10px; justify-items: center; max-width: 36em; margin: auto; }
.card .num { font-family: var(--f-display); color: var(--gold); font-size: clamp(20px, 4cqw, 34px); letter-spacing: 0.3em; }
.card h2 { font-family: var(--f-display); font-weight: normal; font-size: clamp(26px, 5.5cqw, 54px); margin: 0; line-height: 1.05; }
.card p { margin: 0; font-family: var(--f-prose); font-size: clamp(15px, 2.1cqw, 20px); color: var(--ink); line-height: 1.4; }
.card .small { font-family: var(--f-ui); font-size: clamp(15px, 2cqw, 18px); color: var(--ink-dim); }
.card .menu { display: flex; gap: 8px 10px; flex-wrap: wrap; justify-content: center; }
#pauseMain { display: grid; gap: 10px; justify-items: center; }
#pauseSettings:empty { display: none; }
#pauseSettings { width: min(22rem, 100%); text-align: left; }
.paperish { background: rgba(23, 22, 31, 0.92); border: 1px solid var(--rule); padding: clamp(10px, 2.4cqw, 22px); box-sizing: border-box; }
.paperish h2 { font-size: clamp(24px, 4cqw, 36px); }
.stats { display: grid; grid-template-columns: auto auto; gap: 2px 18px; font-size: clamp(16px, 2.2cqw, 20px); font-variant-numeric: tabular-nums; }
.stats span:nth-child(even) { color: var(--gold); text-align: right; }
.scroll-body { display: grid; gap: 10px; }

/* the seal console */
.tablet { width: min(1060px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--stone); border: 1px solid var(--rule); box-shadow: 0 0 0 4px #0c0b11, 0 0 0 5px #2e2a3c, 0 30px 80px #000; }
.tablet header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 14px; border-bottom: 1px solid var(--rule); background: var(--stone-2); }
.tablet header h2 { font-family: var(--f-display); font-weight: normal; font-size: 26px; margin: 0; flex: 1; min-width: 0; color: var(--ink); letter-spacing: 0.02em; }
.lang { font-size: 17px; letter-spacing: 0.14em; padding: 0 7px; border: 1px solid currentColor; }
.lang.py { color: var(--gold); }
.lang.sql { color: var(--azure); }
.tablet-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 0; overflow: auto; }
.brief { padding: 14px 16px; border-right: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.brief .lesson { font-family: var(--f-prose); font-size: 18px; line-height: 1.45; margin: 0; color: var(--ink); }
.brief .task { font-family: var(--f-prose); font-size: 19px; line-height: 1.45; margin: 0; padding: 10px 12px; background: #1b1823; box-shadow: inset 1px 1px 0 #050409, inset -1px -1px 0 #2e2a3d; }
.brief .task::before { content: "Your task: "; font-family: var(--f-ui); color: var(--gold); font-size: 18px; letter-spacing: 0.05em; }
code { font-family: var(--f-code); font-size: 0.82em; background: #2a2636; padding: 1px 4px; color: #f2e6c4; }
.carried { font-size: 18px; color: var(--ink-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.carried button { background: none; border: 0; border-bottom: 1px dotted var(--gold-deep); color: var(--gold); cursor: pointer; padding: 0; font-size: 18px; }
.tbl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }  /* a wide table scrolls in its own box instead of pushing the column (and covering Run) */
.tbl .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 18px; }
.tbl .head b { color: var(--azure); font-weight: normal; }
.tbl .head i { color: var(--ink-dim); font-style: normal; font-family: var(--f-code); font-size: 13px; }
.tbl .head button { margin-left: auto; font-size: 16px; padding: 0 8px; }
.grid-wrap { overflow-x: auto; max-height: 220px; overflow-y: auto; border: 1px solid var(--rule); }
table.rows { border-collapse: collapse; font-family: var(--f-code); font-size: 12.5px; width: 100%; font-variant-numeric: tabular-nums; }
table.rows th, table.rows td { padding: 3px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid #26232f; }
table.rows th { position: sticky; top: 0; background: #262231; color: var(--azure); font-weight: 500; }
table.rows td.n { text-align: right; }
.work { padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.editor { display: grid; grid-template-columns: auto minmax(0, 1fr); background: var(--code-bg); border: 1px solid var(--rule); min-height: 170px; }
.editor .gutter { margin: 0; padding: 10px 6px 10px 10px; font-family: var(--f-code); font-size: 14px; line-height: 1.55; color: #4d4862; text-align: right; user-select: none; overflow: hidden; }
.editor textarea { background: transparent; border: 0; color: var(--ink); font-family: var(--f-code); font-size: 14px; line-height: 1.55; padding: 10px 10px 10px 6px; resize: vertical; min-height: 170px; outline: none; caret-color: var(--gold); tab-size: 4; white-space: pre; overflow: auto; }
.editor:focus-within { border-color: var(--gold-deep); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar .spacer { flex: 1; }
.bar .note { font-size: 16px; color: var(--ink-dim); }
.out { background: #0b0a10; border: 1px solid var(--rule); font-family: var(--f-code); font-size: 13px; line-height: 1.5; padding: 8px 10px; min-height: 48px; max-height: 240px; overflow: auto; white-space: pre-wrap; color: #d6d0c0; }
.out .err { color: var(--ember); }
.out .dim { color: var(--ink-dim); font-family: var(--f-ui); font-size: 17px; }
.out table.rows { font-size: 12px; }
.verdict { font-family: var(--f-prose); font-size: 18px; line-height: 1.4; min-height: 1.4em; }
.verdict.ok { color: var(--jade); }
.verdict.no { color: #f0a58f; }
.verdict .expected { display: block; margin-top: 6px; font-family: var(--f-code); font-size: 13px; color: var(--ink-dim); white-space: pre-wrap; }
.hintbox { font-family: var(--f-prose); font-size: 17px; color: var(--gold); white-space: pre-wrap; }
.hintbox code, .hintbox pre { color: #f2e6c4; }
.hintbox pre { font-family: var(--f-code); font-size: 13px; background: var(--code-bg); padding: 6px 8px; margin: 4px 0 0; overflow-x: auto; color: #f2e6c4; }
.stamp { display: inline-block; font-family: var(--f-display); color: var(--jade); border: 2px solid var(--jade); padding: 0 10px; transform: rotate(-4deg); font-size: 22px; animation: stamp 0.35s ease-out; }
@keyframes stamp { from { transform: rotate(-4deg) scale(1.6); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }

/* the parchment scroll */
.scroll { width: min(640px, 100%); max-height: 100%; overflow: auto; background: radial-gradient(ellipse at center, var(--parch) 55%, var(--parch-edge) 120%); color: var(--parch-ink); padding: 22px 26px 18px; box-sizing: border-box; box-shadow: 0 0 0 2px #6d5530, 0 30px 80px #000; display: grid; gap: 12px; }
.scroll .kicker { font-family: var(--f-ui); font-size: 18px; letter-spacing: 0.16em; color: #7a5a2c; text-transform: uppercase; }
.scroll h2 { font-family: var(--f-display); font-weight: normal; font-size: 32px; margin: 0; line-height: 1.05; text-wrap: balance; }
.scroll p { font-family: var(--f-prose); font-size: 19px; line-height: 1.5; margin: 0; max-width: 34em; }
.scroll code { background: #d9c493; color: #2b1d10; }
.scroll .try { display: grid; gap: 6px; }
.scroll .try textarea { font-family: var(--f-code); font-size: 13.5px; line-height: 1.5; background: #231a12; color: #f1e3c2; border: 0; padding: 10px; resize: vertical; min-height: 96px; tab-size: 4; white-space: pre; outline: none; caret-color: var(--gold); }
.scroll .try .out { background: #18120c; border-color: #4b3a24; color: #efe2c6; }
.scroll .btn { border-color: #7a5a2c; color: var(--parch-ink); }
.scroll .btn:hover { color: #000; border-color: #3a2716; }
.scroll .btn.main { background: #3a2716; color: var(--parch); border-color: #3a2716; }

/* carving */
.carving { width: min(560px, 100%); max-height: 100%; overflow: auto; background: #4a4655; color: #f2efe8; padding: 20px 22px; box-sizing: border-box; display: grid; gap: 12px; box-shadow: inset 0 0 40px #27242f, 0 0 0 2px #2a2733, 0 30px 80px #000; }
.carving h2 { font-family: var(--f-display); font-weight: normal; margin: 0; font-size: 26px; }
.carving pre { margin: 0; font-family: var(--f-code); font-size: 15px; line-height: 1.55; background: #34313d; padding: 10px 12px; color: #fff4d6; overflow-x: auto; box-shadow: inset 1px 1px 0 #24212b, inset -1px -1px 0 #5b5766; }
.carving p { font-family: var(--f-prose); font-size: 18px; margin: 0; line-height: 1.4; }
.carving .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.carving .opts button { font-family: var(--f-code); font-size: 15px; background: #3a3644; border: 1px solid #6a6577; color: #fff; padding: 8px; cursor: pointer; }
.carving .opts button:hover { border-color: var(--gold); }
.carving .opts button.wrong { border-color: var(--ember); color: #f5b4a3; text-decoration: line-through; }
.carving .opts button.right { border-color: var(--jade); color: var(--jade); }
.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* journal */
.journal { width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--stone); border: 1px solid var(--rule); }
.journal header { display: flex; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--rule); gap: 12px; }
.journal header h2 { font-family: var(--f-display); font-weight: normal; margin: 0; flex: 1; font-size: 26px; }
.journal .list { overflow: auto; padding: 12px 14px; display: grid; gap: 14px; }
.journal h3 { margin: 0 0 4px; font-family: var(--f-ui); font-weight: normal; color: var(--gold); font-size: 20px; letter-spacing: 0.06em; }
.journal ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; }
.journal li button { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font-size: 20px; text-align: left; }
.journal li button:hover { color: var(--gold); }
.journal li.missing { color: #5a556a; }
.journal h3 .k, .journal li .k { font-size: 15px; color: var(--ink-dim); margin-left: 6px; }

/* phone controls */
#pad { display: none; width: 100%; max-width: 760px; justify-content: space-between; gap: 10px; user-select: none; -webkit-user-select: none; touch-action: none; }
.cluster { display: grid; gap: 6px; }
.dpad { grid-template-columns: repeat(3, minmax(0, 54px)); grid-template-rows: repeat(2, 50px); }   /* may narrow on 360 px phones */
.acts { grid-template-columns: repeat(3, minmax(0, 58px)); grid-template-rows: repeat(2, 50px); }
.pb { background: #17151f; border: 1px solid #343046; color: var(--ink); font-family: var(--f-ui); font-size: 19px; border-radius: 6px; display: flex; align-items: center; justify-content: center; touch-action: none; padding: 0; }
.pb.on { background: #3a3150; border-color: var(--gold-deep); color: var(--gold); }
.pb.toggle.lit { border-color: var(--gold); color: var(--gold); }
@media (pointer: coarse) {
  #pad { display: flex; }
  #keysline { display: none; }
  #stage { width: min(100%, calc((100dvh - 150px) * 320 / 208)); }
  .esc-hint { display: none; }
}
@media (pointer: coarse) and (orientation: portrait) {
  .dpad { grid-template-rows: repeat(2, 60px); }
  .acts { grid-template-rows: repeat(2, 60px); }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  #app { padding: 0; }
  #stage { width: min(calc(100vw - 360px), calc((100dvh - 8px) * 320 / 208)); }
  #pad { position: fixed; inset: auto 0 calc(10px + env(safe-area-inset-bottom, 0px)) 0; max-width: none; padding-inline: max(8px, env(safe-area-inset-left, 0px)); box-sizing: border-box; pointer-events: none; z-index: 4; }
  #pad .cluster { pointer-events: auto; }
  .dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 54px); }
  .acts { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 54px); }
  .pb { font-size: 17px; }
}
@media (max-width: 760px) {
  .esc-hint { display: none; }
  .tablet header h2 { font-size: 22px; }
  .tablet-body { grid-template-columns: minmax(0, 1fr); }
  .brief { border-right: 0; border-bottom: 1px solid var(--rule); }
  .overlay.full { padding: 0; }
  .tablet, .journal { height: 100%; }
  .carving .opts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .title-col { max-width: 100%; }
  .legal { gap: 0 10px; }
}
/* small screens: menus and cards take the whole window instead of the small game screen */
@media (max-height: 640px), (max-width: 700px) {
  .overlay, .overlay.clear { position: fixed; z-index: 20; background: rgba(6, 5, 10, 0.96); }
  #title { justify-content: flex-start; }
  .title-col { flex: 0 0 auto; max-width: 30em; margin: auto 0; padding-block: 8px; }
  .card { margin: auto; }
  #title .tag { display: block; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .title-col { grid-template-columns: minmax(0, 1fr) minmax(0, 18rem); grid-template-rows: auto auto auto 1fr; column-gap: 28px; max-width: 46rem; }
  .title-col > :not(#titleMenu) { grid-column: 1; }
  #titleMenu { grid-column: 2; grid-row: 1 / span 4; --vm-gap: 4px; }
  #titleMenu .btn { padding-block: 0; font-size: 16px; min-height: 2.2rem; }
}
#rotateHint { display: none; margin: 0; font-family: var(--f-prose); font-style: italic; font-size: 16px; color: var(--ink-dim); text-align: center; }
@media (pointer: coarse) and (orientation: portrait) { #rotateHint { display: block; } }
@media (prefers-reduced-motion: reduce) { .stamp, .shake { animation: none; } }

/* the help each practice gives, as a coloured badge */
.helpbadge { display: inline-block; font-family: var(--f-ui); font-weight: normal; font-size: 17px; letter-spacing: 0.06em; padding: 0 7px; margin-right: 4px; border: 1px solid currentColor; }
.helpbadge.h-guided { color: var(--jade); }
.helpbadge.h-some { color: var(--gold); }
.helpbadge.h-alone { color: #f0a58f; }
.helpbadge.h-recall { color: var(--azure); }
.scroll-tables { font-family: var(--f-ui); font-size: 16px; color: #7a5a2c; }

/* choose Python or SQL */
.picker { width: min(760px, 100%); max-height: 100%; overflow: auto; background: var(--stone); border: 1px solid var(--rule); display: flex; flex-direction: column; }
.picker header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.picker header h2 { flex: 1; margin: 0; font-family: var(--f-display); font-weight: normal; font-size: 28px; }
.pick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 16px; }
.pick { border: 1px solid var(--rule); padding: 16px; display: grid; gap: 10px; align-content: start; background: #1c1a25; }
.pick h3 { margin: 0; font-family: var(--f-display); font-weight: normal; font-size: 34px; }
.pick-py h3 { color: var(--gold); }
.pick-sql h3 { color: var(--azure); }
.pick p { margin: 0; font-family: var(--f-prose); font-size: 18px; line-height: 1.4; }
.pick .status { font-family: var(--f-ui); font-size: 18px; color: var(--ink-dim); }
.pick .menu { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .pick-list { grid-template-columns: minmax(0, 1fr); } .overlay.full .picker { height: 100%; } }

/* ---- terminal: the code runs here like it would on your own computer, right or wrong */
.out.term { background: #050507; border-color: #2b2836; color: #d9d3c3; white-space: normal; padding: 8px 12px 10px; font-size: 13px; line-height: 1.45; box-shadow: inset 0 0 0 1px #000, inset 0 10px 24px rgba(0, 0, 0, 0.6); }
.term > div { white-space: pre-wrap; word-break: break-word; }
.term .t-cmd { color: #bdb6a4; }
.term .t-ps { color: var(--gold); font-weight: 500; }
.term.sql .t-ps { color: var(--azure); }
.term .t-out { color: #ece5d3; }
.term .t-box { white-space: pre; overflow-x: auto; line-height: 1.35; color: #ece5d3; margin: 2px 0; }
.term .t-err { color: #f08a6c; }
.term .t-dim { color: #6f6a7c; font-style: normal; }
.term .t-note { color: #e9d8b0; font-family: var(--f-prose); font-size: 16px; line-height: 1.35; margin: 6px 0 2px; white-space: normal; }
.term .t-caret { display: inline-block; width: 0.6em; height: 1.05em; margin-left: 2px; vertical-align: -0.18em; background: #d9d3c3; animation: tblink 1.06s steps(1) infinite; }
@keyframes tblink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term .t-caret { animation: none; } }
.scroll .try .out.term { background: #050507; border-color: #4b3a24; color: #d9d3c3; }

/* ================================================================ menus, 2026-10-02
   Carved stone, lit by torches. Panels are stone slabs with stepped pixel corners and a carved bevel (light on the
   top left, shadow on the bottom right, as the tiles are lit). Menu items are words cut into the stone, not boxes:
   the one you point at gets torchlight and the silver key from the chests turns beside it. */
:root {
  --slab: #15131c;
  --slab-2: #1c1a26;
  --bev-hi: #423d58;
  --bev-lo: #040307;
  --groove-hi: #2f2b3f;
  --notch: 6px;
}
::selection { background: rgba(232, 191, 98, 0.35); color: #fff7e2; }
* { scrollbar-color: #3a3550 #0b0a10; scrollbar-width: thin; }

/* buttons: small carved plates */
.btn { background: linear-gradient(#1e1b28, #15131c); border: 1px solid #000; box-shadow: inset 1px 1px 0 var(--bev-hi), inset -1px -1px 0 var(--bev-lo); color: var(--ink); transition: color 0.12s, box-shadow 0.12s, background-color 0.12s; }
.btn:hover { color: var(--gold); border-color: #000; box-shadow: inset 1px 1px 0 #6a5a3a, inset -1px -1px 0 var(--bev-lo), inset 0 0 14px rgba(232, 191, 98, 0.12); }
.btn:active:not([disabled]) { box-shadow: inset 1px 1px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi); transform: translateY(1px); }
.btn.main { background: linear-gradient(#f0cd7a, #d9a945); border-color: #3a2508; color: #1b130a; box-shadow: inset 1px 1px 0 #fbe6ad, inset -1px -1px 0 #8a6420; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.45); }
.btn.main:hover { background: linear-gradient(#f7da92, #e4b552); color: #1b130a; box-shadow: inset 1px 1px 0 #fff0c4, inset -1px -1px 0 #8a6420, 0 0 16px rgba(232, 191, 98, 0.3); }
.btn.main:active:not([disabled]) { box-shadow: inset 1px 1px 0 #8a6420, inset -1px -1px 0 #fbe6ad; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* the stone slab every menu sits on */
.slab { position: relative; isolation: isolate; filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.75)); background: none; border: 0; }
.slab::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 190, 110, 0.07), transparent 60%),
    linear-gradient(180deg, var(--slab-2), var(--slab));
  box-shadow: inset 2px 2px 0 var(--bev-hi), inset -2px -2px 0 var(--bev-lo), inset 0 0 0 3px #0c0b12, inset 4px 4px 0 #26223a;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, calc(100% - var(--notch)) 2px, calc(100% - 2px) 2px, calc(100% - 2px) var(--notch), 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - 2px) calc(100% - var(--notch)), calc(100% - 2px) calc(100% - 2px), calc(100% - var(--notch)) calc(100% - 2px), calc(100% - var(--notch)) 100%, var(--notch) 100%, var(--notch) calc(100% - 2px), 2px calc(100% - 2px), 2px calc(100% - var(--notch)), 0 calc(100% - var(--notch)), 0 var(--notch), 2px var(--notch), 2px 2px, var(--notch) 2px); }
.card.slab { padding: clamp(14px, 3cqw, 30px) clamp(18px, 4cqw, 40px); box-sizing: border-box; gap: clamp(8px, 1.6cqw, 14px); }
.card h2 { color: var(--gold); text-shadow: 0 2px 0 #2a1a06; letter-spacing: 0.01em; }
.paperish.slab { background: none; border: 0; }

/* a carved groove between groups */
.groove { height: 2px; border: 0; margin: 0; background: linear-gradient(var(--bev-lo) 0 1px, var(--groove-hi) 1px 2px); }

/* ---- the title menu: words cut into the stone */
#titleMenu.vm-menu { --vm-gap: 0px; max-width: 21rem; }
#titleMenu .vm-list { display: flex; flex-flow: row wrap; gap: 0; align-items: center; }
#titleMenu .vm-item.btn { position: relative; flex: 1 1 100%; min-height: 0; align-items: flex-start; text-align: left; background: none; border: 0; box-shadow: none; transform: none;
  padding: clamp(1px, 0.35cqw, 4px) 10px clamp(1px, 0.35cqw, 4px) clamp(30px, 4cqw, 44px); font-size: clamp(17px, 2.3cqw, 23px); color: var(--ink); letter-spacing: 0.04em; text-shadow: 0 1px 0 #000; }
#titleMenu .vm-item.btn::before { content: ""; position: absolute; left: clamp(4px, 0.8cqw, 8px); top: 50%; width: 32px; height: 32px; margin-top: -16px; transform: scale(var(--kscale, 0.75)); transform-origin: left center;
  background: url("assets/key.png") 0 0 / 384px 32px no-repeat; image-rendering: pixelated; opacity: 0; transition: opacity 0.12s; }
#titleMenu .vm-item.btn::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.18s;
  background: radial-gradient(60% 120% at 12% 50%, rgba(255, 176, 84, 0.22), transparent 70%); }
#titleMenu .vm-item.btn:not([disabled]):hover, #titleMenu .vm-item.btn:focus-visible { color: var(--gold); }
#titleMenu .vm-item.btn:not([disabled]):hover::before, #titleMenu .vm-item.btn:focus-visible::before { opacity: 1; animation: keyturn 0.9s steps(12) infinite; }
#titleMenu .vm-item.btn:not([disabled]):hover::after, #titleMenu .vm-item.btn:focus-visible::after { opacity: 1; }
#titleMenu .vm-item.btn:focus-visible { outline: none; }
@keyframes keyturn { to { background-position: -384px 0; } }
#titleMenu .vm-item[disabled] { color: #5b566b; filter: none; opacity: 1; text-shadow: none; }
#titleMenu .vm-sub { font-family: var(--f-prose); font-style: italic; font-size: clamp(12px, 1.5cqw, 15px); letter-spacing: 0; color: var(--ink-dim); opacity: 1; margin-top: 0; }
/* the two ways in are the biggest words */
#titleMenu .vm-item[data-vm="continue"], #titleMenu .vm-item[data-vm="new"] { font-family: var(--f-display); font-size: clamp(21px, 3.2cqw, 33px); letter-spacing: 0.02em; color: var(--gold); line-height: 1.05; }
#titleMenu .vm-item[data-vm="continue"][disabled] { display: none; }
#titleMenu .vm-item[data-vm="continue"]:not([disabled]) ~ .vm-item[data-vm="new"] { font-size: clamp(17px, 2.4cqw, 24px); color: var(--ink); }
/* a groove, then the rest; the last three sit small on one line */
#titleMenu .vm-list > .vm-item[data-vm="load"] { margin-top: clamp(4px, 0.9cqw, 10px); border-top: 1px solid var(--bev-lo); box-shadow: inset 0 1px 0 var(--groove-hi); padding-top: clamp(4px, 0.9cqw, 10px); }
#titleMenu .vm-item[data-vm="feedback"], #titleMenu .vm-item[data-vm="credits"], #titleMenu .vm-item[data-vm="exit"] { flex: 0 0 auto; width: auto; font-size: clamp(14px, 1.7cqw, 17px); color: var(--ink-dim); padding-left: clamp(30px, 4cqw, 44px); padding-right: 0; }
#titleMenu .vm-item[data-vm="feedback"] { margin-top: clamp(4px, 0.9cqw, 10px); }
#titleMenu .vm-item[data-vm="credits"], #titleMenu .vm-item[data-vm="exit"] { margin-top: clamp(4px, 0.9cqw, 10px); padding-left: 14px; }
#titleMenu .vm-item[data-vm="credits"]::before, #titleMenu .vm-item[data-vm="exit"]::before, #titleMenu .vm-item[data-vm="feedback"]::before { display: none; }
/* the panels the menu opens (load, settings, credits) sit on a slab of their own */
#titleMenu .vm-panel { position: relative; isolation: isolate; padding: 14px 16px; --vm-gap: 8px; }
#titleMenu .vm-panel::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--slab-2), var(--slab)); box-shadow: inset 2px 2px 0 var(--bev-hi), inset -2px -2px 0 var(--bev-lo); }
#titleMenu .vm-panel .vm-h { font-family: var(--f-display); font-weight: normal; color: var(--gold); font-size: clamp(22px, 3cqw, 30px); }
#titleMenu .vm-panel .btn { padding: 2px 12px; }
.vm-slider input[type="range"] { accent-color: var(--gold); }

/* title backdrop: a carved slab behind the words, the palace showing on the right */
#title.overlay.clear { background: linear-gradient(90deg, rgba(4, 3, 8, 0.92) 0%, rgba(4, 3, 8, 0.78) 38%, rgba(4, 3, 8, 0.25) 70%, rgba(4, 3, 8, 0.1) 100%); }
#title h1 { text-shadow: 0 2px 0 #3a2508, 0 3px 0 #120b02, 0 0 30px rgba(232, 191, 98, 0.22); }

/* ---- pause: the ledger on one side, the way on on the other */
#pause .card.slab { max-width: 40rem; width: min(40rem, 100%); }
#pauseMain { grid-template-columns: minmax(0, 1fr) minmax(0, 13rem); grid-template-areas: "h h" "stats menu"; column-gap: clamp(16px, 3cqw, 32px); align-items: start; justify-items: stretch; text-align: left; }
#pauseMain h2 { grid-area: h; text-align: center; }
#pauseMain .stats { grid-area: stats; }
#pauseMain .menu { grid-area: menu; }
.stats { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; color: var(--ink); }
.stats span:nth-child(odd) { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.stats span:nth-child(odd)::after { content: ""; flex: 1; border-bottom: 2px dotted #3a3550; transform: translateY(-4px); min-width: 12px; }
.stats span:nth-child(even) { text-align: right; color: var(--gold); white-space: nowrap; }
/* menus inside cards: a column of carved plates, the first one gold */
.card .menu { display: grid; gap: 6px; justify-content: stretch; width: 100%; }
#death .card .btn, #ending .card .menu { justify-self: center; }
#ending .card .menu { width: auto; grid-auto-flow: column; }
.card .menu .btn { text-align: left; padding: 3px 14px 4px; }
.card .menu .btn.main { text-align: center; }
#pauseSettings .vm-panel { --vm-gap: 8px; }
#pauseSettings .vm-h { font-family: var(--f-display); font-weight: normal; color: var(--gold); font-size: clamp(24px, 3.4cqw, 34px); }

/* ---- level card: the level number cut large beside its name */
.card.lc { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "num words" "key key"; align-items: center; text-align: left; column-gap: clamp(14px, 3cqw, 30px); max-width: 38rem; }
.card.lc .num { grid-area: num; width: clamp(64px, 11cqw, 110px); aspect-ratio: 1; display: grid; place-items: center; font-family: var(--f-display); font-size: clamp(40px, 8cqw, 80px); letter-spacing: 0; line-height: 1; color: var(--gold);
  background: radial-gradient(circle at 40% 35%, #2a2636, #100e16 70%); border-radius: 50%; box-shadow: inset 2px 2px 0 var(--bev-hi), inset -2px -2px 0 var(--bev-lo), 0 0 0 3px #0a090f, 0 0 0 4px #34304a; text-shadow: 0 2px 0 #2a1a06; padding-bottom: 0.08em; box-sizing: border-box; }
.card.lc .num.sql { color: var(--azure); text-shadow: 0 2px 0 #0b1a33; }
.card.lc .lc-words { grid-area: words; display: grid; gap: 6px; }
.card.lc h2 { color: var(--ink); }
.card.lc p { color: var(--ink-dim); font-style: italic; }
.card.lc .small { grid-area: key; justify-self: center; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

/* ---- death and ending */
#death h2 { color: #f0a58f; text-shadow: 0 2px 0 #2a0c06; }
.stamp.big { font-size: clamp(22px, 3.4cqw, 34px); padding: 0 14px; border-width: 3px; }

/* ---- choose Python or SQL: two doors */
.picker.slab { background: none; border: 0; }
.picker.slab header { border-bottom: 0; box-shadow: inset 0 -1px 0 var(--bev-lo), 0 1px 0 var(--groove-hi); padding: 14px 20px 12px; }
.picker header h2 { color: var(--gold); text-shadow: 0 2px 0 #2a1a06; }
.pick-list { padding: 18px 20px 20px; gap: 16px; }
.pick { background: linear-gradient(180deg, #121019, #0d0c12); border: 1px solid #000; box-shadow: inset 1px 1px 0 #2c283b, inset -1px -1px 0 var(--bev-lo); justify-items: start; position: relative; overflow: hidden; }
.pick::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 150px; pointer-events: none; opacity: 0.9; }
.pick-py::before { background: radial-gradient(60% 100% at 50% 0%, rgba(232, 191, 98, 0.16), transparent 70%); }
.pick-sql::before { background: radial-gradient(60% 100% at 50% 0%, rgba(134, 182, 255, 0.16), transparent 70%); }
.pick-door { width: 96px; height: 96px; justify-self: center; background-repeat: no-repeat; background-size: 576px 96px; background-position: 0 0; image-rendering: pixelated; margin: -4px 0 -6px; }
.pick-door.open { background-position: -480px 0; }
.pick:hover .pick-door { animation: dooropen 0.5s steps(5) forwards; }
@keyframes dooropen { to { background-position: -480px 0; } }
.pick h3 { justify-self: center; text-shadow: 0 2px 0 #000; }
.pick .menu { justify-self: stretch; }
.pick .menu .btn { flex: 1; }
.pick .status { justify-self: stretch; text-align: center; border-top: 1px solid var(--bev-lo); box-shadow: inset 0 1px 0 #24202f; padding-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  #titleMenu .vm-item.btn:hover::before, #titleMenu .vm-item.btn:focus-visible::before, .pick:hover .pick-door, .card.lc .small { animation: none; }
}
@media (max-width: 700px), (max-height: 640px) {
  #title.overlay.clear { background: radial-gradient(120% 90% at 85% 40%, rgba(232, 191, 98, 0.06), transparent 60%), rgba(6, 5, 10, 0.97); }
  #pauseMain { grid-template-columns: minmax(0, 1fr); grid-template-areas: "h" "stats" "menu"; }
  .card.slab { width: min(30rem, 100%); }
}
@media (max-height: 560px) {
  .pick-door { width: 48px; height: 48px; background-size: 288px 48px; margin: -6px 0 -4px; }
  .pick-door.open, .pick:hover .pick-door { background-position: -240px 0; animation: none; }
  .pick { padding: 10px 14px; gap: 6px; }
  .pick h3 { font-size: 26px; }
  .pick p { font-size: 16px; }
  .pick-list { padding: 10px 14px 14px; gap: 10px; }
  .picker.slab header { padding: 8px 14px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #titleMenu .vm-item.btn { min-height: 0; font-size: 16px; padding-block: 1px; }
  #titleMenu .vm-item[data-vm="continue"], #titleMenu .vm-item[data-vm="new"] { font-size: 22px; }
  #titleMenu .vm-item[data-vm="continue"]:not([disabled]) ~ .vm-item[data-vm="new"] { font-size: 18px; }
  #titleMenu .vm-item[data-vm="feedback"], #titleMenu .vm-item[data-vm="credits"], #titleMenu .vm-item[data-vm="exit"] { font-size: 14px; }
  #pause .card.slab { max-width: 46rem; width: min(46rem, 100%); }
  #pauseMain { grid-template-columns: minmax(0, 1fr) minmax(0, 13rem); grid-template-areas: "h h" "stats menu"; }
}
/* buttons on the parchment scroll: pressed paper, not stone */
.scroll .btn { background: linear-gradient(#f1e3c2, #dcc79a); border: 1px solid #6d5530; color: var(--parch-ink); box-shadow: inset 1px 1px 0 #fff6dc, inset -1px -1px 0 #a88a55; }
.scroll .btn:hover { color: #000; border-color: #3a2716; box-shadow: inset 1px 1px 0 #fff6dc, inset -1px -1px 0 #a88a55, 0 0 10px rgba(122, 90, 44, 0.35); }
.scroll .btn.main { background: linear-gradient(#4a3420, #33220f); color: var(--parch); border-color: #1d1206; box-shadow: inset 1px 1px 0 #6e5236, inset -1px -1px 0 #160d04; text-shadow: none; }
.scroll .btn.main:hover { background: linear-gradient(#56402a, #3a2716); color: #fff3d6; }

/* vm-mute room (2026-10-04): the site-wide mute button from /assets/menu.js sits in the top right corner. */
.vim-live--palace{right:calc(clamp(10px, 2.4cqw, 26px) + 50px)}
