/* Transit Hunter: the transit survey desk (survey display on the left, survey log on the right).
   Scene by art.js; the display stays dark in both themes (an instrument screen). Panel colours from --th-* below. */
html {
  --th-ink: #17203a; --th-bg1: #f4f5fc; --th-bg2: #e3e6f6; --th-accent: #3b3f8f; --th-ok: #13704a; --th-bad: #b3261e;
  --th-chip: #ffffff; --th-chip-on: #dfe1f7; --th-border: #9aa1c4; --th-a: #b07800; --th-b: #0f7a66;
}
html[data-theme="dark"] {
  --th-ink: #e7e9f8; --th-bg1: #1c1f33; --th-bg2: #141628; --th-accent: #a9aef5; --th-ok: #4fd08c; --th-bad: #ff8a80;
  --th-chip: #12142a; --th-chip-on: #2a2e5c; --th-border: #4d5378; --th-a: #ffd166; --th-b: #7fe0c6;
}
.th { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 12px; padding: 10px; color: var(--tlg-text); font-size: 16px; overflow: hidden; }
.th *, .th *::before, .th *::after { box-sizing: border-box; }
.th input, .th button { font: inherit; }
.th-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.th-brief { margin: 0; font-size: 16px; line-height: 1.25; color: var(--th-ink); }
.th-scene { flex: none; min-width: 0; overflow-x: auto; overflow-y: hidden; border-radius: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.25); background: #060d1a; }
.th-scene:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.th-svg { display: block; width: 100%; min-width: 580px; height: auto; }

/* svg text and marks */
.th-t { font-family: inherit; font-size: 20px; fill: #dfe7f7; }
.th-map-title, .th-map-note { font-size: 20px; fill: #c9d4ee; }
.th-star-name { font-weight: 700; fill: #ffffff; }
.th-star-cap { fill: #ffffff; }
.th-mon-title { font-weight: 700; fill: #e7efff; }
.th-mon-note { fill: #aab8d6; font-style: italic; }
.th-tick { fill: #b8c6e2; }
.th-axis-x { fill: #b8c6e2; }
.th-gridline { stroke: #20314f; stroke-width: 1; }
.th-series { stroke: #7fd6ff; stroke-width: 2.2; stroke-linejoin: round; }
.th-level-line { stroke: #8f9cc0; stroke-width: 1.6; stroke-dasharray: 3 6; }
.th-level-bg { fill: #0f1a30; stroke: #4c5b80; stroke-width: 1.2; }
.th-level-t { fill: #d6def0; }
.th-level { cursor: pointer; }
.th-level:hover .th-level-bg { stroke: #ffffff; }
.th-level.is-on .th-level-line { stroke: #ffd166; stroke-width: 2.6; stroke-dasharray: none; }
.th-level.is-on .th-level-bg { fill: #ffd166; stroke: #ffd166; }
.th-level.is-on .th-level-t { fill: #1a1300; font-weight: 800; }
.th-hit { fill: transparent; }
.is-locked .th-level, .is-locked .th-dip { cursor: default; pointer-events: none; }
.th-dip { cursor: pointer; }
.th-dip-hit { fill: #ffffff; opacity: 0; transition: opacity .15s; }
.th-dip:hover .th-dip-hit { opacity: .06; }
.th-dip.is-a .th-dip-hit, .th-dip.is-b .th-dip-hit { opacity: .08; }
.th-dip-t { fill: #e7efff; font-weight: 700; }
.th-mk { stroke-width: 2.6; }
.th-mk-a { stroke: #ffd166; }
.th-mk-b { stroke: #7fe0c6; stroke-dasharray: 8 5; }
.th-mk-box.th-mk-a { fill: #ffd166; stroke: none; }
.th-mk-box.th-mk-b { fill: #7fe0c6; stroke: none; }
.th-mk-t { fill: #0b1020; font-weight: 800; }
.th-span { stroke: #e7efff; stroke-width: 2; fill: none; opacity: .8; }
.th-box { fill: none; stroke: #ff9f43; stroke-width: 3; stroke-linejoin: round; opacity: .95; }
.th-pred-line { stroke: #ff8fb8; stroke-width: 2.6; stroke-dasharray: 9 5; }
.th-pred-t { fill: #ffc2d6; font-weight: 700; }
.th-keyarc { fill: none; stroke: #4fd08c; stroke-width: 2.6; }
.th-key-t { fill: #8af0b6; font-weight: 700; }
.th-keybox { fill: none; stroke: #4fd08c; stroke-width: 3; }
.th-planet-key { fill: none; stroke: #4fd08c; stroke-width: 2.5; stroke-dasharray: 5 4; }
.th-hz-edge { fill: none; stroke: #3ccf7a; stroke-width: 1; opacity: .8; }
.th-orbit { fill: none; stroke: #e7efff; stroke-width: 1.6; }
.th-orbit-you { fill: none; stroke: #ff8fb8; stroke-width: 1.6; stroke-dasharray: 4 3; }
.th-map-planet { fill: #9fb4ff; stroke: #ffffff; stroke-width: 1; }
.th-twinkle { animation: th-tw 3.2s ease-in-out infinite; }
@keyframes th-tw { 50% { opacity: .15; } }

/* measurement bar (step 1) */
.th-measure { display: grid; grid-template-columns: 136px minmax(0, 1fr) 128px; grid-auto-rows: minmax(40px, auto); gap: 5px 8px; align-items: center;
  padding: 6px 8px; border-radius: 12px; background: linear-gradient(var(--th-bg1), var(--th-bg2)); border: 2px solid var(--th-accent); color: var(--th-ink); }
.th-row-l { display: flex; align-items: center; gap: 6px; font-weight: 700; line-height: 1.1; grid-column: 1; }
.th-badge { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font-weight: 800; color: #0b1020; }
.th-a .th-badge { background: #ffd166; }
.th-b .th-badge { background: #7fe0c6; box-shadow: inset 0 0 0 2px #0b1020; border: 2px dashed #0f7a66; }
.th-f .th-badge { background: #c9cdf2; }
.th-measure .th-radio { grid-column: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.th-run { grid-column: 3; grid-row: 1 / span 3; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 12px; background: var(--th-accent); color: #fff; font-weight: 800; line-height: 1.15; cursor: pointer; padding: 6px; text-align: center; }
html[data-theme="dark"] .th-run { color: #10122a; }
.th-run-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.22); }
.th-run:disabled { opacity: .5; cursor: default; }
.th-run.is-done { background: var(--th-ok); opacity: 1; }
.th-run.is-done.is-bad { background: var(--th-bad); }

/* chips */
.th-chip { position: relative; display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 3px 20px 3px 20px; border: 2px solid var(--th-border); border-radius: 10px;
  background: var(--th-chip); color: var(--th-ink); font-size: 16px; line-height: 1.15; text-align: center; cursor: pointer; font-variant-numeric: tabular-nums; }
.th-chip:hover:not(:disabled) { border-color: var(--th-accent); }
.th-chip.is-on { border-color: var(--th-accent); background: var(--th-chip-on); box-shadow: inset 0 0 0 1px var(--th-accent); font-weight: 800; }
.th-chip.is-on::before { content: '●'; position: absolute; left: 6px; color: var(--th-accent); font-size: 12px; }
.th-radio--left .th-chip.is-on { border-color: var(--th-a); box-shadow: inset 0 0 0 2px var(--th-a); }
.th-radio--right .th-chip.is-on { border-color: var(--th-b); border-style: dashed; box-shadow: inset 0 0 0 1px var(--th-b); }
.th-chip-m { position: absolute; right: 5px; font-weight: 800; }
.th-chip.is-key { border-color: var(--th-ok); box-shadow: inset 0 0 0 2px var(--th-ok); }
.th-chip.is-key .th-chip-m { color: var(--th-ok); }
.th-chip.is-wrong { border-color: var(--th-bad); border-style: dashed; }
.th-chip.is-wrong .th-chip-m { color: var(--th-bad); }
.th-chip:disabled { cursor: default; opacity: 1; }
.th button:focus-visible, .th input:focus-visible, .th summary:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }

/* survey log */
.th-panel { display: flex; flex-direction: column; gap: 7px; min-height: 0; overflow: auto; padding: 8px 12px;
  background: linear-gradient(var(--th-bg1), var(--th-bg2)); color: var(--th-ink); border: 3px solid var(--th-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.th-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--th-accent); }
.th-host { padding: 5px 9px; border-radius: 10px; background: var(--th-chip); border: 1px solid var(--th-border); }
.th-host p { margin: 0; line-height: 1.3; }
.th-host-h { font-weight: 800; }
.th-derived { font-size: .85em; opacity: .8; }
.th-refs { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.th-refs details { flex: 1 1 100%; }
.th-refs details:not([open]) { flex: 0 0 auto; }
.th-refs summary { cursor: pointer; font-weight: 700; color: var(--th-accent); min-height: 26px; }
.th-refs details p { margin: 4px 0; line-height: 1.35; }
.th-step, .th-step-b { display: grid; gap: 4px; }
.th-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.th-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--th-accent); color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .th-n { color: #10122a; }
.th-step.is-done .th-n { background: var(--th-ok); }
.th-mark { margin-left: auto; font-weight: 800; white-space: nowrap; }
.th-mark.is-ok, .th-fmark.is-ok { color: var(--th-ok); }
.th-mark.is-bad, .th-fmark.is-bad { color: var(--th-bad); }
.th-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.th-num { display: grid; gap: 2px; min-width: 0; }
.th-num-l { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-weight: 700; line-height: 1.2; }
.th-fmark { font-weight: 800; }
.th-num-row { display: flex; align-items: center; gap: 5px; }
.th-num input { flex: 1 1 auto; min-width: 0; width: 100%; font-size: 17px; min-height: 40px; padding: 3px 8px; border: 2px solid #8a90b0; border-radius: 8px; background: #fff; color: #17203a; }
html[data-theme="dark"] .th-num input { background: #0e1022; color: #eef0fb; border-color: #5f668c; }
.th-num input.is-ok { border-color: var(--th-ok); }
.th-num input.is-bad { border-color: var(--th-bad); border-style: dashed; }
.th-num input:disabled { opacity: 1; }
.th-unit { flex: none; font-weight: 700; }
.th-chips { display: grid; gap: 5px; }
.th-chips--ev .th-radio { display: grid; grid-template-columns: 1fr; gap: 5px; }
.th-chips--zone .th-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.th-chips .th-chip { justify-content: flex-start; text-align: left; padding-left: 20px; }
.th-readout { margin: auto 0 0; padding: 6px 9px; border-radius: 10px; background: var(--th-chip); border: 1px dashed var(--th-border); line-height: 1.35; min-height: 2.7em; }

/* briefing example */
.th-ex { display: grid; gap: 8px; }
.th-ex-svg { width: 100%; max-width: 520px; height: auto; }
.th-ex-t { border-collapse: collapse; font-size: 16px; }
.th-ex-t th, .th-ex-t td { padding: 3px 10px 3px 0; text-align: left; border-bottom: 1px solid var(--th-border); }

@media (max-width: 1000px) {
  .th { position: static; display: flex; flex-direction: column; overflow: visible; padding: 8px; }
  .th-panel { overflow: visible; }
}
@media (max-width: 560px) {
  .th-measure { grid-template-columns: minmax(0, 1fr); }
  .th-row-l, .th-measure .th-radio, .th-run { grid-column: 1; grid-row: auto; }
  .th-run { flex-direction: row; min-height: 44px; }
  .th-chips--zone .th-radio { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .th *, .th *::before, .th *::after { animation: none !important; transition: none !important; }
}
