:root {
  --ink: #162024;
  --muted: #5e6d75;
  --line: #d8e0e5;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --accent: #0f6651;
  --accent-dark: #094b3b;
  --accent-soft: #e7f2ee;
  --sun: #efad2f;
  --moon: #8496aa;
  --night: #9aa8b4;
  --shadow: 0 12px 30px rgba(22, 32, 36, 0.08);
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
input { font: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(15, 102, 81, 0.25);
  outline-offset: 3px;
}

h1, h2, p { margin-top: 0; }
.is-hidden { display: none !important; }

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 20px clamp(18px, 4vw, 52px);
  background: #fff;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 { margin-bottom: 6px; font-size: clamp(30px, 4vw, 44px); line-height: 1; }
.dek { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.back-link { flex: 0 0 auto; color: var(--accent); font-size: 14px; font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.header-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 12px; }
.language-switch { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.language-switch button { border: 0; padding: 7px 12px; background: #fff; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.language-switch button + button { border-left: 1px solid var(--line); }
.language-switch button.active { background: var(--accent); color: #fff; }

input[type="range"] { direction: ltr; }
[dir="rtl"] .controls-panel { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .readout div + div { border-right: 1px solid var(--line); border-left: 0; }
[dir="rtl"] .readout.is-compact > #resultCell { border-right: 1px solid var(--line); border-left: 0; }
[dir="rtl"] .language-switch button + button { border-right: 1px solid var(--line); border-left: 0; }

.page-shell { width: min(1480px, 100%); margin: 0 auto; padding: 16px clamp(18px, 4vw, 52px) 40px; }

.source-card,
.explorer,
.source-workbench,
.method-note {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.source-top-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.source-top-row .source-workbench--top { min-width: 0; flex: 1; margin-bottom: 0; }
.source-workbench--top:not(.is-walkthrough) { border-color: rgba(15, 102, 81, 0.55); }
.source-walkthrough-controls {
  display: flex;
  order: -1;
  width: 100%;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-self: stretch;
  align-items: center;
  gap: 6px;
}
.walkthrough-invitation {
  order: 1;
  min-width: 180px;
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.source-walkthrough-button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 8px 14px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.source-walkthrough-button:hover,
.source-walkthrough-button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.source-step-button {
  min-width: 34px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.source-step-button:hover { border-color: var(--accent); background: var(--accent-soft); }

.source-card {
  display: grid;
  grid-template-columns: minmax(270px, 0.8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: 32px;
  padding: 22px 26px;
}

.source-card h2 { margin-bottom: 0; font-size: 25px; }
.source-card > p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }

.explorer {
  margin-top: 12px;
  overflow: hidden;
}

.lesson-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
  background: #fff;
}

.explorer-body { display: grid; grid-template-columns: minmax(285px, 340px) minmax(0, 1fr); }

.controls-panel { border-right: 1px solid var(--line); padding: 18px 20px; background: #fbfcfa; }
.mobile-diagram-preview { display: none; }
.controls-heading h2,
.diagram-heading h2 {
  margin-bottom: 0;
  font-size: clamp(17px, 1.5vw, 22px);
  white-space: nowrap;
}
.control-intro { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend,
.control-label-row label,
.control-label-row .control-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.model-switch,
.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 25px;
}

.model-switch legend,
.view-switch legend { grid-column: 1 / -1; }

.segmented,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.segmented { min-height: 52px; padding: 8px 9px; font-size: 13px; font-weight: 700; }
.segmented:hover,
.segmented.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

.scene-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.scene-button span { font-size: 13px; font-weight: 700; }
.scene-button:hover,
.scene-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

.display-settings {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}
.display-settings .view-switch { margin-top: 0; }
.display-settings .view-switch legend {
  color: var(--accent-dark);
  font-size: 13px;
}
.display-settings .view-switch .segmented {
  display: flex;
  min-height: 62px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 14px;
}
.view-switch .segmented small { color: var(--muted); font-size: 10px; font-weight: 500; }
.view-switch .segmented.active small { color: var(--accent-dark); }
.display-settings .model-switch {
  margin-top: 15px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}
.display-settings .model-switch legend { margin-bottom: 6px; }
.display-settings .model-switch .segmented {
  min-height: 38px;
  padding: 6px 8px;
  font-size: 12px;
}

.control-group,
.modern-controls { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 22px; }
.control-label-row { display: flex; flex-direction: column; gap: 2px; }
.control-label-row label,
.control-label-row .control-label { margin-bottom: 0; }
.control-label-row strong { min-height: 39px; font-size: 14px; line-height: 1.4; }

.season-ticks {
  position: relative;
  height: 28px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.season-ticks button {
  position: absolute;
  top: 0;
  border: 0;
  padding: 7px 1px 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  text-align: center;
  transform: translateX(-50%);
}
.season-ticks button::before {
  position: absolute;
  top: -3px;
  left: 50%;
  display: block;
  width: 1px;
  height: 5px;
  background: #9aa8ae;
  content: "";
}
.season-ticks button:nth-child(1) { left: 0; text-align: left; transform: none; }
.season-ticks button:nth-child(1)::before { left: 1px; }
.season-ticks button:nth-child(2) { left: 25%; }
.season-ticks button:nth-child(3) { left: 50%; }
.season-ticks button:nth-child(4) { left: 75%; }
.season-ticks button:nth-child(5) { right: 0; text-align: right; transform: none; }
.season-ticks button:nth-child(5)::before { right: 1px; left: auto; }
.season-ticks button:hover,
.season-ticks button.active { color: var(--accent-dark); font-weight: 800; }
.season-ticks button.active::before { width: 2px; background: var(--accent); }

input[type="range"] { width: 100%; margin: 10px 0 0; accent-color: var(--accent); }
input:disabled,
button:disabled { cursor: not-allowed; opacity: 0.45; }

.restricted-time-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  margin-top: 10px;
}
.restricted-time-range > span {
  height: 4px;
  border-radius: 999px 0 0 999px;
  background: #cbd2d6;
}
.restricted-time-range input[type="range"] { margin: 0; }
[dir="rtl"] .restricted-time-range { direction: ltr; }
.restricted-time-range + .range-labels span:first-child { opacity: 0.42; }

.range-labels { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 4px; color: var(--muted); font-size: 11px; }
.range-labels span { text-align: center; }
.range-labels span:first-child { text-align: left; }
.range-labels span:last-child { text-align: right; }
.range-labels--three { grid-template-columns: repeat(3, 1fr); }
.month-track-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.month-track-labels span { text-align: center; }
.month-track-labels span:first-child { text-align: left; }
.month-track-labels span:last-child { text-align: right; }

.date-select-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: start;
  gap: 6px;
  margin-top: 8px;
}
.date-picker {
  position: relative;
  min-width: 0;
}
.date-step {
  width: 36px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 22px;
}
.date-step:hover { border-color: var(--accent); background: var(--accent-soft); }
.date-picker > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.date-picker > summary::-webkit-details-marker { display: none; }
.date-picker > summary strong { color: var(--accent-dark); font-size: 14px; }
.date-picker > summary span { color: var(--muted); transition: transform 150ms ease; }
.date-picker[open] > summary { border-color: var(--accent); }
.date-picker[open] > summary span { transform: rotate(180deg); }
.date-picker-menu {
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(22, 32, 36, 0.16);
}
.date-picker-menu label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.date-picker-menu select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.calendar-days button {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
}
.calendar-days button:hover { border-color: var(--accent); color: var(--accent-dark); }
.calendar-days button.active { background: var(--accent); color: #fff; font-weight: 800; }
.fine-time { margin-top: 12px; }
.fine-time > summary { color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.fine-time[open] > summary { margin-bottom: 4px; }

.control-help { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.secondary-button { width: 100%; margin-top: 14px; padding: 9px 12px; color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.secondary-button:hover { border-color: var(--accent); }
.secondary-button.playing { background: var(--accent); color: #fff; }
.playback-controls,
.season-playback {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.playback-controls .secondary-button,
.season-playback .secondary-button {
  min-height: 42px;
  margin-top: 0;
  border-color: rgba(15, 102, 81, 0.46);
  padding: 9px 13px;
  background: var(--accent-soft);
  font-size: 13px;
  white-space: nowrap;
}
.playback-pause-row {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
}
.playback-pause-row .pause-button { flex: 0 0 42%; }
.playback-progress { color: var(--muted); font-size: 10px; font-weight: 700; }
.speed-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.speed-control select {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.jump-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.jump-controls button {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 5px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}
.jump-controls button:hover { border-color: var(--accent); background: var(--accent-soft); }

.modern-controls > summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.modern-controls[open] > summary { margin-bottom: 14px; }
.modern-controls label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.modern-controls output { color: var(--accent); font-variant-numeric: tabular-nums; }
.modern-controls input[type="range"] { margin-top: 5px; }

.diagram-panel { min-width: 0; padding: 18px 20px; }
.diagram-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
  align-items: start;
  gap: 18px;
}
.diagram-heading > div:first-child { min-width: 0; }
.explorer.is-rashi-walkthrough .diagram-wrap { min-height: 320px; }
.explorer.is-rashi-walkthrough #skyDiagram { height: 320px; }
.diagram-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  border: 1px solid rgba(15, 102, 81, 0.2);
  border-radius: 9px;
  padding: 8px 24px 7px;
  background: #f8fbfa;
}
.diagram-tools .season-control-wide { order: 1; }
.diagram-tools .diagram-playback { order: 2; }
.diagram-playback {
  display: flex;
  align-self: center;
  align-items: center;
  gap: 8px;
}
.diagram-playback .playback-controls {
  min-width: 0;
  grid-template-columns: auto auto auto auto;
  align-items: center;
  gap: 7px;
}
.diagram-playback .season-playback {
  display: flex;
  min-width: 112px;
}
.diagram-playback .season-playback .secondary-button { flex: 1; }
.diagram-playback .secondary-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}
.diagram-playback .secondary-button:not(.pause-button) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.diagram-playback .secondary-button:not(.pause-button):hover { background: var(--accent-dark); }
.diagram-playback #playYear,
.diagram-playback #playDay {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
}
.diagram-playback #playYear:hover,
.diagram-playback #playDay:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.diagram-playback .continuous-button:not(.pause-button) {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-dark);
}
.diagram-playback .continuous-button:not(.pause-button):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.diagram-playback .playback-pause-row {
  grid-column: auto;
  gap: 6px;
}
.diagram-playback .playback-pause-row .pause-button {
  width: auto;
  min-width: 64px;
  flex: none;
}
.diagram-playback .speed-control {
  grid-column: auto;
  justify-content: center;
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
  font-size: 11px;
}
.diagram-playback .speed-control select { min-width: 64px; padding: 5px 7px; font-size: 11px; font-weight: 800; }
.season-control-wide {
  width: min(820px, 100%);
}
.season-control-wide input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  margin: 10px 0;
  border-radius: 999px;
  background: #d4dcdf;
  cursor: pointer;
}
.season-control-wide input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 5px rgba(22, 32, 36, 0.32);
}
.season-control-wide input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 5px rgba(22, 32, 36, 0.32);
}
.season-control-wide .control-help {
  margin-top: 4px;
  text-align: center;
}
.diagram-status {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  margin-top: 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 7px 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}
[dir="rtl"] .diagram-status {
  border-right: 3px solid var(--accent);
  border-left: 0;
  border-radius: 6px 0 0 6px;
}
.diagram-status span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.diagram-status strong { font-size: 14px; }
.diagram-status small {
  border-left: 1px solid rgba(15, 102, 81, 0.22);
  padding-left: 9px;
  color: var(--muted);
  font-size: 12px;
}
[dir="rtl"] .diagram-status small {
  border-right: 1px solid rgba(15, 102, 81, 0.22);
  border-left: 0;
  padding-right: 9px;
  padding-left: 0;
}
.diagram-status.is-timestamp strong {
  order: 1;
  font-size: 15px;
}
.diagram-status.is-timestamp span {
  order: 2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.diagram-status.is-timestamp small {
  order: 3;
  font-size: 10px;
}
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; justify-self: end; gap: 9px 16px; color: var(--muted); font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 4px; border-radius: 9px; }
.sun-key { background: var(--sun); }
.moon-key { background: var(--moon); }
.day-key { background: var(--accent); }
.night-key { border-top: 2px dashed var(--night); }

.diagram-wrap {
  position: relative;
  min-height: 390px;
  margin-top: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sky-top, #f9fbfa), var(--sky-bottom, #f0f5f2));
  transition: background 180ms linear;
}

.scale-badge {
  display: block;
  width: fit-content;
  margin: 0;
  border: 1px solid rgba(15, 102, 81, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.025em;
  box-shadow: 0 5px 14px rgba(22, 32, 36, 0.12);
}

#skyDiagram { display: block; width: 100%; height: 390px; }
.sky-disk { fill: var(--sky-disc, #fff); stroke: #cbd6d9; stroke-width: 2; transition: fill 180ms linear; }
.axis { stroke: #dbe3e5; stroke-width: 1; }
.observer { fill: var(--ink); }
.observer-label,
.altitude-label,
.orientation-note { fill: var(--muted); font-size: 11px; }
.direction { fill: var(--muted); font-size: 13px; font-weight: 700; }
.direction.primary { fill: var(--ink); }
.day-path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.night-path { fill: none; stroke: var(--night); stroke-width: 2; stroke-dasharray: 7 7; }
.sun { fill: url(#sunGlow); stroke: #d98b15; stroke-width: 1.5; filter: url(#glow); }
.sun.is-below-horizon { opacity: 0.32; filter: none; }
.moon-marker { color: var(--moon); transition: opacity 160ms ease; }
.moon-marker.is-molad { opacity: 0.38; }
.moon-marker.is-below-horizon { opacity: 0.3; }
.moon-halo { fill: rgba(132, 150, 170, 0.1); stroke: var(--moon); stroke-width: 1; }
.moon-crescent { fill: var(--moon); }
.moon-disc { fill: var(--moon); stroke: #66788c; stroke-width: 1; }
.month-phase-glyph { fill: #66788c; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
#riseMarker circle,
#setMarker circle { fill: var(--accent); }
#riseMarker text,
#setMarker text { fill: var(--accent-dark); font-size: 12px; font-weight: 700; }
.west-sky { fill: var(--sky-disc, url(#westGradient)); stroke: #ccd8d9; transition: fill 180ms linear; }
.below-horizon { fill: rgba(121, 104, 77, 0.08); }
.horizon { stroke: #61776e; stroke-width: 2; }
.separation-line { stroke: var(--moon); stroke-width: 1.5; stroke-dasharray: 4 4; }
.relation-label { fill: var(--muted); font-size: 12px; font-weight: 700; }
.visibility-label { fill: #596b7d; font-size: 11px; font-weight: 700; }
.diagram-wrap.is-night .direction,
.diagram-wrap.is-night .direction.primary,
.diagram-wrap.is-night .observer-label,
.diagram-wrap.is-night .altitude-label,
.diagram-wrap.is-night .orientation-note,
.diagram-wrap.is-night .relation-label,
.diagram-wrap.is-night .visibility-label { fill: #dce7f2; }
.diagram-wrap.is-night .axis { stroke: #62728a; }
.diagram-wrap.is-night .observer { fill: #eef5fb; }
.diagram-wrap.is-night .day-path { stroke: #66bda6; }
.diagram-wrap.is-night .night-path { stroke: #bdc9d8; }
.diagram-wrap.is-night #riseMarker text,
.diagram-wrap.is-night #setMarker text,
.diagram-wrap.is-night .month-phase-glyph { fill: #e7eef7; }
.diagram-wrap.is-night #riseMarker circle,
.diagram-wrap.is-night #setMarker circle { fill: #66bda6; }
.diagram-wrap.is-night .horizon { stroke: #b8c7d8; }
.diagram-wrap.is-sunset-moment {
  box-shadow: inset 0 0 0 2px rgba(239, 173, 47, 0.62), 0 0 18px rgba(239, 173, 47, 0.22);
}
.diagram-wrap.is-sunset-moment .horizon,
.diagram-wrap.is-sunset-moment .sky-disk { stroke: var(--sun); }
.diagram-status.is-sunset-moment strong { animation: sunset-date-pulse 650ms ease-in-out infinite alternate; }

@keyframes sunset-date-pulse {
  from { opacity: 0.68; }
  to { opacity: 1; }
}

.day-timeline { margin-top: 13px; padding: 0 3px; }
.day-timeline-track {
  position: relative;
  display: flex;
  direction: ltr;
  height: 10px;
  overflow: visible;
  border: 1px solid #b9c7ce;
  border-radius: 999px;
  background: #eef3f5;
}
.timeline-night {
  width: var(--sunrise-position, 50%);
  border-radius: 999px 0 0 999px;
  background: #8294ab;
}
.timeline-day {
  flex: 1;
  border-radius: 0 999px 999px 0;
  background: #f2c665;
}
.timeline-sunset-start,
.timeline-sunset-end {
  position: absolute;
  top: -3px;
  width: 2.1%;
  height: 14px;
  background: rgba(239, 145, 29, 0.72);
}
.timeline-sunset-start { left: 0; border-radius: 999px 0 0 999px; }
.timeline-sunset-end { right: 0; border-radius: 0 999px 999px 0; }
.day-timeline-track i {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: var(--timeline-position, 0%);
  width: 15px;
  height: 15px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 5px rgba(22, 32, 36, 0.35);
  transform: translate(-50%, -50%);
}
.day-timeline-labels {
  position: relative;
  direction: ltr;
  height: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}
.day-timeline-labels span { position: absolute; transform: translateX(-50%); }
.day-timeline-labels span:first-child { left: 0; transform: none; }
.day-timeline-labels span:nth-child(2) { left: var(--sunrise-position, 50%); }
.day-timeline-labels span:last-child { right: 0; transform: none; }

.readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.readout div { min-width: 0; padding: 9px 13px; }
.readout div + div { border-left: 1px solid var(--line); }
.readout span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.readout strong { font-size: 14px; line-height: 1.35; }
.readout.is-compact { grid-template-columns: repeat(2, 1fr); }
.readout.is-compact > div { border-top: 0; border-left: 0; }
.readout.is-compact > #resultCell { border-left: 1px solid var(--line); }
.readout.is-month { grid-template-columns: 1fr; }
.readout.is-month > .month-summary-cell {
  border: 0;
  padding: 11px 15px;
}

.source-workbench {
  margin-top: 20px;
  overflow: hidden;
}
.source-workbench--top { margin-top: 0; margin-bottom: 12px; }
.source-workbench > summary {
  padding: 12px 18px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}
.source-workbench--top:not(.is-walkthrough) > summary { background: var(--accent-soft); color: var(--accent-dark); }
.source-workbench[open] > summary { border-bottom: 1px solid var(--line); background: #fbfcfa; }
.source-workbench-body {
  padding: 15px 21px 19px;
}
.source-workbench.is-walkthrough .source-workbench-body {
  min-height: 0;
  max-height: calc(var(--source-pane-height, 350px) - var(--source-summary-height, 36px));
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 20px;
  scrollbar-width: thin;
}
.source-workbench.is-walkthrough .gemara-source,
.source-workbench.is-walkthrough .rashi-source-label,
.source-workbench.is-walkthrough .source-instruction { display: none; }
.source-workbench.is-walkthrough .source-steps { font-size: 16px; line-height: 1.75; }
.source-workbench.is-walkthrough .source-steps.source-language-he { font-size: 18px; line-height: 1.9; }
.source-workbench.is-walkthrough .source-steps [data-source-step].active {
  background: #cce9df;
  box-shadow: 0 0 0 2px #cce9df;
}
.gemara-source {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  text-align: right;
}
.gemara-source strong,
.rashi-source-label {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 800;
}
.source-language-he { display: none; }
html[lang="he"] .source-language-en { display: none; }
html[lang="he"] .source-language-he { display: block; }
.gemara-source p { margin: 0; font-size: 17px; line-height: 1.75; }
.gemara-source .source-language-en { direction: ltr; text-align: left; }
.rashi-source-label { margin-bottom: 4px; }
.source-instruction { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.source-steps {
  direction: rtl;
  margin: 0;
  padding: 0;
  color: #39474d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.9;
  text-align: right;
}
.source-steps--english {
  direction: ltr;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  text-align: left;
}
.source-steps [data-source-step] {
  display: inline;
  border-radius: 4px;
  padding: 2px 1px;
  color: inherit;
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.source-dh { color: var(--ink); font-weight: 800; }
.source-steps [data-source-step]:hover { background: #f0f4f1; color: var(--accent-dark); }
.source-steps [data-source-step].active { background: #d9eee6; color: var(--accent-dark); font-weight: 700; }

/* During the walkthrough, the text and diagram become the entire workspace. */
body.is-rashi-walkthrough { overflow: hidden; }
body.is-rashi-walkthrough .site-header {
  min-height: 54px;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 8px;
}
body.is-rashi-walkthrough .site-header .eyebrow,
body.is-rashi-walkthrough .site-header .dek,
body.is-rashi-walkthrough .site-header .back-link { display: none; }
body.is-rashi-walkthrough .site-header h1 { margin: 0; font-size: 21px; line-height: 1.15; }
body.is-rashi-walkthrough .header-actions { gap: 0; }
body.is-rashi-walkthrough .page-shell {
  display: grid;
  width: min(1560px, 100%);
  height: calc(100vh - 54px);
  grid-template-columns: minmax(390px, 0.82fr) minmax(0, 1.18fr);
  gap: 12px;
  overflow: hidden;
  padding-top: 10px;
  padding-bottom: 10px;
}
body.is-rashi-walkthrough .source-top-row {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  gap: 7px;
}
body.is-rashi-walkthrough .source-walkthrough-controls {
  order: -1;
  width: 100%;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
body.is-rashi-walkthrough .walkthrough-invitation { display: none; }
body.is-rashi-walkthrough .source-walkthrough-button { flex: 1; }
body.is-rashi-walkthrough .source-workbench--top {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}
body.is-rashi-walkthrough .source-workbench--top > summary { flex: 0 0 auto; padding: 9px 14px; }
body.is-rashi-walkthrough .explorer {
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin-top: 0;
}
body.is-rashi-walkthrough .lesson-tabs,
body.is-rashi-walkthrough .controls-panel,
body.is-rashi-walkthrough .diagram-tools,
body.is-rashi-walkthrough .method-note { display: none; }
body.is-rashi-walkthrough .explorer-body { display: block; height: 100%; }
body.is-rashi-walkthrough .diagram-panel {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 13px 15px;
}
body.is-rashi-walkthrough .diagram-heading { grid-template-columns: minmax(0, 1fr); gap: 0; }
body.is-rashi-walkthrough .diagram-heading h2 { font-size: 18px; }
body.is-rashi-walkthrough .legend { display: none; }
body.is-rashi-walkthrough .diagram-wrap,
body.is-rashi-walkthrough .explorer.is-rashi-walkthrough .diagram-wrap {
  min-height: 0;
  height: 100%;
  margin-top: 0;
}
body.is-rashi-walkthrough #skyDiagram,
body.is-rashi-walkthrough .explorer.is-rashi-walkthrough #skyDiagram { height: 100%; }
body.is-rashi-walkthrough .readout { min-height: 0; }

/* The desktop entry screen uses the same study workspace as the walkthrough. */
@media (min-width: 1050px) {
  body { overflow: hidden; }
  .site-header {
    min-height: 54px;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .site-header .eyebrow,
  .site-header .dek,
  .site-header .back-link { display: none; }
  .site-header h1 { margin: 0; font-size: 21px; line-height: 1.15; }
  .header-actions { gap: 0; }

  .page-shell {
    display: grid;
    width: min(1560px, 100%);
    height: calc(100vh - 54px);
    grid-template-columns: minmax(390px, 0.82fr) minmax(0, 1.18fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px 12px;
    overflow: hidden;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .source-top-row {
    min-width: 0;
    min-height: 0;
    height: 100%;
  }
  .source-workbench--top {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
  }
  .source-workbench--top:not([open]) { flex: 0 0 auto; }
  .source-workbench--top > summary { flex: 0 0 auto; padding: 10px 14px; }
  .source-workbench--top .source-workbench-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    max-height: calc(var(--source-pane-height, 500px) - var(--source-summary-height, 40px));
    scrollbar-width: thin;
  }
  .source-walkthrough-controls { min-height: 0; }

  .explorer {
    display: flex;
    min-width: 0;
    min-height: 0;
    height: 100%;
    flex-direction: column;
    margin-top: 0;
  }
  .lesson-tabs {
    flex: 0 0 auto;
    gap: 6px;
    padding: 7px 10px;
  }
  .scene-button {
    justify-content: center;
    min-height: 34px;
    padding: 6px 9px;
    text-align: center;
  }
  .scene-button span { font-size: 12px; }
  .explorer-body {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
  }
  .controls-panel {
    display: flex;
    position: relative;
    z-index: 5;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    background: #fbfcfa;
  }
  [dir="rtl"] .controls-panel { border-left: 0; }
  .controls-heading { display: none; }
  .display-settings {
    display: grid;
    min-width: 470px;
    flex: 1 1 520px;
    grid-template-columns: minmax(230px, 1.2fr) minmax(190px, 0.8fr);
    gap: 12px;
    margin-top: 0;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .display-settings .view-switch,
  .display-settings .model-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0;
    border: 0;
    padding: 0;
  }
  .display-settings .model-switch { padding-top: 0; }
  .display-settings .model-switch legend { margin-bottom: 3px; }
  .display-settings .view-switch .segmented,
  .display-settings .model-switch .segmented {
    min-height: 35px;
    padding: 5px 7px;
    font-size: 11px;
  }
  .display-settings .view-switch .segmented { gap: 1px; }
  .view-switch .segmented small { font-size: 9px; }
  .control-group {
    min-width: 250px;
    max-width: 320px;
    flex: 0 1 320px;
    margin-top: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 0 0 0 14px;
  }
  [dir="rtl"] .control-group {
    border-right: 1px solid var(--line);
    border-left: 0;
    padding-right: 14px;
    padding-left: 0;
  }
  .control-label-row strong { min-height: 0; font-size: 12px; }
  .control-help { margin-top: 4px; font-size: 9px; }
  .restricted-time-range { margin-top: 4px; }
  .range-labels { font-size: 9px; }
  .date-select-row { margin-top: 3px; }
  .date-picker-menu {
    position: absolute;
    z-index: 50;
    width: 285px;
  }
  [dir="rtl"] .date-picker-menu { right: 0; }
  .jump-controls,
  .fine-time { display: none; }
  .modern-controls {
    position: absolute;
    z-index: 45;
    top: calc(100% + 6px);
    right: 12px;
    width: 300px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  [dir="rtl"] .modern-controls { right: auto; left: 12px; }

  .diagram-panel {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 10px 13px;
  }
  .diagram-heading { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .diagram-heading h2 { font-size: 17px; }
  .diagram-status { margin-top: 5px; padding: 5px 8px; }
  .diagram-status strong { font-size: 12px; }
  .diagram-status small { font-size: 10px; }
  .legend { gap: 6px 10px; font-size: 10px; }
  .diagram-tools {
    gap: 3px;
    margin-top: 0;
    padding: 5px 13px;
  }
  .season-control-wide input[type="range"] { margin: 5px 0; }
  .season-ticks { height: 24px; }
  .season-ticks button { padding-top: 5px; font-size: 9px; }
  .diagram-tools .control-help { display: none; }
  .diagram-playback .secondary-button { min-height: 26px; padding: 4px 8px; font-size: 10px; }
  .diagram-wrap {
    min-height: 0;
    height: 100%;
    margin-top: 0;
  }
  #skyDiagram { height: 100%; }
  .readout strong { font-size: 12px; }
  .readout span { font-size: 9px; }
  .readout > div { padding-top: 7px; padding-bottom: 7px; }

  .method-note {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  body .page-shell > .method-note { margin-top: 0; }
  .method-note > summary { padding: 6px 10px; }
}

.method-note {
  margin-top: 12px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.method-note > summary {
  padding: 8px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.method-note[open] > summary { border-bottom: 1px solid var(--line); }
.method-note > div { padding: 9px 12px 11px; }
.method-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

@media (max-width: 1040px) {
  .diagram-heading { grid-template-columns: 1fr 1fr; }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .readout div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .readout div:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 940px) {
  body.is-rashi-walkthrough .site-header { flex-direction: row; justify-content: space-between; }
  body.is-rashi-walkthrough .page-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 44fr) minmax(0, 56fr);
  }
  body.is-rashi-walkthrough .source-workbench.is-walkthrough .source-steps { font-size: 15px; line-height: 1.65; }
  body.is-rashi-walkthrough .source-workbench.is-walkthrough .source-steps.source-language-he { font-size: 17px; line-height: 1.75; }
  body.is-rashi-walkthrough .diagram-panel { padding: 9px 12px; }
  body.is-rashi-walkthrough .diagram-heading h2 { font-size: 15px; }
  body.is-rashi-walkthrough .readout { display: none; }
  .explorer-body { grid-template-columns: 1fr; }
  .controls-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  [dir="rtl"] .controls-panel { border-left: 0; }
  .mobile-diagram-preview {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    grid-template-columns: 76px 1fr;
    align-items: center;
    gap: 11px;
    margin: -13px -13px 18px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 7px 18px rgba(22, 32, 36, 0.1);
    backdrop-filter: blur(8px);
  }
  .mobile-preview-sky {
    position: relative;
    height: 45px;
    overflow: hidden;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--preview-top, #e7f1f3), var(--preview-bottom, #f4d4a4));
  }
  .mobile-preview-sky > span { position: absolute; right: 0; bottom: 8px; left: 0; height: 1px; background: #61776e; }
  .mobile-preview-sun,
  .mobile-preview-moon {
    position: absolute;
    z-index: 2;
    left: var(--preview-sun-x, 50%);
    bottom: var(--preview-sun-y, 8px);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sun);
    box-shadow: 0 0 7px rgba(239, 173, 47, 0.8);
    transform: translate(-50%, 50%);
  }
  .mobile-preview-moon {
    left: var(--preview-moon-x, 56%);
    bottom: var(--preview-moon-y, 14px);
    width: 8px;
    height: 8px;
    background: var(--moon);
    box-shadow: none;
  }
  .mobile-diagram-preview strong,
  .mobile-diagram-preview small { display: block; }
  .mobile-diagram-preview strong { color: var(--ink); font-size: 12px; }
  .mobile-diagram-preview small { margin-top: 3px; color: var(--muted); font-size: 10px; }
  .diagram-heading { grid-template-columns: 1fr; }
  .legend { justify-content: flex-start; justify-self: start; }
}

@media (max-width: 680px) {
  .site-header { align-items: flex-start; flex-direction: column; padding: 28px 18px; }
  .header-actions { align-items: flex-start; }
  .page-shell { padding: 18px 12px 38px; }
  .source-top-row { flex-direction: column; }
  .source-top-row .source-workbench--top,
  .source-walkthrough-controls { width: 100%; }
  .source-walkthrough-controls { flex-wrap: wrap; }
  .source-walkthrough-button { flex: 1; }
  .source-card,
  .source-workbench-body { grid-template-columns: 1fr; }
  .source-card { gap: 12px; }
  .controls-panel,
  .diagram-panel,
  .source-workbench-body { padding: 19px 16px; }
  .diagram-tools { padding: 7px 14px 6px; }
  .lesson-tabs { grid-template-columns: 1fr; }
  .diagram-heading h2 { font-size: 15px; }
  .diagram-playback { width: 100%; flex-wrap: wrap; justify-content: center; }
  .diagram-playback .playback-controls { width: 100%; grid-template-columns: 1fr 1fr; }
  .diagram-playback .playback-pause-row,
  .diagram-playback .speed-control { grid-column: 1 / -1; }
  .model-switch,
  .view-switch { grid-template-columns: 1fr; }
  .diagram-wrap { min-height: 340px; }
  #skyDiagram { height: 340px; }
  .readout { grid-template-columns: 1fr; }
  .readout div + div,
  .readout div:nth-child(3),
  .readout div:nth-child(4) { border-top: 1px solid var(--line); border-left: 0; }
  .readout.is-compact > #resultCell { border-top: 1px solid var(--line); border-left: 0; }
  [dir="rtl"] .readout div + div,
  [dir="rtl"] .readout div:nth-child(3),
  [dir="rtl"] .readout div:nth-child(4),
  [dir="rtl"] .readout.is-compact > #resultCell { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .diagram-status.is-sunset-moment strong { animation: none; }
}

.model-settings { position: relative; }
.time-play-button {
  margin-top: 4px;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}
.time-adjustment-summary { color: var(--muted); cursor: pointer; font-size: 10px; padding: 5px 0; }
.time-play-button:hover { color: var(--accent-dark); text-decoration: underline; }
.time-play-button.playing { color: var(--accent-dark); }
.model-settings > summary {
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}
.model-settings-body {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
@media (min-width: 1050px) {
  .display-settings {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
  }
  .display-settings .lesson-tabs {
    display: flex;
    gap: 2px;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .display-settings .scene-button {
    min-height: 30px;
    border-color: transparent;
    padding: 5px 8px;
    background: transparent;
    white-space: nowrap;
  }
  .display-settings .scene-button.active { background: var(--accent-soft); }
  .display-settings .scene-button span { font-size: 11px; }
  .display-settings .view-switch {
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .display-settings .view-switch .segmented {
    min-height: 30px;
    border: 0;
    border-radius: 0;
    padding: 5px 9px;
    white-space: nowrap;
  }
  .display-settings .view-switch .segmented small { display: none; }
  .model-settings-body {
    position: absolute;
    z-index: 60;
    inset-inline-end: 0;
    top: 100%;
    width: 290px;
    box-shadow: var(--shadow);
  }
  .display-settings .modern-controls {
    position: static;
    width: auto;
    margin-top: 12px;
    border: 0;
    padding: 0;
    box-shadow: none;
  }
  .diagram-tools {
    flex-direction: row;
    gap: 15px;
    border: 0;
    border-radius: 0;
    padding: 5px 0;
    background: transparent;
  }
  .diagram-tools .season-control-wide { flex: 1; min-width: 0; }
  .diagram-tools .diagram-playback { flex: 0 0 auto; }
  .diagram-playback .season-playback { min-width: 0; }
  .diagram-playback #playYear {
    min-height: 30px;
    border-color: rgba(15, 102, 81, 0.45);
    border-radius: 6px;
    padding: 5px 10px;
    background: var(--accent-soft);
  }
  .diagram-playback #playYear:hover { border-color: var(--accent); background: #d9eee5; }
  .diagram-playback #playYear.playing { background: var(--accent); color: #fff; }
  .diagram-playback #playDay { border-color: transparent; background: transparent; }
  #timeGroup {
    position: relative;
    order: 3;
    min-width: 0;
    flex: 0 0 auto;
    border: 0;
    padding: 0;
  }
  #timeGroup .time-adjustments {
    position: absolute;
    z-index: 55;
    inset-inline-end: 0;
    top: 100%;
    width: 250px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 12px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  #timeGroup .time-adjustment-summary { white-space: nowrap; }
  .diagram-tools #timeHelp { display: block; }
  .diagram-heading { grid-template-columns: minmax(0, 1fr); }
  .diagram-heading .legend { display: none; }
}

.mobile-control-drawer { display: none; }
.mobile-month-playback { display: none; }
.mobile-crescent-term { display: none; }

/* Phone/tablet workspace: readable source, compact controls, no desktop overflow. */
@media (max-width: 1049px) {
  .site-header,
  body.is-rashi-walkthrough .site-header {
    min-height: 60px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }
  .site-header > div:first-child { min-width: 0; flex: 1; }
  .site-header h1,
  body.is-rashi-walkthrough .site-header h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .site-header .eyebrow,
  .site-header .dek,
  .site-header .back-link { display: none; }
  .header-actions { flex: 0 0 auto; gap: 0; }
  .language-switch button { min-height: 40px; padding: 7px 9px; }
  .page-shell { width: 100%; padding: 10px 10px 20px; }
  .source-top-row { min-width: 0; gap: 8px; }
  .source-walkthrough-controls { gap: 6px; }
  .source-walkthrough-button { min-height: 44px; white-space: normal; }
  .source-step-button { min-width: 40px; min-height: 44px; }
  .walkthrough-invitation { min-width: 0; flex-basis: 100%; font-size: 11px; }
  .source-workbench--top > summary { padding: 10px 12px; font-size: 12px; }
  .source-workbench--top .source-workbench-body {
    max-height: 38svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 12px 14px;
  }
  .source-steps--english { font-size: 16px; line-height: 1.75; }
  .source-steps.source-language-he { font-size: 18px; line-height: 1.85; }
  .gemara-source p { font-size: 16px; line-height: 1.7; }

  .explorer-body { display: flex; min-width: 0; flex-direction: column; }
  .controls-panel { min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  [dir="rtl"] .controls-panel { border-left: 0; }
  .controls-heading,
  .mobile-diagram-preview { display: none; }
  .display-settings {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .display-settings .lesson-tabs {
    grid-column: 1 / -1;
    grid-template-columns: 0.75fr 1.5fr 0.85fr;
    gap: 4px;
    border: 0;
    padding: 0;
  }
  .scene-button { min-width: 0; min-height: 44px; justify-content: center; padding: 6px; text-align: center; }
  .scene-button span { font-size: 11px; line-height: 1.35; }
  .display-settings .view-switch {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 0;
  }
  .display-settings .view-switch .segmented { min-height: 40px; padding: 5px 7px; font-size: 12px; }
  .view-switch .segmented small { display: none; }
  .model-settings { align-self: center; }
  .model-settings > summary { min-height: 40px; padding: 12px 4px; font-size: 10px; }
  .model-settings-body {
    position: absolute;
    z-index: 60;
    inset-inline-end: 0;
    top: 100%;
    width: min(290px, calc(100vw - 40px));
    box-shadow: var(--shadow);
  }
  .display-settings .model-switch { grid-template-columns: 1fr 1fr; margin: 0; border: 0; padding: 0; }
  .display-settings .modern-controls { margin-top: 12px; border: 0; padding: 0; }
  .modern-controls label { flex-wrap: wrap; }

  .diagram-panel { min-width: 0; padding: 10px; }
  .diagram-heading { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .diagram-heading h2 { white-space: normal; font-size: 16px; line-height: 1.3; }
  .legend { gap: 5px 10px; font-size: 10px; }
  .diagram-status { margin-top: 6px; gap: 4px 7px; padding: 6px 8px; }
  .diagram-status strong { font-size: 12px; }
  .diagram-status small { font-size: 10px; }
  .diagram-tools { position: relative; gap: 6px; margin-top: 8px; border: 0; padding: 6px 0; background: transparent; }
  .diagram-tools .control-help { display: none; }
  .season-control-wide { min-width: 0; }
  .season-ticks button { min-height: 30px; font-size: 10px; }
  .diagram-playback { width: 100%; min-width: 0; flex-wrap: wrap; justify-content: flex-start; }
  .diagram-playback .playback-controls { width: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .diagram-playback .secondary-button { min-height: 40px; padding: 7px 9px; font-size: 11px; white-space: normal; }
  .diagram-playback #playYear { border-color: rgba(15, 102, 81, 0.45); background: var(--accent-soft); }
  .diagram-playback .speed-control select { min-height: 40px; }
  #timeGroup { order: 3; width: 100%; margin: 0; border: 0; padding: 0; }
  .time-adjustment-summary { min-height: 36px; padding: 10px 0; font-size: 11px; }
  .time-adjustments { padding: 8px 10px; background: #f8fbfa; border-radius: 6px; }
  .diagram-tools #timeHelp { display: block; }
  .time-play-button { min-height: 36px; font-size: 11px; }
  #monthGroup { margin-top: 10px; padding-top: 10px; }
  .date-picker-menu {
    position: absolute;
    z-index: 70;
    inset-inline-end: -42px;
    width: min(285px, calc(100vw - 44px));
  }
  .calendar-days button { min-height: 36px; height: 36px; aspect-ratio: auto; }
  .diagram-wrap { min-height: 0; }
  #skyDiagram { height: auto; aspect-ratio: 640 / 440; }
  .direction { font-size: 18px; }
  .observer-label,
  .altitude-label,
  .orientation-note { font-size: 15px; }
  #riseMarker text,
  #setMarker text { font-size: 16px; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout > div { padding: 9px; }
  .readout strong { font-size: 12px; }
  .readout span { font-size: 10px; }

  /* Actual header height and dynamic viewport avoid clipping behind browser chrome. */
  body.is-rashi-walkthrough {
    display: grid;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
  }
  body.is-rashi-walkthrough .page-shell {
    min-height: 0;
    height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 52fr) minmax(0, 48fr);
    gap: 8px;
    padding: 8px;
  }
  body.is-rashi-walkthrough .source-walkthrough-controls { gap: 4px; }
  body.is-rashi-walkthrough .source-walkthrough-button { font-size: 11px; }
  body.is-rashi-walkthrough .source-workbench--top .source-workbench-body {
    max-height: calc(var(--source-pane-height, 300px) - var(--source-summary-height, 36px));
    padding: 10px 12px;
  }
  body.is-rashi-walkthrough .source-workbench.is-walkthrough .source-steps { font-size: 16px; line-height: 1.75; }
  body.is-rashi-walkthrough .source-workbench.is-walkthrough .source-steps.source-language-he { font-size: 18px; line-height: 1.85; }
  body.is-rashi-walkthrough .source-workbench--top > summary { padding: 7px 10px; font-size: 11px; }
  body.is-rashi-walkthrough .diagram-panel { min-height: 0; gap: 4px; padding: 8px; }
  body.is-rashi-walkthrough .diagram-heading h2 { white-space: normal; font-size: 14px; }
  body.is-rashi-walkthrough .diagram-status { margin-top: 4px; padding: 4px 6px; }
  body.is-rashi-walkthrough .readout { display: none; }
  body.is-rashi-walkthrough #skyDiagram { height: 100%; aspect-ratio: auto; }
}

@media (max-width: 1049px) {
  body {
    display: grid;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .page-shell {
    display: grid;
    min-height: 0;
    height: 100%;
    grid-template-rows: minmax(0, 42fr) minmax(0, 58fr);
    gap: 8px;
    overflow: hidden;
    padding: 8px;
  }
  .source-top-row { min-height: 0; height: 100%; }
  .source-workbench--top { display: flex; min-height: 0; flex: 1; flex-direction: column; }
  .source-workbench--top .source-workbench-body {
    max-height: calc(var(--source-pane-height, 220px) - var(--source-summary-height, 36px));
  }
  .walkthrough-invitation { font-size: 10px; line-height: 1.3; }
  .explorer { display: flex; min-height: 0; height: 100%; margin: 0; }
  .explorer-body { position: relative; min-height: 0; height: 100%; flex: 1; }
  .mobile-control-drawer { display: block; flex: 0 0 auto; }
  .mobile-control-drawer > summary {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--accent-dark);
    cursor: pointer;
    font-size: 11px;
    list-style: none;
  }
  .mobile-control-drawer > summary::-webkit-details-marker { display: none; }
  .mobile-control-drawer > summary > span:last-child::after { content: " ▾"; }
  .mobile-control-drawer[open] > summary > span:last-child::after { content: " ▴"; }
  .mobile-control-drawer-body {
    position: absolute;
    z-index: 80;
    top: var(--mobile-summary-height, 40px);
    right: 6px;
    left: 6px;
    max-height: calc(100% - var(--mobile-summary-height, 40px) - 8px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  .mobile-control-drawer-body .model-settings[open] { grid-column: 1 / -1; }
  .mobile-control-drawer-body .model-settings-body,
  .mobile-control-drawer-body .date-picker-menu { position: static; width: auto; box-shadow: none; }
  .mobile-control-drawer-body #timeGroup { padding: 8px 10px; }
  .mobile-control-drawer-body .playback-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    padding: 8px 10px;
  }
  .mobile-control-drawer-body .playback-controls .secondary-button {
    min-height: 40px;
    margin: 0;
    padding: 7px;
    font-size: 11px;
    white-space: normal;
  }
  .diagram-panel {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 5px;
    padding: 8px;
  }
  .diagram-heading .legend { display: none; }
  .diagram-heading h2 { font-size: 14px; }
  .diagram-status { margin-top: 4px; padding: 4px 6px; }
  .diagram-tools { flex-direction: row; gap: 8px; margin: 0; padding: 0; }
  .diagram-tools .season-control-wide { min-width: 0; flex: 1; }
  .season-control-wide input[type="range"] { margin: 4px 0; }
  .season-ticks { height: 24px; }
  .season-ticks button { min-height: 24px; font-size: 8px; }
  .diagram-playback { width: auto; flex: 0 0 auto; }
  .diagram-playback .season-playback { min-width: 0; }
  .diagram-playback #playYear { max-width: 95px; min-height: 36px; font-size: 10px; }
  .diagram-playback:has(.playback-controls:not(.is-hidden)) { width: 100%; }
  .diagram-wrap { min-height: 0; height: 100%; margin: 0; }
  #skyDiagram { height: 100%; aspect-ratio: auto; }
  .readout { display: none; }
  .method-note { display: none; }
  body.is-rashi-walkthrough .mobile-control-drawer { display: none; }
  .mobile-control-drawer > summary > span:first-child { min-width: 0; flex: 1; line-height: 1.35; }
  .mobile-control-drawer > summary > span:last-child {
    flex: 0 0 auto;
    max-width: 46%;
    border: 1px solid rgba(15, 102, 81, 0.5);
    border-radius: 6px;
    padding: 8px 9px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
  }
  .mobile-control-drawer > summary:hover > span:last-child,
  .mobile-control-drawer[open] > summary > span:last-child {
    border-color: var(--accent);
    background: #d9eee5;
  }
  .mobile-crescent-term { display: block; margin: 3px 0 0; color: var(--accent-dark); font-size: 11px; line-height: 1.4; }
}

/* Short landscape screens need width-based panes, not two shallow vertical rows. */
@media (min-width: 600px) and (max-width: 1049px) and (orientation: landscape) {
  .page-shell,
  body.is-rashi-walkthrough .page-shell {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .site-header h1,
  body.is-rashi-walkthrough .site-header h1 { font-size: 16px; }
  .source-walkthrough-controls { flex-wrap: nowrap; }
  .source-walkthrough-button { flex: 1; }
  .walkthrough-invitation { display: none; }
  .source-workbench--top > summary { padding: 8px 10px; font-size: 11px; }
  .diagram-panel,
  body.is-rashi-walkthrough .diagram-panel { padding: 6px; gap: 3px; }
  .diagram-heading h2,
  body.is-rashi-walkthrough .diagram-heading h2 { font-size: 12px; }
  .diagram-status { gap: 3px 5px; padding: 3px 5px; }
  .diagram-status strong { font-size: 11px; }
  .diagram-status small { font-size: 9px; }
}

@media (max-width: 1049px) {
  .mobile-control-drawer { height: 0; flex: 0 0 0; }
  .mobile-month-playback:not(.is-hidden) { display: flex; order: 1; gap: 6px; flex: 0 0 auto; }
  .mobile-month-playback .secondary-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 7px 10px;
    font-size: 11px;
  }
  .mobile-month-playback #playSelectedMonth { border-color: var(--accent); background: var(--accent); color: #fff; }
  .diagram-tools:has(.mobile-month-playback:not(.is-hidden)) { flex-wrap: wrap; }
  .mobile-control-drawer > summary {
    position: absolute;
    z-index: 5;
    top: 8px;
    inset-inline-end: 8px;
    min-height: 0;
    padding: 0;
    border: 0;
  }
  .mobile-control-drawer > summary > span:first-child { display: none; }
  .mobile-control-drawer > summary > span:last-child { max-width: none; padding: 7px 8px; font-size: 10px; }
  .mobile-control-drawer-body { top: calc(var(--mobile-summary-height, 32px) + 16px); max-height: calc(100% - var(--mobile-summary-height, 32px) - 24px); }
  body:not(.is-rashi-walkthrough) .diagram-heading h2 {
    min-height: 36px;
    padding-inline-end: 145px;
  }
  .mobile-crescent-term { display: none; }
}
