/* Lab layout uses the application's shared theme tokens and saved preference. */
*{box-sizing:border-box}body{margin:0}
header,main{max-width:1120px;margin:auto;padding:24px}
header{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between;align-items:center;border-bottom:1px solid var(--site-border)}
.lab-header-controls{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
h1{font-size:clamp(2rem,5vw,3.8rem);line-height:1.25;letter-spacing:-.025em;margin:12px 0}h2{margin-top:0}
.eyebrow{color:var(--site-accent);letter-spacing:.1em;font-size:.8rem;font-weight:700}
p{line-height:1.65;color:var(--site-muted)}
nav{display:flex;flex-wrap:wrap;gap:10px;margin:28px 0}
nav a{padding:12px 16px;border:1px solid var(--site-border);border-radius:10px;text-decoration:none;background:var(--htmljs-soft,var(--site-bg))}
nav a[aria-current=page]{background:var(--site-accent);border-color:var(--site-accent);color:var(--site-bg)}
.panel{background:var(--htmljs-panel,var(--site-bg));border:1px solid var(--site-border);border-radius:16px;padding:24px;margin:22px 0;box-shadow:var(--htmljs-shadow,none)}
form{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:18px}
label{display:flex;flex-direction:column;gap:8px;font-size:.9rem}
input,select,button{font:inherit;padding:10px;border:1px solid var(--site-border);border-radius:8px;background:var(--site-bg);color:var(--site-ink);min-width:0;min-height:44px}
input:not([type=checkbox]){width:100%}input[name=instant],input[name=zone]{direction:ltr}
button{cursor:pointer;background:var(--site-accent);color:var(--site-bg);font-weight:650;align-self:end}
button:disabled{opacity:.6;cursor:default}
.check{justify-content:center;flex-direction:row;align-items:center}.check input{width:18px;height:18px;min-height:18px;accent-color:var(--site-accent)}
/* Dark observing surface preserves contrast for the sky chart in both page themes. */
canvas{width:100%;height:auto;display:block;background:#071323;border-radius:12px}
.chart-head{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap}.scroll{overflow:auto}
table{width:100%;border-collapse:collapse;font-size:.88rem}
caption{text-align:start;padding:15px 0;color:var(--site-muted)}
td,th{text-align:start;padding:12px 8px;border-bottom:1px solid var(--site-border);white-space:nowrap}
th{background:var(--htmljs-soft,var(--site-bg))}
dl{display:grid;grid-template-columns:minmax(100px,1fr) 3fr;gap:10px}
dd{margin:0;overflow-wrap:anywhere;color:var(--site-muted)}dt{font-weight:650}
pre{white-space:pre-wrap;overflow-wrap:anywhere;direction:ltr;max-height:420px;overflow:auto}summary{cursor:pointer;padding:14px 0}
:focus-visible{outline:3px solid var(--site-accent);outline-offset:3px}[hidden]{display:none!important}
.transport{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.transport button{align-self:center}.transport label{min-width:120px}.transport output{font-variant-numeric:tabular-nums}
.reference-controls{border-top:1px solid var(--site-border);padding-top:18px;margin:18px 0}
.reference-options{display:flex;gap:16px;flex-wrap:wrap;align-items:center}.reference-options label{max-width:100%;min-width:120px}.reference-options select{max-width:100%}.reference-controls p{font-size:.88rem}
#reference-sources,.reference-controls p{overflow-wrap:anywhere}
@media(max-width:550px){main,header{padding:16px}.panel{padding:16px}dl{display:block}dt{margin-top:14px}dd{margin-top:5px}}
.sky-tools{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-block:18px}.sky-tools label{min-width:140px}.sky-tools button{align-self:center}.sky-tools output{font-variant-numeric:tabular-nums;min-width:4em;text-align:center}#sky{touch-action:none;cursor:ew-resize}#sky:active{cursor:grabbing}#sky-gesture-help{font-size:.9rem}

.sky-stage{position:relative}.sky-overlay{position:absolute;z-index:1;inset-block-start:10px;inset-inline-start:10px;display:flex;gap:8px;max-width:calc(100% - 20px);flex-wrap:wrap}.sky-overlay button{min-height:40px;padding:8px 12px;background:#10243eed;color:#edf3ff;border:1px solid #6b91b9;box-shadow:0 2px 8px #0005}.sky-overlay button:hover{background:#244467}.sky-overlay button:focus-visible{outline:3px solid #83bdff;outline-offset:2px}#sky-action-status:empty{display:none}#sky-window{font-size:.9rem}

.sky-stage{background:#071323;border-radius:12px;display:flex;align-items:center;min-height:400px}.sky-overlay{max-width:calc(100% - 72px);flex-wrap:nowrap}.sky-overlay button{display:inline-flex;align-items:center;gap:6px;min-width:0}.sky-overlay svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.sky-overlay #sky-location{min-width:0;max-width:100%}#sky-location-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.location-dot{fill:currentColor;stroke:none}#sky-location.is-live{color:#81f4c0;border-color:#57d59b}#sky-brand{position:absolute;z-index:1;inset-block-start:12px;inset-inline-end:12px;line-height:0}#sky-logo{width:36px;height:36px;object-fit:contain}.sky-date-hud{position:absolute;inset-inline:12px;inset-block-end:10px;z-index:1;padding:8px 10px;border-radius:8px;background:#071323e8;color:#e6edf6;pointer-events:none;line-height:1.35;font-size:12px}.sky-date-hud time{display:block;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}.sky-date-hud>div{display:flex;gap:8px;flex-wrap:wrap}.sky-date-hud strong{color:#b9c9dc;font-weight:500}.sky-date-hud #sky-moon-phase{display:block;color:#bbcce4;font-size:11px}@media(max-width:550px){.sky-stage{padding-block:56px 96px;min-height:400px}.sky-date-hud>div{display:block}.sky-date-hud strong{margin-inline-end:6px}}
.sky-stage{padding-block:56px 100px}@media(max-width:550px){.sky-stage{padding-block-end:132px}}
.sky-tools label{min-width:0;flex:1 1 200px;max-width:100%}.sky-tools select{width:100%;min-width:0;max-width:100%}.sky-date-hud{overflow-wrap:anywhere}.sky-date-hud span,.sky-date-hud strong{min-width:0;max-width:100%}
.sky-overlay{width:calc(100% - 72px)}.sky-overlay #sky-now{flex:none;white-space:nowrap}.sky-overlay #sky-location{flex:1 1 auto}.sky-overlay button{font-size:13px;padding-inline:8px}#sky-location-label{min-width:0}

.sky-date-hud>div>span{unicode-bidi:isolate}.sky-date-hud>div>strong{unicode-bidi:isolate;margin-inline-start:6px;margin-inline-end:0}

.sky-stage{padding-block:84px 180px}
.sky-overlay{align-items:center;flex-wrap:wrap}
.sky-method-control{flex:1 1 210px;min-width:0;gap:2px;color:#dce8f8;font-size:10px}
.sky-method-control select{width:100%;min-height:34px;padding:4px;background:#10243e;color:#edf3ff;border-color:#6b91b9;font-size:12px}
.sky-date-hud{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;align-items:start}
.sky-calendar-column>div{display:flex;flex-wrap:wrap;gap:4px}
.sky-calendar-column span,.sky-calendar-column strong{unicode-bidi:isolate}
.moon-station-hud{min-width:0;border-inline-start:1px solid #49617d;padding-inline-start:12px}
#moon-station-results>div{display:flex;justify-content:space-between;gap:8px;padding:3px;border-radius:4px}
#moon-station-results>div[data-selected=true]{background:#274769}
#moon-station-results strong{color:#ffdc8b}
#moon-station-more{pointer-events:auto;color:#a9d2ff;display:block;margin-bottom:4px}
@media(max-width:550px){.sky-stage{padding-block:120px 230px}.sky-date-hud{inset-inline:6px;padding:6px;gap:6px;font-size:10px}.sky-date-hud time{font-size:14px}.moon-station-hud{padding-inline-start:6px}#moon-station-results>div{display:block}.sky-method-control{flex-basis:100%}}
/* Canvas toolbar keeps actions and layer switches within the observing surface. */
.sky-sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.sky-overlay{width:calc(100% - 24px);max-width:none;inset-inline:12px;inset-block-start:12px;padding-inline-end:102px;box-sizing:border-box;gap:7px}
.sky-overlay #sky-location{flex:1 1 140px;max-width:240px}
.sky-method-control,.sky-style-control{flex:1 1 165px;min-width:0;max-width:300px;display:block}
.sky-overlay select{width:100%;min-height:40px;padding:7px;background:#10243eed;color:#edf3ff;border-color:#6b91b9;font-size:12px}
.sky-brand-actions{position:absolute;inset-block-start:12px;inset-inline-end:12px;z-index:2;display:flex;gap:8px;align-items:center}
.sky-brand-actions #sky-brand{position:static;line-height:0}
#sky-fullscreen{width:40px;height:40px;min-height:40px;padding:8px;background:#10243eed;color:#edf3ff;border-color:#6b91b9}
#sky-fullscreen svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#sky-fullscreen[aria-pressed=true]{background:#315d88}
#sky-layer-switches{display:flex;flex:1 0 100%;flex-wrap:wrap;gap:6px 14px;padding-block:4px}
#sky-layer-switches .check{flex:none;min-width:0;max-width:none;gap:6px;font-size:11px;color:#dce8f8;white-space:nowrap}
#sky-layer-switches input{appearance:none;width:27px;height:16px;min-height:16px;min-width:27px;border-radius:12px;border:1px solid #7a91aa;padding:0;background:#283d53;position:relative;cursor:pointer}
#sky-layer-switches input:before{content:'';position:absolute;top:2px;left:2px;width:10px;height:10px;border-radius:50%;background:#dce8f8;transition:transform .15s}
#sky-layer-switches input:checked{background:#28776d;border-color:#75e4d0}
#sky-layer-switches input:checked:before{transform:translateX(11px);background:#e4fff8}
.sky-stage{padding-block-start:122px}
.sky-stage:fullscreen,.sky-stage.is-expanded{width:100%;height:100dvh;max-width:none;box-sizing:border-box;border-radius:0;justify-content:center;overflow:auto;padding:112px 12px 170px;background:#071323}
.sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{flex:none;width:min(100%,calc((100dvh - 290px)*850/520));height:auto;min-width:200px}
body.sky-expanded{overflow:hidden}
.sky-stage.is-expanded{position:fixed;inset:0;z-index:10000}
@media(max-width:650px){
 .sky-overlay{padding-inline-end:0;padding-block-start:48px}
 .sky-overlay #sky-now{flex:0 0 auto}.sky-overlay #sky-location{max-width:none;flex:1 1 130px}
 .sky-method-control,.sky-style-control{flex:1 1 130px;max-width:none}
 .sky-stage{padding-block-start:218px}
 .sky-stage:fullscreen,.sky-stage.is-expanded{padding-block:218px 200px}
 .sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,calc((100dvh - 430px)*850/520))}
}


/* Instantaneous Sun and Moon classifications sit beside the calendar clock. */
.sky-date-hud{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}
.sun-station-hud{min-width:0;border-inline-start:1px solid #49617d;padding-inline-start:12px}
.station-column-title{display:block;margin-block-end:5px;color:#edf3ff!important;font-weight:650!important}
#sun-station-basis,#sun-seasonal-station{display:block;color:#bdcde1}
#sun-station-results>div{display:flex;justify-content:space-between;gap:8px;padding:3px;border-radius:4px}
#sun-station-results>div[data-selected=true]{background:#274769}
#sun-station-results strong{color:#ffdc8b}
.sky-stage{padding-block-end:210px}
@media(max-width:650px){
 .sky-date-hud{grid-template-columns:1fr 1fr;gap:8px}
 .sky-calendar-column{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:4px 10px;align-items:center}
 .sky-calendar-column time{flex-basis:100%}
 .moon-station-hud{border-inline-start:0;padding-inline-start:0}
 .sun-station-hud{padding-inline-start:8px}
 #sun-station-results>div{display:block}
 .sky-stage{padding-block-end:320px}
 .sky-stage:fullscreen,.sky-stage.is-expanded{padding-block-end:300px}
 .sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,calc((100dvh - 530px)*850/520))}
}

.image-credits{font-size:11px;overflow-wrap:anywhere;line-height:1.5}
.image-credits a{display:block}
@media(orientation:landscape) and (max-height:650px){
 .sky-stage:fullscreen,.sky-stage.is-expanded{padding-block:94px 140px;padding-inline:12px}
 .sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,calc((100dvh - 245px)*850/520));min-width:100px}
 .sky-stage:fullscreen .sky-overlay,.sky-stage.is-expanded .sky-overlay{padding-block-start:0;padding-inline-end:102px}
 .sky-stage:fullscreen .sky-date-hud,.sky-stage.is-expanded .sky-date-hud{grid-template-columns:repeat(3,minmax(0,1fr));font-size:9px;line-height:1.15}
 .sky-stage:fullscreen .sky-calendar-column,.sky-stage.is-expanded .sky-calendar-column{grid-column:auto;display:block}
 .sky-stage:fullscreen .sky-date-hud time,.sky-stage.is-expanded .sky-date-hud time{font-size:13px}
 .sky-stage:fullscreen #sun-station-results>div,.sky-stage:fullscreen #moon-station-results>div,.sky-stage.is-expanded #sun-station-results>div,.sky-stage.is-expanded #moon-station-results>div{display:flex}
}

.sky-method-control{display:flex;align-items:center;gap:5px}
.sky-method-control select{flex:1;min-width:0}
.sky-method-control #moon-station-more{flex:none;display:inline-flex;align-items:center;justify-content:center;width:27px;height:40px;margin:0;pointer-events:auto;color:#a9d2ff;font-size:20px;text-decoration:none;border-radius:5px}
.sky-method-control #moon-station-more:hover{background:#244467}

.period-tools{display:flex;flex-wrap:wrap;gap:10px;align-items:end}.period-tools label{flex:1 1 180px;min-width:0}.period-tools select{width:100%;max-width:100%}.period-tools button{font-size:13px}.period-tools #period-samples{min-width:0}#period-status{font-size:12px}

.sky-period-mode{flex:0 1 150px;min-width:110px}
.sky-period-settings{position:relative;flex:none;color:#edf3ff}
.sky-period-settings summary{list-style:none;cursor:pointer;border:1px solid #6b91b9;border-radius:8px;background:#10243e;padding:8px 12px;min-height:40px;box-sizing:border-box;font-size:18px}
.sky-period-settings summary::-webkit-details-marker{display:none}
.period-popup{position:absolute;inset-inline-end:0;inset-block-start:48px;width:min(330px,calc(100vw - 38px));max-height:min(65dvh,520px);overflow:auto;box-sizing:border-box;background:#10243e;border:1px solid #6b91b9;border-radius:10px;padding:14px;box-shadow:0 10px 30px #0008;z-index:8}
.period-popup label{display:flex;flex-direction:column;gap:4px;margin-block:8px;font-size:12px;color:#edf3ff}
.period-popup input,.period-popup select{background:#071323;color:#edf3ff;width:100%;box-sizing:border-box}
.period-popup p{font-size:11px;line-height:1.5;color:#c4d4e8}
.sky-overlay{z-index:4}
.sky-overlay #period-select,.sky-overlay #period-open,.sky-overlay #period-parent{flex:none;width:38px;justify-content:center;padding:6px;font-size:20px}
.sky-period-title{flex:1 0 100%;font-size:12px;color:#c4d4e8;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sky-period-title:empty{display:none}
.sky-period-side{position:absolute;z-index:3;top:47%;width:40px;height:56px;padding:0;display:flex;align-items:center;justify-content:center;background:#10243ecf;color:#edf3ff;border:1px solid #6b91b9;font-size:34px;line-height:1}
.sky-period-side.previous{inset-inline-start:6px}.sky-period-side.next{inset-inline-end:6px}
[dir=rtl] .sky-period-side{transform:scaleX(-1)}
.sky-stage{padding-block-start:220px}
#sky-gesture-cue{position:absolute;z-index:3;top:46%;left:50%;transform:translate(-50%,-50%);padding:9px 14px;border-radius:20px;background:#183852e8;color:#edf3ff;font-size:12px;pointer-events:none;opacity:0;transition:opacity .15s;white-space:nowrap}
#sky-gesture-cue.is-active{opacity:1}
@media(max-width:650px){
 .sky-stage{padding-block-start:310px}
 .sky-overlay{gap:6px}
 .sky-period-mode{flex:1 1 120px}
 .period-popup{position:fixed;inset-inline:18px;top:18dvh;width:auto;max-height:70dvh}
 .sky-stage:fullscreen,.sky-stage.is-expanded{padding-block-start:310px}
 .sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,calc((100dvh - 620px)*850/520))}
}
@media(orientation:landscape) and (max-height:650px){
 .sky-stage:fullscreen,.sky-stage.is-expanded{padding-block-start:155px}
 .sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,calc((100dvh - 310px)*850/520))}
}
@media(prefers-reduced-motion:reduce){#sky-gesture-cue{transition:none}}

/* Measure controls and HUD rather than reserving a fixed number of toolbar rows. */
.sky-stage{padding-block-start:var(--sky-toolbar-space,220px);padding-block-end:var(--sky-hud-space,210px)}
.sky-stage:fullscreen,.sky-stage.is-expanded{padding-block-start:var(--sky-toolbar-space,220px);padding-block-end:var(--sky-hud-space,210px)}
.sky-stage:fullscreen canvas,.sky-stage.is-expanded canvas{width:min(100%,max(100px,calc((100dvh - var(--sky-toolbar-space,220px) - var(--sky-hud-space,210px) - 20px)*850/520)));min-width:100px}

.sky-period-bar{display:flex;flex:1 1 300px;align-items:center;gap:6px;min-width:290px;max-width:400px}
.sky-period-bar .sky-period-mode{flex:1 1 110px;min-width:110px}
.sky-stage .sky-period-side{font-size:34px;font-weight:400}
@media(max-width:650px){.sky-period-bar{flex-basis:100%;max-width:none;min-width:0}}


/* Blank toolbar space must never intercept the fullscreen button or sky gestures. */
.sky-overlay{pointer-events:none}
.sky-overlay>*{pointer-events:auto}
.sky-brand-actions{z-index:5}
.sky-overlay #sky-now,.sky-overlay #sky-location{flex:0 0 40px;width:40px;min-width:40px;max-width:40px;justify-content:center;padding:8px}
.period-form-actions{display:flex;gap:8px;flex-wrap:wrap}
.period-form-actions button{flex:1}
#period-error{flex:1 0 100%;margin:0;color:#ffcfaa;background:#442a20;padding:8px;border-radius:6px;overflow-wrap:anywhere}
#period-error[hidden]{display:none}


/* Arrows follow the grab gesture: left advances time, right goes back. */
.sky-period-side.next{inset-inline:unset;left:6px;right:auto;transform:none}
.sky-period-side.previous{inset-inline:unset;right:6px;left:auto;transform:none}
[dir=rtl] .sky-period-side{transform:none}
.period-popup .sky-method-control{display:flex;flex-direction:column;align-items:stretch;max-width:none;gap:6px}
.period-popup .sky-method-control label{font-size:12px}
.period-popup .check{display:flex;align-items:center;gap:8px}
.period-popup #planet-style[hidden]{display:none}

#planet-images{appearance:none;position:relative;flex:none;width:32px;height:18px;min-width:32px;min-height:18px;padding:0;border:1px solid #7a91aa;border-radius:12px;background:#283d53;cursor:pointer}
#planet-images:before{content:'';position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#dce8f8}
#planet-images:checked{background:#28776d;border-color:#75e4d0}
#planet-images:checked:before{transform:translateX(14px);background:#e4fff8}
#planet-images:focus-visible{outline:3px solid #83bdff;outline-offset:2px}

/* Neutral chevrons must not be mirrored by the Arabic bidi algorithm. */
.sky-stage .sky-period-side{direction:ltr;unicode-bidi:isolate}

.period-popup .check{flex-direction:row;justify-content:flex-start}
.period-popup .sky-method-control{display:grid;grid-template-columns:minmax(0,1fr) 27px}
.period-popup .sky-method-control label{grid-column:1 / -1;margin-bottom:0}
.period-popup .sky-method-control select{grid-column:1}
.period-popup .sky-method-control #moon-station-more{grid-column:2}


/* One action row; calculation and period controls form a second coherent row. */
.sky-brand-actions{inset-inline:12px;justify-content:flex-end;gap:7px;pointer-events:none}
.sky-brand-actions>*{pointer-events:auto}
.sky-brand-actions button{width:40px;min-width:40px;height:40px;padding:8px;background:#10243eed;color:#edf3ff;border:1px solid #6b91b9;display:inline-flex;align-items:center;justify-content:center}
.sky-brand-actions svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sky-brand-actions #sky-location.is-live{color:#81f4c0;border-color:#57d59b}
.sky-overlay{padding-block-start:50px;padding-inline-end:0}
.sky-period-bar{flex:1 1 290px;min-width:0;max-width:450px;gap:8px}
.sky-period-navigation{display:flex;align-items:stretch;border:1px solid #6b91b9;border-radius:9px;overflow:hidden;flex:1;min-width:0;background:#10243eed}
.sky-period-navigation .sky-period-mode{flex:1;min-width:92px}
.sky-period-navigation select,.sky-period-navigation button{border:0!important;border-radius:0!important;box-shadow:none!important;height:40px;min-height:40px}
.sky-period-navigation #period-open,.sky-period-navigation #period-parent{width:36px;flex:none;padding:4px}
.sky-period-navigation .sky-period-mode{border-inline:1px solid #6b91b9}
.sky-overlay .sky-method-control{flex:1 1 200px;max-width:340px;min-width:0}
#sky-layer-switches>.check{display:inline-flex;flex-direction:row;align-items:center;gap:6px}
#sky-layer-switches #planet-images{margin:0}
.lab-calendar-choice{display:flex;align-items:center;gap:6px;min-width:0}
.lab-calendar-choice select{flex:1;min-width:0}
.calendar-info{flex:none;width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;border:1px solid currentColor;border-radius:50%;text-decoration:none;font-weight:700;color:#9bcaff}
.calendar-info:focus-visible{outline:3px solid #83bdff;outline-offset:2px}
.period-popup .lab-calendar-choice{display:flex;flex-direction:row}
@media(max-width:650px){.sky-overlay{padding-block-start:50px}.sky-period-bar{flex-basis:100%;max-width:none}}

.sky-brand-actions #sky-now,.sky-brand-actions #sky-location{padding:8px;box-sizing:border-box}
.sky-brand-actions svg{flex:none;min-width:20px}

.sky-stage .calendar-info{color:#a9d2ff}
