﻿:root { --bg: #1a1030; --card: rgba(30, 18, 52, 0.94); --accent: #ff9f1c; --accent2: #ff4d6d; --good: #4ade80; --text: #f7f0ff; --dim: #b9a9d6; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #000; color: var(--text); font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; user-select: none; }
#game { position: fixed; inset: 0; overflow: hidden; } /* fills whatever container / iframe / fullscreen element the page gives it (phase 5) */
canvas#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
kbd { background: #fff; color: #222; border-radius: 5px; padding: 1px 7px; font: 700 0.85em/1.4 monospace; box-shadow: 0 2px 0 #999; }

.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20; }
.screen.show { display: flex; }
.panel { background: rgba(10, 5, 25, 0.62); backdrop-filter: blur(5px); }
#loading { background: radial-gradient(circle at 50% 40%, #3a1f6b, #120a22); z-index: 50; flex-direction: column; text-align: center; }
.loadbox { width: min(420px, 80vw); } .bar { height: 10px; border-radius: 6px; background: #ffffff22; overflow: hidden; margin: 18px 0 8px; } .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.2s; }

.logo { font-size: clamp(34px, 6vw, 64px); line-height: 0.95; margin: 0 0 6px; letter-spacing: 3px; color: #fff; text-shadow: 0 4px 0 #6a2cc4, 0 8px 18px #0008; font-weight: 900; transform: rotate(-3deg); transform-origin: left; }
.logo span { color: var(--accent); text-shadow: 0 4px 0 #b3410d, 0 8px 18px #0008; }
.tag { color: var(--dim); margin: 0 0 14px; }

#menu { justify-content: flex-start; background: linear-gradient(90deg, rgba(10, 4, 24, 0.88) 0%, rgba(10, 4, 24, 0.55) 38%, transparent 70%); }
.menu-side { padding: 3vh 4vw; max-height: 100vh; overflow-y: auto; width: min(460px, 92vw); }
#menu-buttons { display: grid; gap: 7px; }
button { font: 700 16px/1 inherit; font-family: inherit; color: var(--text); background: #ffffff14; border: 2px solid #ffffff2a; border-radius: 12px; padding: 12px 16px; cursor: pointer; text-align: left; transition: transform 0.12s, background 0.12s, border-color 0.12s; }
button:hover:not(:disabled) { background: #ffffff26; border-color: var(--accent); transform: translateX(5px); }
button:active:not(:disabled) { transform: scale(0.98); }
button.primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); border-color: transparent; color: #2a0f00; }
button.danger { border-color: var(--accent2); color: #ffb3c1; }
button:disabled { opacity: 0.4; cursor: not-allowed; } button small { font-weight: 400; opacity: 0.8; }
.coins-line { margin-top: 14px; color: var(--dim); }

.card { background: var(--card); border: 2px solid #ffffff22; border-radius: 20px; padding: 26px 30px; width: min(560px, 92vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px #000a; }
.card.wide { width: min(900px, 94vw); }
.card h2 { margin: 0 0 8px; font-size: 28px; color: var(--accent); } .card h3 { margin: 14px 0 6px; font-size: 16px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.sub { color: var(--dim); font-size: 14px; } .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; } .col { display: grid; gap: 10px; margin-top: 12px; }
.chip { display: inline-block; background: #6a2cc4; border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
label { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 10px 0; } label input[type=range] { width: 55%; accent-color: var(--accent); } select { background: #2a1a4a; color: var(--text); border: 2px solid #ffffff2a; border-radius: 8px; padding: 6px; font-size: 14px; } label.check { justify-content: flex-start; }
.adapt { background: #ff4d6d1f; border: 1px solid #ff4d6d66; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-top: 10px; } .adapt:empty { display: none; }
#b-objs li, #obj-list li { margin: 3px 0; }

#level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; padding: 4px; }
.lvl { background: #ffffff10; border: 2px solid #ffffff22; border-radius: 12px; padding: 10px; position: relative; cursor: pointer; min-height: 88px; }
.lvl:hover { border-color: var(--accent); } .lvl.locked { opacity: 0.45; cursor: not-allowed; } .lvl .n { font-size: 11px; color: var(--dim); } .lvl .t { font-weight: 700; font-size: 14px; margin: 2px 0 6px; } .lvl .st { color: #ffd23f; letter-spacing: 2px; } .lvl .st .off { color: #ffffff30; } .lvl .badge { position: absolute; right: 8px; top: 8px; font-size: 10px; background: #0007; border-radius: 6px; padding: 2px 6px; }
.dopt { padding: 12px; border: 2px solid #ffffff22; border-radius: 12px; margin: 8px 0; cursor: pointer; } .dopt.sel { border-color: var(--accent); background: #ff9f1c1f; } .dopt b { color: var(--accent); }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; margin: 12px 0; } .tips { color: var(--dim); font-size: 14px; line-height: 1.5; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #0008; opacity: 0.85; transition: transform 0.1s; } #crosshair.on { transform: scale(1.8); background: var(--accent); }
#prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: #000b; border: 2px solid var(--accent); border-radius: 12px; padding: 8px 16px; font-weight: 700; white-space: nowrap; }
#objectives { position: absolute; left: 18px; top: 18px; background: #12082acc; border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 16px; min-width: 250px; max-width: 360px; }
#objectives h4 { margin: 0 0 6px; color: var(--accent); } #objectives ul { margin: 0; padding-left: 18px; font-size: 14px; } #objectives li.done { color: var(--good); text-decoration: line-through; opacity: 0.8; } #obj-time { font-size: 12px; color: var(--dim); margin-top: 6px; }
#topright { position: absolute; right: 18px; top: 18px; text-align: right; }
#coins { font-size: 18px; background: #12082acc; display: inline-block; border-radius: 10px; padding: 5px 12px; margin-bottom: 6px; } #area { font-size: 13px; color: var(--dim); margin-bottom: 4px; }
#minimap { background: #0a0618cc; border: 2px solid #ffffff33; border-radius: 12px; display: block; margin-left: auto; } #fps { font: 12px monospace; color: #9f9; }
#detect { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); text-align: center; width: 260px; } #detect-label { font-weight: 900; letter-spacing: 3px; font-size: 14px; text-shadow: 0 2px 4px #000; }
.dbar { height: 12px; border-radius: 8px; background: #000a; border: 2px solid #fff4; overflow: hidden; margin-top: 4px; } .dbar i { display: block; height: 100%; width: 0; background: #4ade80; transition: width 0.1s, background 0.2s; }
#detect.sus #detect-label { color: #ffd23f; } #detect.srch #detect-label { color: #ff9f1c; } #detect.chase #detect-label { color: #ff4d6d; animation: pulse 0.5s infinite alternate; } #detect.unaware #detect-label { color: #86efac; }
@keyframes pulse { to { transform: scale(1.12); } }
#stamina { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); width: 220px; height: 9px; border-radius: 6px; background: #0008; border: 2px solid #fff4; overflow: hidden; } #stamina i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #38bdf8, #a78bfa); } #stamina.low i { background: #ff4d6d; }
#inventory { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; }
.slot { width: 68px; height: 68px; border-radius: 12px; background: #12082acc; border: 3px solid #ffffff33; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; font-size: 30px; } .slot.sel { border-color: var(--accent); box-shadow: 0 0 14px #ff9f1c99; transform: translateY(-5px); } .slot small { position: absolute; left: 5px; top: 2px; font-size: 11px; color: var(--dim); } .slot.empty { opacity: 0.6; }
#item-hint { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); font-size: 13px; color: var(--dim); text-shadow: 0 2px 3px #000; white-space: nowrap; }
#toasts { position: absolute; left: 50%; top: 190px; pointer-events: none; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; }
.toast { background: #12082aee; border: 2px solid #ffffff33; border-radius: 10px; padding: 8px 16px; font-weight: 700; animation: tin 0.25s; max-width: min(520px, 80vw); text-align: center; } .toast.good { border-color: var(--good); } .toast.warn { border-color: var(--accent2); } .toast.hint { border-color: #38bdf8; } @keyframes tin { from { transform: translateY(-14px); opacity: 0; } }
#hidden-note { position: absolute; left: 50%; bottom: 25%; transform: translateX(-50%); background: #000b; padding: 8px 16px; border-radius: 10px; } #vignette { position: absolute; inset: 0; box-shadow: inset 0 0 160px #000c; opacity: 0; transition: opacity 0.3s; } #vignette.chase { box-shadow: inset 0 0 160px #ff0030cc; opacity: 1; animation: vig 0.6s infinite alternate; } @keyframes vig { to { opacity: 0.55; } } #vignette.hide { opacity: 1; box-shadow: inset 0 0 260px #000f; }
#r-stars { font-size: 44px; color: #ffd23f; letter-spacing: 8px; margin: 6px 0; } #r-stars .off { color: #ffffff30; } #r-lines { list-style: none; padding: 0; } #r-lines li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #ffffff22; } .total { font-size: 30px; font-weight: 900; text-align: right; color: #ffd23f; }
#inv-detail .it { display: flex; gap: 12px; align-items: center; padding: 8px; border-bottom: 1px solid #ffffff1a; } #inv-detail .it span { font-size: 30px; } #inv-detail small { color: var(--dim); display: block; }
#bigmap { background: #0a0618; border-radius: 12px; display: block; margin: 8px auto; max-width: 100%; }
#cine { position: absolute; inset: 0; z-index: 30; pointer-events: none; } .bars { position: absolute; left: 0; right: 0; height: 11vh; background: #000; } .bars.top { top: 0; } .bars.bottom { bottom: 0; } #cine-text { position: absolute; bottom: 14vh; width: 100%; text-align: center; font-size: 26px; font-weight: 900; text-shadow: 0 3px 6px #000; } #cine-skip { position: absolute; right: 18px; bottom: 3vh; color: var(--dim); font-size: 12px; }
#tutorial { position: absolute; right: 18px; bottom: 120px; width: min(320px, 44vw); background: #12082af2; border: 2px solid #38bdf8; border-radius: 12px; padding: 10px 14px; box-shadow: 0 0 18px #38bdf855; } .tut-step { font-size: 11px; letter-spacing: 1px; color: #38bdf8; font-weight: 800; text-transform: uppercase; } #tut-text { font-weight: 700; margin: 4px 0 6px; } .tut-skip { font-size: 11px; color: var(--dim); } #tutorial.done { border-color: var(--good); } #tutorial.done .tut-step { color: var(--good); }
#detect.edge #detect-label { color: #fbbf24; }
#camwarn { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); width: 230px; text-align: center; } #camwarn-label { font-weight: 800; letter-spacing: 2px; font-size: 12px; color: #ff6b81; text-shadow: 0 2px 4px #000; } #camwarn .dbar i { background: #ff4d6d; } #camwarn.alarm #camwarn-label { animation: pulse 0.35s infinite alternate; }
#alarm { position: absolute; left: 50%; top: 112px; transform: translateX(-50%); font-weight: 900; font-size: 26px; letter-spacing: 6px; color: #ff4d6d; text-shadow: 0 0 14px #ff0030, 0 3px 4px #000; animation: pulse 0.3s infinite alternate; }
#power { position: absolute; left: 18px; bottom: 120px; background: #12082aee; border: 2px solid #ffd23f; border-radius: 10px; padding: 6px 12px; font-weight: 800; color: #ffd23f; letter-spacing: 2px; font-size: 13px; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 41; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; transition: opacity 0.5s; }
@media (max-width: 760px) { #objectives { max-width: 200px; font-size: 12px; } .slot { width: 52px; height: 52px; font-size: 22px; } }

/* ---- phase 4: chapter-grouped level select, characters, shop, HUD chips ---- */
#level-grid { display: block; }
h3.chapter { margin: 14px 0 6px; font-size: 15px; color: var(--accent); text-transform: none; letter-spacing: 0; border-bottom: 1px solid #ffffff22; padding-bottom: 4px; } h3.chapter small { color: var(--dim); font-weight: 400; margin-left: 8px; }
.lvl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } /* six missions per chapter: 3 x 2 never leaves an orphan card */
@media (min-width: 1100px) { .lvl-row { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 560px) { .lvl-row { grid-template-columns: repeat(2, 1fr); } }
#char-grid, .shop-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
#char-card { display: flex; gap: 14px; align-items: center; background: #ffffff10; border-radius: 12px; padding: 10px 14px; margin: 8px 0 12px; } #char-card .avatar { font-size: 44px; }
.chr, .shp { background: #ffffff10; border: 2px solid #ffffff22; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.chr.sel { border-color: var(--accent); } .chr.locked, .shp:not(.own) button:disabled { opacity: 0.55; } .shp.own { border-color: #4ade8088; }
.chr .ico, .shp .ico { font-size: 30px; } .chr small, .shp small { color: var(--dim); font-size: 12px; } .chr small.req { color: #ffd23f; } .shp small.price { color: #ffd23f; font-weight: 700; }
.chr button, .shp button { margin-top: auto; padding: 6px 10px; font-size: 14px; }
#chips { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 70vw; pointer-events: none; }
#chips span { background: #12082acc; border: 1px solid #ffffff33; border-radius: 14px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.adapt.rules { background: #38bdf81f; border-color: #38bdf866; } .adapt.rules:empty { display: none; }

/* ---- phase 5: achievements ---- */
#ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 12px; align-items: flex-start; background: #ffffff10; border: 2px solid #ffffff22; border-radius: 12px; padding: 10px 12px; opacity: 0.8; }
.ach.got { border-color: #ffd23f; background: #ffd23f14; opacity: 1; }
.ach .ico { font-size: 30px; line-height: 1; } .ach .txt { display: grid; gap: 3px; flex: 1; min-width: 0; } .ach small { color: var(--dim); font-size: 12px; } .ach .prog { color: #ffd23f; font-weight: 700; }
.pbar { height: 6px; background: #ffffff1c; border-radius: 4px; overflow: hidden; } .pbar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9f1c, #ffd23f); }
#r-ach { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; } #r-ach span { background: #ffd23f22; border: 2px solid #ffd23f; border-radius: 12px; padding: 4px 12px; animation: tin 0.4s; } #r-ach.hidden { display: none; }
#menu-buttons small { opacity: 0.75; font-weight: 400; }

/* ---- phase 5: touch controls (body.touch is set by TouchControls when the primary pointer is coarse, with ?touch, or by the setting) ---- */
#touch { position: absolute; inset: 0; display: none; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; }
body.touch #touch { display: block; }
#touch .tzone { position: absolute; pointer-events: auto; touch-action: none; }
#t-stick { left: 0; bottom: 0; width: 42%; height: 62%; } #t-look { right: 0; top: 0; width: 58%; height: 100%; z-index: -1; }
#t-base { position: absolute; width: 120px; height: 120px; left: 28px; bottom: 36px; border-radius: 50%; border: 3px solid #ffffff44; background: #ffffff12; opacity: 0.45; }
#t-base.on { opacity: 0.9; } #t-knob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: #ffffffaa; box-shadow: 0 0 10px #0006; }
#t-btns { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(3, 54px); gap: 8px; direction: rtl; pointer-events: none; }
#t-btns button, #t-top button { pointer-events: auto; touch-action: none; width: 54px; height: 54px; border-radius: 50%; background: #12082acc; border: 3px solid #ffffff44; color: #fff; font-size: 18px; font-weight: 800; padding: 0; }
#t-btns button.big { background: #ff9f1ccc; border-color: #ffd23f; color: #1a0c00; font-size: 14px; } #t-btns button.on { background: #38bdf8cc; border-color: #fff; }
#t-btns button:active, #t-top button:active { transform: scale(0.92); background: #ff9f1ccc; } #t-btns .hidden { display: none; }
#t-top { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none; } #t-top button { width: 44px; height: 44px; font-size: 16px; }
#t-rotate { display: none; position: absolute; inset: 0; background: #120a22f2; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; text-align: center; padding: 24px; pointer-events: auto; z-index: 5; }
@media (orientation: portrait) { body.touch #t-rotate { display: flex; } }
body.touch #inventory { pointer-events: auto; } body.touch #inventory .slot { touch-action: none; }
body.touch #cine { pointer-events: auto; } body.touch #cine-skip { font-size: 0; } body.touch #cine-skip::after { content: 'Tap to skip'; font-size: 14px; }
body.touch #crosshair { opacity: 0.6; } body.touch #prompt kbd { background: #ff9f1c; color: #1a0c00; } body.touch .tut-skip { display: none; }
@media (max-height: 520px) { body.touch .slot { width: 42px; height: 42px; font-size: 20px; border-width: 2px; } body.touch #stamina { bottom: 66px; width: 160px; } body.touch #chips { bottom: 72px; } body.touch #objectives { padding: 6px 10px; min-width: 170px; max-width: 230px; font-size: 11px; } body.touch #topright canvas#minimap { width: 110px; height: 110px; } body.touch #toasts { top: 70px; } #t-btns { grid-template-columns: repeat(3, 46px); gap: 6px; } #t-btns button { width: 46px; height: 46px; font-size: 15px; } #t-base { width: 100px; height: 100px; } }
/* touch layout fixes found in the 812x375 landscape check: keep the tutorial clear of the button grid, and the pause/inventory buttons clear of the detection label */
body.touch #t-top { top: 44px; }
body.touch #tutorial { right: auto; left: 50%; transform: translateX(-50%); bottom: auto; top: 96px; width: min(300px, 40vw); padding: 6px 10px; font-size: 12px; }

/* ---- phase 5: ArcadeFusion container bits ---- */
#btn-fs-menu { position: absolute; right: 14px; top: 14px; width: 44px; height: 44px; padding: 0; text-align: center; font-size: 20px; border-radius: 50%; z-index: 21; } #btn-fs-menu:hover:not(:disabled) { transform: scale(1.08); }
