:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  color: #e8edf5;
  background: #091722;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --surface: #10212c;
  --surface-raised: #172b39;
  --border: rgba(145, 190, 202, 0.16);
  --accent: #73c7d7;
  --gold: #e2b64d;
  --muted: #91aab3;
  --soft: #c2d3d8;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -18rem, rgba(32, 113, 155, 0.25), transparent 48rem),
    #091722;
}

button,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 94px;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid rgba(215, 170, 95, 0.24);
  background:
    radial-gradient(ellipse at 50% 0, rgba(42, 127, 145, 0.28), transparent 34rem),
    rgba(8, 29, 39, 0.97);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  transition:
    transform 240ms ease,
    background-color 240ms ease;
}

.topbar.is-hidden {
  transform: translateY(calc(-100% - 2px));
}

.wordmark {
  display: inline-flex;
  grid-column: 2;
  justify-self: center;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: 0.015em;
  text-shadow: 0 2px 18px rgba(232, 184, 68, 0.2);
  white-space: nowrap;
}

.wordmark-mark {
  display: block;
  width: 58px;
  height: 58px;
  padding: 3px;
  border: 1px solid rgba(232, 184, 68, 0.58);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(23, 80, 91, 0.84), rgba(7, 28, 38, 0.74) 72%);
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  box-shadow:
    0 0 20px rgba(84, 191, 200, 0.12),
    inset 0 0 12px rgba(84, 191, 200, 0.14);
}

.updated-label,
.panel-caption {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.11em;
}

.topbar-updated {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(160, 205, 215, 0.14);
  border-radius: 6px;
  background: rgba(4, 20, 28, 0.3);
  color: #b7cbd0;
  font-size: 10px;
  letter-spacing: 0.015em;
}

.topbar-updated::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #80c78c;
  box-shadow: 0 0 9px rgba(128, 199, 140, 0.55);
  content: "";
}

main {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: 40px;
}

.intro {
  padding: 48px 0 34px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(40px, 6vw, 62px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.roster-section {
  margin-bottom: 26px;
}

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

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.roster-section > .section-heading {
  justify-content: center;
  text-align: center;
}

.roster-section .section-ornament {
  margin-right: auto;
  margin-left: auto;
}

.section-ornament {
  display: flex;
  align-items: center;
  width: 112px;
  gap: 9px;
  margin-bottom: 7px;
  color: #e8b844;
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(232, 184, 68, 0.55);
}

.section-ornament::before,
.section-ornament::after {
  height: 1px;
  content: "";
}

.section-ornament::before {
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(232, 184, 68, 0.72));
}

.section-ornament::after {
  flex: 1;
  background: linear-gradient(90deg, rgba(232, 184, 68, 0.72), transparent);
}

h2 {
  margin-bottom: 0;
  color: #f0eadc;
  font-family: "Spectral", Georgia, serif;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0.005em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.32);
}

.updated-label,
.panel-caption {
  margin-bottom: 3px;
  letter-spacing: 0.03em;
}

.topbar-updated {
  margin: 0;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.character-card {
  --class-color: var(--gold);
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--class-color) 7%, transparent), transparent 56%),
    linear-gradient(145deg, #151f2c, #101720);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.character-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--class-color) 38%, var(--border));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.character-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--class-color);
  content: "";
  opacity: 0.8;
}

.character-topline {
  display: flex;
  align-items: center;
  gap: 13px;
}

.class-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--class-color) 46%, transparent);
  border-radius: 50%;
  background: #0d141d;
  box-shadow: 0 0 20px color-mix(in srgb, var(--class-color) 13%, transparent);
}

.class-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.class-icon-fallback {
  color: var(--class-color);
  font-family: "Spectral", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
}

.character-name {
  overflow: hidden;
  margin: 0 0 2px;
  color: var(--class-color);
  font-family: "DM Sans", sans-serif;
  font-size: 22px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-class {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.level-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 0 auto;
}

.level-number {
  color: #f1f5fa;
  font-family: "DM Sans", sans-serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
}

.level-caption {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: #273443;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--class-color);
  box-shadow: 0 0 12px color-mix(in srgb, var(--class-color) 45%, transparent);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.card-meta strong {
  color: var(--soft);
  font-weight: 600;
}

.loading-card,
.error-card {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.error-card {
  color: #e6a39a;
}

.panel {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(19, 28, 40, 0.96), rgba(14, 21, 30, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.journey-section {
  margin-top: 22px;
}

.journey-section > .journey-heading {
  justify-content: center;
  margin-bottom: 14px;
  text-align: center;
}

.journey-heading .section-ornament {
  margin-right: auto;
  margin-left: auto;
}

.journey-panel {
  margin-top: 0;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resources-section {
  margin-top: 40px;
}

.nasa-launch-section {
  margin-top: 40px;
}

.nasa-launch-heading {
  justify-content: center;
  margin-bottom: 18px;
  text-align: center;
}

.nasa-launch-heading .section-ornament {
  margin-right: auto;
  margin-left: auto;
}

.nasa-launch-caption {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.nasa-launch-chart-wrap {
  position: relative;
  min-height: 220px;
}

.nasa-launch-chart-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.nasa-launch-chart {
  min-width: 860px;
}

.nasa-launch-time-grid {
  stroke-dasharray: 2 6;
  opacity: 0.6;
}

.nasa-launch-day-label {
  fill: #b7cbd0;
  font-size: 11px;
}

.nasa-launch-point {
  stroke: #101720;
  stroke-width: 1.5;
}

.nasa-launch-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-bottom: 8px;
}

.nasa-launch-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--soft);
  font-size: 11px;
  cursor: pointer;
  opacity: 0.48;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    opacity 150ms ease;
}

.nasa-launch-legend-item:hover,
.nasa-launch-legend-item.is-active {
  border-color: rgba(74, 158, 255, 0.27);
  background: rgba(74, 158, 255, 0.09);
  opacity: 1;
}

.nasa-launch-legend-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nasa-launch-legend-item .legend-swatch {
  flex: 0 0 8px;
}

.resources-heading {
  justify-content: center;
  margin-bottom: 18px;
  text-align: center;
}

.resources-heading .section-ornament {
  margin-right: auto;
  margin-left: auto;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.resource-card {
  position: relative;
  display: flex;
  min-height: 152px;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 100% 0, rgba(48, 132, 150, 0.13), transparent 65%),
    linear-gradient(145deg, rgba(19, 34, 45, 0.98), rgba(11, 24, 34, 0.98));
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.resource-card:hover {
  transform: translateY(-3px);
  border-color: rgba(115, 199, 215, 0.42);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25), 0 0 22px rgba(79, 169, 185, 0.08);
}

.resource-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.resource-site {
  color: #e2b64d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.015em;
  overflow-wrap: anywhere;
}

.resource-copy {
  display: grid;
  gap: 6px;
  padding-right: 12px;
}

.resource-title {
  color: #f0eadc;
  font-family: "Spectral", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.resource-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.resource-arrow {
  position: absolute;
  right: 16px;
  bottom: 17px;
  color: var(--accent);
  font-size: 14px;
  transition: transform 180ms ease;
}

.resource-card:hover .resource-arrow {
  transform: translate(2px, -2px);
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 9px;
}

.chart-controls select {
  min-width: 154px;
  padding: 9px 32px 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: #0c131c;
  color: #d5deea;
  font-size: 11px;
  transition: border-color 150ms ease;
}

.chart-controls select:focus {
  border-color: var(--accent);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
  font-size: 11px;
  opacity: 0.48;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    opacity 150ms ease;
}

.legend-item:hover,
.legend-item.is-active {
  border-color: rgba(74, 158, 255, 0.27);
  background: rgba(74, 158, 255, 0.09);
  opacity: 1;
}

.legend-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-wrap {
  position: relative;
  min-height: 220px;
}

.level-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-line {
  stroke: rgba(160, 181, 207, 0.13);
  stroke-dasharray: 3 6;
}

.chart-axis-label {
  fill: #8492a4;
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
}

.chart-series {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.chart-crosshair {
  stroke: rgba(186, 207, 232, 0.48);
  stroke-dasharray: 3 5;
  stroke-width: 1;
  pointer-events: none;
}

.chart-hover-marker {
  stroke: #101720;
  stroke-width: 2;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 1;
  min-width: 145px;
  max-width: min(250px, calc(100% - 16px));
  padding: 10px 12px;
  border: 1px solid rgba(151, 174, 202, 0.24);
  border-radius: 8px;
  background: rgba(10, 15, 22, 0.97);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip-date {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}

.chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 3px 0 0;
  font-size: 11px;
}

.chart-tooltip-row strong {
  color: #e8edf5;
  font-weight: 600;
}

.empty-state {
  padding: 42px 12px;
  color: var(--muted);
  text-align: center;
}

.notes-panel {
  margin-bottom: 50px;
}

.note-form {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  margin-top: 20px;
}

.note-form select,
.note-form textarea {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: #0c131c;
  color: #e8edf5;
  transition: border-color 150ms ease;
}

.note-form select:focus,
.note-form textarea:focus {
  border-color: var(--accent);
}

.note-form textarea {
  min-height: 45px;
  resize: vertical;
}

.note-form textarea::placeholder {
  color: #748296;
}

.gold-button {
  padding: 0 17px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #06111f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(39, 126, 223, 0.18);
  transition: background 150ms ease, transform 150ms ease;
}

.gold-button:hover {
  transform: translateY(-1px);
  background: #70b3ff;
}

.gold-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-message {
  min-height: 16px;
  margin: 8px 0 0;
  color: #8fb987;
  font-size: 12px;
}

.form-message.is-error {
  color: #e6a39a;
}

.notes-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.note-content {
  margin: 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.delete-note {
  flex: 0 0 auto;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: #7d8b9e;
  cursor: pointer;
  font-size: 11px;
}

.delete-note:hover {
  color: #e6a39a;
}

.footer {
  display: grid;
  justify-items: center;
  gap: 0;
  overflow: hidden;
  padding: 20px 24px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background:
    radial-gradient(ellipse at 50% 100%, rgba(35, 122, 142, 0.16), transparent 60%),
    #091722;
}

.footer-mascot {
  display: block;
  width: 112px;
  height: 112px;
  margin: -4px 0 -3px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
}

.footer-emblem {
  color: #e8b844;
}

.footer a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #74c8d3;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

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

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 2px;
    min-height: 96px;
    padding: 8px 16px 9px;
  }

  .wordmark {
    grid-column: 1;
    gap: 9px;
    font-size: 20px;
  }

  .wordmark-mark {
    width: 48px;
    height: 48px;
  }

  .topbar-updated {
    grid-column: 1;
    justify-self: center;
    padding: 4px 8px;
    font-size: 9px;
  }

  main {
    width: min(100% - 36px, 540px);
    padding-top: 40px;
  }

  .intro {
    padding: 38px 0 27px;
  }

  .character-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .character-card {
    min-height: 0;
    padding: 14px 17px;
  }

  .panel {
    padding: 19px 16px;
  }

  .note-form {
    grid-template-columns: 1fr;
  }

  .note-form select {
    min-height: 44px;
  }

  .gold-button {
    min-height: 44px;
  }
}

@media (max-width: 460px) {
  .topbar {
    min-height: 88px;
    gap: 0;
    padding: 5px 12px 7px;
  }

  .wordmark {
    min-width: 0;
    gap: 8px;
    font-size: 18px;
  }

  .wordmark-mark {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
  }

  .topbar-updated {
    max-width: none;
    padding: 3px 7px;
    font-size: 8px;
  }

  main {
    width: calc(100% - 32px);
  }

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

  .resources-section {
    margin-top: 32px;
  }

  .resource-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .resource-card {
    min-height: 0;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 15px;
  }

  .resource-site {
    flex: 0 0 auto;
    max-width: 112px;
  }

  .resource-copy {
    padding-right: 18px;
  }

  .resource-arrow {
    top: 50%;
    right: 15px;
    bottom: auto;
    transform: translateY(-50%);
  }

  h2 {
    font-size: 24px;
  }

  .updated-label,
  .panel-caption {
    max-width: 130px;
    font-size: 10px;
    text-align: right;
  }

  .chart-toolbar {
    align-items: flex-start;
  }

  .chart-legend {
    gap: 4px;
  }

  .chart-controls select {
    min-width: 130px;
    padding-right: 24px;
  }

  .legend-item {
    padding: 5px 6px;
    font-size: 10px;
  }

  .chart-controls {
    margin-left: auto;
  }

  .legend-item {
    font-size: 10px;
  }

  .chart-wrap {
    min-height: 180px;
    margin: 0 -7px;
  }

  .footer {
    padding-bottom: 20px;
  }

  .footer-mascot {
    width: 88px;
    height: 88px;
  }

  .footer-copy {
    gap: 7px;
    font-size: 11px;
  }
}
