:root {
  color-scheme: dark;
  --bg: #0a0f14;
  --panel: #111923;
  --panel-strong: #172432;
  --line: #263442;
  --text: #edf5f8;
  --muted: #9fb0bb;
  --accent: #50c2a7;
  --accent-strong: #7ee0c8;
  --warning: #f0b35f;
  --input: #0d151d;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(130deg, rgba(7, 10, 14, 0.9), rgba(7, 10, 14, 0.62) 42%, rgba(7, 10, 14, 0.92)),
    url("assets/steven-miller-dobson.jpg"),
    linear-gradient(130deg, rgba(12, 21, 30, 0.95), rgba(7, 10, 14, 0.98)),
    #071016;
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  background-position:
    0 0,
    42px 58px;
  background-size:
    120px 120px,
    180px 180px;
  opacity: 0.18;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(18px, 3vw, 42px);
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.image-credit {
  width: min(1180px, 100%);
  margin: 18px auto 0;
  color: rgba(237, 245, 248, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: right;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}

.image-credit a {
  color: var(--accent-strong);
  text-decoration: none;
}

.image-credit a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro-text {
  max-width: 760px;
  margin-top: 14px;
  color: rgba(237, 245, 248, 0.78);
  font-size: clamp(0.95rem, 1.8vw, 1.08rem);
  font-weight: 650;
  line-height: 1.45;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.78);
}

h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.status-pill {
  min-width: 190px;
  padding: 10px 14px;
  border: 1px solid rgba(126, 224, 200, 0.32);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(80, 194, 167, 0.1);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(159, 176, 187, 0.18);
  border-radius: 8px;
  background: rgba(17, 25, 35, 0.92);
  box-shadow: var(--shadow);
}

.observation-panel {
  grid-row: span 2;
  padding-bottom: 22px;
}

.summary-panel {
  grid-column: 1 / -1;
  padding-bottom: 20px;
}

@media (min-width: 921px) {
  .summary-panel {
    display: flow-root;
    padding: 0 20px 20px;
  }

  .summary-panel .panel-heading {
    padding-left: 0;
    padding-right: 0;
  }

  .summary-panel .resolution-guide,
  .summary-panel .summary-duration-field,
  .summary-panel .result-placeholder {
    margin-left: 0;
    margin-right: 0;
  }
}

.chart-panel {
  grid-column: 1 / -1;
  padding-bottom: 20px;
}

.sky-map-panel {
  grid-column: 1 / -1;
  padding-bottom: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 0;
}

.panel-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.step-index {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: rgba(80, 194, 167, 0.16);
  color: var(--accent-strong);
  font-weight: 800;
}

.field-grid,
.object-field,
.metrics-row,
.resolution-guide,
.summary-duration-field,
.result-placeholder,
.rotation-chart,
.sky-map {
  margin: 18px 20px 0;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.seeing-pixel-box {
  min-height: 44px;
  border: 1px solid rgba(159, 176, 187, 0.28);
  border-radius: 8px;
  background: rgba(7, 10, 14, 0.28);
  padding: 7px 10px;
}

.seeing-pixel-box span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.1;
}

.seeing-pixel-box strong {
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

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

.compact {
  margin-top: 16px;
}

.wide-field {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--input);
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: rgba(126, 224, 200, 0.82);
  box-shadow: 0 0 0 3px rgba(80, 194, 167, 0.14);
}

.field-hint {
  color: rgba(159, 176, 187, 0.88);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.search-field {
  position: relative;
}

.search-results {
  position: absolute;
  z-index: 20;
  right: 0;
  left: 0;
  max-height: 310px;
  margin-top: 6px;
  overflow: auto;
  border: 1px solid rgba(126, 224, 200, 0.32);
  border-radius: 6px;
  background: #0b131a;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.42);
}

.search-option {
  display: grid;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid rgba(159, 176, 187, 0.12);
  padding: 9px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.search-option:hover,
.search-option:focus {
  background: rgba(80, 194, 167, 0.12);
  outline: none;
}

.search-option strong {
  font-size: 0.92rem;
}

.search-option span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
}

.unit-input:focus-within {
  border-color: rgba(126, 224, 200, 0.82);
  box-shadow: 0 0 0 3px rgba(80, 194, 167, 0.14);
}

.unit-input input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.unit-input span {
  padding: 0 12px;
  color: var(--muted);
}

.location-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.location-button {
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(80, 194, 167, 0.38);
  background: rgba(80, 194, 167, 0.12);
  color: var(--accent-strong);
}

.location-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  padding-bottom: 20px;
}

.metrics-row div,
.resolution-guide,
.result-placeholder {
  min-width: 0;
  border: 1px solid rgba(159, 176, 187, 0.14);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-strong);
}

.metrics-row span,
.resolution-guide span,
.result-placeholder span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics-row strong,
.resolution-guide strong,
.result-placeholder strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: clamp(0.9rem, 2vw, 1.05rem);
}

.resolution-guide p {
  margin: 8px 0 0;
  color: rgba(159, 176, 187, 0.9);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
}

.resolution-guide .resolution-question {
  margin-top: 12px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.resolution-guide strong {
  color: var(--accent-strong);
}

.result-placeholder {
  border-color: rgba(240, 179, 95, 0.28);
  background: rgba(240, 179, 95, 0.1);
  padding: 14px 14px 16px;
}

.result-placeholder strong {
  color: var(--warning);
}

.result-placeholder strong[hidden] {
  display: none;
}

.result-detail {
  margin-top: 8px;
  color: rgba(237, 245, 248, 0.78);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.38;
}

.result-advice {
  color: rgba(237, 245, 248, 0.86);
}

.rotation-chart {
  margin: 18px 20px 0;
}

.chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-heading h2 {
  flex: 1 1 260px;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
}

.chart-heading strong {
  color: var(--accent-strong);
  font-size: 0.86rem;
  text-align: right;
}

.sky-map-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 190px));
  justify-content: center;
  gap: 12px;
  margin: 14px auto 0;
}

.sky-control-field span {
  text-align: center;
}

.sky-toggle-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sky-toggle-field input {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin: 0;
  accent-color: var(--accent);
}

#rotation-speed-chart {
  display: block;
  width: 100%;
  height: 360px;
  margin-top: 10px;
}

#sky-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  margin: 12px auto 0;
}

.chart-caption {
  margin-top: 8px;
  color: rgba(159, 176, 187, 0.9);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 920px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .observation-panel {
    grid-row: auto;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 650px) {
  .app-shell {
    padding: 10px;
  }

  body {
    background-attachment: scroll;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .status-pill {
    min-width: 0;
    width: 100%;
  }

  .image-credit {
    text-align: left;
  }

  .two-columns,
  .metrics-row,
  .sky-map-controls {
    grid-template-columns: 1fr;
  }

  .sky-map {
    margin-left: 6px;
    margin-right: 6px;
  }
}

@media (min-width: 651px) and (max-width: 1080px) {
  .metrics-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
