/* Simulator styles — extracted from map.html · Lumipad themed */
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Sora:wght@300;400;500&display=swap');

:root{
  --bg:#0b0813; --bg-2:#120c1d; --bg-3:#0f0a18;
  --panel:rgba(11,8,19,0.82); --panel-solid:rgba(11,8,19,0.94); --scrim:rgba(7,5,12,0.9);
  --violet:#7c3aed; --violet-l:#a78bfa;
  --amber:#f5a623; --pink:#ff5d8f; --green:#39d39a;
  --text:#ece8f5; --text-2:#9b8fb5; --text-3:#695f80;
  --line:rgba(150,120,240,0.16); --line-2:rgba(150,120,240,0.34); --seam:#0a0712;
  --mono:'JetBrains Mono',ui-monospace,Menlo,monospace;
  --display:'Chakra Petch',system-ui,sans-serif;
  --body:'Sora',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: var(--bg); font-family: var(--body); color: var(--text); }

.sim-layout { display: flex; height: 100vh; }
.sim-main { flex: 1; position: relative; }
.sim-main canvas { width: 100%; height: 100%; display: block; }
.sim-side { width: 35%; border-left: 3px solid var(--seam); display: flex; flex-direction: column; }
.sim-side-top { flex: 1; position: relative; }
.sim-side-top canvas { width: 100%; height: 100%; display: block; }
.sim-side-bottom { flex: 1; position: relative; border-top: 2px solid var(--seam); background: var(--bg); }
.sim-side-bottom canvas { width: 100%; height: 100%; display: block; }

.sim-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
    background: var(--panel-solid); border-bottom: 1px solid var(--line); padding: 6px 14px;
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sim-header .cam-label { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.sim-header a { color: var(--text-2); font-size: 10px; text-decoration: none; letter-spacing: 0.04em; }
.sim-header a:hover { color: var(--violet-l); }
.sim-header .spacer { flex: 1; }
.sim-header .sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 4px; }
.sim-header .hdr-btn {
    padding: 4px 10px; font-size: 10px; font-weight: 600; color: var(--text-2);
    background: transparent; border: 1px solid var(--line-2); border-radius: 6px;
    cursor: pointer; font-family: var(--mono);
    transition: all 0.12s;
}
.sim-header .hdr-btn:hover { color: var(--text); border-color: var(--violet); }
.sim-header .hdr-btn.active { background: var(--violet); color: #fff; border-color: var(--violet); box-shadow: 0 0 14px rgba(124,58,237,0.45); }
.sim-header .hdr-btn.on { color: var(--green); border-color: var(--green); }
.sim-header .hdr-btn.off { color: var(--pink); border-color: var(--pink); }
.sim-header .btn-group { display: flex; gap: 3px; }

.side-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
    background: var(--panel-solid); border-bottom: 1px solid var(--line); padding: 8px 14px;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.side-header .cam-label { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }

#metrics-panel {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--panel); border-top: 1px solid var(--line); padding: 12px 18px;
    font-size: 12px; line-height: 1.7;
    font-family: var(--mono);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#metrics-panel span { color: var(--violet-l); font-weight: 600; }

/* Start overlay */
#start-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: var(--scrim);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer;
}
#start-overlay .start-title {
    font-family: var(--display); font-size: 32px; font-weight: 600; letter-spacing: 0.02em;
    color: var(--text); margin-bottom: 8px;
}
#start-overlay .start-sub {
    font-size: 15px; color: var(--text-2); margin-bottom: 32px;
}
#start-overlay .start-btn {
    padding: 14px 40px; font-size: 16px; font-weight: 600;
    font-family: var(--mono); letter-spacing: 0.04em;
    background: var(--violet); color: #fff; border: none; border-radius: 8px;
    cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 22px rgba(124,58,237,0.4);
}
#start-overlay .start-btn:hover { background: #8b4cf2; box-shadow: 0 0 32px rgba(124,58,237,0.6); }
#start-overlay .start-hint {
    margin-top: 16px; font-size: 12px; color: var(--text-3); font-family: var(--mono);
}



/* Controls drawer (slides from left) */
#controls-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: min(340px, 85vw); background: rgba(13,9,22,0.96);
    border-right: 1px solid var(--line-2);
    transform: translateX(-100%); transition: transform 0.28s ease;
    overflow-y: auto; padding: 20px 22px 32px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#controls-drawer.open { transform: translateX(0); }
#controls-drawer-overlay {
    display: none; position: fixed; inset: 0; z-index: 49;
    background: rgba(0,0,0,0.4);
}
#controls-drawer-overlay.open { display: block; }
#controls-drawer h4 {
    font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--violet-l); margin: 16px 0 8px;
}
#controls-drawer h4:first-child { margin-top: 0; }
#controls-drawer .drawer-close-btn {
    position: absolute; top: 14px; right: 14px; background: none;
    border: 1px solid var(--line-2); border-radius: 6px; color: var(--text-2);
    width: 28px; height: 28px; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
}
#controls-drawer .drawer-close-btn:hover { color: var(--violet-l); border-color: var(--violet); }
.ctrl-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 2; }
.ctrl-key {
    font-family: var(--mono); font-size: 11px; color: var(--text);
    background: var(--bg-3); padding: 2px 8px; border-radius: 5px;
    border: 1px solid var(--line-2); border-bottom-width: 2px; white-space: nowrap;
}
.ctrl-desc { color: var(--text-2); }

/* Mission HUD */
/* Score panels — top right of left viewport */
.hud-panel {
    display: none; position: absolute; z-index: 15;
    background: rgba(11,8,19,0.78); border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 14px; font-family: var(--mono); color: var(--text);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.hud-panel .hud-label { display: block; font-size: 8px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); margin-bottom: 2px; }
.hud-panel .hud-val { font-size: 20px; font-weight: 700; }
#hud-score-panel { top: 42px; right: 18px; }
#hud-score-panel .hud-val { color: var(--violet-l); }
#hud-payload-panel { top: 42px; right: 108px; }
#hud-race-timer { top: 42px; right: 108px; }
#hud-race-timer .hud-val { color: var(--amber); font-variant-numeric: tabular-nums; }
#hud-race-rings { top: 42px; right: 220px; }
#hud-race-rings .hud-val { color: var(--green); }
#hud-game-score { top: 42px; right: 188px; }
#hud-game-score .hud-val { color: var(--amber); }
#hud-level { top: 42px; right: 278px; }
#mission-hud { display: none; }

/* Battery in metrics bar */
.metrics-battery { display: none; align-items: center; gap: 6px; margin-right: 12px; }
.metrics-battery .batt-label { color: var(--text-2); font-size: 12px; }
.metrics-battery .batt-time { color: var(--violet-l); font-weight: 600; font-size: 12px; }
.metrics-battery .battery-track { width: 60px; height: 5px; background: rgba(150,120,240,0.18); border-radius: 3px; overflow: hidden; }
.battery-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.5s; }

/* Drop feedback */
#drop-feedback {
    display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 25; font-size: 22px; font-weight: 700; color: var(--green);
    text-shadow: 0 2px 12px rgba(57,211,154,0.5); transition: opacity 0.5s;
    pointer-events: none;
}

/* Guidance hint — persistent step-by-step instructions */
#guide-hint {
    display: none; position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%);
    z-index: 20; padding: 10px 24px; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: #fff;
    background: rgba(124,58,237,0.9); border: 1px solid var(--violet);
    pointer-events: none; white-space: nowrap;
    font-family: var(--mono);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    box-shadow: 0 0 18px rgba(124,58,237,0.35);
}

/* Descent warning */
#descent-warning {
    display: none; position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
    z-index: 25; padding: 8px 20px; border-radius: 6px;
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    pointer-events: none; text-align: center;
    animation: pulse-warn 0.6s ease-in-out infinite alternate;
}
#descent-warning.caution {
    background: rgba(245,166,35,0.92); color: #000; border: 2px solid var(--amber);
}
#descent-warning.danger {
    background: rgba(255,93,143,0.92); color: #fff; border: 2px solid var(--pink);
}
@keyframes pulse-warn { from { opacity: 0.8; } to { opacity: 1; } }

/* Shooting crosshair */
#shooting-crosshair {
    display: none; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); z-index: 12; pointer-events: none;
}
#shooting-crosshair .ch-ring {
    width: 32px; height: 32px; border: 2px solid rgba(255,93,143,0.7);
    border-radius: 50%; position: relative; transition: border-color 0.05s, box-shadow 0.05s;
}
#shooting-crosshair.flash .ch-ring {
    border-color: rgba(255,200,68,1);
    box-shadow: 0 0 12px rgba(255,150,0,0.6);
}
#shooting-crosshair .ch-dot {
    position: absolute; top: 50%; left: 50%; width: 4px; height: 4px;
    background: var(--pink); border-radius: 50%; transform: translate(-50%,-50%);
}
#shooting-crosshair .ch-line {
    position: absolute; background: rgba(255,93,143,0.45);
}
#shooting-crosshair .ch-h { width: 10px; height: 1px; top: 50%; transform: translateY(-50%); }
#shooting-crosshair .ch-h.l { left: -14px; }
#shooting-crosshair .ch-h.r { right: -14px; }
#shooting-crosshair .ch-v { width: 1px; height: 10px; left: 50%; transform: translateX(-50%); }
#shooting-crosshair .ch-v.t { top: -14px; }
#shooting-crosshair .ch-v.b { bottom: -14px; }

/* Altitude warning */
#altitude-warning {
    display: none; position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
    z-index: 25; padding: 6px 16px; border-radius: 6px;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    pointer-events: none;
    background: rgba(255,93,143,0.92); color: #fff; border: 2px solid var(--pink);
    animation: pulse-warn 0.6s ease-in-out infinite alternate;
}

/* Environment panel */
#env-panel {
    display: none; position: absolute; top: 44px; left: 18px; z-index: 22;
    background: rgba(11,8,19,0.9); border: 1px solid var(--line); border-radius: 8px;
    padding: 14px 16px; width: 240px; max-height: 380px; overflow-y: auto;
    font-family: var(--mono); font-size: 11px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#env-panel h4 {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--violet-l); margin: 0 0 8px; font-weight: 700;
}
#env-panel .env-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
#env-panel .env-label { color: var(--text-2); font-size: 10px; }
#env-panel .env-val { color: var(--text); font-size: 10px; font-weight: 600; min-width: 28px; text-align: right; }
#env-panel input[type=range] {
    -webkit-appearance: none; width: 100%; height: 3px; border-radius: 3px;
    background: var(--line-2); outline: none; margin: 2px 0 8px;
}
#env-panel input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
    background: var(--violet); cursor: pointer;
}
#env-panel .env-presets {
    display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
}
#env-panel .env-preset {
    padding: 4px 8px; font-size: 9px; font-weight: 600; color: var(--text-2);
    background: rgba(150,120,240,0.06); border: 1px solid var(--line-2); border-radius: 4px;
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em;
    transition: all 0.12s;
}
#env-panel .env-preset:hover { color: var(--text); border-color: var(--violet); }
#env-panel .env-preset.active { color: var(--violet-l); border-color: var(--violet); background: rgba(124,58,237,0.15); }


/* Score overlay */
#score-overlay {
    display:none; position:fixed; inset:0; z-index:60;
    background:var(--scrim); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
    align-items:center; justify-content:center; padding:24px;
    overflow-y:auto; -webkit-overflow-scrolling:touch;
}
.score-card {
    position:relative; background:var(--bg-2);
    border:1px solid var(--line-2); border-radius:16px;
    padding:30px 30px 26px; max-width:400px; width:100%; text-align:center;
    box-shadow:0 24px 60px rgba(0,0,0,.5), 0 0 50px rgba(124,58,237,.18), inset 0 0 60px rgba(124,58,237,.05);
    animation:cardIn .36s cubic-bezier(.2,.8,.2,1) both;
    /* Cap to viewport so the card never overflows the screen. The header/stats
       scroll inside .score-scroll; feedback + actions stay pinned + visible. */
    display:flex; flex-direction:column;
    max-height:calc(100vh - 48px); max-height:calc(100dvh - 48px);
}
@keyframes cardIn { from{opacity:0; transform:translateY(14px) scale(.96);} to{opacity:1; transform:none;} }

/* Scrollable region: seal, title, hero, stats, score breakdown */
.score-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.score-scroll::-webkit-scrollbar { width:6px; }
.score-scroll::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:3px; }
.score-scroll::-webkit-scrollbar-track { background:transparent; }
/* Always-visible pinned footer: rating + Try again / Back */
#feedback-section, .score-actions { flex-shrink:0; }

/* HUD corner brackets */
.score-card .corner { position:absolute; width:16px; height:16px; border:2px solid var(--violet); opacity:.6; }
.score-card .corner.tl { top:-1px; left:-1px; border-right:0; border-bottom:0; border-top-left-radius:16px; }
.score-card .corner.tr { top:-1px; right:-1px; border-left:0; border-bottom:0; border-top-right-radius:16px; }
.score-card .corner.bl { bottom:-1px; left:-1px; border-right:0; border-top:0; border-bottom-left-radius:16px; }
.score-card .corner.br { bottom:-1px; right:-1px; border-left:0; border-top:0; border-bottom-right-radius:16px; }

/* success seal */
.score-seal {
    width:60px; height:60px; border-radius:50%; margin:0 auto 14px;
    display:flex; align-items:center; justify-content:center; font-size:30px;
    color:var(--green); border:2px solid rgba(57,211,154,.5);
    background:rgba(57,211,154,.1); box-shadow:0 0 26px rgba(57,211,154,.3);
    animation:sealPop .42s .08s cubic-bezier(.2,.9,.3,1.4) both;
}
@keyframes sealPop { from{opacity:0; transform:scale(.3);} to{opacity:1; transform:scale(1);} }

.score-card h2 { font-family:var(--display); font-size:25px; font-weight:600; letter-spacing:.02em; color:var(--text); margin-bottom:20px; }

/* hero total */
.score-hero {
    background:var(--bg-3); border:1px solid var(--line); border-radius:12px;
    padding:16px; margin-bottom:16px; box-shadow:inset 0 0 30px rgba(124,58,237,.07);
}
.score-hero .hero-label { font-family:var(--mono); font-size:10px; letter-spacing:.2em; text-transform:uppercase; color:var(--text-2); margin-bottom:5px; }
.score-hero .hero-val { font-family:var(--mono); font-size:46px; font-weight:700; line-height:1; color:var(--violet-l); font-variant-numeric:tabular-nums; text-shadow:0 0 24px rgba(124,58,237,.45); }

/* stat tiles */
.score-stats { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:18px; }
.stat-tile { background:var(--bg-3); border:1px solid var(--line); border-radius:9px; padding:11px 12px; text-align:left; }
.stat-tile .stat-label { font-family:var(--mono); font-size:9px; letter-spacing:.12em; text-transform:uppercase; color:var(--text-2); margin-bottom:5px; }
.stat-tile .stat-val { font-family:var(--mono); font-size:18px; font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; }
.stat-tile.good .stat-val { color:var(--green); }
.stat-tile.bad .stat-val { color:var(--pink); }
.stat-tile.span { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; }
.stat-tile.span .stat-label { margin-bottom:0; }

/* breakdown */
.breakdown-head { font-family:var(--mono); font-size:10px; letter-spacing:.16em; text-transform:uppercase; color:var(--text-2); text-align:left; margin-bottom:8px; }
#score-breakdown { text-align:left; border-top:1px solid var(--line); padding-top:6px; margin-bottom:18px; }
#score-breakdown:empty { display:none; }
.breakdown-head:has(+ #score-breakdown:empty) { display:none; }
.score-row { display:flex; justify-content:space-between; gap:12px; padding:7px 0; font-size:13px; border-bottom:1px solid rgba(150,120,240,.08); }
.score-row:last-child { border-bottom:none; }
.score-label { color:var(--text-2); }
.score-val { color:var(--text); font-weight:600; font-family:var(--mono); }
#score-breakdown::-webkit-scrollbar { width:6px; }
#score-breakdown::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:3px; }
#score-breakdown::-webkit-scrollbar-track { background:transparent; }

/* actions */
.score-actions { display:flex; gap:10px; justify-content:center; }
.score-btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; flex:1;
    padding:12px 18px; font-size:13.5px; font-weight:600; border:none; border-radius:9px; cursor:pointer;
    font-family:var(--mono); letter-spacing:.04em; transition:.14s; }
.score-btn i { font-size:16px; }
.score-btn-primary { background:var(--violet); color:#fff; box-shadow:0 0 20px rgba(124,58,237,.4); }
.score-btn-primary:hover { background:#8b4cf2; box-shadow:0 0 30px rgba(124,58,237,.6); transform:translateY(-1px); }
.score-btn-secondary { background:var(--bg-3); color:var(--text-2); border:1px solid var(--line-2); }
.score-btn-secondary:hover { color:var(--text); border-color:var(--violet); background:rgba(124,58,237,.1); }

@media (prefers-reduced-motion:reduce) {
  .score-card, .score-seal { animation:none; }
}

/* Loading screen with progress bar */
#loading {
    position: fixed; inset: 0; background: var(--bg); color: var(--text);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 14px; z-index: 40; gap: 16px; font-family: var(--body);
}
#loading-text { color: var(--text-2); font-family: var(--mono); }
#loading-bar-track {
    width: 240px; height: 4px; background: rgba(150,120,240,0.14);
    border-radius: 2px; overflow: hidden;
}
#loading-bar {
    width: 0%; height: 100%; background: var(--violet);
    border-radius: 2px; transition: width 0.2s ease; box-shadow: 0 0 12px rgba(124,58,237,0.5);
}

@media (max-width: 768px) {
    .sim-layout { flex-direction: column; }
    .sim-main { flex: 1; height: 100% !important; }
    .sim-side { width: 25% !important; display: flex !important; flex-direction: column; border-left: 2px solid #000; }
    .score-card { padding: 20px 24px; max-width: 320px; }
    .score-card h2 { font-size: 20px; margin-bottom: 14px; }
    .score-row { font-size: 12px; padding: 6px 0; }
    .score-total-row { font-size: 22px; }
    .score-btn { padding: 8px 16px; font-size: 13px; }
    .score-actions { flex-wrap: wrap; }
}

/* Short screens (landscape phones, small laptops): compact the card so the
   pinned rating + Try again / Back always fit; the header/stats scroll.
   !important overrides the inline styles on the feedback controls. */
@media (max-height: 560px) {
    .score-card { padding: 14px 22px 12px !important; }
    .score-seal { width:38px; height:38px; font-size:19px; margin-bottom:6px; }
    .score-card h2 { font-size:17px; margin-bottom:8px !important; }
    .score-hero { padding:9px; margin-bottom:9px; }
    .score-hero .hero-val { font-size:30px; }
    .score-stats { gap:6px; margin-bottom:9px; }
    .stat-tile { padding:8px 10px; }
    #score-breakdown { margin-bottom:10px; }
    #feedback-section { margin-top:10px !important; padding-top:10px !important; margin-bottom:10px !important; }
    #feedback-section textarea { height:34px !important; }
    .fb-star { font-size:22px !important; }
    .score-actions .score-btn { padding:8px 14px; }
}
