:root {
  --bg: #0b0f14;
  --panel: #111821;
  --line: #263242;
  --text: #dbe5f0;
  --muted: #9badc1;
  --accent: #6ea7ff;
  --accent-soft: #3d5f8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Consolas", "Menlo", "Monaco", "Liberation Mono", monospace;
  line-height: 1.45;
  height: 100vh;
  overflow: hidden;
}

.page {
  width: min(1280px, 98vw);
  height: 100vh;
  margin: 0 auto;
  padding: 0.75rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.65rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 0;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.star-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  padding: 0.32rem 0.6rem;
  background: #111f31;
  white-space: nowrap;
}

.star-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.subtitle {
  margin: 0.25rem 0 0.3rem;
  color: var(--muted);
}

.note {
  margin: 0;
  padding-top: 0.25rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 0.88rem;
}

.plain-summary {
  margin: 0.35rem 0 0;
  color: var(--accent);
  font-size: 0.86rem;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 320px 1fr;
  gap: 0.65rem;
}

.control-grid {
  display: grid;
  gap: 0.55rem;
}

.control-row {
  display: grid;
  grid-template-columns: 56px 104px 1fr;
  gap: 0.55rem;
  align-items: center;
}

.control-row span {
  color: var(--muted);
  font-weight: 600;
}

input[type="number"] {
  width: 100%;
  color: var(--text);
  background: #0c1219;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.28rem 0.42rem;
  font: inherit;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.mini-title {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.value-cell {
  background: #0c131b;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem;
  display: grid;
  gap: 0.18rem;
}

.value-cell span {
  color: var(--muted);
  font-size: 0.82rem;
}

.value-cell output {
  color: var(--accent);
  font-size: 0.95rem;
}

.plot-tools {
  display: grid;
  grid-template-columns: auto 70px 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.plot-tools label {
  color: var(--muted);
  font-size: 0.82rem;
}

.plot-tools button {
  color: var(--text);
  background: #111f31;
  border: 1px solid var(--accent-soft);
  border-radius: 5px;
  font: inherit;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}

.plot-tools output {
  color: var(--accent);
  font-size: 0.83rem;
}

#plotCanvas {
  width: 100%;
  height: clamp(180px, 34vh, 320px);
  display: block;
  background: #0a1017;
  border: 1px solid #1f2c3c;
  border-radius: 6px;
}

.mini-visuals {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.visual-block {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem;
  background: #0c131b;
}

.visual-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.axis-text {
  margin: 0.25rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

#axisCanvas,
#eyeCanvas {
  width: 100%;
  max-width: 170px;
  margin: 0 auto;
  height: auto;
  display: block;
  background: #0a1017;
  border: 1px solid #1f2c3c;
  border-radius: 6px;
}

@media (max-width: 1150px) {
  body {
    overflow: auto;
    height: auto;
  }

  .page {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .plot-tools {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

@media (max-width: 680px) {
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .value-grid {
    grid-template-columns: 1fr;
  }

  .mini-visuals {
    grid-template-columns: 1fr;
  }
}
