/* Moonshot - Orbital Mechanics Game */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0e27;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ── Settings ── */

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    cursor: default;
}

/* ── Version Label ── */
#version-label {
    position: absolute;
    top: 8px;
    right: 12px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    z-index: 60;
    pointer-events: none;
    letter-spacing: 1px;
}

/* ── HUD ── */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

#hud > * {
    pointer-events: auto;
}

#mission-label {
    position: absolute;
    top: 12px;
    left: 16px;
    font-size: 15px;
    color: rgba(255,255,255,0.75);
    letter-spacing: 1px;
}

/* (stats panel moved to canvas rendering + bottom HUD) */

.unit-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #aaa;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.unit-toggle:hover {
    border-color: rgba(255,255,255,0.3);
    color: #ccc;
}

.unit-toggle.active {
    border-color: #00ff88;
    color: #00ff88;
}

/* ── Bottom Controls (playback + day + abort) ── */
/* ── Flight Dashboard ── */
#flight-readout {
    position: absolute;
    bottom: 100px;
    right: 12px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: 'Courier New', monospace;
}

.dash-panel {
    background: rgba(8, 12, 28, 0.88);
    border: 1px solid rgba(0, 255, 136, 0.12);
    border-radius: 3px;
    padding: 4px 10px 5px;
    position: relative;
    overflow: hidden;
}

/* Scanline overlay on each panel */
.dash-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.06) 2px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
}

.dash-label {
    color: rgba(0, 204, 110, 0.5);
    font-size: 9px;
    letter-spacing: 3px;
    margin-bottom: 2px;
}

.dash-unit {
    color: rgba(0, 204, 110, 0.35);
    letter-spacing: 1px;
}

.dash-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 20px;
}

.dash-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.dash-icon-earth { color: #4a9eff; }
.dash-icon-moon { color: #cccccc; }

.dash-arrow {
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    font-weight: bold;
}

.dash-arrow.toward { color: #44bbff; }
.dash-arrow.away { color: #ff6644; }

.dash-value {
    color: #00ff88;
    font-size: 13px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.dash-value-lg {
    font-size: 15px;
    letter-spacing: 2px;
}

.dash-gforce {
    justify-content: center;
}

#bottom-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 10;
}

#day-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

#day-display .label {
    color: #aaa;
}

#day-display .value {
    color: #00ff88;
}

#time-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.time-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ddd;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
}

.time-btn:hover {
    background: rgba(255,255,255,0.15);
}

.time-btn.active {
    background: rgba(0,255,136,0.15);
    border-color: rgba(0,255,136,0.4);
    color: #00ff88;
}

.time-btn.inactive {
    background: rgba(255,60,60,0.12);
    border-color: rgba(255,60,60,0.35);
    color: #ff6666;
}

/* ── View Controls (top right) ── */
#view-controls {
    position: absolute;
    top: 36px;
    right: 16px;
    display: flex;
    gap: 6px;
    z-index: 50;
}

.view-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.view-btn:hover {
    background: rgba(255,255,255,0.15);
}

.view-zoom-btn {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 6px 10px;
    color: #ffa500;
    border-color: rgba(255,165,0,0.3);
}

.view-zoom-btn:hover {
    border-color: rgba(255,165,0,0.6);
}

.view-cycle-btn {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 6px 14px;
    height: auto;
    width: auto;
    background: rgba(0,255,136,0.1);
    border-color: rgba(0,255,136,0.3);
    color: #00ff88;
}

.time-btn.flash-green, .view-btn.flash-green {
    animation: flashGreen 0.4s ease 3;
}

@keyframes jitter {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-3px, 1px); }
    20% { transform: translate(2px, -2px); }
    30% { transform: translate(-1px, 3px); }
    40% { transform: translate(3px, -1px); }
    50% { transform: translate(-2px, -2px); }
    60% { transform: translate(1px, 3px); }
    70% { transform: translate(-3px, -1px); }
    80% { transform: translate(2px, 2px); }
    90% { transform: translate(-1px, -3px); }
}

.jitter {
    animation: jitter 0.3s ease;
}

@keyframes flashGreen {
    0%, 100% { background: rgba(0,255,136,0.15); border-color: rgba(0,255,136,0.4); color: #00ff88; }
    50% { background: rgba(0,255,136,0.45); border-color: rgba(0,255,136,0.8); color: #fff; }
}

.time-btn.pause-btn.paused {
    background: rgba(255,165,0,0.2);
    border-color: rgba(255,165,0,0.5);
    color: #ffa500;
}

/* ── Burn Panel ── */
#burn-panel {
    display: none;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 19, 32, 0.95);
    border: 1px solid rgba(255,165,0,0.3);
    border-radius: 8px;
    padding: 20px;
    width: 260px;
    z-index: 20;
}

#burn-panel.visible {
    display: block;
}

#burn-panel h3 {
    color: #ffa500;
    font-size: 14px;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.burn-field {
    margin-bottom: 16px;
}

.burn-field .field-label {
    color: #aaa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.burn-field .field-value {
    color: #00ff88;
    font-size: 18px;
}

.burn-field .field-sub {
    color: #888;
    font-size: 11px;
    margin-top: 2px;
}

#burn-angle-dial {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #444;
    position: relative;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    margin: 8px 0;
}

#burn-angle-input, #burn-duration-input {
    background: #1a1f35;
    border: 1px solid #333;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 4px;
    width: 100%;
}

#burn-duration-slider {
    width: 100%;
    accent-color: #00ff88;
    margin: 8px 0;
}

.burn-buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.burn-btn {
    flex: 1;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.2s;
}

.burn-btn.execute {
    background: rgba(0,255,136,0.15);
    border-color: #00ff88;
    color: #00ff88;
}

.burn-btn.execute:hover {
    background: rgba(0,255,136,0.3);
}

.burn-btn.cancel {
    background: rgba(255,255,255,0.05);
    border-color: #444;
    color: #888;
}

.burn-btn.cancel:hover {
    background: rgba(255,255,255,0.1);
}

/* ── Launch Setup — NASA Console ── */
#launch-setup {
    display: none;
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: #0c1020;
    border: 2px solid #1a2040;
    border-radius: 4px;
    width: 320px;
    z-index: 30;
    text-align: center;
    box-shadow:
        inset 0 0 0 1px rgba(0,255,136,0.08),
        0 0 40px rgba(0,0,0,0.6);
    overflow: hidden;
}

#launch-setup.visible {
    display: block;
}

/* Scanline overlay */
#launch-setup::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.06) 2px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
}

.console-header {
    background: rgba(0,255,136,0.06);
    border-bottom: 1px solid rgba(0,255,136,0.15);
    padding: 8px 10px 6px;
}

.console-header h2 {
    color: #00ff88;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

.console-header-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-header-sub .subtitle {
    color: rgba(0,204,110,0.8);
    font-size: 12px;
}

#attempt-counter {
    color: rgba(0,204,110,0.6);
    font-size: 10px;
    letter-spacing: 1px;
}

.console-body {
    padding: 6px 8px 4px;
}

/* Console fieldset sections */
.console-section {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    padding: 4px 6px 4px;
    margin: 0 0 6px 0;
    position: relative;
}

.console-section legend {
    color: rgba(0,204,110,0.8);
    font-size: 9px;
    letter-spacing: 2px;
    padding: 0 6px;
    font-family: 'Courier New', monospace;
}

.console-section-sm {
    padding: 4px 6px;
}

/* Display canvases */
#display-angle, #display-velocity {
    display: block;
    margin: 0 auto;
    cursor: grab;
    touch-action: none;
}

#display-angle:active, #display-velocity:active {
    cursor: grabbing;
}

/* Fine-tune row: 5% pad | 10% btn | 5% gap | 60% dial | 5% gap | 10% btn | 5% pad */
.fine-tune-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 5%;
    gap: 5%;
    box-sizing: border-box;
    margin-top: 4px;
}

.fine-tune-row canvas {
    width: 60% !important;
    flex: 0 0 60%;
    height: 36px;
}

.fine-tune-btn {
    flex: 0 0 10%;
    background: rgba(0, 204, 110, 0.1);
    border: 1px solid rgba(0, 204, 110, 0.3);
    color: #00cc6e;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 6px 0;
    border-radius: 3px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    text-align: center;
}

.fine-tune-btn:active {
    background: rgba(0, 204, 110, 0.3);
}

/* Roller canvases */
#roller-angle, #roller-velocity {
    display: block;
    cursor: grab;
    touch-action: none;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}

#roller-angle:active, #roller-velocity:active {
    cursor: grabbing;
}

/* Console switches (units) */
.console-switches {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.console-switch {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(0,204,110,0.2);
    color: rgba(0,204,110,0.6);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
}

.console-switch.active {
    background: rgba(0,255,136,0.1);
    border-color: rgba(0,255,136,0.4);
    color: #00ff88;
    box-shadow: 0 0 6px rgba(0,255,136,0.15);
}

.console-switch:hover {
    border-color: rgba(255,255,255,0.3);
}

/* Combined options row (units + font) */
.console-options-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.options-sep {
    color: rgba(255,255,255,0.15);
    font-size: 14px;
}

.options-label {
    color: rgba(0,204,110,0.8);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 1px;
}

.font-slider-inline {
    width: 60px;
    accent-color: #00ff88;
}

.font-value-inline {
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    min-width: 28px;
}

/* Launch row — launch + scrub side by side */
.launch-row {
    display: flex;
    width: 100%;
    gap: 0;
}

#launch-btn {
    flex: 3;
    background: rgba(255,100,50,0.15);
    border: none;
    border-top: 1px solid rgba(255,100,50,0.2);
    color: #ff6832;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 14px 40px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: all 0.2s;
    text-shadow: 0 0 10px rgba(255,100,50,0.4);
}

#launch-btn:hover {
    background: rgba(255,100,50,0.25);
    color: #ff8855;
    text-shadow: 0 0 20px rgba(255,100,50,0.6);
}

#scrub-btn {
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-left: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.35);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

#scrub-btn:hover {
    background: rgba(255,68,68,0.1);
    color: #ff4444;
    border-top-color: rgba(255,68,68,0.3);
}

/* ── Title Screen ── */
#title-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: radial-gradient(ellipse at center, #0f1429 0%, #0a0e27 70%);
    overflow-y: auto;
    padding: 20px;
}

#title-screen h1 {
    font-size: 56px;
    color: #00ff88;
    letter-spacing: 8px;
    text-shadow: 0 0 30px rgba(0,255,136,0.3);
    margin-bottom: 8px;
}

#title-screen .tagline {
    color: #ccc;
    font-size: 16px;
    letter-spacing: 3px;
    margin-bottom: 48px;
}

.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 360px;
}

.mission-card {
    display: block;
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    font-family: 'Courier New', monospace;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.mission-card:hover {
    background: rgba(0,255,136,0.08);
    border-color: rgba(0,255,136,0.3);
}

.mission-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.mission-card .mission-name {
    color: #00ff88;
    font-size: 16px;
    margin-bottom: 4px;
}

.mission-card .mission-desc {
    color: #ccc;
    font-size: 13px;
}

.mission-card.hoyvin-card {
    border-color: rgba(255,165,0,0.25);
    background: rgba(255,165,0,0.04);
}

.mission-card.hoyvin-card:hover {
    background: rgba(255,165,0,0.1);
    border-color: rgba(255,165,0,0.5);
}

.mission-card.hoyvin-card .mission-name {
    color: #ffa500;
}

/* ── Mission Select Screen ── */
#mission-select-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(10, 14, 39, 0.95);
    font-family: 'Courier New', monospace;
}

#mission-select-screen.visible {
    display: flex;
}

#mission-select-screen .mission-list {
    width: 340px;
}

/* ── Briefing Screen ── */
#briefing-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(10, 14, 39, 0.95);
    flex-direction: column;
    align-items: center;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding: 40px 16px;
}

#briefing-screen.visible {
    display: flex;
}

#briefing-screen h2 {
    color: #00ff88;
    font-size: 28px;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

#briefing-screen .mission-subtitle {
    color: #ffa500;
    font-size: 15px;
    margin-bottom: 32px;
}

#briefing-text {
    color: #ddd;
    font-size: 15px;
    line-height: 1.8;
    max-width: 500px;
    text-align: left;
    margin-bottom: 32px;
}

#briefing-objectives {
    max-width: 500px;
    text-align: left;
    margin-bottom: 32px;
}

#briefing-objectives h3 {
    color: #ffa500;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

#briefing-objectives li {
    color: #ddd;
    font-size: 14px;
    margin-bottom: 6px;
    list-style: none;
    padding-left: 16px;
    position: relative;
}

#briefing-objectives li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #00ff88;
}

#begin-mission-btn {
    background: rgba(0,255,136,0.15);
    border: 2px solid #00ff88;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 12px 36px;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
}

#begin-mission-btn:hover {
    background: rgba(0,255,136,0.3);
}

/* ── Result Screen ── */
#result-screen {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 40;
    background: none;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 24px 32px;
    pointer-events: none;
}

#result-screen > * {
    pointer-events: auto;
}

#result-screen h2,
#result-message,
#result-stats,
#result-records {
    background: rgba(10, 14, 39, 0.85);
    padding: 4px 12px;
    border-radius: 4px;
}

#result-screen.visible {
    display: flex;
}

#result-screen h2 {
    font-size: 26px;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

#result-screen h2.success {
    color: #00ff88;
}

#result-screen h2.failure {
    color: #ff4444;
}

#result-message {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 8px;
}

#result-stats {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.6;
}

#result-stats .stat-label {
    color: #aaa;
}

#result-stats .stat-value {
    color: #00ff88;
}

#result-records {
    margin-top: 8px;
    margin-bottom: 12px;
}

.result-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-bottom: 16px;
}

.result-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ddd;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    padding: 10px 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-btn:hover {
    background: rgba(255,255,255,0.15);
}

.result-btn.primary {
    background: rgba(0,255,136,0.15);
    border-color: #00ff88;
    color: #00ff88;
}

/* ── Mission Checklist ── */
#checklist-panel {
    position: absolute;
    top: 76px;
    right: 16px;
    text-align: right;
    font-size: 13px;
    line-height: 1.9;
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.check-icon {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

.check-icon.pending {
    background: #ff4444;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.4);
}

.check-icon.done {
    background: #00ff88;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.4);
}

.check-label {
    color: #888;
}

.check-label.done {
    color: #00ff88;
}

/* ── Abort Button (inside bottom-controls) ── */
#btn-abort {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: #ff4444;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

#btn-abort:hover {
    background: rgba(255, 68, 68, 0.3);
    border-color: rgba(255, 68, 68, 0.7);
}

/* ── Records Screen ── */
#records-screen {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 45;
    background: rgba(10, 14, 39, 0.97);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 40px;
}

#records-screen.visible {
    display: flex;
}

#records-content {
    max-width: 600px;
    width: 100%;
}

.records-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.records-tab {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.15);
    color: #888;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
}

.records-tab:hover {
    border-color: rgba(0,255,136,0.3);
    color: #ccc;
}

.records-tab.active {
    background: rgba(0,255,136,0.1);
    border-color: rgba(0,255,136,0.4);
    color: #00ff88;
}

.records-tab[data-mode="hoyvin-glavin"].active {
    background: rgba(255,165,0,0.1);
    border-color: rgba(255,165,0,0.4);
    color: #ffa500;
}

.records-category {
    margin-bottom: 24px;
}

.records-category h3 {
    color: #00ff88;
    font-size: 15px;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.record-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
}

.record-label {
    color: #aaa;
}

.record-value {
    color: #4a7a9e;
}

.record-value.has-record {
    color: #00ff88;
}

.record-star {
    color: #ffd700;
    font-size: 14px;
    margin-left: 6px;
}

.record-achievement {
    color: #ffd700;
    font-size: 10px;
    margin-left: 4px;
    letter-spacing: 1px;
}

.record-spoiler-btn {
    display: inline-block;
    font-size: 10px;
    cursor: pointer;
    margin-left: 6px;
    background: rgba(74, 122, 158, 0.15);
    border: 1px solid rgba(74, 122, 158, 0.4);
    color: #4a7a9e;
    font-family: 'Courier New', monospace;
    padding: 2px 8px;
    border-radius: 3px;
}

.record-spoiler-btn:hover {
    background: rgba(74, 122, 158, 0.25);
    color: #6a9abe;
}

.record-spoiler-value {
    display: none;
    color: #ffd700;
    font-size: 10px;
    margin-left: 6px;
    cursor: pointer;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.record-spoiler-btn.revealed {
    display: none;
}

.record-spoiler-btn.revealed + .record-spoiler-value {
    display: inline;
}

/* ── Result Records ── */
#result-records {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.8;
    max-width: 400px;
}

.record-broken {
    color: #00ff88;
}

.record-achieved {
    color: #ffd700;
    font-weight: bold;
}

/* ── Mobile: title screen + overlays only ── */
@media (max-width: 768px) {
    #title-screen {
        justify-content: flex-start;
        padding: 24px 16px 20px;
    }
    #title-screen h1 { font-size: 36px; letter-spacing: 4px; margin-bottom: 4px; }
    #title-screen .tagline { font-size: 12px; letter-spacing: 2px; margin-bottom: 20px; }
    #title-screen #byline { font-size: 11px; }
    .mission-list { width: 90vw; max-width: 320px; }
    .mission-card .mission-name { font-size: 14px; }
    .mission-card .mission-desc { font-size: 11px; }

    /* Briefing — smaller text */
    #briefing-text { font-size: 13px; max-width: 90vw; padding: 0 16px; }
    #briefing-objectives { max-width: 90vw; padding: 0 16px; }

    /* Records */
    #records-screen { padding: 20px 16px; }
    .record-row { font-size: 12px; flex-wrap: wrap; gap: 4px; }
    .record-label { flex-basis: 100%; }
}

/* ── Mobile landscape ── */
@media (max-width: 960px) and (orientation: landscape) {
    /* Flight dashboard — vertical stack on top left */
    #flight-readout {
        bottom: auto;
        right: auto;
        left: 4px;
        top: 32px;
        flex-direction: column;
        gap: 3px;
    }

    .dash-panel { padding: 2px 6px 3px; }
    .dash-label { font-size: 8px; letter-spacing: 2px; margin-bottom: 1px; }
    .dash-row { gap: 3px; height: 16px; }
    .dash-icon { font-size: 11px; width: 14px; }
    .dash-arrow { font-size: 11px; width: 12px; }
    .dash-value { font-size: 12px; letter-spacing: 0; }
    .dash-value-lg { font-size: 13px; letter-spacing: 1px; }

    /* All controls on one bottom row */
    #bottom-controls {
        bottom: 4px;
        right: 4px;
        left: 4px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    #day-display { font-size: 11px; }
    #time-controls { gap: 2px; }
    .time-btn { font-size: 10px; padding: 4px 7px; min-width: 26px; }
    #btn-abort { font-size: 10px; padding: 4px 8px; }

    /* View button — bottom left, above result/control buttons */
    #view-controls {
        top: auto;
        right: auto;
        bottom: 52px;
        left: 8px;
    }

    .view-cycle-btn {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }

    /* Checklist — top right, tight spacing */
    #checklist-panel {
        top: 32px;
        right: 8px;
        left: auto;
        bottom: auto;
        text-align: right;
        font-size: 11px;
        line-height: 1.3;
    }

    .check-item {
        justify-content: flex-end;
    }

    #mission-label {
        font-size: 11px;
        top: 6px;
        left: 6px;
    }

    /* Launch console — compact */
    #launch-setup {
        left: 12px;
        width: 280px;
    }

    .console-header {
        padding: 4px 8px 3px;
    }

    .console-header h2 {
        font-size: 13px;
        letter-spacing: 2px;
    }

    .console-header-sub {
        display: none;
    }

    .console-body {
        padding: 4px 6px 2px;
    }

    .console-section {
        padding: 2px 4px 3px;
        margin: 0 0 4px 0;
    }

    #launch-btn {
        padding: 8px 20px;
        font-size: 14px;
    }
}

/* ── Mobile portrait ── */
@media (max-width: 768px) and (orientation: portrait) {
    /* Flight dashboard — horizontal row above controls */
    #flight-readout {
        bottom: 64px;
        right: 4px;
        left: 4px;
        flex-direction: row;
        gap: 3px;
    }

    .dash-panel {
        flex: 1;
        padding: 3px 6px 4px;
        min-width: 0;
    }

    .dash-label {
        font-size: 8px;
        letter-spacing: 2px;
        margin-bottom: 1px;
    }

    .dash-row {
        gap: 3px;
        height: 16px;
    }

    .dash-icon { font-size: 11px; width: 14px; }
    .dash-arrow { font-size: 11px; width: 12px; }
    .dash-value { font-size: 12px; letter-spacing: 0; }
    .dash-value-lg { font-size: 13px; letter-spacing: 1px; }

    /* Bottom controls — single horizontal row */
    #bottom-controls {
        bottom: 4px;
        right: 4px;
        left: 4px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
    }

    #day-display { font-size: 12px; }

    #time-controls { gap: 2px; }

    .time-btn {
        font-size: 11px;
        padding: 5px 8px;
        min-width: 28px;
    }

    #btn-abort {
        font-size: 10px;
        padding: 5px 10px;
    }

    /* View button — bottom left, above result/control buttons */
    #view-controls {
        top: auto;
        right: auto;
        bottom: 120px;
        left: 8px;
    }

    .view-cycle-btn {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
}

/* ── Utility ── */
.hidden {
    display: none !important;
}
