:root {
  --navy: #0f1b4d;
  --navy-2: #16266b;
  --line: #3b6cff;
  --yellow: #ffd83a;
  --yellow-2: #ffb800;
  --ink: #0a1238;
  --text: #eef2ff;
  --muted: #a9b8ef;
  --red: #ef4444;
  --side: clamp(62px, 7.2vw, 104px);
  --display: 'Baloo 2', 'Nunito', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a2450; color: var(--text); font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
[data-icon] { display: inline-grid; place-items: center; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- shared buttons ---------- */
.big-play {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .35em 1.2em; border: 4px solid #fff3b0; border-radius: 22px;
  font: 800 clamp(22px, 3.4vw, 46px)/1.1 var(--display); color: var(--ink); letter-spacing: .5px;
  background: linear-gradient(180deg, #fff27a, var(--yellow) 45%, var(--yellow-2));
  box-shadow: 0 6px 0 #b77f00, 0 0 0 4px var(--navy), 0 12px 30px rgba(255, 200, 0, .35);
  transition: transform .1s;
}
.big-play i { width: 1em; height: 1em; }
.big-play:hover { transform: translateY(-2px) scale(1.02); }
.big-play:active { transform: translateY(3px); box-shadow: 0 2px 0 #b77f00, 0 0 0 4px var(--navy); }
.big-play.small { font-size: 22px; margin-top: 14px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--line); background: rgba(15, 27, 77, .85); font-weight: 900; font-size: 15px;
}
.pill i { width: 20px; height: 20px; }
.pill img { width: 26px; height: 26px; object-fit: contain; }
a.pill { color: inherit; text-decoration: none; }
.pill:hover { background: var(--navy-2); }
.pill.wide { width: 100%; margin-top: 10px; }
.icon-btn { width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--line); background: rgba(15, 27, 77, .85); padding: 9px; }
.icon-btn i { width: 100%; height: 100%; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; }
.screen.dim { display: grid; place-items: center; background: rgba(6, 10, 36, .72); padding: 16px; z-index: 20; }
.dialog {
  width: min(420px, 100%); max-height: 100%; overflow-y: auto; padding: 22px; border-radius: 20px; text-align: center;
  background: linear-gradient(180deg, #1a2a78, var(--navy)); border: 3px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.dialog h2 { margin: 0 0 12px; font: 800 30px var(--display); color: var(--yellow); }
.dialog .big-play { font-size: 26px; }
#dialog-body { text-align: left; font-weight: 700; color: #dbe3ff; font-size: 14.5px; }
#dialog-body li { margin: 6px 0; }
#dialog-body .row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); }
#dialog-body .gold { color: var(--yellow); letter-spacing: 2px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 30; pointer-events: none;
  padding: 10px 18px; border-radius: 14px; background: var(--navy); border: 2px solid var(--yellow); font-weight: 900; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- main menu ---------- */
.menu { background: #1c2d6e url('assets/ui/bg.webp') center / cover no-repeat; overflow: hidden; }
.side {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.6vh, 18px); padding-top: 1.5vh;
  background: linear-gradient(180deg, #0c1640, #0a1236); clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
  box-shadow: 4px 0 0 var(--line);
}
.brand { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #fff; margin-bottom: 1vh; }
.brand span { font: 800 clamp(14px, 1.9vw, 26px)/1 var(--display); letter-spacing: 1px; }
.brand small { font-size: clamp(8px, .8vw, 11px); letter-spacing: 3px; font-weight: 900; }
.brand::before { content: '👑'; font-size: clamp(10px, 1.2vw, 16px); line-height: 1; }
.nav { width: 72%; aspect-ratio: 1.25; display: grid; place-items: center; border: 0; background: none; color: #c7d2fe; border-radius: 12px; padding: 0; text-decoration: none; }
.nav i { width: clamp(22px, 2.6vw, 36px); height: clamp(22px, 2.6vw, 36px); }
.nav img { width: clamp(28px, 3.4vw, 48px); height: clamp(28px, 3.4vw, 48px); object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.side-crown { margin-top: auto; margin-bottom: 2vh; width: 70%; }
.side-crown img { width: 100%; }
.nav.on { background: var(--yellow); color: var(--navy); box-shadow: 0 0 18px rgba(255, 216, 58, .6); width: 118%; margin-left: 18%; border-radius: 0 14px 14px 0; }
.nav:not(.on):hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav.soon { opacity: .5; filter: grayscale(.6); }

.heroes { position: absolute; left: calc(var(--side) + 1vw); bottom: 0; width: 50vw; height: 96vh; display: flex; align-items: flex-end; justify-content: center; gap: 0; }
.hero { position: relative; height: 100%; flex: 1; border: 0; background: none; padding: 0 0 7vh; display: flex; align-items: flex-end; justify-content: center; }
.hero img { position: absolute; bottom: 9vh; left: 50%; transform: translateX(-50%); height: 84%; max-width: 130%; object-fit: contain; object-position: bottom center; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .35)); transition: transform .2s, filter .2s; }
.hero:not(.sel) img { filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .35)) saturate(.8) brightness(.92); }
.hero.sel img { transform: translateX(-50%) scale(1.03); }
.hero::before { content: ''; position: absolute; bottom: 5.5vh; left: 50%; width: 70%; height: 7vh; transform: translateX(-50%); border-radius: 50%; border: 4px solid rgba(96, 165, 250, .7); background: radial-gradient(rgba(15, 27, 77, .6), transparent 70%); }
.hero.sel::before { border-color: var(--yellow); background: radial-gradient(rgba(255, 216, 58, .45), transparent 70%); box-shadow: 0 0 24px rgba(255, 216, 58, .5); }
.hero .tag {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px;
  border-radius: 999px; background: var(--navy); border: 3px solid var(--line); font: 800 clamp(15px, 1.7vw, 24px) var(--display); white-space: nowrap;
}
.hero .tag .face { width: 1.4em; height: 1.4em; border-radius: 50%; background: #fff; color: var(--navy); display: grid; place-items: center; font-size: .8em; }
.hero .tag .tick { width: 1.2em; height: 1.2em; border-radius: 50%; border: 3px solid #93c5fd; display: grid; place-items: center; font-size: .75em; }
.hero.sel .tag { background: var(--yellow); color: var(--navy); border-color: #fff3b0; }
.hero.sel .tag .tick { background: var(--navy); border-color: var(--navy); color: var(--yellow); }
.hero.sel .tag .tick::after { content: '✔'; }

.menu-right { position: absolute; right: 2.2vw; top: 2vh; bottom: 3vh; width: 38vw; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 1vh; }
.logo { width: 92%; max-height: 30vh; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.preview { border: 0; padding: 0; background: none; width: 90%; border-radius: 16px; transition: transform .15s; }
.preview img { width: 100%; max-height: 30vh; object-fit: contain; display: block; }
.preview:hover { transform: scale(1.02); }
.badges { display: flex; gap: 2vw; justify-content: center; }
.badges span { display: flex; align-items: center; gap: 8px; font: 800 clamp(10px, 1vw, 14px)/1.15 'Nunito', sans-serif; text-transform: uppercase; text-shadow: 0 2px 4px #000; }
.badges img { width: clamp(34px, 3.6vw, 52px); height: clamp(34px, 3.6vw, 52px); object-fit: contain; flex: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }
.map-row { display: flex; gap: 8px; justify-content: center; }
.map-chip { min-width: 0; padding: 6px 12px; border-radius: 14px; border: 3px solid var(--line); background: rgba(15, 27, 77, .9); font-weight: 900; font-size: clamp(12px, 1.1vw, 15px); line-height: 1.2; }
.map-chip small { display: block; color: var(--muted); font-size: .8em; }
.map-chip .best { display: block; color: var(--yellow); letter-spacing: 1px; font-size: .9em; }
.lvl { display: inline-block; margin: 2px 0; padding: 0 8px; border-radius: 999px; font-style: normal; font-size: .8em; font-weight: 900; }
.lvl.easy { background: #16a34a; } .lvl.mid { background: #d97706; } .lvl.hard { background: #dc2626; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1vh; }
.facts span { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(147, 197, 253, .4); font-weight: 800; font-size: clamp(11px, 1vw, 14px); }
.facts .lvl { margin: 0; font-size: clamp(11px, 1vw, 14px); }
.map-chip.sel { border-color: var(--yellow); background: var(--navy-2); box-shadow: 0 0 14px rgba(255, 216, 58, .45); }
.map-chip:disabled { opacity: .5; }

/* ---------- mission briefing ---------- */
.side.mini .nav { margin-top: 1vh; }
.brief-hero { position: absolute; left: calc(var(--side) - 1vw); bottom: 0; height: 92vh; max-width: 40vw; object-fit: contain; object-position: bottom; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .4)); }
.brief-panel {
  position: absolute; right: 2vw; top: 9vh; bottom: 5vh; width: min(62vw, 1040px);
  padding: 5vh 2.2vw 2.5vh; border-radius: 26px; display: flex; flex-direction: column; gap: 2vh;
  background: linear-gradient(180deg, rgba(20, 34, 96, .96), rgba(12, 20, 64, .97)); border: 3px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .05);
}
.brief-tag { position: absolute; top: -3.6vh; left: 3vw; display: flex; align-items: center; gap: 6px; padding: .6vh 26px .6vh 14px; background: linear-gradient(90deg, #2563eb, #1d4ed8); border: 3px solid #93c5fd; border-radius: 12px; clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%); font: 800 clamp(18px, 2.2vw, 30px) var(--display); }
.brief-tag img { width: 1.1em; height: 1.1em; object-fit: contain; }
.brief-head { display: flex; gap: 2vw; align-items: center; }
.brief-pic { flex: none; width: clamp(120px, 17vw, 260px); aspect-ratio: 4 / 3; border-radius: 16px; border: 3px solid #93c5fd; background: #2a4aa8 center / cover no-repeat; display: grid; place-items: center; font-size: clamp(40px, 6vw, 80px); box-shadow: 0 0 18px rgba(59, 130, 246, .5); }
.brief-head h2 { margin: 0; font: 800 clamp(26px, 3.6vw, 54px)/1 var(--display); letter-spacing: 1px; }
.brief-head h2 em { font-style: normal; color: var(--yellow); }
.brief-head h3 { margin: .4vh 0; font: 800 clamp(15px, 1.8vw, 26px)/1.1 var(--display); color: #dbe3ff; letter-spacing: 1px; text-transform: uppercase; }
.brief-head p { margin: 0; font-weight: 700; color: #c8d3ff; font-size: clamp(12px, 1.2vw, 17px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.4vw; align-content: start; min-height: 0; }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 0; }
.steps li:not(:last-child)::after { content: '›'; position: absolute; right: -1.2vw; top: 22%; font: 900 clamp(20px, 2.4vw, 34px) sans-serif; color: #93c5fd; }
.steps .pic { position: relative; width: 100%; aspect-ratio: 5 / 4; max-height: 24vh; border-radius: 14px; border: 3px solid #60a5fa; background: #1e3a8a center / cover no-repeat; display: grid; place-items: center; font-size: clamp(28px, 3.6vw, 54px); }
.steps .pic img { width: 62%; height: 62%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.steps .no { position: absolute; top: -14px; left: -10px; width: clamp(28px, 3vw, 44px); }
.steps b { display: block; margin-top: 1vh; font: 800 clamp(11px, 1.15vw, 16px)/1.15 'Nunito', sans-serif; text-transform: uppercase; }
.steps span { display: block; margin-top: 2px; font-weight: 700; font-size: clamp(10px, 1vw, 14px); color: var(--muted); line-height: 1.25; }
.brief-foot { margin-top: auto; display: flex; gap: 2vw; align-items: center; justify-content: space-between; }
.goals { flex: 1; max-width: 420px; padding: 1vh 1vw; border-radius: 16px; border: 2px solid rgba(96, 165, 250, .6); background: rgba(10, 18, 56, .6); }
.goals h4 { margin: 0 0 .6vh; font: 800 clamp(12px, 1.2vw, 16px) 'Nunito', sans-serif; letter-spacing: 1px; }
.goals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6vh; }
.goals li { display: flex; align-items: center; gap: 8px; padding: .5vh 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); font-weight: 800; font-size: clamp(11px, 1.05vw, 15px); }
.goals li::before { content: '★'; color: var(--yellow); font-size: 1.3em; }
.goals li.got { background: rgba(255, 216, 58, .18); }

/* ---------- result ---------- */
.result { background: #1c2d6e url('assets/ui/bg.webp') center / cover no-repeat; }
.result-art { position: absolute; inset: -20px; background: center / cover no-repeat; filter: blur(4px) brightness(.85); }
.result-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%); width: min(480px, 92vw); max-height: 92vh; overflow-y: auto;
  padding: 46px 24px 22px; border-radius: 28px; text-align: center;
  background: linear-gradient(180deg, rgba(26, 42, 120, .96), rgba(12, 20, 64, .97)); border: 4px solid var(--line);
  box-shadow: 0 0 0 4px rgba(147, 197, 253, .25), 0 24px 60px rgba(0, 0, 0, .55);
}
.result-card { overflow: visible; }
.crown { position: absolute; top: -52px; left: 50%; transform: translateX(-50%); width: 96px; }
.crown img { width: 100%; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.face img { width: 92px; margin: -6px 0 2px; }
.stars img { width: clamp(52px, 6vw, 74px); margin: 0 2px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.stars img.off { filter: grayscale(1) brightness(.45); }
.end-stats li { display: flex; align-items: center; gap: 10px; }
.end-stats li img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.end-stats li b { color: var(--yellow); }
.stars { font-size: clamp(44px, 5vw, 64px); letter-spacing: 4px; line-height: 1; margin: 6px 0; }
.stars .off { filter: grayscale(1) brightness(.5); }
.ribbon { display: inline-block; margin: 6px 0 10px; padding: 8px 26px; border-radius: 10px; background: linear-gradient(180deg, #fff27a, var(--yellow-2)); color: var(--navy); font: 800 clamp(26px, 3.2vw, 42px)/1 var(--display); box-shadow: 0 4px 0 #b77f00; }
.result.lost .ribbon { background: linear-gradient(180deg, #fca5a5, #dc2626); color: #fff; box-shadow: 0 4px 0 #7f1d1d; }
.end-stats { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; font-weight: 800; color: #dfe4ff; font-size: 16px; text-align: left; }
.end-stats li { padding: 7px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.result-card .big-play { width: 100%; font-size: clamp(22px, 2.6vw, 34px); }
.end-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.obj {
  position: absolute; top: 12px; left: 12px; max-width: min(430px, 34vw); padding: 10px 14px; border-radius: 16px;
  background: rgba(15, 27, 77, .88); border: 2px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.obj i, .obj .ic { width: 22px; height: 22px; flex: none; object-fit: contain; }
.obj-map { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; }
.obj-map .floor { padding: 1px 8px; border-radius: 8px; background: var(--line); font-size: 12px; }
.obj-task { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.obj-task b { font-size: 14px; font-weight: 800; flex: 1; }
.obj-task em { font-style: normal; font: 800 18px var(--display); color: var(--yellow); }
.obj-meta { display: flex; gap: 14px; margin-top: 4px; padding-left: 30px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.eye { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(15, 27, 77, .88); border: 2px solid var(--line); opacity: .55; transition: opacity .2s; }
.eye.on { opacity: 1; }
.eye .eye-face { width: 34px; height: 34px; object-fit: contain; filter: grayscale(1) brightness(1.4); transition: filter .2s; }
.eye.on .eye-face { filter: none; }
.eye .segs { display: flex; gap: 4px; }
.eye s { width: clamp(18px, 3vw, 34px); height: 12px; border-radius: 4px; background: #24336e; }
.eye s.f { background: linear-gradient(180deg, #ff7b7b, var(--red)); box-shadow: 0 0 8px rgba(239, 68, 68, .8); }
.eye.hot { animation: shake .25s infinite; }
@keyframes shake { 50% { transform: translateX(calc(-50% + 2px)); } }
.status { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); padding: 4px 14px; border-radius: 999px; font-weight: 900; font-size: 13px; background: rgba(37, 99, 235, .9); white-space: nowrap; }
.status.chased { background: linear-gradient(180deg, #ef4444, #b91c1c); border: 2px solid #fecaca; font-size: 15px; padding: 6px 18px; animation: pulse .6s infinite alternate; }
.status.suspicious { background: rgba(234, 88, 12, .9); }
@keyframes pulse { to { transform: translateX(-50%) scale(1.08); } }
.pause-btn { position: absolute; top: 12px; right: 12px; pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 14px; border: 3px solid #fff3b0; background: linear-gradient(180deg, #fff27a, var(--yellow-2)); color: var(--ink); font-weight: 900; font-size: 15px; box-shadow: 0 4px 0 #b77f00; }
.pause-btn .bars { width: 14px; height: 16px; border-left: 5px solid var(--ink); border-right: 5px solid var(--ink); }
.minimap-wrap { position: absolute; top: 72px; right: 12px; width: clamp(120px, 15vw, 190px); aspect-ratio: 1; }
#minimap { width: 100%; height: 100%; border-radius: 50%; border: 3px solid #60a5fa; box-shadow: 0 0 0 3px var(--navy), 0 8px 24px rgba(0, 0, 0, .45); background: #13205a; }
#minimap-note { position: absolute; left: 60%; bottom: -8px; transform: translateX(-50%); padding: 1px 8px; border-radius: 8px; background: var(--navy); border: 2px solid var(--yellow); font-size: 11px; font-weight: 900; white-space: nowrap; }
#minimap-note:empty { display: none; }
.guide-btn { position: absolute; left: -10px; bottom: -6px; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #60a5fa; background: var(--navy); font-size: 20px; padding: 0; pointer-events: auto; }
.prompt {
  position: absolute; bottom: 158px; left: 50%; transform: translateX(-50%);
  padding: 9px 16px; border-radius: 14px; background: rgba(15, 27, 77, .9); border: 2px solid var(--yellow);
  font-weight: 900; font-size: 16px; white-space: nowrap;
}
.prompt kbd { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 6px; background: var(--yellow); color: var(--ink); font: inherit; }
.flash { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 17px; text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity .25s; white-space: nowrap; }
.flash.show { opacity: 1; }
.inventory { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 6px; border-radius: 16px; background: rgba(15, 27, 77, .75); border: 2px solid var(--line); }
.slot {
  width: 60px; height: 60px; border-radius: 12px; display: grid; place-items: center; position: relative;
  background: #1a2a6c; border: 2px solid #3656b8; font-size: 30px;
}
.slot.sel { border-color: var(--yellow); box-shadow: 0 0 12px rgba(255, 216, 58, .6); }
.use-hint { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); padding: 5px 14px; border-radius: 12px; background: rgba(15, 27, 77, .9); border: 2px solid var(--yellow); font-weight: 800; font-size: 14px; white-space: nowrap; }
.use-hint kbd { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 6px; background: var(--yellow); color: var(--ink); font: inherit; font-weight: 900; }
.slot img { width: 84%; height: 84%; object-fit: contain; pointer-events: none; }
.slot small { position: absolute; top: 1px; left: 5px; font-size: 11px; font-weight: 900; color: var(--muted); }
.slot .boost { position: absolute; bottom: 3px; left: 4px; right: 4px; height: 4px; border-radius: 4px; background: #f97316; }
.stamina { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border-radius: 999px; background: rgba(15, 27, 77, .85); border: 2px solid var(--yellow); }
.stamina i { width: 24px; height: 24px; color: var(--yellow); }
.stamina .bar { width: clamp(140px, 22vw, 280px); height: 12px; border-radius: 6px; background: #24336e; overflow: hidden; }
.stamina .bar div { height: 100%; width: 100%; background: repeating-linear-gradient(90deg, #67e8f9 0 18px, #22d3ee 18px 20px); transform-origin: left; }
.stamina.low .bar div { background: #f97316; }
.hint { position: absolute; bottom: 124px; left: 10px; right: 10px; text-align: center; font-size: 12px; color: rgba(255, 255, 255, .75); font-weight: 700; text-shadow: 0 1px 3px #000; }
.stamina:not(.hidden) ~ .hint { display: none; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; }
.stick { position: absolute; left: 24px; bottom: 24px; width: 140px; height: 140px; border-radius: 50%; background: rgba(15, 27, 77, .35); border: 3px solid rgba(147, 197, 253, .6); pointer-events: auto; }
.stick .arr { position: absolute; font-size: 12px; color: rgba(255, 255, 255, .8); }
.arr.u { top: 6px; left: 50%; transform: translateX(-50%); }
.arr.d { bottom: 6px; left: 50%; transform: translateX(-50%); }
.arr.l { left: 8px; top: 50%; transform: translateY(-50%); }
.arr.r { right: 8px; top: 50%; transform: translateY(-50%); }
.knob { position: absolute; left: 42px; top: 42px; width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #bcd3ff); box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
.actions { position: absolute; right: 18px; bottom: 18px; width: 240px; height: 240px; pointer-events: none; }
.actions .act { pointer-events: auto; }
.act { position: absolute; border-radius: 50%; border: 3px solid rgba(147, 197, 253, .8); background: rgba(15, 27, 77, .75); color: #fff; padding: 0; display: grid; place-items: center; }
.act i { width: 58%; height: 58%; }
.act.main { right: 0; bottom: 0; width: 96px; height: 96px; border-width: 4px; }
.act.main.ready { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 216, 58, .35), 0 0 20px rgba(255, 216, 58, .6); }
.act.crouch { right: 124px; bottom: 0; width: 66px; height: 66px; }
.act.sprint { right: 4px; bottom: 124px; width: 66px; height: 66px; }
.act.jump { right: 118px; bottom: 112px; width: 52px; height: 52px; }
.act.on { background: var(--yellow); color: var(--navy); border-color: #fff3b0; }
.act:has(.btn-img) { border: 0; background: none; }
.act .btn-img { width: 112%; height: 112%; object-fit: contain; pointer-events: none; }
.act.on:has(.btn-img) { background: none; filter: drop-shadow(0 0 10px rgba(255, 216, 58, .9)) brightness(1.15); }
.act.main.ready:has(.btn-img) { box-shadow: none; animation: ready .8s infinite alternate; }
@keyframes ready { to { transform: scale(1.08); } }
.act.use { right: 212px; bottom: 96px; width: 62px; height: 62px; border-color: var(--yellow); }
.act.use img { width: 70%; height: 70%; object-fit: contain; }
.act.use span { position: absolute; bottom: -16px; font-size: 11px; font-weight: 900; text-shadow: 0 1px 3px #000; }
body.touch .hint { display: none; }
/* Phones: items sit in the top bar (like the artwork) so the character stays clear. */
body.touch .obj { max-width: calc(50% - 40px); }
body.touch .inventory { top: 10px; bottom: auto; left: calc(50% + 34px); transform: none; padding: 4px; }
body.touch .slot { width: 48px; height: 48px; font-size: 24px; pointer-events: auto; }
body.touch .prompt { bottom: 12px; padding: 6px 14px; font-size: 14px; border-width: 2px; border-radius: 999px; }
body.touch .prompt kbd { display: none; }
body.touch .stamina { bottom: 52px; }
body.touch .use-hint { display: none; }
body.touch .obj-meta { display: none; }

/* ---------- small / portrait screens ---------- */
/* Not enough room beside the objective panel: the eye meter drops below it. */
@media (max-width: 1000px) {
  .eye { top: 100px; left: 12px; transform: none; }
  .eye.hot { animation: none; }
  .status { top: 146px; left: 12px; transform: none; }
  .status.chased { animation: none; }
  .flash { top: 190px; }
  .obj { max-width: calc(100vw - 180px); }
}
@media (max-height: 520px) {
  .badges { display: none; }
  .logo { max-height: 25vh; }
  .preview img { max-height: 30vh; }
  .menu-right { top: 1.5vh; bottom: 2.5vh; gap: .5vh; }
  .map-chip { padding: 3px 8px; font-size: 11px; }
  .map-chip small { display: none; }
  .menu-right .big-play { font-size: 22px; padding: .25em 1em; }
  .brief-panel { top: 7vh; bottom: 2vh; padding: 4.5vh 2vw 1.5vh; gap: 1.2vh; }
  .brief-head p, .facts { display: none; }
  .goals li { padding: 1px 8px; }
  .obj { padding: 6px 10px; }
  .obj-map { font-size: 13px; }
  .obj-task b { font-size: 12.5px; }
  .minimap-wrap { top: 60px; width: 110px; }
  .eye s { height: 9px; }
  .actions { transform: scale(.8); transform-origin: right bottom; }
  .stick { transform: scale(.8); transform-origin: left bottom; }
  .result-card { padding: 22px 16px 14px; }
  .end-stats { font-size: 12.5px; gap: 3px; margin-bottom: 8px; }
  .end-stats li { padding: 4px 10px; }
  .stars { font-size: 36px; }
  .steps span { display: none; }
}
@media (orientation: portrait) {
  :root { --side: 0px; }
  .side { display: none; }
  .menu-right { position: absolute; inset: auto 3vw 2vh 3vw; top: auto; width: auto; height: auto; justify-content: flex-end; }
  .logo { position: fixed; top: 2vh; left: 50%; transform: translateX(-50%); width: 88vw; max-height: 22vh; }
  .preview { display: none; }
  .heroes { left: 0; width: 100vw; top: 22vh; bottom: auto; height: 46vh; }
  .hero { padding-bottom: 0; }
  .hero img { bottom: 6vh; height: 90%; }
  .hero::before { bottom: 2vh; height: 5vh; }
  .badges { gap: 3vw; }
  .badges span { font-size: 10px; }
  .big-play { font-size: 28px; }
  .brief-hero { display: none; }
  .brief-panel { left: 3vw; right: 3vw; width: auto; top: 6vh; bottom: 2vh; padding: 5vh 4vw 2vh; overflow-y: auto; }
  .brief-head { flex-direction: column; align-items: flex-start; }
  .steps { grid-template-columns: 1fr; }
  .steps li { flex-direction: row; gap: 12px; text-align: left; }
  .steps li::after { display: none; }
  .steps .pic { width: 90px; flex: none; height: 64px; aspect-ratio: auto; }
  .brief-foot { flex-direction: column; align-items: stretch; }
  .result-card { right: 5vw; left: 5vw; width: auto; top: auto; bottom: 3vh; transform: none; }
  .obj { max-width: calc(100vw - 150px); }
  .minimap-wrap { width: 110px; }
}

/* Result card on landscape phones: two columns so it fits without scrolling. */
@media (max-height: 520px) and (orientation: landscape) {
  .result-card {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 18px; align-items: center;
    width: min(760px, 94vw); max-height: 90vh; overflow-y: auto; padding: 14px 18px; transform: translate(-50%, -50%);
  }
  .result-card > * { grid-column: 1; }
  .result-card .end-stats { grid-column: 2; grid-row: 1 / span 6; margin: 0; }
  .crown { display: none; }
  .face img { width: 64px; margin: 0; }
  .stars img { width: 48px; }
  .ribbon { margin: 4px auto; font-size: 24px; padding: 6px 18px; }
  .result-card .big-play { font-size: 22px; padding: .25em 1em; }
  .end-buttons { margin-top: 8px; }
  .end-buttons .pill { padding: 7px 12px; font-size: 13px; }
}
/* Pause menu on landscape phones: title + 2x2 buttons, no scrolling. */
@media (max-height: 520px) and (orientation: landscape) {
  #pause .dialog { width: min(560px, 92vw); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 16px; }
  #pause .dialog h2 { grid-column: 1 / -1; margin: 0; font-size: 24px; }
  #pause .dialog .big-play { grid-column: 1 / -1; font-size: 22px; padding: .2em 1em; }
  #pause .dialog .pill.wide { margin-top: 0; padding: 8px 10px; font-size: 13.5px; }
}
