/* ============================================================
   CSL VISUALIZATION ENGINE - Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0e17;
    --surface: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.1);
    --primary: #00ffcc;
    --danger: #ff4d6d;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --radius: 12px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Layout ---- */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

body.ui-minimal {
    background: transparent;
}

body.ui-minimal #topbar,
body.ui-minimal #sidebar {
    display: none;
}

body.ui-minimal #main {
    display: block;
}

body.ui-minimal #canvas-wrap {
    padding: 0.35rem;
    height: 100vh;
}

body.ui-minimal #game-canvas {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 16px;
}

body.ui-minimal #goal-banner {
    bottom: 0.75rem;
}

/* ---- Top Bar ---- */
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.25rem;
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1rem;
    z-index: 10;
}

#topbar h1 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary);
}

.game-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.game-btn:hover { border-color: var(--primary); color: var(--primary); }
.game-btn.active {
    background: rgba(0,255,204,0.12);
    border-color: var(--primary);
    color: var(--primary);
}

.controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ctrl-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.1); }
.ctrl-btn.primary {
    background: rgba(0,255,204,0.12);
    border-color: rgba(0,255,204,0.3);
    color: var(--primary);
}
.ctrl-btn.primary:hover { background: rgba(0,255,204,0.2); }

/* ---- Main Area ---- */
#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- SVG Canvas ---- */
#canvas-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#game-canvas {
    width: 100%;
    max-width: 900px;
    height: 100%;
    max-height: 640px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #0d1220;
    display: block;
}

/* ---- Sidebar ---- */
#sidebar {
    width: 240px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
    gap: 1rem;
}

.sidebar-section {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.75rem;
    background: var(--surface);
}

.sidebar-section h3 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

/* ---- Player List ---- */
.player-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.8rem;
}
.player-entry:last-child { border-bottom: none; }

.player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-name {
    flex: 1;
    color: var(--text);
    font-weight: 500;
}

.player-state {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

.phase-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.phase-controls {
    display: flex;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.phase-btn {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(0,255,204,0.14);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.phase-btn:hover:not(:disabled) {
    border-color: rgba(0,255,204,0.32);
    color: var(--primary);
}

.phase-btn:disabled {
    opacity: 0.42;
    cursor: default;
}

.phase-btn.is-manual {
    background: rgba(0,255,204,0.12);
    color: var(--primary);
    border-color: rgba(0,255,204,0.28);
}

.phase-step {
    display: flex;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    opacity: 0.68;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.phase-step:last-child {
    border-bottom: none;
}

.phase-step.active {
    opacity: 1;
    transform: translateX(2px);
}

.phase-step-index {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(0,255,204,0.18);
    background: rgba(0,255,204,0.08);
    color: var(--primary);
    font-size: 0.68rem;
    font-family: monospace;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.phase-step.active .phase-step-index {
    background: rgba(0,255,204,0.16);
    border-color: rgba(0,255,204,0.36);
}

.phase-step-copy {
    min-width: 0;
}

.phase-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.phase-result {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: 0.12rem;
}

/* ---- Game Info ---- */
.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { color: var(--text); font-weight: 600; font-family: monospace; }

/* ---- Stats ---- */
#stat-tags { color: var(--danger); font-weight: 700; }
#stat-time { color: var(--primary); font-weight: 700; font-family: monospace; }

/* ---- Goal Banner ---- */
#goal-banner {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 20, 10, 0.9);
    border: 1px solid rgba(0, 255, 204, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}
#goal-banner.visible { opacity: 1; }

#step-overlay {
    position: absolute;
    top: 1.2rem;
    left: 1.2rem;
    max-width: 18rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(0,255,204,0.16);
    background: linear-gradient(180deg, rgba(5,18,22,0.86), rgba(5,18,22,0.68));
    box-shadow: 0 16px 40px rgba(0,0,0,0.24);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

#step-overlay.visible {
    opacity: 1;
    transform: translateY(0);
}

.step-overlay-kicker {
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(0,255,204,0.72);
    margin-bottom: 0.24rem;
    font-weight: 700;
}

.step-overlay-title {
    font-size: 0.95rem;
    line-height: 1.2;
    color: var(--text);
    font-weight: 700;
}

.step-overlay-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.38rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.step-overlay-line strong {
    color: var(--primary);
    font-weight: 700;
}

.step-overlay-meta,
.step-overlay-target {
    color: var(--text-muted);
}

.step-overlay-result {
    margin-top: 0.42rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: rgba(226,232,240,0.86);
}

/* ---- Speed Slider ---- */
.slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.slider-wrap label { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
input[type=range] {
    flex: 1;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ---- Scroll on sidebar ---- */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ---- Zone Labels on SVG ---- */
.zone-label {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 11px;
    fill: rgba(255,255,255,0.25);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- SVG Player styles (injected inline) ---- */
.player-label {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
}
