/* CPAnext — dark, pixel-friendly UI chrome */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #14141c;
    color: #e8e8f0;
    font-family: "Segoe UI", system-ui, sans-serif;
}

h1:focus { outline: none; }

button {
    background: #2a2a3a;
    color: #e8e8f0;
    border: 1px solid #44445c;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font: inherit;
}

button:hover { background: #38384e; }
button.primary { background: #3d5afe; border-color: #3d5afe; }
button.primary:hover { background: #536dfe; }
button.danger { background: #6b2030; border-color: #8a2a3e; }

input, select {
    background: #1e1e2a;
    color: #e8e8f0;
    border: 1px solid #44445c;
    border-radius: 4px;
    padding: 6px 10px;
    font: inherit;
}

.error { color: #ff6b7a; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #6b2030; padding: 8px 16px; z-index: 9999; }
#blazor-error-ui.visible { display: block; }

/* ---------- start screen ---------- */

.start-screen { max-width: 960px; margin: 0 auto; padding: 32px 16px; }
.start-header h1 { font-size: 42px; margin: 0; letter-spacing: 2px; }
.start-header p { color: #9a9ab0; }
.lang-toggle button.active { background: #3d5afe; }
.identity { display: flex; gap: 16px; align-items: end; margin: 24px 0; flex-wrap: wrap; }
.identity label { display: flex; flex-direction: column; gap: 4px; }
.color-picker { display: flex; gap: 6px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.color-dot.selected { border-color: #fff; }
.join-box { display: flex; gap: 8px; margin-bottom: 24px; }
.code-input { text-transform: uppercase; letter-spacing: 4px; width: 180px; font-size: 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game-card { background: #1e1e2a; border: 1px solid #2e2e40; border-radius: 8px; padding: 16px; }
.game-card img { width: 100%; border-radius: 4px; image-rendering: pixelated; }
.game-card .version { color: #707088; font-size: 12px; }

/* ---------- game screen ---------- */

.game-root { display: flex; flex-direction: column; height: 100vh; outline: none; }
.top-bar { display: flex; align-items: center; gap: 12px; padding: 6px 12px;
    background: #101018; border-bottom: 1px solid #2e2e40; flex-wrap: wrap; }
.game-title { font-weight: 600; }
.code-badge { letter-spacing: 3px; font-family: monospace; font-size: 15px; }
.roster { display: flex; gap: 4px; }
.player-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.player-dot.offline { opacity: 0.3; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

.stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center;
    overflow: hidden; background: #000; position: relative; min-height: 0; }
.stage { position: relative; overflow: hidden; background: #000; }
.scene { position: absolute; top: 0; left: 0; will-change: transform; }
.scene-bg { position: absolute; top: 0; left: 0; display: block; height: 100%; }
.hd-el { position: absolute; image-rendering: auto; }        /* HD stays smooth on purpose */
.hd-el.glow { animation: hdglow 1.6s ease-in-out infinite alternate; }
@keyframes hdglow { from { filter: drop-shadow(0 0 3px rgba(255,240,160,.6)); }
                    to { filter: drop-shadow(0 0 9px rgba(255,240,160,1)); } }
.focus-dim { position: absolute; inset: 0; background: rgba(0,0,0,.3); z-index: 599; pointer-events: none; }
.scene-item { position: absolute; width: 32px; height: 32px; }
.sprite { position: absolute; background-repeat: no-repeat; }
.protagonist { position: absolute; }
.protagonist .sprite-frame { background-repeat: no-repeat; }
.cursor-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1500; }
.remote-cursor { position: absolute; top: 0; left: 0; pointer-events: none; }
.remote-cursor span { font-size: 9px; color: #000; padding: 1px 4px; border-radius: 3px; margin-left: 10px; }

.subtitle { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
    max-width: 85%; text-align: center; font-size: 16px; font-weight: 600;
    text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
    z-index: 1000; pointer-events: none; }
.skip-indicator { margin-left: 10px; font-size: 11px; opacity: .8; }

.cutscene-still { position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; background: #000; z-index: 1100; animation: fadein .5s; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.letterbox { position: absolute; left: 0; right: 0; height: 10%; background: #000; z-index: 1050; }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
.skip-btn { position: absolute; right: 12px; bottom: 12%; z-index: 1200; opacity: .85; }

.loading-overlay { position: absolute; inset: 0; background: #0a0a12; z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.progress { width: 240px; height: 10px; background: #22222e; border-radius: 5px; overflow: hidden; }
.progress div { height: 100%; background: #3d5afe; transition: width .15s; }
.waiting { color: #9a9ab0; font-size: 13px; }

.end-overlay { position: absolute; inset: 0; background: rgba(6,6,12,.92); z-index: 2100;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.end-overlay a.primary { background: #3d5afe; padding: 8px 20px; border-radius: 4px;
    color: #fff; text-decoration: none; }

.toast { position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    background: rgba(20,20,30,.92); border: 1px solid #44445c; padding: 6px 14px;
    border-radius: 6px; z-index: 2200; animation: fadein .2s; }

/* ---------- command bar ---------- */

.command-bar { background: #101018; border-top: 1px solid #2e2e40; padding: 6px 12px; }
.sentence-line { min-height: 22px; color: #ffd966; font-size: 15px; padding: 2px 4px; }
.command-grid { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.verb-grid { display: grid; grid-template-columns: repeat(3, 110px); gap: 4px; }
.verb-btn { padding: 8px 4px; font-size: 14px; }
.verb-btn.armed { background: #3d5afe; border-color: #536dfe; }
.inventory-grid { display: grid; grid-template-columns: repeat(6, 44px); grid-auto-rows: 44px;
    gap: 4px; max-height: 96px; overflow-y: auto; }
.inv-slot { padding: 2px; }
.inv-slot img { width: 32px; height: 32px; image-rendering: pixelated; }
.inv-slot.armed { background: #3d5afe; }

/* ---------- dialogs ---------- */

.dialog-choices { background: #101018; border-top: 1px solid #2e2e40; padding: 10px 16px;
    display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.dialog-choice { text-align: left; font-size: 15px; }

/* ---------- chat ---------- */

.chat-panel { position: fixed; right: 12px; bottom: 12px; width: 280px; z-index: 2300;
    display: flex; flex-direction: column; }
.chat-panel .chat-toggle { align-self: flex-end; }
.chat-messages { background: rgba(16,16,24,.95); border: 1px solid #2e2e40; border-radius: 6px;
    height: 240px; overflow-y: auto; padding: 8px; font-size: 13px; margin: 6px 0; }
.chat-msg.system { color: #8a8aa0; font-style: italic; }
.chat-name { font-weight: 600; }
.chat-input { display: flex; gap: 4px; }
.chat-input input { flex: 1; }

/* ---------- modals ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 2400;
    display: flex; align-items: center; justify-content: center; }
.modal { background: #1a1a26; border: 1px solid #2e2e40; border-radius: 8px; padding: 20px;
    min-width: 380px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px; }
.save-new { display: flex; gap: 8px; }
.save-new input { flex: 1; }
.save-row { display: flex; gap: 8px; align-items: center; padding: 4px 0;
    border-bottom: 1px solid #26263a; }
.save-row span:first-child { flex: 1; }
.save-date { color: #707088; font-size: 12px; }

/* ---------- dev overlay ---------- */

.dev-overlay { position: fixed; left: 12px; top: 52px; width: 300px; max-height: 80vh;
    overflow-y: auto; background: rgba(14,14,22,.97); border: 1px solid #3d5afe;
    border-radius: 8px; padding: 12px; z-index: 2500; font-size: 13px;
    display: flex; flex-direction: column; gap: 8px; }
.dev-header { display: flex; justify-content: space-between; align-items: center; }
.dev-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.dev-json { word-break: break-all; display: block; background: #0a0a12; padding: 4px; }
.dev-status { color: #7fd97f; }
.dev-shapes { position: absolute; inset: 0; z-index: 1400; pointer-events: none; }
.dev-walkbox { fill: rgba(60,180,75,.15); stroke: #3cb44b; stroke-width: 1; }
.dev-hotspot { fill: rgba(61,90,254,.15); stroke: #3d5afe; stroke-width: 1; }
.dev-exit { fill: rgba(245,130,49,.15); stroke: #f58231; stroke-width: 1; }
