#panel-lumen.panel[hidden] {
  display: none !important;
}

#panel-lumen.panel.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 5rem);
  max-height: calc(100dvh - 5rem);
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* Stage fills the viewport under the header, so drawing, waves, and traces share one on-screen box. */
body.lm-tab-active {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

body.lm-tab-active .site-header {
  flex: 0 0 auto;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

body.lm-tab-active #panel-lumen.panel.active {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
}

body.lm-tab-active .site-footer,
body.lm-tab-active .site-header .subtitle {
  display: none;
}

.lm-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  background: #05060a;
  color: #e8f6f4;
}

.lm-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #07080c;
}

.lm-frame {
  position: absolute;
  inset: 0;
  background: #07080c;
}

.lm-zoom {
  position: absolute;
  z-index: 3;
  left: 0.65rem;
  bottom: 0.65rem;
  display: flex;
  gap: 0.3rem;
}

.lm-zoom button {
  font: inherit;
  color: #d5eee8;
  background: rgba(8, 12, 16, 0.82);
  border: 1px solid rgba(140, 210, 196, 0.35);
  border-radius: 6px;
  cursor: pointer;
  min-width: 2.2rem;
  padding: 0.32rem 0.5rem;
}

.lm-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.lm-canvas[data-mode="move"] { cursor: grab; }
.lm-canvas[data-mode="trace"] { cursor: alias; }

.lm-readout {
  margin: -0.35rem 0 0.75rem;
  color: rgba(220, 245, 236, 0.9);
  font-size: 0.78rem;
  line-height: 1.35;
}

.lm-side {
  min-height: 0;
  overflow: auto;
  padding: 0.9rem 0.95rem 1.3rem;
  border-left: 1px solid rgba(120, 220, 200, 0.16);
  background: #0b1016;
}

.lm-side h2 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display, Georgia, serif);
  font-weight: 400;
  font-size: 1.8rem;
}

.lm-lede, .lm-hint, .lm-status {
  margin: 0 0 0.75rem;
  color: rgba(210, 230, 226, 0.72);
  font-size: 0.8rem;
  line-height: 1.4;
}

.lm-modes, .lm-actions, .lm-trace {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.lm-modes button,
.lm-actions button,
.lm-trace button,
.lm-prompt button,
.lm-file,
.lm-eq button {
  font: inherit;
  color: #d5eee8;
  background: transparent;
  border: 1px solid rgba(140, 210, 196, 0.28);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.38rem 0.55rem;
}

.lm-file { display: inline-flex; align-items: center; }

.lm-modes button.is-on,
.lm-trace button.is-on {
  color: #04120f;
  background: #7ef0d2;
  border-color: #7ef0d2;
  font-weight: 650;
}

.lm-prompt {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.lm-prompt span {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: rgba(210, 230, 226, 0.78);
}

.lm-prompt input,
.lm-eq select,
.lm-materials select,
.lm-file {
  font: inherit;
  color: #d5eee8;
  background: transparent;
  border: 1px solid rgba(140, 210, 196, 0.28);
  border-radius: 6px;
  padding: 0.38rem 0.55rem;
  cursor: pointer;
}

.lm-materials {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.lm-block {
  padding: 0.45rem 0.5rem 0.55rem;
  border: 1px solid rgba(140, 210, 196, 0.2);
  border-radius: 8px;
  background: rgba(8, 16, 20, 0.45);
}

.lm-block.is-inward { border-color: rgba(126, 240, 210, 0.7); }
.lm-block.is-outward { border-color: rgba(186, 196, 206, 0.28); }

.lm-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #f4fff8;
}

.lm-block .lm-note,
.lm-note {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(210, 230, 226, 0.66);
}

.lm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.4rem;
}

.lm-materials label,
.lm-row label {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.72rem;
  color: rgba(210, 230, 226, 0.75);
}

.lm-materials select,
.lm-materials input[type="range"] {
  width: 100%;
  accent-color: #7ef0d2;
}

.lm-prompt code {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  color: #d8fff4;
}

.lm-eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.lm-eq select,
.lm-eq button { grid-column: 1 / -1; }

.lm-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.72rem;
  color: rgba(210, 230, 226, 0.75);
}

.lm-field input[type="range"] { width: 100%; accent-color: #7ef0d2; }

.lm-card {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(140, 210, 196, 0.2);
  background: rgba(8, 18, 22, 0.65);
  font-size: 0.78rem;
  line-height: 1.4;
}

.lm-card dl {
  display: grid;
  grid-template-columns: 6.4rem 1fr;
  gap: 0.18rem 0.45rem;
  margin: 0;
}

.lm-card dt {
  color: rgba(210, 230, 226, 0.62);
}

.lm-card dd {
  margin: 0;
  color: #f4fff8;
}

.lm-sheet {
  width: 100%;
  margin: 0.55rem 0 0;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.lm-sheet th,
.lm-sheet td {
  padding: 0.22rem 0.28rem;
  text-align: left;
  border-bottom: 1px solid rgba(140, 210, 196, 0.16);
  vertical-align: middle;
}

.lm-sheet th {
  color: rgba(210, 230, 226, 0.62);
  font-weight: 500;
}

.lm-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.28rem;
  border-radius: 2px;
  vertical-align: -0.1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.lm-card.is-flip {
  border-color: rgba(220, 170, 255, 0.45);
}

@media (max-width: 800px) {
  body.lm-tab-active {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  #panel-lumen.panel.active,
  body.lm-tab-active #panel-lumen.panel.active {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: hidden;
  }

  .lm-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(8rem, 1fr) minmax(8rem, 46%);
    height: 100%;
    min-height: 0;
  }

  .lm-side {
    border-left: none;
    border-top: 1px solid rgba(120, 220, 200, 0.16);
  }
}
