:root {
  --screen-accent: #65e2d4;
  --screen-accent-2: #78bfff;
  --screen-ink: #f7fbfd;
  --screen-muted: #d8e6ec;
  --screen-panel: #07151d;
  --screen-panel-soft: #0d2530;
  --screen-line: rgba(138, 213, 220, .56);
}

.stage-head {
  gap: 14px;
}

.stage-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
  flex-direction: row;
}

.stage-actions .stage-meta {
  min-width: 0;
  margin-right: 2px;
  text-align: right;
}

.classroom-screen-toggle,
.fullscreen-button {
  min-height: 40px;
  border: 1px solid rgba(164, 193, 207, .34);
  color: #dce8ee;
  background: rgba(255, 255, 255, .045);
  box-shadow: none;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}

.classroom-screen-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 118px;
  padding: 0 13px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.classroom-screen-icon {
  position: relative;
  width: 17px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.classroom-screen-icon::after {
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  transform: translateX(-50%);
}

.fullscreen-button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
}

.classroom-screen-toggle:hover,
.fullscreen-button:hover {
  border-color: rgba(101, 226, 212, .72);
  color: #fff;
  background: rgba(101, 226, 212, .1);
  transform: translateY(-1px);
}

.classroom-screen-toggle:focus-visible,
.fullscreen-button:focus-visible {
  outline: 3px solid rgba(120, 191, 255, .4);
  outline-offset: 3px;
}

.classroom-screen-toggle[aria-pressed="true"] {
  border-color: rgba(101, 226, 212, .78);
  color: #06151b;
  background: linear-gradient(135deg, #66dfd1, #8ec9ee);
}

.classroom-screen-inline-toggle {
  display: none !important;
}

body.classroom-screen {
  --muted: var(--screen-muted);
  --line: rgba(143, 194, 207, .42);
  --line-strong: rgba(101, 226, 212, .68);
}

body.classroom-screen .stage,
body.classroom-screen .control-panel {
  border: 2px solid var(--screen-line);
  background: var(--screen-panel);
  box-shadow: 0 0 0 1px rgba(101, 226, 212, .08), 0 24px 70px rgba(0, 0, 0, .34);
}

body.classroom-screen .stage-head {
  min-height: 64px;
  border-bottom: 2px solid rgba(138, 213, 220, .42);
  color: var(--screen-ink);
  background: var(--screen-panel-soft);
}

body.classroom-screen .stage-title {
  color: var(--screen-ink);
  font-size: 18px;
}

body.classroom-screen .stage-meta,
body.classroom-screen .hint,
body.classroom-screen .question,
body.classroom-screen .control-panel label,
body.classroom-screen .control-title,
body.classroom-screen .control-label,
body.classroom-screen .switch-row {
  color: var(--screen-muted);
}

body.classroom-screen .stage-meta {
  font-size: 15px;
  font-weight: 900;
}

body.classroom-screen .status-dot {
  box-shadow: 0 0 0 5px rgba(101, 226, 212, .15), 0 0 18px rgba(101, 226, 212, .38);
}

body.classroom-screen .canvas-wrap,
body.classroom-screen .board {
  filter: saturate(1.1) contrast(1.08);
}

body.classroom-screen .control-panel h2 {
  color: var(--screen-ink);
  font-size: 27px;
}

body.classroom-screen .control,
body.classroom-screen .control-group {
  border-color: rgba(143, 194, 207, .3);
}

body.classroom-screen .control-panel .value,
body.classroom-screen .control-label strong,
body.classroom-screen .control-label span:last-child,
body.classroom-screen .dimension-value strong,
body.classroom-screen .step-value {
  color: #77e8da;
}

body.classroom-screen .control-panel button:not(.fullscreen-button):not(.classroom-screen-toggle) {
  min-height: 50px;
  border-width: 2px;
  font-size: 15px;
}

body.classroom-screen .control-panel input[type="range"] {
  min-height: 34px;
}

body.classroom-screen .control-panel input[type="range"]::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
}

body.classroom-screen .result,
body.classroom-screen .notice,
body.classroom-screen .hint,
body.classroom-screen .formula-panel,
body.classroom-screen .fraction-readout {
  border-color: rgba(138, 213, 220, .42);
  color: var(--screen-ink);
  background: rgba(18, 43, 54, .94);
}

body.classroom-screen .result,
body.classroom-screen .notice,
body.classroom-screen .hint,
body.classroom-screen .question,
body.classroom-screen .fraction-readout {
  font-size: 16px;
  line-height: 1.7;
}

body.classroom-screen .answer,
body.classroom-screen .fraction-large,
body.classroom-screen #formulaText,
body.classroom-screen .step-value {
  color: #fff;
  text-shadow: 0 0 20px rgba(101, 226, 212, .24);
}

body.classroom-screen .svg-label,
body.classroom-screen .svg-small {
  fill: #e6f1f5;
}

body.classroom-screen .classroom-screen-toggle,
body.classroom-screen .fullscreen-button {
  border-color: rgba(138, 213, 220, .58);
  color: #f7fbfd;
  background: rgba(255, 255, 255, .08);
}

.lab:fullscreen {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #061018;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
  gap: 18px;
  align-content: center;
}

.lab:fullscreen .stage,
.lab:fullscreen .control-panel {
  margin: 0;
}

.lab:fullscreen .control-panel {
  position: static;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.lab:fullscreen .stage {
  min-height: min(760px, calc(100vh - 36px));
}

@media (min-width: 1400px) {
  body.classroom-screen .lab:not(:fullscreen) {
    width: min(1500px, calc(100% - 48px));
    grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  }
}

@media (max-width: 920px) {
  .lab:fullscreen {
    height: 100vh;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .lab:fullscreen .stage {
    min-height: auto;
  }

  .lab:fullscreen .control-panel {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .stage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-title {
    width: 100%;
  }

  .stage-actions {
    width: 100%;
    flex: 0 0 auto;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .stage-actions .stage-meta {
    flex: 1 0 100%;
    margin: 0;
    text-align: left;
  }

  .classroom-screen-toggle {
    min-width: 0;
    flex: 1 1 auto;
  }

  body.classroom-screen .stage-title {
    font-size: 16px;
  }

  body.classroom-screen .stage-meta {
    font-size: 14px;
  }

  .lab:fullscreen {
    padding: 10px;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .classroom-screen-toggle,
  .fullscreen-button {
    transition: none;
  }
}
