/* ==========================================================================
   Solar System Calculator — Scene tab
   Loaded AFTER solar-shared.css
   No duplicate rules; only scene-specific styles and explicit overrides.
   ========================================================================== */

/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
    --ss-ctrl-size: 38px;
    --ss-ctrl-gap: 10px;
    --ss-ctrl-pad-x: 8px;
    --ss-ctrl-pad-y: 2px;
    --ss-viewport-pad-b: 56px;
}

/* ==========================================================================
   1. Layout — split focus panel
   ========================================================================== */
.solar-canvas--main {
    flex: 1 1 auto;
    order: 2;
    position: relative;
}

.solar-canvas--focus {
    flex: 0 0 0;
    overflow: hidden;
    order: 1;
    background:
        radial-gradient(circle at 50% 42%,
            rgba(30, 58, 108, 0.55) 0%,
            rgba(3, 6, 18, 0.9) 60%,
            rgba(2, 2, 10, 1) 100%);
    border-right: 1px solid rgba(0, 243, 255, 0);
    transition: flex-basis .45s cubic-bezier(.22, .61, .36, 1),
        border-color .3s ease;
}

.solar-viewport[data-has-selection="true"] .solar-canvas--focus {
    flex: 0 0 34%;
    border-right-color: rgba(0, 243, 255, 0.35);
    box-shadow: inset -1px 0 0 rgba(0, 243, 255, 0.15),
        0 0 40px rgba(0, 243, 255, 0.14);
}

/* ==========================================================================
   2. Viewport — reserve bottom padding for controls, all screen sizes
   ========================================================================== */
.solar-viewport {
    height: calc(var(--solar-viewport-h) + var(--ss-viewport-pad-b)) !important;
    min-height: calc(var(--solar-viewport-h) + var(--ss-viewport-pad-b)) !important;
}

/* ==========================================================================
   3. Focus labels
   ========================================================================== */
.solar-focus-label {
    position: absolute;
    top: 14px;
    left: 16px;
    right: 16px;
    z-index: 4;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .7);
    line-height: 1.2;
}

.solar-focus-label:empty::before {
    content: '—';
    opacity: .4;
}

.solar-focus-name {
    white-space: nowrap;
    font-weight: 800;
}

.solar-focus-sub {
    font-size: .72em;
    font-weight: 600;
    opacity: .82;
    white-space: nowrap;
}

.solar-focus-tag {
    position: absolute;
    bottom: 14px;
    left: 16px;
    z-index: 4;
    pointer-events: none;
    font-size: .625rem;
    letter-spacing: .14em;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(0, 243, 255, .75);
    background: rgba(3, 9, 22, .7);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(0, 243, 255, .35);
}

/* ==========================================================================
   4. Selection tracker
   ========================================================================== */
.solar-tracker {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 12;
    pointer-events: none;
    transform: translate(-9999px, -9999px);
    transition: transform .08s linear;
    will-change: transform;
}

.solar-tracker__beam {
    position: absolute;
    left: -1px;
    bottom: 0;
    width: 2px;
    height: 60px;
    background: linear-gradient(180deg, rgba(0, 243, 255, 0), rgba(0, 243, 255, .85));
    box-shadow: 0 0 10px rgba(0, 243, 255, .7);
    transform: translateY(-60px);
}

.solar-tracker__ring {
    position: absolute;
    left: -18px;
    top: -18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--solar-accent);
    box-shadow: 0 0 12px rgba(0, 243, 255, .7),
        inset 0 0 8px rgba(0, 243, 255, .4);
    animation: solar-tracker-pulse 1.6s ease-in-out infinite;
}

@keyframes solar-tracker-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: .95;
    }

    50% {
        transform: scale(1.15);
        opacity: .55;
    }
}

.solar-tracker__tag {
    position: absolute;
    left: 24px;
    top: -12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--solar-panel-bg-strong);
    border: 1px solid rgba(0, 243, 255, .55);
    color: var(--solar-accent);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
}

.solar-tracker.is-edge .solar-tracker__ring {
    border-color: #ff9d4d;
    box-shadow: 0 0 12px rgba(255, 157, 77, .7);
    animation: none;
}

.solar-tracker.is-edge .solar-tracker__tag {
    border-color: rgba(255, 157, 77, .55);
    color: #ff9d4d;
}

.solar-tracker.is-edge .solar-tracker__beam {
    background: linear-gradient(180deg, rgba(255, 157, 77, 0), rgba(255, 157, 77, .85));
    box-shadow: 0 0 10px rgba(255, 157, 77, .7);
}

/* ==========================================================================
   5. Controls bar — ONE rule, applies at every size (user spec)
   Only sizes change in media queries below.
   ========================================================================== */
.solar-studio .solar-controls {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 5px !important;
    top: auto !important;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap !important;
    width: auto;
    max-width: calc(100% - 24px);
    padding: var(--ss-ctrl-pad-y) var(--ss-ctrl-pad-x);
    gap: var(--ss-ctrl-gap);
    border-radius: 32px;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(0, 243, 255, .45);
    box-shadow: 0 0 0 1px rgba(0, 243, 255, .08) inset,
        0 6px 22px rgba(0, 0, 0, .35);
}

/* Speed slider shrinks; buttons stay fixed */
.solar-studio .solar-controls .solar-speed {
    flex: 0 1 auto;
    min-width: 0;
}

/* Ctrl buttons — rigid, no wrapping, transparent in every state */
.solar-studio .solar-controls .solar-ctrl {
    flex: 0 0 auto;
    width: var(--ss-ctrl-size);
    height: var(--ss-ctrl-size);
    min-width: var(--ss-ctrl-size);
    max-width: var(--ss-ctrl-size);
    padding: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
    border-width: 1.5px;
    font-size: calc(var(--ss-ctrl-size) * 0.42);
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #00f3ff !important;
    outline: none !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 6px rgba(0, 0, 0, .65);
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

.solar-studio .solar-controls .solar-ctrl:hover,
.solar-studio .solar-controls .solar-ctrl:focus,
.solar-studio .solar-controls .solar-ctrl:focus-visible {
    background: transparent !important;
    color: #fff !important;
    border-color: #00f3ff !important;
    box-shadow: 0 0 10px rgba(0, 243, 255, .5) !important;
}

.solar-studio .solar-controls .solar-ctrl:active {
    background: transparent !important;
    border-color: #00f3ff !important;
    transform: scale(.94);
}

/* ==========================================================================
   Hint text — positioned above the controls bar (not behind it)
   The `bottom: calc(...)` uses the same variables the controls use, so the
   gap auto-scales with every breakpoint. Text grows upward when wrapping —
   it can never overlap the controls.
   ========================================================================== */
.solar-hint {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    /* Top of controls = bottom(5px) + ctrl-size + 2 × pad-y + border(2px)
       Hint sits 8px above that with room for its own padding */
    bottom: calc(5px + var(--ss-ctrl-size) + 2 * var(--ss-ctrl-pad-y) + 10px);
    z-index: 14;
    font-size: .75rem;
    line-height: 1.35;
    color: rgba(229, 238, 251, .75);
    letter-spacing: .02em;
    pointer-events: none;
    text-align: center;
    width: max-content;
    max-width: calc(100% - 24px);
    padding: 4px 12px;
    border-radius: 20px;
    background: transparent;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 8px rgba(0, 0, 0, .55);
    white-space: nowrap;
    transition: opacity .2s;
}

/* Narrow screens — allow wrapping, shrink type, but stay above controls */
@media (max-width: 640px) {
    .solar-hint {
        white-space: normal;
        font-size: .6875rem;
        line-height: 1.3;
        padding: 3px 10px;
        max-width: calc(100% - 16px);
        margin-bottom: 10px;
    }
}

@media (max-width: 460px) {
    .solar-hint {
        font-size: .625rem;
        padding: 3px 8px;
        max-width: calc(100% - 12px);
        margin-bottom: 10px;
    }
}

@media (max-width: 380px) {
    .solar-hint {
        font-size: .5625rem;
        line-height: 1.25;
        margin-bottom: 10px;
    }
}

@media (max-width: 320px) {
    .solar-hint {
        font-size: .5rem;
        padding: 2px 6px;
    }
}

/* Hide hint during tour — JS class toggle (works on every browser,
   including those that don't support :has()) */
.solar-viewport.is-tour-active .solar-hint {
    display: none;
}

/* ==========================================================================
   7. Tour caption — centered above controls
   ========================================================================== */
.solar-tour-caption {
    position: absolute;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 90px;
    z-index: 18;
    width: max-content;
    max-width: min(calc(100% - 24px), 520px);
    max-height: 55%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid rgba(0, 243, 255, .55);
    color: var(--solar-panel-text);
    font-size: .875rem;
    line-height: 1.55;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
    pointer-events: none;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 10px rgba(0, 0, 0, .6);
    animation: solar-tour-in .3s ease;
}

@keyframes solar-tour-in {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.solar-tour-caption__main {
    line-height: 1.5;
}

.solar-tour-caption__moon {
    padding-top: 6px;
    border-top: 1px solid rgba(0, 243, 255, .22);
    color: #c8d5ea;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .95), 0 0 8px rgba(0, 0, 0, .5);
}

/* ==========================================================================
   8. Planet chips, bubbles, missions, wiki
   ========================================================================== */
.solar-planet-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.solar-planet-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 48px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    transition: background-color .15s, border-color .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.solar-planet-chip:hover,
.solar-planet-chip:focus-visible {
    background: var(--primary-soft);
    border-color: var(--primary);
    transform: translateX(3px);
    outline: none;
}

.solar-planet-chip__name {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text);
}

.solar-planet-chip__meta {
    font-size: .6875rem;
    color: var(--text-muted);
}

.solar-bubbles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.solar-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 48px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color .18s, transform .18s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.solar-bubble:hover {
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.solar-bubble__icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--primary-soft);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.solar-bubble__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.solar-bubble__label {
    font-size: .625rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 700;
}

.solar-bubble__value {
    font-size: .8125rem;
    color: var(--text);
    font-weight: 700;
}

.solar-bubble-pop {
    padding: 10px 14px 12px;
    margin-top: -4px;
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--text-muted);
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    border-radius: 0 0 10px 10px;
}

.solar-missions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.solar-mission {
    display: flex;
    gap: 12px;
    padding-left: 12px;
    border-left: 2px solid #ff7a33;
    position: relative;
}

.solar-mission::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff7a33;
    box-shadow: 0 0 10px rgba(255, 122, 51, .7);
}

.solar-mission__year {
    flex: 0 0 auto;
    font-size: .75rem;
    font-weight: 800;
    color: #d15a17;
    min-width: 40px;
}

.solar-mission__body {
    min-width: 0;
}

.solar-mission__name {
    display: block;
    font-size: .8125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.solar-mission__desc {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
}

.solar-wiki-text {
    padding: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
}

.solar-wiki-text__columns {
    column-count: 2;
    column-gap: 28px;
    font-size: .8125rem;
    line-height: 1.7;
    color: var(--text-muted);
    text-align: justify;
}

.solar-wiki-text__columns p {
    margin: 0 0 10px;
    break-inside: avoid;
}

.solar-wiki-text__columns p:last-child {
    margin-bottom: 0;
}

.solar-wiki-empty {
    font-style: italic;
    color: var(--text-faint);
}

@media (max-width: 700px) {
    .solar-wiki-text__columns {
        column-count: 1;
        text-align: left;
    }
}

.solar-wiki {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: var(--solar-tap);
    padding: 12px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d2ff, #0072ff);
    color: #fff;
    font-weight: 700;
    font-size: .875rem;
    text-decoration: none;
    box-shadow: 0 6px 22px rgba(0, 114, 255, .3);
    transition: transform .2s, box-shadow .2s;
    touch-action: manipulation;
}

.solar-wiki:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 26px rgba(0, 243, 255, .45);
    text-decoration: none;
}

/* ==========================================================================
   9. How-to + Formula sections
   ========================================================================== */
.solar-howto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 24px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.solar-howto__col {
    min-width: 0;
}

.solar-howto__title {
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--text);
    margin: 0 0 14px;
}

.solar-howto__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.solar-howto__list li {
    position: relative;
    padding-left: 22px;
    font-size: .875rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.solar-howto__list li::before {
    content: '→';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary);
    font-weight: 800;
}

.solar-howto__list strong {
    color: var(--text);
    font-weight: 700;
}

.solar-formula {
    padding: 16px 18px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    margin-bottom: 14px;
}

.solar-formula:last-child {
    margin-bottom: 0;
}

.solar-formula h3 {
    font-size: .875rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 8px;
}

.solar-formula p {
    font-size: .8125rem;
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.solar-formula p:last-child {
    margin-bottom: 0;
}

.solar-formula pre {
    display: block;
    padding: 10px 14px;
    margin: 8px 0;
    background: var(--bg-inset);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: .8125rem;
    color: var(--primary);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-weight: 600;
    white-space: pre-wrap;
    word-break: break-word;
}

.solar-formula em {
    color: var(--text);
    font-style: normal;
    font-weight: 600;
}

/* ==========================================================================
   10. Card hints + result rows
   ========================================================================== */
.solar-card__hint {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.solar-card__hint strong {
    color: var(--text);
    font-weight: 700;
}

.solar-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .8125rem;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.solar-res-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    line-height: 1.4;
}

.solar-res-line>span:first-child {
    color: var(--text-muted);
    flex: 0 0 auto;
}

.solar-res-line>strong {
    color: var(--text);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

.solar-selected-body {
    color: var(--primary) !important;
    font-weight: 800 !important;
}

/* ==========================================================================
   11. Responsive — size-only adjustments (position stays identical)
   ========================================================================== */

/* ---- ≤1199px : tablet landscape ---- */
@media (max-width: 1199px) {
    :root {
        --ss-ctrl-size: 36px;
        --ss-ctrl-gap: 8px;
        --ss-viewport-pad-b: 54px;
    }

    .solar-viewport[data-has-selection="true"] .solar-canvas--focus {
        flex: 0 0 28%;
    }

    .solar-speed input[type="range"] {
        width: 100px;
    }

    .solar-tour-caption {
        bottom: 80px;
    }
}

/* ---- ≤900px : tablet portrait ---- */
@media (max-width: 900px) {
    :root {
        --ss-ctrl-size: 34px;
        --ss-ctrl-gap: 7px;
        --ss-viewport-pad-b: 52px;
    }

    .solar-viewport[data-has-selection="true"] .solar-canvas--focus {
        flex: 0 0 26%;
    }

    .solar-speed input[type="range"] {
        width: 90px;
    }

    .solar-focus-label {
        font-size: .9375rem;
    }

    .solar-tour-caption {
        bottom: 72px;
        font-size: .8125rem;
    }

    .solar-tour-caption__moon {
        font-size: .75rem;
    }
}

/* ---- ≤640px : large phone ---- */
@media (max-width: 640px) {
    :root {
        --ss-ctrl-size: 32px;
        --ss-ctrl-gap: 6px;
        --ss-viewport-pad-b: 50px;
    }

    .solar-viewport[data-has-selection="true"] .solar-canvas--focus {
        flex: 0 0 24%;
    }

    .solar-speed {
        font-size: .6875rem;
        gap: 5px;
    }

    .solar-speed label {
        display: none;
    }

    .solar-speed input[type="range"] {
        width: 76px;
    }

    .solar-focus-label {
        font-size: .875rem;
        top: 10px;
        left: 12px;
        right: 12px;
    }

    .solar-focus-tag {
        bottom: 10px;
        left: 12px;
        font-size: .5625rem;
        padding: 3px 8px;
    }

    .solar-hint {
        font-size: .6875rem;
    }

    .solar-tour-caption {
        bottom: 64px;
        font-size: .75rem;
        padding: 10px 14px;
        border-radius: 10px;
    }

    .solar-tour-caption__moon {
        font-size: .6875rem;
        padding-top: 4px;
    }

    .solar-howto {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 20px;
    }
}

/* ---- ≤460px : edge-to-edge ---- */
@media (max-width: 460px) {
    :root {
        --ss-ctrl-size: 30px;
        --ss-ctrl-gap: 5px;
        --ss-ctrl-pad-x: 10px;
        --ss-viewport-pad-b: 48px;
    }

    .container.tool-layout:has([data-solar-tab-root]) {
        padding-inline: 0;
    }

    .container.tool-layout:has([data-solar-tab-root]) .tool-main>*:not(.calc) {
        padding-inline: 12px;
    }

    .solar-studio {
        padding-inline: 4px;
        gap: 12px;
    }

    .solar-viewport {
        border-radius: 12px;
    }

    .solar-viewport[data-has-selection="true"] .solar-canvas--focus {
        flex: 0 0 22%;
    }

    .solar-studio .solar-controls {
        padding: var(--ss-ctrl-pad-y) var(--ss-ctrl-pad-x);
        border-radius: 22px;
    }

    .solar-speed input[type="range"] {
        width: 64px;
    }

    .solar-actions {
        padding: 4px;
        gap: 4px;
    }

    .solar-tab-action {
        padding: 8px 10px;
        min-height: 40px;
        font-size: .75rem;
    }

    .solar-tab-action span:first-child {
        font-size: .9375rem;
    }

    .solar-help-strip {
        padding: 8px 12px;
        font-size: .75rem;
        gap: 8px;
        border-radius: 10px;
    }

    .solar-help-strip__icon {
        font-size: 1rem;
    }

    .solar-overlay-btn {
        top: 6px;
        right: 6px;
        padding: 5px 9px;
        font-size: .625rem;
        min-height: 30px;
        border-radius: 16px;
        gap: 4px;
    }

    .solar-overlay-panel {
        top: 40px;
        right: 6px;
        left: auto;
        width: 190px;
        max-width: calc(100% - 12px);
        max-height: calc(100% - 60px);
        padding: 8px 10px;
        gap: 0;
        border-radius: 12px;
    }

    .solar-overlay-panel__title {
        font-size: .5625rem;
        margin-bottom: 3px;
        padding-bottom: 3px;
        letter-spacing: .07em;
    }

    .solar-overlay-toggle {
        padding: 4px 2px;
        font-size: .6875rem;
        min-height: 30px;
        gap: 6px;
        border-radius: 6px;
    }

    .solar-overlay-toggle input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    .solar-hint {
        font-size: .625rem;
        padding: 3px 8px;
    }

    .solar-tour-caption {
        bottom: 56px;
        padding: 8px 10px;
        font-size: .6875rem;
        line-height: 1.4;
        border-radius: 8px;
        max-width: calc(100% - 16px);
    }

    .solar-tour-caption__moon {
        font-size: .625rem;
        padding-top: 3px;
    }

    .solar-focus-label {
        top: 6px;
        left: 8px;
        right: 8px;
        font-size: .75rem;
        gap: 1px 6px;
    }

    .solar-focus-sub {
        font-size: .625rem;
    }

    .solar-focus-tag {
        bottom: 6px;
        left: 8px;
        font-size: .5rem;
        padding: 2px 5px;
        letter-spacing: .1em;
    }

    .solar-below {
        gap: 14px;
    }

    .solar-below__right {
        padding: 12px;
    }

    .solar-info-name {
        font-size: 1.0625rem;
    }

    .solar-card {
        padding: 12px;
    }

    .solar-howto {
        padding: 16px;
    }

    .solar-howto__title {
        font-size: 1rem;
    }

    .solar-howto__list li {
        font-size: .8125rem;
    }

    .solar-formula {
        padding: 14px;
    }

    .solar-formula pre {
        font-size: .75rem;
        padding: 8px 10px;
    }
}

/* ---- ≤380px : small phones (iPhone SE) ---- */
@media (max-width: 380px) {
    :root {
        --ss-ctrl-size: 28px;
        --ss-ctrl-gap: 4px;
        --ss-ctrl-pad-x: 8px;
        --ss-viewport-pad-b: 46px;
    }

    .solar-viewport[data-has-selection="true"] .solar-canvas--focus {
        flex: 0 0 20%;
    }

    .solar-speed input[type="range"] {
        width: 52px;
    }

    .solar-tour-caption {
        bottom: 50px;
    }

    .solar-focus-label {
        font-size: .6875rem;
    }

    .solar-focus-sub {
        font-size: .5625rem;
    }

    .solar-howto {
        padding: 12px;
        gap: 16px;
    }

    .solar-howto__list {
        gap: 8px;
    }

    .solar-formula {
        padding: 12px;
    }
}

/* ---- ≤360px : extra small ---- */
@media (max-width: 360px) {
    :root {
        --ss-viewport-pad-b: 44px;
    }

    .solar-studio {
        padding-inline: 3px;
        gap: 10px;
    }

    .solar-speed input[type="range"] {
        width: 44px;
    }

    .solar-tour-caption {
        bottom: 46px;
        font-size: .625rem;
    }
}

/* ---- ≤320px : Galaxy Fold cover screen ---- */
@media (max-width: 320px) {
    :root {
        --ss-ctrl-size: 26px;
        --ss-viewport-pad-b: 42px;
    }

    .solar-studio {
        padding-inline: 2px;
        gap: 8px;
    }

    .solar-studio .solar-controls {
        border-radius: 18px;
    }

    .solar-speed input[type="range"] {
        width: 36px;
    }

    .solar-tour-caption {
        bottom: 42px;
        font-size: .5625rem;
        padding: 6px 8px;
    }

    .solar-overlay-panel {
        width: 160px;
        padding: 7px 8px;
    }

    .solar-overlay-toggle {
        font-size: .625rem;
        min-height: 28px;
    }
}

/* ---- Landscape short screens ---- */
@media (max-height: 520px) and (orientation: landscape) {
    .solar-viewport {
        height: 76vh !important;
        min-height: 76vh !important;
    }

    .solar-tour-caption {
        bottom: 46px;
        max-height: 42%;
    }
}

/* ==========================================================================
   12. Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .solar-tracker__ring {
        animation: none;
    }

    .solar-canvas--focus {
        transition: none;
    }

    .solar-planet-chip:hover,
    .solar-bubble:hover,
    .solar-wiki:hover {
        transform: none;
    }

    .solar-studio .solar-controls .solar-ctrl:active {
        transform: none;
    }

    .solar-tour-caption {
        animation: none;
    }
}

/* ==========================================================================
   Hint text — swap desktop vs touch instructions based on input type
   ========================================================================== */

.solar-hint__touch,
.solar-compare-hint .solar-hint__touch {
    display: none;
}

@media (hover: none) and (pointer: coarse) {

    .solar-hint__desktop,
    .solar-compare-hint .solar-hint__desktop {
        display: none;
    }

    .solar-hint__touch,
    .solar-compare-hint .solar-hint__touch {
        display: inline;
    }
}

/* ==========================================================================
   Layout containment — prevents CLS when 3D canvas mounts
   Safe to add: .solar-viewport already has explicit height.
   ========================================================================== */
.solar-viewport {
    contain: layout size;
}

.solar-canvas--main,
.solar-canvas--focus {
    contain: layout size;
}