:root {
  --bg: #0d1316;
  --panel: #131d21;
  --panel-strong: #0f171a;
  --panel-soft: rgba(20, 28, 33, 0.92);
  --text: #e8f2ef;
  --muted: #9bb2ab;
  --accent: #7be0b1;
  --accent-strong: #4cc48b;
  --accent-warm: #ffb866;
  --accent-cool: #7cd6ff;
  --accent-rose: #ff8f70;
  --border: #213037;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(123, 224, 177, 0.1), transparent 30%),
              radial-gradient(circle at 85% 0%, rgba(112, 197, 255, 0.12), transparent 26%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

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

.auth-page,
.menu-page {
  justify-content: center;
}

.auth-shell,
.menu-shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 32px 20px;
}

.auth-card,
.menu-card {
  background: linear-gradient(180deg, rgba(19, 29, 33, 0.96), rgba(13, 20, 23, 0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-card {
  max-width: 460px;
  margin: 8vh auto 0;
  padding: 32px;
}

.menu-card {
  padding: 28px;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.auth-form label {
  font-size: 13px;
  color: var(--muted);
}

.auth-form input {
  border: 1px solid var(--border);
  background: #0c1114;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
}

.form-error {
  min-height: 24px;
  margin: 12px 0 0;
  color: #ffb3b3;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.menu-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.session-pill {
  background: rgba(123, 224, 177, 0.12);
  color: var(--accent);
  border: 1px solid rgba(123, 224, 177, 0.25);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.menu-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.menu-entry,
.topic-entry {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255, 184, 102, 0.08), rgba(124, 214, 255, 0.05)),
    linear-gradient(180deg, rgba(17, 25, 29, 0.95), rgba(11, 16, 20, 0.98));
}

.menu-bullet-link,
.topic-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.menu-bullet-link:hover,
.topic-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 184, 102, 0.45);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 184, 102, 0.08);
}

.menu-bullet {
  font-size: 28px;
  line-height: 1;
  color: var(--accent-warm);
}

.menu-bullet-title,
.topic-link {
  font-size: 18px;
  font-weight: 700;
}

.menu-entry-copy,
.topic-copy {
  margin: 0;
  padding-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.menu-link-track {
  background:
    linear-gradient(135deg, rgba(124, 214, 255, 0.18), rgba(123, 224, 177, 0.1)),
    linear-gradient(180deg, rgba(17, 25, 29, 0.96), rgba(11, 16, 20, 0.98));
}

.menu-link-matrix {
  background:
    linear-gradient(135deg, rgba(255, 184, 102, 0.18), rgba(255, 143, 112, 0.12)),
    linear-gradient(180deg, rgba(17, 25, 29, 0.96), rgba(11, 16, 20, 0.98));
}

header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(15, 17, 21, 0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0.3px;
}

p {
  margin: 0;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.control-group {
  background: var(--panel);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 240px;
}

.control-group label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.upload-progress {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(124, 214, 255, 0.16);
  background: linear-gradient(180deg, rgba(9, 14, 18, 0.88), rgba(14, 22, 26, 0.92));
}

.upload-progress[data-state="done"] {
  border-color: rgba(123, 224, 177, 0.28);
}

.upload-progress[data-state="error"] {
  border-color: rgba(255, 143, 112, 0.32);
}

.upload-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.upload-progress-header span:last-child {
  color: var(--accent-cool);
  font-weight: 700;
}

.upload-progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(6, 10, 12, 0.88);
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-cool), var(--accent), var(--accent-warm));
  box-shadow: 0 0 22px rgba(124, 214, 255, 0.22);
  transition: width 0.18s ease;
}

.upload-progress[data-state="done"] .upload-progress-bar {
  background: linear-gradient(90deg, var(--accent), #22c55e);
}

.upload-progress[data-state="error"] .upload-progress-bar {
  background: linear-gradient(90deg, #ff8f70, #ffb866);
}

.upload-progress[data-indeterminate="true"] .upload-progress-bar {
  width: 42%;
  animation: upload-progress-indeterminate 1.1s ease-in-out infinite;
}

@keyframes upload-progress-indeterminate {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(260%);
  }
}

select,
input[type="file"],
button,
.button-link,
.secondary-button {
  border: 1px solid var(--border);
  background: #11141a;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

select,
input[type="file"] {
  flex: 1;
}

button,
.button-link,
.secondary-button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0b0f14;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-link:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(76, 196, 139, 0.25);
}

.secondary-button {
  background: #10171b;
  color: var(--text);
}

.nav-group {
  min-width: 210px;
}

main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  padding: 16px 16px 20px;
  flex: 1;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

#info {
  margin: 0;
  padding: 16px;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 120px;
}

.map-panel {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--panel);
}

.view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(145deg, rgba(14, 20, 24, 0.98), rgba(8, 12, 15, 0.96)),
    radial-gradient(circle at top left, rgba(124, 214, 255, 0.08), transparent 32%);
}

.view-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(124, 214, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(124, 214, 255, 0.08), rgba(123, 224, 177, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.view-toggle button {
  min-width: 112px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.view-toggle button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.view-toggle .active {
  background: linear-gradient(135deg, var(--accent), #22c55e);
  color: #0b0f14;
  border-color: rgba(123, 224, 177, 0.55);
  box-shadow: 0 10px 22px rgba(76, 196, 139, 0.22);
}

.playback-controls,
.camera-controls,
.terrain-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: var(--panel-soft);
}

#speedSelect {
  width: 110px;
}

.camera-controls {
  border: 1px solid rgba(124, 214, 255, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 214, 255, 0.08), rgba(255, 184, 102, 0.06));
}

.camera-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.camera-field select {
  min-width: 150px;
}

.camera-field-slider {
  min-width: 260px;
}

.camera-field-slider input[type="range"] {
  width: 140px;
}

.camera-field output {
  min-width: 96px;
  color: var(--accent-cool);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.terrain-controls {
  margin-left: auto;
  justify-content: flex-end;
  border-color: rgba(123, 224, 177, 0.12);
  background: linear-gradient(135deg, rgba(123, 224, 177, 0.08), rgba(124, 214, 255, 0.06));
}

.inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.playback-controls .inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.status-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 11, 14, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: #cfe0da;
}

.status-text span span,
.status-text > span:last-child {
  color: var(--accent-cool);
  font-weight: 700;
}

.view-messages {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(70, 15, 17, 0.34), rgba(17, 22, 28, 0.12));
}

.view-message {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 143, 112, 0.28);
  background: rgba(31, 12, 16, 0.88);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.view-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.view-message-title {
  margin: 0;
  color: #ffd5c6;
  font-size: 14px;
  font-weight: 700;
}

.view-message-close {
  width: auto;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: none;
}

.view-message-close:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.view-message-body {
  margin: 0;
  color: #ffe8df;
  font-size: 13px;
  line-height: 1.6;
}

.view-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-message-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #ffd9ca;
  font-size: 12px;
}

#map,
#cesiumContainer {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 360px;
}

#cesiumContainer {
  position: relative;
  background: #07090c;
}

.hidden {
  display: none;
}

.learning-page {
  justify-content: center;
}

.learning-card {
  padding: 30px;
}

.topic-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.topic-link {
  background:
    linear-gradient(135deg, rgba(255, 184, 102, 0.18), rgba(255, 143, 112, 0.12)),
    linear-gradient(180deg, rgba(17, 25, 29, 0.96), rgba(11, 16, 20, 0.98));
}

.topic-error {
  margin: 0;
  color: #ffb3b3;
}

.detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.detail-panel {
  background: linear-gradient(180deg, rgba(18, 25, 29, 0.92), rgba(11, 16, 20, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 20px;
}

.detail-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.full-width {
  grid-column: 1 / -1;
}

.formula-box,
.example-box,
.detail-note {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(8, 12, 15, 0.72);
  padding: 14px 16px;
  margin: 14px 0;
}

.formula-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

.formula-box code,
.example-box pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  color: #f6ead6;
  white-space: pre-wrap;
}

.detail-note {
  color: var(--text);
  line-height: 1.6;
}

.detail-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.detail-list li + li {
  margin-top: 8px;
}

@media (max-width: 900px) {
  header {
    flex-direction: column;
  }

  main {
    grid-template-columns: 1fr;
  }

  #map,
  #cesiumContainer {
    height: 60vh;
  }

  .terrain-controls {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .menu-header {
    flex-direction: column;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .menu-entry,
  .topic-entry {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .row {
    flex-direction: column;
  }

  .upload-progress-header {
    flex-direction: column;
    align-items: flex-start;
  }

  button {
    width: 100%;
  }

  .button-link,
  .secondary-button {
    width: 100%;
  }

  .view-toolbar {
    flex-direction: column;
  }

  .playback-controls,
  .camera-controls,
  .terrain-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .view-toggle {
    width: 100%;
  }

  .view-toggle button {
    flex: 1;
  }

  .view-message-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #speedSelect {
    width: 100%;
  }
}
