/* ============================================================================
   ORCA Board — Pixel Art Tactical Strategy Game
   Cyberpunk dark theme matching ORCA Dashboard palette
   ============================================================================ */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-section: #161622;
    --accent-cyan: #00bfff;
    --accent-green: #00ff41;
    --accent-red: #ff3333;
    --accent-orange: #ff9900;
    --accent-yellow: #ffff00;
    --accent-purple: #a78bfa;
    --accent-magenta: #ff00ff;
    --text-primary: #e0e0e0;
    --text-secondary: #8899a6;
    --text-muted: #555555;
    --border-color: #2a2a3a;
    --font-mono: ui-monospace, 'Fira Code', 'Consolas', monospace;
    --font-sans: 'Segoe UI', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Layout
   ============================================================================ */
#game-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
}

#game-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 1px solid var(--border-color);
    cursor: crosshair;
    max-width: 100%;
    max-height: calc(100vh - 80px);
}
#game-canvas:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 4px;
}

/* ============================================================================
   Top HUD Bar
   ============================================================================ */
#top-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid var(--border-color);
    height: 40px;
    flex-shrink: 0;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hud-center { justify-content: center; }

.phase-label {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 2px 12px;
    border-radius: 4px;
}
.phase-label.phase-dev { color: var(--accent-cyan); border: 1px solid var(--accent-cyan); background: rgba(0,191,255,0.1); }
.phase-label.phase-sec { color: var(--accent-red); border: 1px solid var(--accent-red); background: rgba(255,51,51,0.1); }
.phase-label.phase-threat { color: var(--accent-orange); border: 1px solid var(--accent-orange); background: rgba(255,153,0,0.1); }
.phase-label.phase-resolution { color: var(--accent-green); border: 1px solid var(--accent-green); background: rgba(0,255,65,0.1); }

#turn-counter {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.integrity-bar {
    width: 150px;
    height: 12px;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
    transition: width 0.5s;
}
.bar-fill.warning { background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow)); }
.bar-fill.critical { background: linear-gradient(90deg, var(--accent-red), var(--accent-orange)); }

#integrity-text {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 3px #000;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}
.resource-icon { font-size: 14px; }
.resource-value.credits { color: var(--accent-yellow); }
.resource-value.intel { color: var(--accent-purple); }

.integrity-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}
.integrity-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================================================
   Side Panels
   ============================================================================ */
#side-panel {
    width: 220px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-section {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

/* Agent Panel */
#agent-panel {
    display: none;
}
#agent-panel.visible { display: block; }

#agent-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
#agent-role {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.agent-team {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.agent-team.dev { color: var(--accent-cyan); border: 1px solid var(--accent-cyan); background: rgba(0,191,255,0.1); }
.agent-team.sec { color: var(--accent-red); border: 1px solid var(--accent-red); background: rgba(255,51,51,0.1); }

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding: 3px 0;
}
.stat-label {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
}
.stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
}
.stat-value.build { color: var(--accent-cyan); }
.stat-value.shield { color: var(--accent-red); }
.stat-value.focus { color: var(--accent-yellow); }

.ability-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

#ability-btn {
    width: 100%;
    padding: 6px;
    background: rgba(255, 0, 255, 0.15);
    border: 1px solid var(--accent-magenta);
    color: var(--accent-magenta);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-bottom: 4px;
}
#ability-btn:hover:not(:disabled) {
    background: rgba(255, 0, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}
#ability-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#ability-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-magenta);
    margin-bottom: 2px;
}
#ability-desc {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.3;
}
#ability-cd {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--accent-orange);
    margin-top: 2px;
}

/* Project Panel */
.project-item {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 6px;
}
.project-item.completed {
    border-color: var(--accent-green);
    opacity: 0.7;
}
.project-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.project-room {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.project-bar {
    height: 4px;
    background: #111;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2px;
}
.project-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
    border-radius: 2px;
    transition: width 0.4s;
}
.project-item.completed .project-fill { background: var(--accent-green); }
.project-pct {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--accent-cyan);
    text-align: right;
}

/* End Phase Button */
#end-phase-btn {
    display: none;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 32px;
    background: rgba(0, 191, 255, 0.15);
    border: 2px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    z-index: 10;
}
#end-phase-btn:hover {
    background: rgba(0, 191, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
    transform: translateX(-50%) translateY(-2px);
}

/* ============================================================================
   Commentary Bubble
   ============================================================================ */
#commentary {
    position: absolute;
    bottom: 60px;
    left: 16px;
    background: rgba(18, 18, 26, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    max-width: 320px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 10;
    pointer-events: none;
}
#commentary.visible {
    opacity: 1;
    transform: translateY(0);
}
.commentary-name {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 3px;
}
.commentary-name.dev { color: var(--accent-cyan); }
.commentary-name.sec { color: var(--accent-red); }
#commentary-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============================================================================
   Tip Banner
   ============================================================================ */
#tip-banner {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    padding: 8px 16px;
    max-width: 500px;
    font-size: 11px;
    color: var(--accent-purple);
    text-align: center;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
#tip-banner.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   Menu Overlay
   ============================================================================ */
#menu-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 5, 10, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.menu-title {
    font-family: var(--font-mono);
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
    letter-spacing: 6px;
    margin-bottom: 8px;
}

.menu-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.menu-btn {
    display: block;
    width: 280px;
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.menu-btn:hover {
    background: rgba(0, 191, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
    transform: translateY(-2px);
}
.menu-btn.red {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(255, 51, 51, 0.1);
}
.menu-btn.red:hover {
    background: rgba(255, 51, 51, 0.25);
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.3);
}
.menu-description {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 24px;
    max-width: 320px;
    text-align: center;
    line-height: 1.4;
}

/* ============================================================================
   End Overlay
   ============================================================================ */
#end-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 5, 10, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#end-title {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-green);
    text-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
    letter-spacing: 4px;
    margin-bottom: 16px;
}

#end-message {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 32px;
}

#restart-btn {
    padding: 12px 40px;
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
#restart-btn:hover {
    background: rgba(0, 191, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
}

/* ============================================================================
   Scrollbar
   ============================================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 900px) {
    #side-panel { width: 180px; }
    .menu-title { font-size: 24px; }
}

@media (max-width: 600px) {
    #game-wrapper { flex-direction: column; }
    #side-panel {
        width: 100%;
        height: 120px;
        border-left: none;
        border-top: 1px solid var(--border-color);
        flex-direction: row;
        overflow-x: auto;
    }
    .panel-section { min-width: 180px; }
}

/* Way home to the arcade (2026-09-23 arcade hygiene) */
.hud-home {
    color: inherit;
    opacity: .75;
    font-size: .78rem;
    letter-spacing: .08em;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
}
.hud-home:hover, .hud-home:focus-visible {
    opacity: 1;
    text-decoration: underline;
}
