/* ═══════════════════════════════════════════════════════
   Night Sky Viewer — "Observatory Brass" Theme
   Inspired by vintage observatory instrument panels,
   brass telescope fittings, and amber safety lighting.
   ═══════════════════════════════════════════════════════ */

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 12px 2px var(--accent-glow); }
}

/* ── Design Tokens ── */
:root {
    /* True observatory black */
    --bg-primary: #000000;
    --bg-secondary: #080808;
    --bg-tertiary: #111111;
    --bg-card: #0c0c0c;
    --bg-inset: #060606;

    /* Warm amber from brass fittings */
    --amber: #c8a456;
    --amber-dim: #8a7139;
    --amber-bright: #e8c466;
    --amber-glow: rgba(200, 164, 86, 0.15);

    /* Cold starfield blue — depth accent */
    --blue-deep: #1e3a5f;
    --blue-subtle: #0d1f33;
    --blue-glow: rgba(30, 58, 95, 0.3);

    /* Text hierarchy */
    --text-primary: #d4cfc0;
    --text-secondary: #8a8577;
    --text-muted: #555045;
    --text-data: var(--amber);

    /* Semantic */
    --accent-primary: var(--amber);
    --accent-glow: var(--amber-glow);
    --success: #5a9e6f;
    --warning: #c8a456;
    --error: #a04040;

    /* Borders — etched instrument panel lines */
    --border-color: #1a1a18;
    --border-hover: #2a2a25;
    --border-accent: #332e20;

    /* Radii — slightly sharper, more industrial */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 10px;

    /* Shadows — deep, directional */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.8);
    --shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.5);

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;

    /* 16th Century Vibe Tokens */
    --brass-light: #e8c466;
    --brass-mid: #c8a456;
    --brass-dark: #6e5828;
    --wood-bg: linear-gradient(160deg, #1a120c 0%, #080503 100%);
    --brass-bg: linear-gradient(135deg, #b89040 0%, #856122 40%, #543b12 100%);
    --chamfer-panel: inset 1px 1px 2px rgba(255,255,255,0.08), inset -2px -2px 4px rgba(0,0,0,0.9), 0 4px 10px rgba(0,0,0,0.9);
    --chamfer-inset: inset 2px 2px 6px rgba(0,0,0,0.9), inset -1px -1px 1px rgba(255,255,255,0.05);
    --brass-bezel: 2px solid var(--brass-dark);
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Subtle film grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ── App Container ── */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
}

/* ── Header ── */
.header {
    background: var(--wood-bg);
    padding: 0.875rem 1.5rem;
    border-bottom: 3px solid var(--brass-dark);
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.8);
    position: relative;
    z-index: 100;
}

/* Thin brass accent line under header */
.header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--brass-light);
    opacity: 0.7;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.header-title {
    text-align: left;
    background: rgba(0,0,0,0.4);
    padding: 5px 15px;
    border-radius: 4px;
    border: 1px solid var(--brass-dark);
    box-shadow: var(--chamfer-inset);
}

.header h1 {
    font-family: var(--font-display);
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--amber-bright);
    letter-spacing: 0.04em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    animation: twinkle 4s ease-in-out infinite;
}

.header .subtitle {
    font-family: var(--font-mono);
    color: var(--amber-dim);
    font-size: 0.7rem;
    margin-top: 0.125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-nav {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    justify-content: flex-end;
}

/* Custom Header Buttons - Static Bezel and Moving Plunger */
.nav-link {
    display: inline-block;
    padding: 3px; /* Gap forming the hole */
    background: #000; /* The deep hole background */
    border: 1px solid #d4af37; /* Inner bright edge of bezel */
    border-radius: 4px;
    box-shadow: 
        0 0 0 1px #5a3d12, /* Middle dark step */
        0 0 0 2px #c8a456, /* Outer bright step */
        0 4px 8px 2px rgba(0,0,0,0.8), /* Bezel drop shadow on wood */
        inset 0 4px 6px rgba(0,0,0,1); /* Deep shadow inside the hole */
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-link .plunger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1.25rem;
    background: var(--brass-bg);
    border-radius: 2px;
    color: #111;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    
    /* 3D Plunger sticking out */
    transform: translateY(-5px);
    box-shadow: 
        inset 1px 1px 1px rgba(255,255,255,0.4),
        0 1px 0 #f0da96, /* Top bright edge */
        0 5px 0 #6e4e1a, /* Physical brass thickness */
        0 5px 0 1px #332107,
        0 8px 10px rgba(0,0,0,0.8); /* Plunger shadow on the hole floor */
    transition: transform 0.1s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.1s cubic-bezier(0.4, 0.0, 0.2, 1), background 0.1s;
}

.nav-link:hover .plunger {
    background: linear-gradient(135deg, #d4b050 0%, #9e752d 40%, #614517 100%);
    transform: translateY(-2px); /* Pushed halfway */
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.5),
        0 1px 0 #f0da96,
        0 2px 0 #6e4e1a, /* Compressed thickness */
        0 2px 0 1px #332107,
        0 4px 6px rgba(0,0,0,0.9);
    color: #000;
}

.nav-link:active .plunger {
    transform: translateY(0px); /* Flush in the hole */
    background: linear-gradient(135deg, #a57c2a 0%, #6b4d18 100%);
    box-shadow: 
        inset 2px 4px 6px rgba(0,0,0,0.7),
        0 0 0 #f0da96,
        0 0 0 #6e4e1a, /* No thickness visible */
        0 0 0 1px #221503,
        0 1px 2px rgba(0,0,0,0.9);
}

/* Remove original custom link borders since they use brass now */
.planner-link { }
.redlight-btn { }
.redlight-btn:hover { color: #500; }

body.redlight .redlight-btn {
    background: linear-gradient(135deg, #8a2a2a 0%, #5c1818 40%, #3a0a0a 100%);
    border-color: #ff5555;
    border-bottom-color: #3a0a0a;
    border-right-color: #3a0a0a;
    color: #ffcccc;
}
body.redlight .redlight-btn svg { stroke: #ffcccc; }

/* ── Main Content Layout ── */
.main-content {
    display: flex;
    flex: 1;
    gap: 0;
    min-height: 0;
}

/* ── Controls Panel — inset helm bays ── */
.controls-panel {
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    padding: 0.55rem 0.7rem 0.35rem;
    overflow-y: auto;
    max-height: 36dvh;
    box-shadow: none;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.45rem;
}

.control-section {
    background: var(--bg-card);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    border: var(--brass-bezel);
    box-shadow: var(--chamfer-inset);
    animation: fadeInUp 0.4s ease-out both;
    position: relative;
}

/* Corner brass screws */
.control-section::before, .control-section::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brass-mid);
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.8), inset 1px 1px 1px rgba(255,255,255,0.4);
    z-index: 1;
}
.control-section::before { top: 6px; left: 6px; }
.control-section::after { top: 6px; right: 6px; }

.control-section h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--amber-bright);
    margin-bottom: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--brass-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    text-align: center;
}

/* ── Location Input ── */
.location-row {
    display: flex;
    gap: 0.5rem;
}

.location-row input {
    flex: 1;
    padding: 0.5rem 0.625rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.location-row input:focus {
    outline: none;
    border-color: var(--amber-dim);
    box-shadow: 0 0 0 2px var(--amber-glow);
}

.location-row input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.75rem;
}

.icon-btn {
    padding: 0.5rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--amber-dim);
    color: var(--amber);
}

.location-info {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    min-height: 1rem;
}

.location-info.error { color: var(--error); }

/* ── Direction Grid (Compass Rose) ── */
.direction-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    border: 2px solid var(--brass-dark);
    box-shadow: var(--chamfer-inset);
    width: fit-content;
    margin: 0 auto;
}

/* Custom Direction Buttons - Pushbuttons */
.direction-btn {
    padding: 2px; /* Hole gap */
    width: 44px;
    height: 44px;
    background: #000;
    border: 1px solid #444;
    border-radius: 50%;
    box-shadow: 
        0 0 0 1px #222,
        0 0 0 2px #444,
        0 2px 4px rgba(0,0,0,0.8),
        inset 0 4px 6px rgba(0,0,0,1);
    cursor: pointer;
    display: inline-block;
}

.direction-btn .plunger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #2a2a2a 0%, #111 100%);
    border-radius: 50%;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    
    transform: translateY(-4px);
    box-shadow: 
        inset 1px 1px 1px rgba(255,255,255,0.1),
        0 1px 0 #555,
        0 4px 0 #0a0a0a,
        0 5px 6px rgba(0,0,0,0.8);
    transition: all 0.1s;
}

.direction-btn:hover .plunger {
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        0 1px 0 #555,
        0 2px 0 #0a0a0a,
        0 3px 5px rgba(0,0,0,0.8);
}

.direction-btn:active .plunger {
    transform: translateY(0px);
    box-shadow: 
        inset 2px 4px 6px rgba(0,0,0,0.8),
        0 0 0 #0a0a0a;
}

.direction-btn.selected .plunger {
    background: var(--brass-bg);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 
        inset 1px 1px 3px rgba(255,255,255,0.5), 
        0 1px 0 #f0da96,
        0 1px 0 #5a3d12,
        0 0 10px var(--amber-glow);
    text-shadow: none;
}

.direction-center {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--amber-dim);
}

/* ── Options Grid (Checkboxes) ── */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
    transition: color 0.2s;
}

.checkbox-label:hover { color: var(--text-primary); }

.checkbox-label input[type="checkbox"] {
    width: 0.875rem;
    height: 0.875rem;
    accent-color: var(--amber);
    cursor: pointer;
    border-radius: 2px;
}

/* ── Style Controls ── */
.style-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.style-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.style-row label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.style-row select {
    padding: 0.4rem 0.625rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.style-row select:focus {
    outline: none;
    border-color: var(--amber-dim);
}

/* ── Advanced Section ── */
.advanced-section {
    cursor: pointer;
    grid-column: 1 / -1;
}

.advanced-section summary {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.4rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.04em;
}

.advanced-section summary::before {
    content: '\25B8';
    font-size: 0.625rem;
    color: var(--amber-dim);
    transition: transform 0.25s;
}

.advanced-section[open] summary::before {
    transform: rotate(90deg);
}

.advanced-content { padding-top: 0.625rem; }

.slider-control { margin-bottom: 0.875rem; }

.slider-control label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.slider-control label span {
    color: var(--amber);
    font-weight: 600;
}

.slider-control input[type="range"] {
    width: 100%;
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    appearance: none;
    cursor: pointer;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--amber);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--amber-glow);
    transition: transform 0.2s;
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(200, 164, 86, 0.3);
}

/* ── Sky View Container ── */
.sky-view-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#starmap {
    width: 100%;
    height: 100%;
    min-height: 0;
}

#starmap canvas {
    display: block;
    margin: 0 auto;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    object-fit: contain;
}

/* ── Info Panel ── */
.info-panel {
    background:
        linear-gradient(180deg, #1a120c 0%, #0a0704 100%);
    border: 1px solid #6a5228;
    margin: 0.55rem 0 0;
    padding: 0.4rem 0.75rem 0.45rem;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(232, 196, 102, 0.16),
        inset 0 3px 8px rgba(0, 0, 0, 0.85);
}

.info-panel::before { display: none; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    justify-content: stretch;
    margin-bottom: 0.35rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
}

.info-label {
    font-family: var(--font-mono);
    font-size: 0.563rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.info-value {
    font-family: var(--font-mono);
    font-size: 0.813rem;
    color: var(--amber);
    font-weight: 500;
}

/* ── Time Controls ── */
.time-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.time-buttons {
    display: flex;
    gap: 0.45rem;
    align-items: flex-end;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(40, 28, 12, 0.5) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(20, 14, 8, 0.6) 0%, transparent 50%),
        linear-gradient(165deg, #1a120c 0%, #0a0705 55%, #050403 100%);
    padding: 10px 8px 8px;
    border-radius: 5px 6px 4px 7px;
    border: 1px solid #2a2010;
    box-shadow:
        var(--chamfer-inset),
        inset 0 0 20px rgba(0, 0, 0, 0.55);
}

/* ── Time plungers: aged brass family, each a slightly different casting ── */
.time-btn {
    flex: 1;
    position: relative;
    padding: 3px;
    background:
        radial-gradient(circle at 30% 20%, #3a2a12 0%, transparent 45%),
        linear-gradient(160deg, #1c140a 0%, #050403 100%);
    border: 1px solid #4a3820;
    border-top-color: #2a2010;
    border-left-color: #2a2010;
    cursor: pointer;
    display: inline-block;
    /* Irregular “hand-filed” bezel — same family, not clones */
    border-radius: 3px;
    box-shadow:
        0 1px 0 rgba(200, 164, 86, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.85),
        inset 0 3px 6px rgba(0, 0, 0, 0.95),
        inset 0 -1px 0 rgba(180, 140, 60, 0.08);
}

.time-btn .plunger {
    position: relative;
    display: block;
    width: 100%;
    padding: 0.42rem 0.1rem;
    overflow: hidden;
    isolation: isolate;
    /* Base brass — patina layers stack per nth-child below */
    background:
        linear-gradient(155deg,
            #c9a24a 0%,
            #a07a32 28%,
            #6e5420 58%,
            #4a3814 100%);
    border-radius: 2px;
    color: #1a1208;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow:
        0 1px 0 rgba(255, 230, 160, 0.25),
        0 -1px 0 rgba(0, 0, 0, 0.45);
    transform: translateY(-5px);
    box-shadow:
        inset 1px 1px 1px rgba(255, 240, 180, 0.35),
        inset -1px -2px 3px rgba(40, 25, 5, 0.55),
        0 1px 0 #e0c070,
        0 5px 0 #5a3d14,
        0 5px 0 1px #2a1808,
        0 8px 12px rgba(0, 0, 0, 0.75);
    transition:
        transform 0.12s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.12s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.15s ease;
}

/* Soft scuff / oxidation veil on every plunger */
.time-btn .plunger::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
    mix-blend-mode: multiply;
    background-image:
        radial-gradient(ellipse 40% 35% at 18% 72%, rgba(45, 90, 55, 0.55) 0%, transparent 70%),
        radial-gradient(ellipse 30% 25% at 78% 22%, rgba(90, 70, 30, 0.4) 0%, transparent 65%),
        radial-gradient(ellipse 50% 40% at 55% 90%, rgba(30, 50, 40, 0.35) 0%, transparent 60%),
        linear-gradient(125deg, transparent 40%, rgba(20, 15, 5, 0.15) 70%, transparent 90%);
}

/* Micro-scratch / dust noise */
.time-btn .plunger::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
    opacity: 0.22;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

/* ── Individual casting personalities (same brass family) ── */

/* -1d: oldest, heavy verdigris, slightly squat */
.time-btn:nth-child(1) {
    border-radius: 4px 2px 5px 3px;
    transform: rotate(-0.6deg);
}
.time-btn:nth-child(1) .plunger {
    border-radius: 3px 1px 4px 2px;
    padding: 0.38rem 0.1rem 0.4rem;
    filter: saturate(0.82) brightness(0.92);
    background:
        linear-gradient(148deg,
            #a88838 0%,
            #7a5e28 35%,
            #4a3a18 70%,
            #3a2c14 100%);
    box-shadow:
        inset 1px 1px 1px rgba(200, 180, 100, 0.2),
        inset -1px -2px 4px rgba(20, 40, 25, 0.45),
        0 1px 0 #b89850,
        0 4px 0 #4a3410,
        0 4px 0 1px #1a1005,
        0 7px 10px rgba(0, 0, 0, 0.8);
}
.time-btn:nth-child(1) .plunger::before {
    opacity: 0.72;
    background-image:
        radial-gradient(ellipse 55% 45% at 25% 80%, rgba(40, 95, 60, 0.75) 0%, transparent 68%),
        radial-gradient(ellipse 35% 30% at 85% 15%, rgba(60, 80, 40, 0.45) 0%, transparent 60%),
        radial-gradient(circle at 60% 40%, rgba(30, 25, 10, 0.3) 0%, transparent 40%);
}

/* -1h: worn edges, cooler tarnish, slightly taller */
.time-btn:nth-child(2) {
    border-radius: 2px 4px 2px 5px;
    transform: rotate(0.4deg);
}
.time-btn:nth-child(2) .plunger {
    border-radius: 2px 3px 1px 4px;
    padding: 0.44rem 0.1rem 0.36rem;
    filter: hue-rotate(-6deg) saturate(0.9);
    background:
        linear-gradient(162deg,
            #c4a050 0%,
            #8e6e2e 40%,
            #5c4820 75%,
            #3d3012 100%);
}
.time-btn:nth-child(2) .plunger::before {
    opacity: 0.5;
    background-image:
        radial-gradient(ellipse 30% 50% at 90% 60%, rgba(50, 70, 55, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse 40% 25% at 10% 20%, rgba(100, 80, 40, 0.35) 0%, transparent 65%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.1) 100%);
}

/* Now: center gem — polished, warmer, proudest height */
.time-btn:nth-child(3) {
    border-radius: 3px;
    transform: none;
    flex: 1.12;
    border-color: #6a5020;
    box-shadow:
        0 0 0 1px rgba(200, 160, 60, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.9),
        inset 0 3px 6px rgba(0, 0, 0, 0.95),
        inset 0 -1px 0 rgba(220, 180, 80, 0.12);
}
.time-btn:nth-child(3) .plunger {
    border-radius: 2px;
    padding: 0.48rem 0.15rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: #0e0a04;
    filter: saturate(1.15) brightness(1.06);
    background:
        linear-gradient(145deg,
            #f0d478 0%,
            #d4a840 22%,
            #a87828 55%,
            #6e4e18 100%);
    transform: translateY(-6px);
    box-shadow:
        inset 1px 1px 2px rgba(255, 250, 200, 0.55),
        inset -1px -2px 3px rgba(60, 40, 10, 0.4),
        0 1px 0 #f8e8a0,
        0 6px 0 #6e4e1a,
        0 6px 0 1px #3a280c,
        0 10px 14px rgba(0, 0, 0, 0.75),
        0 0 12px rgba(200, 150, 50, 0.25);
}
.time-btn:nth-child(3) .plunger::before {
    opacity: 0.28;
    background-image:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 245, 200, 0.45) 0%, transparent 70%),
        radial-gradient(ellipse 25% 20% at 70% 85%, rgba(80, 100, 50, 0.25) 0%, transparent 70%);
}

/* +1h: brighter face, slight right lean, copper note */
.time-btn:nth-child(4) {
    border-radius: 5px 2px 3px 4px;
    transform: rotate(0.55deg);
}
.time-btn:nth-child(4) .plunger {
    border-radius: 4px 2px 2px 3px;
    padding: 0.4rem 0.1rem 0.42rem;
    filter: hue-rotate(8deg) saturate(1.05);
    background:
        linear-gradient(158deg,
            #d8b050 0%,
            #b07830 32%,
            #785828 68%,
            #4a3018 100%);
}
.time-btn:nth-child(4) .plunger::before {
    opacity: 0.48;
    background-image:
        radial-gradient(ellipse 45% 35% at 15% 30%, rgba(120, 70, 40, 0.4) 0%, transparent 65%),
        radial-gradient(ellipse 35% 40% at 80% 75%, rgba(45, 85, 55, 0.4) 0%, transparent 70%),
        linear-gradient(200deg, rgba(255, 200, 100, 0.08) 0%, transparent 50%);
}

/* +1d: darkest, roughest edge, most irregular silhouette */
.time-btn:nth-child(5) {
    border-radius: 2px 5px 3px 2px;
    transform: rotate(-0.35deg);
}
.time-btn:nth-child(5) .plunger {
    border-radius: 1px 4px 3px 2px;
    padding: 0.36rem 0.1rem 0.44rem;
    filter: saturate(0.78) brightness(0.88) contrast(1.05);
    background:
        linear-gradient(170deg,
            #9a7838 0%,
            #6a5024 30%,
            #3e3014 65%,
            #2a2010 100%);
    box-shadow:
        inset 1px 1px 1px rgba(180, 150, 80, 0.18),
        inset -2px -2px 4px rgba(10, 30, 20, 0.5),
        0 1px 0 #8a6c30,
        0 4px 0 #3a2810,
        0 4px 0 1px #140c04,
        0 7px 11px rgba(0, 0, 0, 0.85);
}
.time-btn:nth-child(5) .plunger::before {
    opacity: 0.78;
    background-image:
        radial-gradient(ellipse 50% 55% at 70% 70%, rgba(35, 80, 50, 0.7) 0%, transparent 65%),
        radial-gradient(ellipse 40% 30% at 20% 25%, rgba(70, 55, 25, 0.5) 0%, transparent 60%),
        radial-gradient(circle at 45% 55%, rgba(20, 15, 8, 0.35) 0%, transparent 35%);
}

/* Hover / press — shared motion, keep personality filters */
.time-btn:hover .plunger {
    color: #0a0804;
    transform: translateY(-2px);
    filter: brightness(1.08) saturate(1.05);
    box-shadow:
        inset 1px 1px 2px rgba(255, 245, 200, 0.4),
        inset -1px -1px 2px rgba(40, 25, 5, 0.4),
        0 1px 0 #f0da96,
        0 2px 0 #6e4e1a,
        0 2px 0 1px #332107,
        0 4px 8px rgba(0, 0, 0, 0.85);
}
.time-btn:nth-child(3):hover .plunger {
    transform: translateY(-3px);
    filter: brightness(1.12) saturate(1.15);
}

.time-btn:active .plunger {
    transform: translateY(0) !important;
    filter: brightness(0.85) saturate(0.9);
    box-shadow:
        inset 2px 4px 8px rgba(0, 0, 0, 0.75),
        inset 0 0 0 1px rgba(0, 0, 0, 0.3),
        0 0 0 transparent,
        0 1px 2px rgba(0, 0, 0, 0.9);
}

.current-time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--amber-dim);
    text-align: center;
    margin-top: 0.2rem;
}

/* ── Footer ── */
.footer {
    background: #0c0805;
    border-top: 1px solid #3a2a14;
    padding: 0.4rem 0.75rem;
    text-align: center;
}

.footer p {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.footer a {
    color: var(--amber-dim);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover { color: var(--amber); }

/* ── Scrollbar ── */
.controls-panel::-webkit-scrollbar { width: 4px; }
.controls-panel::-webkit-scrollbar-track { background: var(--bg-secondary); }
.controls-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
.controls-panel::-webkit-scrollbar-thumb:hover { background: var(--amber-dim); }

/* ── Spinner ── */
.spinner, .spinner-large { animation: spin 1s linear infinite; }
.spinner-large { width: 48px; height: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════
   Telescope Modal
   ═══════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active { display: flex; }

.modal-content {
    background: var(--wood-bg);
    border: 3px solid var(--brass-dark);
    border-radius: 4px;
    width: 92%;
    max-width: 920px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), var(--chamfer-inset);
    animation: fadeInUp 0.3s ease-out;
    position: relative;
}

/* ═══════════════════════════════════════════════════════
   Lore Library — observatory catalogue / star atlas panel
   No emoji chrome; brass ledger + manuscript reading pane
   ═══════════════════════════════════════════════════════ */
#lore-modal.modal {
    padding: 1.25vh 1.25vw;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.94);
}

#lore-modal .modal-content.lore-modal-content {
    width: 96vw;
    max-width: 1480px;
    height: 94vh;
    max-height: 94vh;
    border-width: 2px;
    border-color: var(--brass-dark);
    background:
        linear-gradient(180deg, rgba(30, 22, 12, 0.35) 0%, transparent 48px),
        var(--wood-bg);
    box-shadow:
        0 0 0 1px rgba(200, 164, 86, 0.12),
        0 28px 80px rgba(0, 0, 0, 0.92),
        var(--chamfer-inset);
}

.lore-modal-header {
    padding: 1.1rem 1.75rem 1rem;
    border-bottom: 1px solid rgba(110, 88, 40, 0.55);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.25) 100%);
    align-items: flex-end;
}

.lore-title-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.lore-kicker {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--amber-dim);
}

.lore-modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--amber-bright);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.lore-modal-body {
    padding: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.lore-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) 1fr;
    height: 100%;
    min-height: 0;
}

/* ── Index (left) ── */
.lore-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.22) 100%);
    border-right: 1px solid rgba(110, 88, 40, 0.45);
}

.lore-search {
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(110, 88, 40, 0.35);
}

.lore-search input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-inset);
    border: 1px solid var(--brass-dark);
    border-radius: 2px;
    color: var(--text-primary);
    padding: 0.55rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    box-shadow: var(--chamfer-inset);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lore-search input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.lore-search input:focus {
    outline: none;
    border-color: var(--amber-dim);
    box-shadow: var(--chamfer-inset), 0 0 0 1px rgba(200, 164, 86, 0.2);
}

/* Section tabs — engraved labels, not app chips */
.lore-categories {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(110, 88, 40, 0.35);
    background: rgba(0, 0, 0, 0.2);
}

.lore-cat-btn {
    appearance: none;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.45rem 1.1rem;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.lore-cat-btn:hover {
    color: var(--amber-bright);
    background: rgba(200, 164, 86, 0.06);
}

.lore-cat-btn.active {
    color: var(--amber-bright);
    border-left-color: var(--brass-mid);
    background: linear-gradient(90deg, rgba(200, 164, 86, 0.12) 0%, transparent 100%);
}

.lore-object-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--brass-dark) transparent;
}

.lore-loading {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-style: italic;
    line-height: 1.6;
}

.lore-loading.lore-error {
    color: #a86868;
    font-style: normal;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    text-align: left;
}

.lore-object-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.12s ease, color 0.12s ease;
}

.lore-object-item:hover {
    background: rgba(200, 164, 86, 0.07);
    color: var(--amber-bright);
}

.lore-object-item.selected {
    background: rgba(200, 164, 86, 0.1);
    color: var(--amber-bright);
    box-shadow: inset 2px 0 0 var(--brass-mid);
}

.lore-obj-name {
    flex: 1;
    min-width: 0;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.lore-obj-meta {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lore-object-item.selected .lore-obj-meta,
.lore-object-item:hover .lore-obj-meta {
    color: var(--amber-dim);
}

/* ── Reading pane ── */
.lore-content {
    overflow-y: auto;
    min-height: 0;
    padding: 2rem 2.75rem 2.5rem;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(200, 164, 86, 0.04) 0%, transparent 55%),
        linear-gradient(180deg, rgba(8, 6, 4, 0.4) 0%, transparent 120px);
    scrollbar-width: thin;
    scrollbar-color: var(--brass-dark) transparent;
}

.lore-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: min(420px, 55vh);
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.lore-placeholder-rule {
    width: 4.5rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brass-dark), transparent);
    margin: 0.35rem 0;
}

.lore-placeholder h3 {
    margin: 1rem 0 0.65rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    font-style: italic;
    color: var(--amber-dim);
    letter-spacing: 0.02em;
}

.lore-placeholder p {
    margin: 0 0 1rem;
    max-width: 26rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.lore-culture-selector {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-right: 0.35rem;
}

.lore-culture-selector label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lore-culture-selector select {
    appearance: none;
    background: var(--bg-inset)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238a7139' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
        no-repeat right 0.65rem center;
    border: 1px solid var(--brass-dark);
    border-radius: 2px;
    color: var(--text-primary);
    padding: 0.4rem 1.75rem 0.4rem 0.7rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    min-width: 10.5rem;
    box-shadow: var(--chamfer-inset);
    cursor: pointer;
}

.lore-culture-selector select:hover,
.lore-culture-selector select:focus {
    outline: none;
    border-color: var(--amber-dim);
}

.lore-story-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(110, 88, 40, 0.4);
}

.lore-story-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    min-width: 0;
}

.lore-story-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 2.4vw, 2.35rem);
    font-weight: 600;
    line-height: 1.15;
    color: var(--amber-bright);
    letter-spacing: 0.01em;
}

.lore-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.lore-action-btn {
    appearance: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.45rem 0.85rem;
    border-radius: 2px;
    border: 1px solid var(--brass-dark);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    box-shadow: var(--chamfer-inset);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lore-action-btn:hover {
    color: var(--amber-bright);
    border-color: var(--amber-dim);
    background: rgba(200, 164, 86, 0.08);
}

.lore-action-btn.lore-action-primary {
    background: linear-gradient(180deg, rgba(200, 164, 86, 0.18) 0%, rgba(0, 0, 0, 0.35) 100%);
    color: var(--amber-bright);
    border-color: var(--brass-mid);
}

.lore-action-btn.lore-action-primary:hover {
    background: linear-gradient(180deg, rgba(200, 164, 86, 0.28) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.lore-inline-link {
    color: var(--amber);
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 164, 86, 0.35);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.lore-inline-link:hover {
    color: var(--amber-bright);
    border-bottom-color: var(--amber-bright);
}

.lore-section-hint {
    margin: -0.5rem 0 0.85rem;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--text-muted);
}

.lore-dso-btn {
    appearance: none;
    display: inline-block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    padding: 0.35rem 0.7rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(110, 88, 40, 0.3);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lore-dso-btn:hover {
    color: var(--amber-bright);
    border-color: var(--brass-mid);
    background: rgba(200, 164, 86, 0.1);
}

.lore-dso-btn.lore-link-busy,
.lore-star-card-btn.lore-link-busy {
    opacity: 0.55;
    pointer-events: none;
}

.lore-star-card-btn {
    appearance: none;
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.lore-star-card-btn:hover {
    border-color: var(--brass-mid);
    background: rgba(200, 164, 86, 0.08);
}

.lore-star-card-btn:hover .lore-star-name {
    color: var(--amber-bright);
}

.lore-open-hint {
    margin-top: 0.45rem !important;
    color: var(--amber-dim) !important;
    font-style: italic;
    font-family: var(--font-display) !important;
    letter-spacing: 0.02em !important;
}

.lore-abbr,
.lore-symbol {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--amber-dim);
}

.lore-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.35rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(110, 88, 40, 0.3);
    border-radius: 2px;
    box-shadow: var(--chamfer-inset);
}

.lore-meta-item {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.lore-meta-item strong {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.lore-intro {
    max-width: 42rem;
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.7;
    color: #cfc8b6;
    margin: 0 0 1.75rem;
}

.lore-section {
    max-width: 44rem;
    margin-top: 2rem;
}

.lore-section h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber-dim);
    border-bottom: 1px solid rgba(110, 88, 40, 0.35);
    padding-bottom: 0.55rem;
    margin: 0 0 1.15rem;
}

.lore-body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text-primary);
    margin: 0 0 0.85rem;
    max-width: 40rem;
}

.lore-muted {
    color: var(--text-muted);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.9rem;
}

.lore-myth-block {
    margin-bottom: 1.15rem;
    padding: 1.15rem 1.25rem 1.2rem;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(110, 88, 40, 0.22);
    border-left: 2px solid var(--brass-dark);
    border-radius: 0 2px 2px 0;
}

.lore-culture-name {
    margin: 0 0 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--amber);
}

.lore-myth-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--amber-bright);
    margin-bottom: 0.65rem;
    letter-spacing: 0.01em;
}

.lore-detail-line {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(110, 88, 40, 0.35);
}

.lore-detail-line strong {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 0.35rem;
}

.lore-sources {
    font-style: italic;
    color: var(--text-muted);
}

.lore-stars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.65rem;
}

.lore-star-card {
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(110, 88, 40, 0.28);
    border-radius: 2px;
}

.lore-star-name {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--amber-bright);
    margin-bottom: 0.25rem;
}

.lore-star-sub {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.4;
}

.lore-italic {
    font-family: var(--font-display);
    font-style: italic;
    letter-spacing: 0;
    color: var(--text-secondary);
}

.lore-dso-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.lore-dso-list li {
    padding: 0;
    background: transparent;
    border: none;
    list-style: none;
}

@media (max-width: 820px) {
    .lore-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(38%, 42%) 1fr;
    }
    .lore-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(110, 88, 40, 0.45);
    }
    .lore-categories {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.15rem 0;
        padding: 0.35rem 0.5rem;
    }
    .lore-cat-btn {
        width: auto;
        border-left: none;
        border-bottom: 1px solid transparent;
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }
    .lore-cat-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--brass-mid);
        background: transparent;
    }
    .lore-content { padding: 1.35rem 1.25rem 1.75rem; }
    .lore-culture-selector label { display: none; }
}

/* Red-light mode */
.redlight .lore-cat-btn.active,
.redlight .lore-cat-btn:hover,
.redlight .lore-object-item.selected,
.redlight .lore-object-item:hover,
.redlight .lore-story-header h2,
.redlight .lore-myth-name,
.redlight .lore-star-name,
.redlight .lore-modal-header h2 {
    color: #ff6666;
}
.redlight .lore-cat-btn.active { border-left-color: #aa4444; }
.redlight .lore-object-item.selected { box-shadow: inset 2px 0 0 #aa4444; }
.redlight .lore-section h3,
.redlight .lore-kicker,
.redlight .lore-culture-name { color: #cc5555; }
.redlight .lore-myth-block { border-left-color: #882222; }

/* Corner brass screws for modal */
.modal-content::before, .modal-content::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brass-mid);
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.8), inset 1px 1px 1px rgba(255,255,255,0.4);
    z-index: 10;
}
.modal-content::before { top: 12px; left: 12px; }
.modal-content::after { top: 12px; right: 12px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--brass-dark);
    background: rgba(0,0,0,0.4);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 5;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--amber-bright);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    padding-left: 20px; /* Space for the screw */
}

.modal-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 20px;
}

.fullscreen-btn {
    background: linear-gradient(180deg, #2a2a2a 0%, #111 100%);
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--amber-dim);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.8), inset 1px 1px 1px rgba(255,255,255,0.1);
}

.fullscreen-btn:hover {
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    color: var(--amber);
}

.modal-close {
    background: linear-gradient(180deg, #4a1a1a 0%, #220000 100%);
    border: 1px solid #662222;
    border-radius: 4px;
    color: #ff8888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.4rem;
    line-height: 1;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.8), inset 1px 1px 1px rgba(255,255,255,0.1);
}

.modal-close:hover { 
    background: linear-gradient(180deg, #6a2a2a 0%, #330000 100%);
    color: #ffaaaa;
}

.modal-content.fullscreen {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

.modal-content.fullscreen #aladin-container {
    height: calc(100vh - 200px);
}

.modal-body {
    padding: 0.875rem;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#aladin-container {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
}

.telescope-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.survey-select {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.survey-select label {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.survey-select select {
    padding: 0.4rem 0.625rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
}

.coord-display {
    display: flex;
    gap: 0.875rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--amber-dim);
}

.zoom-buttons {
    display: flex;
    gap: 0.375rem;
    margin-left: auto;
    align-items: center;
}

.zoom-btn {
    padding: 0.375rem 0.75rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    border-color: var(--amber-dim);
    color: var(--amber);
}

.fov-display {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    color: var(--amber-dim);
    min-width: 65px;
}

/* Telescope search & catalog toggles */
.telescope-top-controls {
    display: flex;
    gap: 0.875rem;
    margin-bottom: 0.625rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    display: flex;
    gap: 0.375rem;
    flex: 1;
    min-width: 200px;
}

.search-box input {
    flex: 1;
    padding: 0.4rem 0.625rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.813rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--amber-dim);
    box-shadow: 0 0 0 2px var(--amber-glow);
}

.search-btn {
    padding: 0.4rem 0.875rem;
    background: var(--amber);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.search-btn:hover {
    background: var(--amber-bright);
    box-shadow: 0 0 8px var(--amber-glow);
}

.catalog-toggles {
    display: flex;
    gap: 0.875rem;
}

.checkbox-label.small { font-size: 0.688rem; }
.checkbox-label.small input { width: 0.813rem; height: 0.813rem; }

/* Click info banner */
.click-info {
    padding: 0.4rem 0.625rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    text-align: center;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.click-info.highlight {
    background: var(--amber);
    color: #000;
    border-color: var(--amber);
}

.click-info strong { color: var(--amber); }
.click-info.highlight strong { color: #000; }

/* Object info panel */
.object-info {
    font-family: var(--font-body);
    font-size: 0.813rem;
    color: var(--text-secondary);
    padding: 0.625rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    max-height: 100px;
    overflow-y: auto;
    display: none;
}

.object-info.active { display: block; max-height: 250px; }
.object-info a { color: var(--amber); }

/* Object Details Display */
.object-details {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.detail-card.main-card {
    background: linear-gradient(135deg, var(--blue-deep) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    text-align: center;
    border: 1px solid var(--border-accent);
}

.object-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--amber);
    margin-bottom: 0.2rem;
}

.object-type {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.4rem;
}

.stat-item {
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, transform 0.2s;
}

.stat-item:hover {
    border-color: var(--amber-dim);
    transform: translateY(-1px);
}

.stat-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.563rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--amber);
}

.stat-desc {
    display: block;
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.stat-extra {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.563rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    word-break: break-all;
}

.object-details .coord-info {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    color: var(--amber-dim);
    padding: 0.4rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
}

.nearby-objects {
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    border: 1px solid var(--border-color);
}

.nearby-title {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nearby-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.nearby-item:last-child { border-bottom: none; }
.nearby-name { font-size: 0.75rem; color: var(--text-primary); font-weight: 500; }
.nearby-type { font-size: 0.625rem; color: var(--text-muted); }

.fun-fact {
    background: var(--blue-subtle);
    border-left: 2px solid var(--amber-dim);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

.empty-region { text-align: center; padding: 0.875rem; color: var(--text-muted); }
.empty-region p { margin: 0.375rem 0; font-size: 0.813rem; }

/* Object info scrollbar */
.object-info::-webkit-scrollbar { width: 3px; }
.object-info::-webkit-scrollbar-track { background: var(--bg-inset); }
.object-info::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.object-info::-webkit-scrollbar-thumb:hover { background: var(--amber-dim); }

/* Generate button (used in planner) */
.generate-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--amber);
    border: none;
    border-radius: var(--radius-md);
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.generate-btn:hover:not(:disabled) {
    background: var(--amber-bright);
    box-shadow: 0 4px 16px var(--amber-glow);
    transform: translateY(-1px);
}

.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sky-placeholder { text-align: center; color: var(--text-secondary); padding: 2rem; }
.sky-error { text-align: center; color: var(--error); padding: 2rem; }
.sky-error p { font-size: 0.813rem; margin-bottom: 1rem; }

.retry-btn {
    padding: 0.4rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover { border-color: var(--amber-dim); color: var(--amber); }

/* Geostationary info */
.geo-sat-info { font-size: 0.688rem; color: var(--text-muted); margin-top: 0.375rem; }
.geo-sat-info.visible { color: var(--success); }

/* ═══════════════════════════════════════
   RED-LIGHT MODE — Night Vision Preservation
   Toggle via body.redlight class
   Uses ~630nm red wavelength equivalent
   ═══════════════════════════════════════ */
body.redlight {
    --bg-primary: #000000;
    --bg-secondary: #0a0000;
    --bg-tertiary: #120000;
    --bg-card: #0e0000;
    --bg-inset: #060000;

    --amber: #8b1a1a;
    --amber-dim: #5c1111;
    --amber-bright: #aa2020;
    --amber-glow: rgba(139, 26, 26, 0.2);

    --blue-deep: #1a0505;
    --blue-subtle: #0d0202;

    --text-primary: #8b3030;
    --text-secondary: #5c1818;
    --text-muted: #3a0e0e;
    --text-data: #8b1a1a;

    --accent-primary: #8b1a1a;
    --success: #5c1818;
    --warning: #8b1a1a;
    --error: #661111;

    --border-color: #1a0505;
    --border-hover: #2a0808;
    --border-accent: #330e0e;
}

body.redlight .header h1 { animation: none; }

body.redlight #starmap canvas {
    filter: saturate(0) brightness(0.5) sepia(1) hue-rotate(-30deg);
}

/* ═══════════════════════════════════════
   Twilight / Darkness Window Bar
   ═══════════════════════════════════════ */

.twilight-container {
    margin-top: 0.4rem;
    padding: 0.35rem 0.2rem 0.15rem;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.twilight-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.375rem;
}

.twilight-title {
    font-family: var(--font-mono);
    font-size: 0.563rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.twilight-summary {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--amber-dim);
    letter-spacing: 0.02em;
}

.twilight-bar-wrapper {
    position: relative;
    height: 10px;
    border-radius: 0;
    overflow: hidden;
    background: #050302;
    border: 1px solid #2a1c0c;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.9);
}
.twilight-legend { display: none; }
.twilight-labels { height: 12px; margin-top: 1px; }

.twilight-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.twilight-segment {
    transition: opacity 0.2s;
}

.twilight-segment:hover {
    opacity: 0.85;
}

.twilight-moon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.twilight-moon-period {
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 200, 0.12),
        rgba(255, 255, 200, 0.12) 2px,
        transparent 2px,
        transparent 6px
    );
    border-top: 1px solid rgba(255, 255, 200, 0.2);
    border-bottom: 1px solid rgba(255, 255, 200, 0.2);
}

.twilight-now-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--amber);
    box-shadow: 0 0 6px rgba(200, 164, 86, 0.6);
    z-index: 5;
    pointer-events: none;
    transform: translateX(-1px);
}

.twilight-labels {
    position: relative;
    height: 16px;
    margin-top: 2px;
}

.twilight-time-label {
    position: absolute;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.twilight-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    justify-content: center;
}

.twilight-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    color: var(--text-secondary);
}

.twilight-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.twilight-legend-moon {
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 200, 0.3),
        rgba(255, 255, 200, 0.3) 2px,
        transparent 2px,
        transparent 4px
    ) !important;
    border-color: rgba(255, 255, 200, 0.4);
}

/* ═══════════════════════════════════════
   Weather / Cloud Forecast Panel
   ═══════════════════════════════════════ */

.weather-container {
    margin-top: 0.35rem;
    padding: 0.35rem 0.2rem 0.1rem;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.weather-conditions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.weather-cond-item {
    padding: 0.15rem 0;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.375rem;
}

.weather-title {
    font-family: var(--font-mono);
    font-size: 0.563rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.weather-status {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--amber-dim);
    letter-spacing: 0.02em;
}

.weather-conditions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.weather-cond-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0;
    background: #050302;
    border: 1px solid #2a1c0c;
    border-radius: 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.8);
}

.weather-cond-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.125rem;
}

.weather-cond-value {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: 500;
    color: var(--text-data);
}

/* Gauge */

.weather-gauge-row {
    margin-bottom: 0.5rem;
}

.weather-gauge-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.weather-gauge-label strong {
    color: var(--amber-bright);
    font-weight: 600;
}

.weather-gauge-track {
    height: 8px;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.weather-gauge-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease, background 0.6s ease;
}

/* Forecast bar row */

.weather-forecast-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.weather-forecast {
    display: flex;
    gap: 2px;
    height: 10px;
    margin-bottom: 1px;
}
.weather-gauge-row { display: none; }
.weather-conditions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 0.25rem;
}
.weather-cond-item { padding: 0.1rem 0; background: transparent; border: 0; box-shadow: none; }

.weather-bar {
    flex: 1;
    border-radius: 2px;
    transition: background 0.3s ease;
    cursor: default;
}

.weather-bar:hover {
    opacity: 0.8;
    outline: 1px solid var(--amber-dim);
}

.weather-time-labels {
    display: flex;
    gap: 2px;
}

.weather-time-tick {
    flex: 1;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.45rem;
    color: var(--text-muted);
}

.weather-updated {
    font-family: var(--font-mono);
    font-size: 0.45rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════
   Observation Log (obslog)
   ═══════════════════════════════════════ */

/* Button row */
.obslog-btn-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.obslog-log-btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    background: var(--bg-inset);
    border: 1px solid var(--amber-dim);
    border-radius: var(--radius-sm);
    color: var(--amber);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.obslog-log-btn:hover {
    background: var(--amber-dim);
    color: var(--bg-primary);
    box-shadow: 0 0 8px var(--amber-glow);
}

.obslog-export-btn {
    padding: 0.4rem 0.5rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.obslog-export-btn:hover {
    border-color: var(--amber-dim);
    color: var(--amber);
}

/* Form */
.obslog-form-wrap {
    margin-bottom: 0.625rem;
    animation: fadeInUp 0.25s ease-out;
}

.obslog-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.obslog-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.obslog-field label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.obslog-field input[type="text"],
.obslog-field input[type="date"],
.obslog-field input[type="time"],
.obslog-field select,
.obslog-field textarea {
    padding: 0.35rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    transition: border-color 0.2s;
}

.obslog-field input:focus,
.obslog-field select:focus,
.obslog-field textarea:focus {
    outline: none;
    border-color: var(--amber-dim);
    box-shadow: 0 0 0 2px var(--amber-glow);
}

.obslog-field input::placeholder,
.obslog-field textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.688rem;
}

.obslog-field textarea {
    resize: vertical;
    min-height: 2rem;
}

.obslog-field-row {
    display: flex;
    gap: 0.5rem;
}

.obslog-field-row .obslog-field {
    flex: 1;
    min-width: 0;
}

/* Range sliders */
.obslog-field input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    margin-top: 0.25rem;
    border: none;
}

.obslog-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--amber);
    cursor: pointer;
    border: 1px solid var(--amber-dim);
}

.obslog-range-val {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--amber);
    text-align: right;
}

/* Star picker */
.obslog-star-picker {
    display: flex;
    gap: 0.15rem;
}

.obslog-star-pick {
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}

.obslog-star-pick.active,
.obslog-star-pick.hover {
    color: var(--amber);
}

/* Form actions */
.obslog-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.obslog-save-btn {
    flex: 1;
    padding: 0.375rem;
    background: var(--amber-dim);
    border: 1px solid var(--amber);
    border-radius: var(--radius-sm);
    color: var(--bg-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.obslog-save-btn:hover {
    background: var(--amber);
    box-shadow: 0 0 10px var(--amber-glow);
}

.obslog-cancel-btn {
    padding: 0.375rem 0.625rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.obslog-cancel-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Progress bars */
.obslog-progress-wrap {
    margin-bottom: 0.625rem;
}

.obslog-progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.obslog-progress-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-secondary);
    width: 52px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.obslog-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.obslog-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--amber-dim), var(--amber));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.obslog-progress-count {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--amber-dim);
    width: 42px;
    text-align: right;
    flex-shrink: 0;
}

/* List header */
.obslog-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.obslog-list-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.obslog-expand-btn {
    background: none;
    border: none;
    color: var(--amber-dim);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.obslog-expand-btn:hover {
    color: var(--amber);
}

/* Observation cards */
.obslog-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.obslog-card {
    position: relative;
    padding: 0.5rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}

.obslog-card:hover {
    border-color: var(--border-hover);
}

.obslog-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.obslog-card-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--amber);
}

.obslog-card-stars {
    font-size: 0.688rem;
    color: var(--amber-dim);
    letter-spacing: 0.05em;
}

.obslog-card-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.obslog-card-notes {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.obslog-card-del {
    position: absolute;
    top: 0.25rem;
    right: 0.35rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.obslog-card:hover .obslog-card-del {
    opacity: 1;
}

.obslog-card-del:hover {
    color: var(--error);
}

/* Empty state */
.obslog-empty {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem 0;
}

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */
.controls-toggle { display: inline-block; }

.settings-accordion {
    flex: 0 0 auto;
    position: relative;
    background:
        repeating-linear-gradient(90deg, rgba(255,220,140,0.03) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, #4a3618 0%, #2c1e0c 42%, #140e08 100%);
    border-top: 1px solid #7a5c28;
    box-shadow:
        inset 0 1px 0 rgba(240, 210, 130, 0.22),
        0 -1px 0 #3d2a10;
}
.settings-accordion > summary {
    position: relative;
    list-style: none;
    cursor: pointer;
    padding: 0.48rem 1.6rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: #e4c57a;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    user-select: none;
    text-align: center;
}
.settings-accordion > summary::-webkit-details-marker { display: none; }
.settings-accordion > summary::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 0.45rem;
    border-left: 5px solid #c4a050;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    vertical-align: middle;
}
.settings-accordion[open] > summary::before {
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 5px solid #c4a050;
    border-bottom: 0;
    margin-right: 0.4rem;
}
.settings-accordion > summary .bank-screw.tl,
.settings-accordion > summary .bank-screw.tr { top: 50%; transform: translateY(-50%); }
.settings-accordion > summary .bank-screw.tl { left: 10px; }
.settings-accordion > summary .bank-screw.tr { right: 10px; }
.settings-plate {
    position: relative;
    border-top: 1px solid #5c4418;
    padding: 0.85rem 1.15rem 0.9rem;
    background:
        repeating-linear-gradient(90deg, rgba(255,220,140,0.025) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, #2a1e10 0%, #140e08 55%, #0c0805 100%);
    box-shadow:
        inset 0 1px 0 rgba(240, 210, 130, 0.16),
        inset 0 10px 18px rgba(0, 0, 0, 0.45);
}
.settings-plate > .bank-screw.tl { top: 8px; left: 10px; }
.settings-plate > .bank-screw.tr { top: 8px; right: 10px; }
.settings-plate > .bank-screw.bl { bottom: 8px; left: 10px; }
.settings-plate > .bank-screw.br { bottom: 8px; right: 10px; }
.settings-accordion[open] .controls-panel {
    max-height: 22dvh;
}
.main-content { flex-direction: column; }
.sky-view-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
}

@media (max-width: 900px) {
    body { overflow: hidden; }
    .app-container { height: 100dvh; }
    .header { padding: 0.5rem 0.75rem; }
    .header-content { flex-direction: column; gap: 0.5rem; align-items: stretch; }
    .header-title { text-align: center; width: 100%; }
    .header h1 { font-size: 1.15rem; }
    .header .subtitle { display: none; }
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.55rem;
    }
    .nav-link .plunger {
        font-size: 0.85rem;
        padding: 0.32rem 0.7rem;
    }

    .sky-view-container { min-height: 42dvh; }
    .settings-accordion[open] .controls-panel { max-height: 38dvh; }
    .info-panel { padding: 0.4rem 0.75rem; }
    .options-grid { grid-template-columns: repeat(3, 1fr); }
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
    }
    #lore-modal .modal-content.lore-modal-content {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
    }
}

@media (max-width: 600px) {
    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .info-grid { gap: 0.875rem; }
    .control-section { padding: 0.625rem; }
    .direction-grid { transform: scale(0.92); transform-origin: top center; }
}

/* Open drawer stays low. Color bars are a thin inset rail. Do not restyle plungers. */
.settings-accordion[open] {
    max-height: 40dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.settings-accordion[open] > summary { flex: 0 0 auto; }
.settings-accordion[open] .settings-plate {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
.settings-plate .control-section {
    padding: 0.5rem 0.55rem 0.55rem;
    margin-bottom: 0;
    animation: none;
}
.twilight-legend,
.weather-gauge-row,
.weather-forecast-label,
.weather-updated {
    display: none !important;
}
.twilight-bar-wrapper { height: 8px !important; }
.weather-forecast { height: 8px !important; }
.weather-conditions {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    margin-bottom: 0.2rem !important;
}
