:root {
  color-scheme: dark;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  background: #071019;
  color: #e7f0f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: #071019;
  background-image:
    linear-gradient(rgba(61, 105, 126, 0.095) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 105, 126, 0.095) 1px, transparent 1px),
    radial-gradient(ellipse at 54% 7%, rgba(19, 51, 68, 0.56), transparent 53%);
  background-size: 32px 32px, 32px 32px, auto;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.site-frame {
  width: min(100% - 48px, 1480px);
  margin: 0 auto;
}

.site-header {
  padding: 18px 0 20px;
  border-bottom: 1px solid #203543;
}

.prototype-breadcrumb {
  min-height: 22px;
  color: #9aafb8;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 13px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #49cfe1;
  color: #81eafa;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.06em;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.brand-copy small {
  color: #8ca4b0;
  font: 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.09em;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 20px;
}

.section-nav a {
  color: #a9bbc2;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.section-nav a:hover,
.section-nav a:focus-visible {
  color: #74e4f0;
}

.section-nav a:focus-visible,
.brand:focus-visible,
.site-footer a:focus-visible,
.site-footer .public-site-footer-nav a:focus-visible {
  outline: 2px solid #f0ba65;
  outline-offset: 4px;
}

main {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.75fr);
  align-items: end;
  gap: 28px;
  padding: 48px 0 34px;
}

.hero-copy,
.hero-lead,
.status-rack,
.observation-panel,
.control-panel,
.note-card {
  min-width: 0;
}

.kicker,
.status-label,
.stage-readout span,
.panel-index,
.plot-card figcaption,
.control-group h3,
.readout-list dt,
.footer-note {
  color: #64d6e8;
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker {
  margin: 0 0 9px;
}

h1 {
  margin: 0;
  color: #f4f4ef;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  font-weight: 720;
  letter-spacing: 0;
}

.hero-subtitle {
  margin: 9px 0 0;
  color: #91a7b2;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.07em;
}

.hero-lead {
  display: grid;
  gap: 6px;
  max-width: 790px;
  margin: 20px 0 0;
  color: #c2d0d5;
  font-size: 14px;
  line-height: 1.75;
}

.hero-lead span + span {
  color: #93a8b2;
  font-size: 12px;
}

.status-rack {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 112px;
  padding: 16px 18px;
  border: 1px solid #765d39;
  background: rgba(33, 29, 22, 0.82);
}

.status-rack .status-label {
  color: #e6b461;
}

.status-rack strong {
  color: #f0c77d;
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
}

.status-rack > span:last-child {
  color: #c8b894;
  font-size: 12px;
  line-height: 1.55;
}

.observatory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.82fr);
  align-items: start;
  gap: 16px;
  scroll-margin-top: 20px;
}

.observation-panel,
.control-panel,
.note-card {
  border: 1px solid #2a414e;
  background: rgba(8, 19, 28, 0.94);
}

.observation-panel,
.control-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading .kicker {
  margin-bottom: 5px;
}

.panel-heading h2,
.note-card h2 {
  margin: 0;
  color: #eef3f1;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.stage-readout {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
}

.stage-readout strong {
  color: #b5c6cd;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.plot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.plot-card {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid #203642;
  background: #061019;
}

.canvas-surface {
  position: relative;
}

.plot-card figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  color: #a9c0c8;
  letter-spacing: 0.06em;
}

.plot-card figcaption span + span {
  color: #718995;
  font-size: 9px;
  letter-spacing: 0.03em;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #152b37;
  background: #050d14;
}

.plot-card canvas {
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}

.plot-card canvas.is-angle-dragging {
  cursor: grabbing;
}

.plot-card canvas.is-speed-dragging {
  cursor: grabbing;
}

.canvas-launch-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 1;
  min-width: 74px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #3dbdcb;
  border-radius: 0;
  background: rgba(10, 34, 43, 0.96);
  color: #9df1f5;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  touch-action: manipulation;
}

.canvas-launch-button:hover {
  background: #1a414d;
}

.canvas-launch-button:focus-visible {
  outline: 3px solid #f1ca84;
  outline-offset: 2px;
}

.fallback,
.noscript-notice {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid #8d6040;
  background: #211911;
  color: #f0d2a5;
  font-size: 13px;
  line-height: 1.7;
}

.fallback p,
.noscript-notice p {
  margin: 8px 0 0;
}

.noscript-notice a {
  color: #79e4ef;
}

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 17px;
  margin-top: 13px;
  color: #a8bac1;
  font-size: 11px;
}

.stage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  border: 1px solid currentColor;
}

.legend-origin {
  border-radius: 50%;
  color: #58d2c4;
  background: #58d2c4;
}

.legend-path {
  color: #7be4ed;
  background: #7be4ed;
}

.legend-target {
  color: #e9ad58;
  background: rgba(233, 173, 88, 0.65);
}

.legend-contact {
  border-radius: 50%;
  color: #ff8276;
  background: #ff8276;
}

.legend-time-limit {
  color: #e8b66c;
  background: transparent;
}

.legend-speed {
  border-radius: 50%;
  color: #e8aa4f;
  background: #e8aa4f;
}

.canvas-help {
  margin: 12px 0 0;
  color: #8da2ab;
  font-size: 11px;
  line-height: 1.6;
}

.compact-heading {
  align-items: center;
}

.panel-index {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid #38505c;
  color: #91a6ae;
  font-size: 9px;
  letter-spacing: 0.09em;
}

.control-group {
  padding: 15px 0;
  border-top: 1px solid #1c303b;
}

.control-group h3 {
  margin: 0 0 12px;
  color: #86dce7;
}

.select-label,
.range-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #c0cdd1;
  font-size: 12px;
  line-height: 1.5;
}

.select-label {
  margin: 12px 0 5px;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #385461;
  border-radius: 0;
  background: #0d1c26;
  color: #e5eef0;
}

input[type="range"] {
  display: block;
  margin: 8px 0 2px;
  accent-color: #5dd4e4;
  cursor: pointer;
}

output {
  color: #f1ca84;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.range-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 13px;
  color: #728a95;
  font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.range-endpoints span:nth-child(2) {
  color: #a6b9bf;
}

select:focus-visible,
input:focus-visible,
button:focus-visible,
main:focus-visible {
  outline: 2px solid #f0ba65;
  outline-offset: 3px;
}

.control-hint {
  margin: 8px 0 0;
  color: #889da6;
  font-size: 11px;
  line-height: 1.65;
}

.time-limit-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #5e5037;
  background: #171912;
  color: #e5d3aa;
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
}

.time-limit-control input {
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: #e8b66c;
  cursor: pointer;
}

.time-limit-control output {
  color: #f1ca84;
  font-weight: 700;
  white-space: nowrap;
}

.button-primary,
.button-secondary,
.button-quiet {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #47717c;
  border-radius: 0;
  background: #102a34;
  color: #e4f2f4;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.45;
}

.button-primary {
  border-color: #3dbdcb;
  background: #12323d;
  color: #9df1f5;
  font-weight: 700;
}

.button-secondary:hover,
.button-primary:hover {
  background: #1a414d;
}

.button-quiet {
  border-color: #4b4b42;
  background: #1c1d19;
  color: #d4c59c;
}

.button-quiet:hover {
  background: #2a2a21;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.action-grid .button-primary {
  grid-column: 1 / -1;
}

.condition-hint {
  margin: 9px 0 0;
}

.readout-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  margin: 18px 0 0;
  border-top: 1px solid #283b45;
}

.readout-list > div {
  min-width: 0;
  padding: 10px 0 9px;
  border-bottom: 1px solid #1c3039;
}

.readout-list dt {
  margin: 0 0 4px;
  color: #849ca5;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.readout-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #d9e5e7;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  scroll-margin-top: 20px;
}

.note-card {
  padding: 17px;
  color: #b8c7cc;
  font-size: 12px;
  line-height: 1.7;
}

.note-card h2 {
  margin-bottom: 10px;
  font-size: 16px;
}

.note-card p {
  margin: 8px 0 0;
}

.note-card ol {
  margin: 9px 0 0;
  padding-left: 21px;
}

.note-card li + li {
  margin-top: 4px;
}

.note-emphasis {
  color: #e5bb76;
}

.formula {
  display: grid;
  gap: 5px;
  margin: 11px 0;
  padding: 11px;
  border-left: 2px solid #3ebdce;
  background: #091821;
}

.formula code {
  color: #b9e6eb;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 18px 0 26px;
  border-top: 1px solid #203543;
}

.footer-note {
  margin: 0;
  color: #90a6ae;
  font-size: 9px;
  letter-spacing: 0.09em;
}

.footer-note span {
  color: #667e88;
}

.site-footer .public-site-footer-nav {
  gap: 7px 18px;
  color: #a0b2b9;
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.07em;
}

.site-footer .public-site-footer-nav a:hover {
  color: #76e4ef;
}

@media (max-width: 1050px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.72fr);
    gap: 18px;
  }

  .observatory-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .control-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
  }

  .compact-heading,
  .action-grid,
  .condition-hint,
  .readout-list {
    grid-column: 1 / -1;
  }

  .control-group {
    align-self: start;
  }
}

@media (max-width: 760px) {
  .site-frame {
    width: min(100% - 32px, 620px);
  }

  .header-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .section-nav {
    justify-content: flex-start;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding: 34px 0 22px;
  }

  .hero-lead {
    margin-top: 14px;
  }

  .status-rack {
    min-height: 0;
  }

  .control-panel {
    display: block;
  }

  .notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .plot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .observation-panel,
  .control-panel {
    padding: 13px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .stage-readout {
    display: none;
  }

  .panel-heading h2 {
    font-size: 16px;
  }

  .readout-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .action-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .action-grid .button-primary {
    grid-column: auto;
  }

  .brand-copy small {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .stage-legend {
    gap: 8px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
