/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
}

h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 0.92rem;
  color: #aaaaaa;
  max-width: 850px;
  margin: 0 auto 0.6rem;
}

.math {
  font-family: "Cambria Math", "Latin Modern Math", Georgia, serif;
  font-style: italic;
  color: #cccccc;
}

/* ── Mode tabs ──────────────────────────────────────────── */
#mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 0.5rem auto 0;
  max-width: 400px;
}

.mode-tab {
  flex: 1;
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  background: #111111;
  color: #777777;
  border: 1px solid #222222;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.mode-tab:first-child { border-radius: 6px 0 0 6px; }
.mode-tab:last-child  { border-radius: 0 6px 6px 0; border-left: none; }
.mode-tab.active {
  background: #1a1a1a;
  color: #e8860c;
  border-color: #e8860c;
}
.mode-tab:hover:not(.active) {
  background: #161616;
  color: #aaaaaa;
}

/* ── Caveat banner ──────────────────────────────────────── */
#caveat-banner {
  max-width: 800px;
  margin: 0.6rem auto 0;
  text-align: center;
  min-height: 2.6rem;
}
.caveat-text {
  display: none;
  font-size: 0.82rem;
  color: #777777;
  padding: 0.3rem 1rem;
}
.caveat-text.active { display: block; }
.caveat-text strong { color: #999999; }
.caveat-text em { color: #e8860c; font-style: normal; }

/* ── Controls ────────────────────────────────────────────── */
#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 0.8rem 1.5rem;
  flex-wrap: wrap;
}

#controls label {
  font-size: 0.85rem;
  color: #999999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#controls input[type="range"] {
  width: 160px;
  accent-color: #e8860c;
  cursor: pointer;
}

#controls span {
  display: inline-block;
  width: 2.4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #cccccc;
}

#btn-regenerate {
  background: #1a1a1a;
  color: #cccccc;
  border: 1px solid #333333;
  padding: 0.35rem 1rem;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
}
#btn-regenerate:hover {
  background: #2a2a2a;
  border-color: #e8860c;
  color: #ffffff;
}

/* ── Panels ──────────────────────────────────────────────── */
#panels {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0 1rem 1rem;
  max-width: 1440px;
  margin: 0 auto;
}

.panel {
  flex: 1 1 0;
  min-width: 280px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panel-label {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: 0.01em;
}

.canvas-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #050505;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.panel-desc {
  font-size: 0.8rem;
  color: #888888;
  text-align: center;
  margin-top: 0.6rem;
  padding: 0 0.5rem;
  line-height: 1.5;
}

/* ── Physics note section ────────────────────────────────── */
#physics-note {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.5rem 2rem 2rem;
  border-top: 1px solid #1a1a1a;
}

#physics-note h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  margin-bottom: 1.2rem;
}

.note-columns {
  display: flex;
  gap: 2rem;
  justify-content: center;
}

.note-col {
  flex: 1;
  max-width: 360px;
}

.note-col h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e8860c;
  margin-bottom: 0.6rem;
}

.note-col ul {
  list-style: none;
  padding: 0;
}

.note-col li {
  font-size: 0.82rem;
  color: #999999;
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  position: relative;
}
.note-col li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: #444444;
}
.note-col li strong {
  color: #cccccc;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  font-size: 0.8rem;
  color: #555555;
  letter-spacing: 0.04em;
  line-height: 2;
}
footer a {
  color: #e8860c;
  text-decoration: none;
  transition: color 0.2s;
}
footer a:hover {
  color: #ffaa33;
  text-decoration: underline;
}

/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505ee;
  color: #666666;
  font-size: 0.85rem;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.4s;
}
.loading-overlay.hidden {
  opacity: 0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  #panels {
    flex-direction: column;
    align-items: center;
  }
  .panel {
    max-width: 560px;
    width: 100%;
  }
  .note-columns {
    flex-direction: column;
    align-items: center;
  }
  .note-col {
    max-width: 560px;
  }
}
