/* ============================================================
   Projectile Launcher
   ============================================================ */

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

:root {
    --ball:  #d97706;
    --bg:    #f3f5f8;
    --panel: #ffffff;
    --border:#d8dee6;
    --text:  #1f2a37;
    --muted: #667085;
    --accent:#2563eb;
    --line-vx:   #7c3aed;
    --line-vy:   #f59e0b;
    --line-vmag: #059669;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    margin-bottom: 16px;
}
header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

/* ---------- Top row ---------- */

#top-row {
    display: grid;
    grid-template-columns: 250px 1fr 220px;
    gap: 14px;
    margin-bottom: 14px;
}

aside, main {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

#stage {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sim {
    flex: 1;
    width: 100%;
    min-height: 440px;
    display: block;
}

/* ---------- Mode toggle ---------- */

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    background: #eef2f7;
    border-radius: 6px;
}
.mode-btn {
    background: transparent;
    border: none;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
    font-family: inherit;
}
.mode-btn.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15,23,42,0.08);
}
.mode-btn:not(.active):hover { color: var(--text); }

/* ---------- Controls ---------- */

.control-group {
    margin-bottom: 16px;
}
.control-group:last-child { margin-bottom: 0; }

.control-group h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
}

.control-group label {
    display: block;
    font-size: 12px;
    color: var(--text);
    margin: 8px 0 4px;
}
.control-group .val {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}
.control-group input[type=range] {
    width: 100%;
    accent-color: var(--accent);
}

.val-input {
    display: inline-block;
    width: 62px;
    padding: 1px 4px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    text-align: right;
    vertical-align: baseline;
}
.val-input:hover { border-color: var(--border); }
.val-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
}
.val-input.out-of-range {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.val-input::-webkit-outer-spin-button,
.val-input::-webkit-inline-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.val-input[type=number] { -moz-appearance: textfield; appearance: textfield; }

label.check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* ---------- Playback bar ---------- */

#playback {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}
#playback button {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s, border-color 0.1s;
}
#playback button:hover { background: #eef2f7; border-color: #c0c9d4; }
#playback button:active { background: #e3e9f0; }
#playback button#playPause {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    min-width: 64px;
}
#playback button#playPause:hover { background: #1d4ed8; }

#time-display {
    margin-left: auto;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- Readouts ---------- */

.readout {
    margin-bottom: 14px;
}
.readout:last-child { margin-bottom: 0; }

.readout h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
}

.readout .row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: baseline;
    gap: 6px;
    padding: 3px 0;
    font-size: 13px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
}
.readout .lbl {
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.readout .num {
    text-align: right;
    font-weight: 600;
}
.readout .unit {
    color: var(--muted);
    font-size: 11px;
}

.status {
    margin-top: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    display: inline-block;
}
.status.landed {
    color: #065f46;
    background: #d1fae5;
}

/* ---------- Graphs ---------- */

#graphs-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.graph-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.graph-box h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.line-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.line-dot.vx   { background: var(--line-vx); }
.line-dot.vy   { background: var(--line-vy); }
.line-dot.vmag { background: var(--line-vmag); }

.graph-box canvas {
    width: 100%;
    height: 200px;
    display: block;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    #top-row { grid-template-columns: 1fr; }
    #graphs-row { grid-template-columns: 1fr; }
}
