/* Orbital Mechanics Laboratory — responsive dark UI */

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: #05070f;
  color: #e8ecf4;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.app-header {
  flex: 0 0 auto;
  padding: 10px 16px 8px;
  border-bottom: 1px solid #171f33;
}

.app-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #8b98b8;
  font-variant-numeric: tabular-nums;
}

.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  min-width: 0;
}

.canvas-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
}

#simulation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  background: radial-gradient(ellipse at center, #0a1024 0%, #05070f 75%);
}

.controls {
  flex: 0 0 300px;
  width: 300px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid #171f33;
  background: #080c18;
  overflow-y: auto;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row button {
  flex: 1 1 0;
  min-height: 44px;
  min-width: 0;
  padding: 10px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #e8ecf4;
  background: #16203a;
  border: 1px solid #263455;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-row button:hover { background: #1c2a4c; }
.btn-row button:active { transform: translateY(1px); }
.btn-row button:focus-visible {
  outline: 2px solid #7ab8ff;
  outline-offset: 2px;
}

#play-pause { background: #1d3555; border-color: #2f4f7d; }
#play-pause:hover { background: #24426a; }
#play-pause[aria-pressed="true"] { background: #154d3a; border-color: #24745a; }

.slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider label {
  font-size: 0.8rem;
  color: #aab6d0;
  font-variant-numeric: tabular-nums;
}

.slider input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: #7ab8ff;
  cursor: pointer;
  touch-action: manipulation;
}

.readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: #0b1226;
  border: 1px solid #1d2a49;
  border-radius: 8px;
}

.readout span {
  font-size: 0.75rem;
  color: #8b98b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#energy-drift {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #7ee2a8;
  font-variant-numeric: tabular-nums;
}

#energy-drift.warn { color: #ffd166; }
#energy-drift.bad  { color: #ff7b7b; }

.hint {
  margin: 0;
  font-size: 0.72rem;
  color: #6d7a99;
  line-height: 1.6;
}

kbd {
  background: #131b30;
  border: 1px solid #263455;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: inherit;
}

/* Small screens (e.g. 375x812): stack canvas above controls */
@media (max-width: 760px) {
  .app-header { padding: 8px 12px 6px; }
  .app-header h1 { font-size: 0.95rem; }

  .layout {
    flex-direction: column;
  }

  .canvas-wrap {
    flex: 1 1 58%;
  }

  .controls {
    flex: 0 0 auto;
    width: 100%;
    border-left: none;
    border-top: 1px solid #171f33;
    padding: 10px 12px;
    gap: 10px;
  }

  .btn-row { flex-wrap: nowrap; }

  .slider { flex-direction: row; align-items: center; gap: 10px; }
  .slider label { flex: 0 0 auto; min-width: 118px; }
  .slider input[type="range"] { flex: 1 1 auto; }

  .readout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .hint { display: none; }
}
