/* Back When We Were Little — warm, minimal, pixel-edged interface (built-in fonts only). */
:root {
  --ink: #2b1a10;
  --ink-soft: #5a3a24;
  --cream: #fbf0dc;
  --paper: #f3e1c1;
  --paper-2: #e9cfa3;
  --brown: #7a4a2a;
  --gold: #d9a441;
  --deep: #1c110b;
  --rose: #b2563a;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tscale: 1;
  --font: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
  --box-x: 0px; --box-y: 0px; --box-w: 100vw; --box-h: 100vh; --side-w: 0px;
}
body[data-text="large"] { --tscale: 1.15; }
body[data-text="larger"] { --tscale: 1.32; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--deep); color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { position: fixed; inset: 0; }

#safe-probe {
  position: fixed; visibility: hidden; pointer-events: none; inset: 0;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
}
#game {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  image-rendering: pixelated; image-rendering: crisp-edges;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
img { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- pixel panels ---------- */
.panel {
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 4px var(--paper-2), 0 6px 0 rgba(0,0,0,.35);
  clip-path: polygon(0 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px));
}
h1, h2, h3 { font-weight: normal; margin: 0; color: var(--ink); }

.btn {
  font: inherit; font-size: calc(clamp(14px, 1.2vw + 0.9vh, 20px) * var(--tscale));
  color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); padding: .5em 1.1em; cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--paper-2), inset 3px 3px 0 #fff8ea;
  min-height: 44px; touch-action: manipulation;
}
.btn:hover:not(:disabled) { background: #fff4df; }
.btn:active:not(:disabled) { box-shadow: inset 3px 3px 0 var(--paper-2); transform: translateY(1px); }
.btn:focus-visible, .chip-btn:focus-visible, .lt-item:focus-visible, .seg button:focus-visible, .choice:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--gold); box-shadow: inset -3px -3px 0 #b07f2a, inset 3px 3px 0 #f4cf7c; }
.btn.primary:hover:not(:disabled) { background: #e5b252; }
.btn.danger { background: #e8b6a2; box-shadow: inset -3px -3px 0 #c98d77, inset 3px 3px 0 #f7d6c8; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { font-size: calc(clamp(12px, .9vw + .7vh, 16px) * var(--tscale)); padding: .35em .8em; min-height: 36px; }

.menu { display: flex; flex-direction: column; gap: .55em; align-items: stretch; }
.row { display: flex; gap: .7em; justify-content: flex-end; flex-wrap: wrap; margin-top: 1em; }
.small { font-size: calc(clamp(12px, .8vw + .8vh, 16px) * var(--tscale)); color: var(--ink-soft); }
.note { font-size: 13px; color: var(--ink-soft); margin: .6em 0 0; text-align: center; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
[hidden], .screen[hidden] { display: none !important; }
#loading { flex-direction: column; gap: 14px; color: var(--paper); font-style: italic; font-size: 18px; text-align: center; padding: 20px; }
.ld-track { width: min(320px, 70vw); height: 10px; border: 2px solid var(--paper-2); }
#loading-bar { height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#loading ul { text-align: left; font-style: normal; font-size: 14px; }

#title { opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
#title.on { opacity: 1; pointer-events: auto; }
.title-panel {
  width: min(calc(var(--box-w) * 0.46), 460px); min-width: 280px;
  padding: clamp(14px, 3vh, 30px) clamp(16px, 2.4vw, 32px);
  text-align: center; background: rgba(251, 240, 220, 0.94);
  max-height: calc(100vh - 24px); overflow: auto;
}
.title-panel h1 { font-size: calc(clamp(22px, 2.2vw + 2vh, 44px) * var(--tscale)); line-height: 1.1; letter-spacing: .01em; }
.subtitle { font-style: italic; color: var(--ink-soft); margin: .6em 0 1.1em; font-size: calc(clamp(13px, .8vw + 1vh, 19px) * var(--tscale)); }

#end { flex-direction: column; color: var(--paper); text-align: center; opacity: 0; transition: opacity 2.5s ease; }
#end.on { opacity: 1; }
#end h1 { color: var(--paper); font-size: clamp(26px, 3vw + 2vh, 56px); }
#end .the-end { font-style: italic; font-size: clamp(18px, 1.5vw + 1.5vh, 30px); margin: .4em 0 1.4em; color: var(--paper-2); }
#end .menu { width: min(320px, 80vw); }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 10, 5, .55); opacity: 0; transition: opacity .25s ease;
  padding: max(10px, var(--safe-t)) max(10px, var(--safe-r)) max(10px, var(--safe-b)) max(10px, var(--safe-l));
}
.modal.on { opacity: 1; }
.modal[hidden] { display: none; }
#confirm { z-index: 60; }
#pause { z-index: 50; }
#howto, #settings, #ios-help { z-index: 55; }
.modal-box {
  width: min(640px, 100%); max-height: 100%; overflow: auto; padding: clamp(14px, 3vh, 26px) clamp(16px, 3vw, 30px);
  font-size: calc(clamp(14px, .9vw + 1vh, 19px) * var(--tscale)); touch-action: pan-y;
}
.modal-box.narrow { width: min(400px, 100%); }
.modal-box h2 { font-size: 1.5em; margin-bottom: .5em; }
.modal-box h3 { font-size: 1.1em; margin: .4em 0; color: var(--brown); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.keys { list-style: none; padding: 0; margin: 0; line-height: 1.9; }
kbd { font-family: inherit; background: var(--paper); border: 2px solid var(--ink); padding: 0 .35em; font-size: .85em; }
.confirm-text { font-size: 1.1em; margin: .3em 0; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin: .6em 0; flex-wrap: wrap; }
.seg { display: flex; flex-wrap: wrap; border: 3px solid var(--ink); }
.seg button { font: inherit; font-size: .9em; background: var(--paper); border: 0; border-right: 2px solid var(--ink); padding: .4em .7em; cursor: pointer; min-height: 40px; color: var(--ink); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--gold); }
input[type=range] { width: min(220px, 50vw); accent-color: var(--brown); }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 20; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 8px) 0 calc(var(--safe-l) + 8px); }
#hud[hidden] { display: none; }
.hud-left, .hud-right { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: auto; }
.hud-right { justify-content: flex-end; }
.chip, .chip-btn {
  font-family: var(--font); font-size: calc(clamp(12px, .7vw + .9vh, 18px) * var(--tscale));
  background: rgba(251, 240, 220, .92); color: var(--ink); border: 3px solid var(--ink);
  padding: .3em .7em; line-height: 1.2; box-shadow: inset -2px -2px 0 var(--paper-2);
}
.chip-btn { cursor: pointer; min-height: 40px; touch-action: manipulation; }
.chip-btn:active { transform: translateY(1px); }
.tag-chip { border-left: 10px solid var(--tag, var(--gold)); }

.prompt {
  position: fixed; z-index: 15; transform: translate(-50%, -100%); pointer-events: none;
  background: rgba(251, 240, 220, .95); border: 3px solid var(--ink); padding: .25em .7em;
  font-size: calc(clamp(12px, .6vw + .9vh, 18px) * var(--tscale)); white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.prompt[hidden] { display: none; }

/* ---------- dialogue ---------- */
#dialogue-catcher { position: fixed; inset: 0; z-index: 12; touch-action: none; cursor: pointer; }
#dialogue-catcher[hidden] { display: none; }
#dialogue {
  position: fixed; z-index: 14; left: 50%; bottom: calc(var(--safe-b) + 10px);
  width: min(calc(100% - 20px - var(--safe-l) - var(--safe-r)), max(calc(var(--box-w) * 0.86), 560px), 1040px);
  transform: translate(-50%, 12px); opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none;
  background: rgba(251, 240, 220, .96); border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--paper-2), 0 5px 0 rgba(0,0,0,.35);
  padding: .55em 1em .7em; min-height: 3.2em;
  font-size: calc(clamp(15px, .9vw + 1.5vh, 27px) * var(--tscale));
}
#dialogue.on { opacity: 1; transform: translate(-50%, 0); }
#dialogue .name {
  display: inline-block; font-size: .78em; letter-spacing: .04em; color: #fff8ea;
  background: var(--tag, var(--brown)); border: 3px solid var(--ink); padding: 0 .55em; margin: -1.25em 0 .2em -.2em;
}
#dialogue .text { line-height: 1.35; min-height: 1.35em; }
#dialogue .hint { position: absolute; right: .7em; bottom: .45em; width: 0; height: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--brown); opacity: 0; }
#dialogue .hint.on { opacity: 1; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

#narration {
  position: fixed; z-index: 14; left: 50%; top: 40%; transform: translate(-50%, -50%);
  width: min(86vw, 900px); text-align: center; pointer-events: none;
  color: #fff6e4; font-style: italic; line-height: 1.4;
  font-size: calc(clamp(18px, 1.4vw + 2vh, 38px) * var(--tscale));
  text-shadow: 0 2px 0 #1c110b, 0 0 18px rgba(0,0,0,.85), 0 0 4px rgba(0,0,0,.9);
  opacity: 0; transition: opacity .8s ease;
}
#narration.on { opacity: 1; }

#toast {
  position: fixed; z-index: 25; left: 50%; top: calc(var(--safe-t) + 58px); transform: translate(-50%, -10px);
  opacity: 0; transition: opacity .5s ease, transform .5s ease; pointer-events: none; text-align: center;
  background: rgba(251, 240, 220, .97); border: 4px solid var(--ink); box-shadow: inset 0 0 0 3px var(--gold), 0 5px 0 rgba(0,0,0,.35);
  padding: .5em 1.4em; font-size: calc(clamp(14px, .9vw + 1.2vh, 24px) * var(--tscale));
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast .t-title { font-size: .7em; letter-spacing: .12em; text-transform: uppercase; color: var(--brown); }
#toast .t-sub { font-style: italic; }
#toast.small { box-shadow: inset 0 0 0 3px var(--paper-2), 0 4px 0 rgba(0,0,0,.3); }

#level-card {
  position: fixed; z-index: 13; left: 50%; top: 46%; width: min(90vw, 900px); transform: translate(-50%, -50%); text-align: center;
  color: #fff6e4; text-shadow: 0 2px 0 #1c110b, 0 0 16px rgba(0,0,0,.9); opacity: 0; transition: opacity .9s ease; pointer-events: none;
}
#level-card.on { opacity: 1; }
#level-card .lc-num { font-size: clamp(13px, 1vw + 1vh, 20px); letter-spacing: .25em; text-transform: uppercase; color: var(--gold); }
#level-card .lc-num::after { content: ""; display: block; width: 64px; height: 2px; margin: .55em auto .5em; background: rgba(217,164,65,.7); }
#level-card .lc-name { font-style: italic; font-size: clamp(22px, 1.8vw + 2.2vh, 44px); }
#level-card .lc-name { transform: translateY(6px); transition: transform 1.4s ease; }
#level-card.on .lc-name { transform: none; }

/* ---------- touch controls ---------- */
#touch { position: fixed; inset: 0; z-index: 16; pointer-events: none; }
#touch[hidden] { display: none; }
#touch { --bsz: clamp(50px, calc((var(--side-w) - 22px) / 2.15), 72px); }
body.touch-big #touch { --bsz: clamp(60px, calc((var(--side-w) - 22px) / 2.05), 86px); }
.pad { position: absolute; bottom: calc(var(--safe-b) + 10px); display: flex; gap: 8px; pointer-events: none; align-items: flex-end; }
.pad-left { left: calc(var(--safe-l) + 8px); }
.pad-right { right: calc(var(--safe-r) + 8px); }
.pad-col { display: flex; flex-direction: column; gap: 8px; }
.tbtn {
  --sz: var(--bsz);
  width: var(--sz); height: var(--sz); pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  font-family: var(--font); font-size: 15px; color: var(--ink);
  background: rgba(251, 240, 220, .78); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: inset -3px -3px 0 rgba(200,160,110,.8), 0 3px 0 rgba(0,0,0,.35);
}
.tbtn[data-act="left"], .tbtn[data-act="right"] { font-size: 28px; }
.tbtn.big { --sz: calc(var(--bsz) * 1.12); font-size: 16px; }
.tbtn { padding: 0; }
.tbtn[data-act="interact"] { font-size: 11px; letter-spacing: -.02em; }
.tbtn.pressed { background: var(--gold); transform: translateY(2px); box-shadow: inset 2px 2px 0 rgba(150,100,40,.8); }
/* virtual joystick */
.pad-stick {
  --d: calc(var(--bsz) * 2 + 8px);
  width: var(--d); height: var(--d); pointer-events: auto; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; display: block;
}
.stick-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(251,240,220,.22) 0%, rgba(251,240,220,.38) 70%);
  border: 3px solid rgba(43,26,16,.85); box-shadow: inset 0 0 0 3px rgba(251,240,220,.35), 0 3px 0 rgba(0,0,0,.3);
}
/* faint marks showing where running starts */
.stick-run-l, .stick-run-r { position: absolute; top: 50%; width: 9%; height: 3px; background: rgba(43,26,16,.55); transform: translateY(-50%); border-radius: 2px; }
.stick-run-l { left: 7%; } .stick-run-r { right: 7%; }
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(251,240,220,.92); border: 3px solid var(--ink);
  box-shadow: inset -3px -3px 0 rgba(200,160,110,.9), 0 3px 0 rgba(0,0,0,.35);
  pointer-events: none;
}
.pad-stick.active .stick-knob { background: #fff4df; }
.pad-stick.running .stick-knob { background: var(--gold); }
.pad-stick:not(.active) .stick-knob { transition: transform .12s ease-out; }
body:not(.move-buttons) .pad-buttons { display: none; }
body.move-buttons .pad-stick { display: none; }

#touch-interact.ready { background: #ffe8a6; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0,0,0,.35); }
#touch-interact[hidden] { display: none; }

/* ---------- scroller HUD ---------- */
#scroller-hud { position: fixed; z-index: 20; left: 0; right: 0; top: 0; display: flex; gap: 8px; align-items: flex-start; justify-content: space-between;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 8px) 0 calc(var(--safe-l) + 8px); pointer-events: none; }
#scroller-hud[hidden] { display: none; }
#scroller-hud > * { pointer-events: auto; }
.sh-info { background: rgba(251,240,220,.92); border: 3px solid var(--ink); padding: .3em .7em; display: flex; flex-direction: column;
  font-size: calc(clamp(12px, .7vw + .9vh, 17px) * var(--tscale)); }
.sh-title { font-weight: bold; }
.sh-help { font-style: italic; color: var(--ink-soft); }
.sh-btns { display: flex; gap: 6px; }

/* ---------- laptop ---------- */
.lt-window {
  width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column;
  background: #cfc8b8; border: 3px solid #1d1d1d;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #7c7668, 0 8px 0 rgba(0,0,0,.35);
  font-family: Tahoma, Verdana, "Segoe UI", sans-serif; font-size: calc(clamp(14px, .8vw + 1.1vh, 19px) * var(--tscale));
}
.lt-titlebar { display: flex; justify-content: space-between; align-items: center; color: #fff;
  background: linear-gradient(90deg, #233a7a, #5b7fc7); padding: .25em .25em .25em .6em; font-weight: bold; }
.lt-x { font: inherit; font-weight: bold; width: 34px; height: 30px; background: #cfc8b8; color: #111; border: 2px solid #111;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #7c7668; cursor: pointer; }
.lt-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; background: #2f6f73; overflow: auto; }
.lt-folder { background: #f4f1e8; border: 2px solid #111; box-shadow: inset -2px -2px 0 #b9b3a3; }
.lt-folder-name { background: #e1dccd; border-bottom: 2px solid #111; padding: .25em .6em; font-weight: bold; }
.lt-list { display: flex; flex-direction: column; padding: 6px; gap: 6px; }
.lt-item { font: inherit; text-align: left; background: #fff; border: 2px solid #111; padding: .45em .6em; cursor: pointer;
  display: flex; justify-content: space-between; gap: .6em; min-height: 44px; align-items: center; color: #111; }
.lt-item:hover { background: #233a7a; color: #fff; }
.lt-item.done .lt-state { font-size: .8em; font-style: italic; color: #2f6f73; }
.lt-item:hover .lt-state { color: #dfe8ff; }
.lt-statusbar { display: flex; justify-content: space-between; padding: .3em .6em; font-size: .85em; border-top: 2px solid #7c7668; }

/* ---------- mini-game panel ---------- */
.mg-box { width: min(920px, 100%); height: min(780px, 100%); display: flex; flex-direction: column; padding: 12px 16px;
  font-size: calc(clamp(13px, .8vw + 1vh, 18px) * var(--tscale)); box-sizing: border-box; }
.mg-box.compact { height: auto; width: min(620px, 100%); }
.mg-box.compact .panel-stage { flex: none; }
.mg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mg-head h2 { font-size: 1.4em; }
.mg-actions { display: flex; gap: 6px; }
.panel-help { margin: .3em 0 .5em; color: var(--ink-soft); font-style: italic; }
.panel-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow: auto; }
.panel-foot { min-height: 2.4em; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; text-align: center; padding-top: 6px; }
.mg-canvas { display: block; touch-action: none; border: 3px solid var(--ink); background: var(--paper); }
.dice-wrap { display: flex; align-items: center; gap: 10px; }
.dice-img { width: 64px; height: auto; cursor: pointer; }
.dice-img.tilt { transform: rotate(12deg); }
.missing { max-width: 560px; }
.missing ul { font-family: Consolas, "Courier New", monospace; font-size: .85em; }
.pretend { display: flex; align-items: flex-end; justify-content: center; gap: clamp(10px, 4vw, 50px); flex-wrap: wrap; }
.pretend-person { display: flex; flex-direction: column; align-items: center; gap: 4px; font-style: italic; color: var(--ink-soft); position: relative; }
.portrait { image-rendering: pixelated; }
.pretend-table { display: flex; align-items: flex-end; gap: 10px; }
.plate { position: relative; width: clamp(110px, 18vw, 180px); }
.plate > img { width: 100%; display: block; }
.served { position: absolute; inset: 15% 10%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; }
.served-item { width: 34%; animation: drop .4s ease-out; }
@keyframes drop { from { transform: translateY(-40px) scale(1.2); opacity: 0; } }
.utensil { height: clamp(50px, 9vw, 90px); }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.choice { font: inherit; background: var(--paper); border: 3px solid var(--ink); padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; min-height: 64px; }
.choice img { height: clamp(40px, 7vw, 72px); }
.choice.used { opacity: .3; }
.choice.chosen { background: var(--gold); }
.used-tool { position: absolute; right: -30px; top: 30%; }
.used-tool img { height: 56px; animation: drop .4s ease-out; }

/* ---------- studio intro (Tiny Play) ---------- */
#studio {
  position: fixed; inset: 0; z-index: 200; background: #000; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: opacity 1.1s ease; touch-action: none; user-select: none; -webkit-user-select: none;
}
#studio.out { opacity: 0; pointer-events: none; }
.studio-stage { position: relative; height: min(100vh, 168vw); aspect-ratio: 335 / 597; transform: scale(.86); }
#studio.play .studio-stage { animation: studio-push 5.2s cubic-bezier(.22,.7,.2,1) forwards; }
@keyframes studio-push {
  0%, 12% { transform: scale(.86); }
  34% { transform: scale(1); }
  100% { transform: scale(1.06); }
}
/* the logo image is shown exactly as supplied: only faded in and gently scaled with its stage */
.studio-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  image-rendering: auto; opacity: 0;
}
#studio.play .studio-stage img { animation: studio-logo 5.2s ease-out forwards; }
@keyframes studio-logo { 0%, 12% { opacity: 0; } 34%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .studio-stage { transform: none !important; }
  .studio-stage img { opacity: 1 !important; }
}
/* soft light bloom behind the emblem as it appears */
.studio-glow {
  position: absolute; left: 50%; top: 47%; width: 120%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(.4);
  background: radial-gradient(circle, rgba(255,255,255,.22) 0%, rgba(255,255,255,.06) 35%, rgba(255,255,255,0) 65%);
  opacity: 0; pointer-events: none;
}
#studio.play .studio-glow { animation: studio-glow 5.2s ease-out forwards; }
@keyframes studio-glow {
  0%, 20% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  34% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: .25; transform: translate(-50%, -50%) scale(1.15); }
}
/* one light sweep across the emblem, drawn on top (the image itself is untouched) */
.studio-sweep {
  position: absolute; left: 12.5%; top: 25.6%; width: 75.5%; height: 43.7%; overflow: hidden; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle, #000 66%, transparent 70%); mask-image: radial-gradient(circle, #000 66%, transparent 70%);
}
.studio-sweep::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; width: 30%; left: -45%;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.32) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-18deg);
}
#studio.play .studio-sweep::before { animation: studio-sweep 5.2s ease-in-out forwards; }
@keyframes studio-sweep { 0%, 40% { left: -45%; } 62%, 100% { left: 125%; } }
.studio-skip {
  position: absolute; bottom: calc(var(--safe-b) + 16px); right: calc(var(--safe-r) + 20px);
  color: rgba(255,255,255,.35); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; opacity: 0; transition: opacity .6s;
}
#studio.can-skip .studio-skip { opacity: 1; }
.sk-tap, body.is-touch .sk-key { display: none; }
body.is-touch .sk-tap { display: inline; }
#studio.done-wait .studio-skip { opacity: 0; }

/* ---------- rotate ---------- */
#rotate { position: fixed; inset: 0; z-index: 100; background: var(--deep); color: var(--paper); display: flex; align-items: center; justify-content: center; text-align: center; }
#rotate[hidden] { display: none; }
.rotate-box p { font-size: 22px; font-style: italic; margin-top: 18px; }
.rotate-phone { width: 46px; height: 78px; border: 4px solid var(--paper); border-radius: 8px; margin: 0 auto; animation: turn 2.4s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

@media (max-height: 520px) {
  .title-panel { padding: 10px 16px; width: min(calc(var(--box-w) * 0.62), 520px); }
  .title-panel h1 { font-size: 24px; }
  .subtitle { margin: .3em 0 .6em; font-size: 13px; }
  #title .menu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #title .menu .btn { min-height: 38px; padding: .3em .6em; font-size: 15px; }
  #title #btn-start { grid-column: 1 / -1; }
  .chip, .chip-btn { min-height: 34px; padding: .2em .55em; font-size: 13px; }
  #dialogue { font-size: calc(15px * var(--tscale)); padding: .45em .8em .5em; }
}
@media (max-width: 700px), (max-height: 430px) {
  .cols { grid-template-columns: 1fr; }
  .lt-body { grid-template-columns: 1fr 1fr; padding: 8px; }
  .modal-box { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01s !important; animation: none !important; }
}
