/* Sonne, Erde & Mond – Ein-Bildschirm-Cockpit (entdecken/sonne_erde_mond/styles.css) */

:root {
    --sem-accent: #166534;
    --sem-accent-soft: #dcfce7;
    --sem-space: #040814;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

.sem-body {
    height: 100dvh;
    overflow: hidden;
    background: var(--le-bg, #fdfaf3);
    color: var(--le-ink, #1e293b);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
}

.mono {
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* --- TOPBAR (KOMPAKT) --- */
.sem-topbar {
    flex-shrink: 0;
    z-index: 30;
    background: rgba(253, 250, 243, 0.96);
    border-bottom: 1px solid rgba(22, 101, 52, 0.14);
    padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
}

.sem-topbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sem-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sem-brand-icon {
    flex-shrink: 0;
    display: flex;
}

.sem-brand-title {
    margin: 0;
    font-size: clamp(0.95rem, 2vw, 1.12rem);
    font-weight: 900;
    line-height: 1.15;
    color: #0f172a;
    white-space: nowrap;
}

.sem-brand-sub {
    margin: 0;
    font-size: 0.72rem;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

.sem-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sem-mission-pill {
    min-height: 36px;
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
}

.sem-panel-toggle {
    display: none;
    min-height: 36px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
}

/* --- HAUPTLAYOUT (KEIN SCROLLEN AUF DEM GANZEN BILDSCHIRM) --- */
.sem-layout {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.sem-stage-wrap {
    position: relative;
    flex: 1 1 54%;
    min-height: 220px;
    background: var(--sem-space);
    overflow: hidden;
}

.sem-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}

.sem-canvas:active {
    cursor: grabbing;
}

.sem-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(4, 8, 20, 0.92);
    color: #f8fafc;
    text-align: center;
}

.sem-fallback[hidden] {
    display: none;
}

.sem-fallback-card {
    max-width: 400px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 20px;
}

/* --- STAGE OVERLAYS --- */
.sem-stage-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 190px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.sem-scale-chip {
    align-self: flex-start;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.sem-scale-chip.is-real {
    background: rgba(22, 101, 52, 0.88);
    border-color: rgba(134, 239, 172, 0.65);
    color: #f0fdf4;
}

.sem-eclipse-banner {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(194, 65, 12, 0.94), rgba(153, 27, 27, 0.94));
    border: 1px solid #fdba74;
    color: #fff7ed;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 5px 11px;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.sem-toast {
    align-self: flex-start;
    padding: 7px 12px;
    border-radius: 10px;
    background: rgba(254, 243, 199, 0.96);
    border: 1px solid #f59e0b;
    color: #78350f;
    font-weight: 800;
    font-size: 0.8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* --- MOND-VORSCHAU OBEN RECHTS --- */
.sem-moon-hud {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 5px 10px 5px 5px;
    color: #f8fafc;
    pointer-events: none;
}

#moonPhaseCanvas {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sem-moon-hud-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.18;
}

.sem-moon-hud-kicker {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    font-weight: 700;
}

.sem-moon-hud-meta strong {
    font-size: 0.8rem;
    font-weight: 800;
}

.sem-moon-hud-meta span.mono {
    font-size: 0.7rem;
    color: #cbd5e1;
}

/* --- KAMERA-TOOLBAR UNTEN --- */
.sem-cam-bar {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.sem-cam-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: auto;
}

.sem-cam-btn,
.sem-icon-btn {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    color: #f1f5f9;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sem-icon-btn {
    min-width: 44px;
    font-size: 1.05rem;
    line-height: 1;
}

.sem-cam-btn:hover,
.sem-icon-btn:hover {
    background: rgba(30, 41, 59, 0.96);
    border-color: #7dd3fc;
}

.sem-cam-btn.is-active,
.sem-cam-btn[aria-pressed="true"] {
    background: #166534;
    border-color: #86efac;
    color: #ffffff;
}

.sem-touch-hint {
    position: absolute;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
}

/* --- KOMPAKTES COCKPIT-DOCK --- */
.sem-panel {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fdfaf3;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    gap: 8px;
}

.sem-player-bar {
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sem-player-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sem-play-btn {
    min-height: 44px;
    padding: 6px 14px;
    border: none;
    border-radius: 10px;
    background: #166534;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.84rem;
    cursor: pointer;
    white-space: nowrap;
}

.sem-play-btn[aria-pressed="false"] {
    background: #0284c7;
}

.sem-date-block {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.sem-date-display {
    font-size: 0.95rem;
    font-weight: 900;
    color: #0f172a;
    white-space: nowrap;
}

.sem-today-btn {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
}

.sem-speed-group {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
}

.sem-speed-btn {
    min-height: 44px;
    padding: 4px 2px;
    border-radius: 9px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
    font-size: 0.72rem;
    cursor: pointer;
}

.sem-speed-btn.is-active {
    background: #dcfce7;
    border-color: #166534;
    color: #166534;
}

/* --- TABS --- */
.sem-tabs {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.sem-tab {
    min-height: 44px;
    border-radius: 11px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: #475569;
    font-weight: 800;
    font-size: 0.76rem;
    padding: 6px 4px;
    cursor: pointer;
    white-space: nowrap;
}

.sem-tab.is-active {
    background: #166534;
    border-color: #166534;
    color: #ffffff;
}

.sem-tab-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sem-tab-body[hidden] {
    display: none;
}

/* --- TAB 1: WISSEN & MESSWERTE --- */
.sem-explain-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 9px 11px;
}

.sem-season-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.sem-season-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    background: #166534;
    color: #ffffff;
}

.sem-season-badge.is-soft {
    background: #e2e8f0;
    color: #334155;
}

.sem-explain-text {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #1e293b;
}

.sem-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.sem-metric-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sem-metric-box span {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
}

.sem-metric-box strong {
    font-size: 0.88rem;
    color: #0f172a;
}

.sem-metric-box small {
    font-size: 0.68rem;
    color: #475569;
}

/* --- TAB 2: DATUM & SPRÜNGE --- */
.sem-date-jump-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sem-label {
    font-size: 0.76rem;
    font-weight: 800;
    color: #475569;
    display: block;
}

.sem-date-input {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
}

.sem-preset-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 6px;
}

.sem-preset-btn {
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 700;
    font-size: 0.76rem;
    cursor: pointer;
    text-align: left;
}

.sem-preset-btn:hover {
    background: #ecfdf5;
    border-color: #86efac;
}

/* --- TAB 3: ANSICHT & HILFSLINIEN --- */
.sem-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.sem-toggle-chip {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.sem-toggle-chip input {
    width: 18px;
    height: 18px;
    accent-color: #166534;
    flex-shrink: 0;
}

.sem-legend-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 0.74rem;
    line-height: 1.42;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sem-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    vertical-align: middle;
}

.sem-dot.is-green {
    background: #22c55e;
}

.sem-dot.is-orange {
    background: #f97316;
}

/* --- TAB 4: MISSIONEN --- */
.sem-mission-intro {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.35;
    color: #475569;
}

.sem-missions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sem-mission-item {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 11px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sem-mission-item.is-done {
    background: #f0fdf4;
    border-color: #86efac;
}

.sem-mission-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
}

.sem-mission-desc {
    font-size: 0.72rem;
    color: #475569;
    margin-top: 1px;
    line-height: 1.3;
}

.sem-mission-reward {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    white-space: nowrap;
}

.sem-mission-item.is-done .sem-mission-reward {
    background: #166534;
    color: #ffffff;
}

/* --- DESKTOP & TABLET QUERFORMAT (OHNE SCROLLEN, VOLLE BILDSCHIRMBREITE) --- */
@media (min-width: 900px) {
    .sem-panel-toggle {
        display: inline-flex;
        align-items: center;
    }

    .sem-layout {
        flex-direction: row;
        align-items: stretch;
    }

    .sem-stage-wrap {
        flex: 1 1 auto;
        height: 100%;
    }

    .sem-panel {
        width: 380px;
        flex: 0 0 380px;
        border-top: none;
        border-left: 1px solid rgba(15, 23, 42, 0.1);
        padding: 10px 12px;
        gap: 9px;
    }

    .sem-layout.is-panel-hidden .sem-panel {
        display: none;
    }
}

/* --- KOMPAKTES HANDY-HOCHFORMAT --- */
@media (max-width: 899px) {
    .sem-brand-sub {
        display: none;
    }

    .sem-stage-wrap {
        flex: 0 0 46dvh;
    }

    .sem-panel {
        flex: 1 1 auto;
    }
}

@media (max-width: 560px) {
    .sem-mission-pill {
        font-size: 0.72rem;
        padding: 4px 8px;
    }

    .sem-stage-badges {
        right: 10px;
        top: 62px;
    }

    .sem-touch-hint {
        display: none;
    }

    .sem-cam-btn {
        min-height: 44px;
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .sem-icon-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .sem-preset-pills,
    .sem-toggle-grid {
        grid-template-columns: 1fr;
    }
}
