:root {
  color-scheme: light;
  --bg: #d9d4cb;
  --surface: #ece8df;
  --surface-raised: #f8f5ed;
  --surface-deep: #ded9d0;
  --metal: #e6e1d8;
  --metal-hi: #b9b3a9;
  --line: #c8c2b8;
  --line-soft: #d7d1c8;
  --paper: #eee7dc;
  --ink: #272723;
  --muted: #6d6a64;
  --muted-dark: #918c83;
  --accent: #79d9ba;
  --accent-bright: #9aebd0;
  --accent-dim: rgba(121, 217, 186, 0.2);
  --lime: #79d9ba;
  --lime-dim: rgba(121, 217, 186, 0.2);
  --blue: #3e756c;
  --blue-dim: rgba(62, 117, 108, 0.14);
  --mauve: #d77d72;
  --mauve-dim: rgba(215, 125, 114, 0.14);
  --control-height: 48px;
  --control-gap: 8px;
  --font-control: 11px;
  --font-meta: 9px;
  --danger: #c5524e;
  --radius: 14px;
  --shadow-raised: -5px -5px 11px rgba(255, 255, 255, 0.78), 7px 9px 18px rgba(72, 66, 57, 0.2);
  --shadow-small: -2px -2px 5px rgba(255, 255, 255, 0.84), 3px 4px 8px rgba(72, 66, 57, 0.2);
  --shadow-inset: inset 3px 4px 8px rgba(84, 77, 66, 0.18), inset -3px -3px 7px rgba(255, 255, 255, 0.78);
  --display: "Avenir Next", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -12%, rgba(0, 68, 255, 0.12), transparent 29%),
    radial-gradient(circle at 82% -18%, rgba(255, 69, 2, 0.1), transparent 30%),
    linear-gradient(rgba(0, 68, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 68, 255, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 48px 48px, 48px 48px, auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button,
label,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.page-noise {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 136px;
  padding: 29px clamp(18px, 3vw, 48px) 24px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 69, 2, 0.055), transparent 30%),
    rgba(8, 9, 8, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.site-header::before {
  position: absolute;
  top: 15px;
  right: clamp(18px, 3vw, 48px);
  left: clamp(18px, 3vw, 48px);
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--accent) 0 72px,
    var(--line) 72px 72%,
    var(--blue) 72% 82%,
    var(--mauve) 82% 90%,
    var(--lime) 90% 100%
  );
  content: "";
}

.site-header::after {
  position: absolute;
  right: clamp(18px, 3vw, 48px);
  bottom: -1px;
  width: min(24vw, 320px);
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent) 20% 100%);
  box-shadow: 0 0 20px rgba(255, 69, 2, 0.24);
  content: "";
}

.brand-block {
  display: flex;
  width: clamp(357px, 44.5vw, 491px);
  flex: 0 0 clamp(357px, 44.5vw, 491px);
  align-items: center;
  gap: 17px;
}

.brand-block > div {
  width: calc(100% - 71px);
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 2px solid var(--accent);
  background:
    linear-gradient(90deg, transparent 45%, var(--accent) 45%, var(--accent) 55%, transparent 55%),
    linear-gradient(transparent 45%, var(--accent) 45%, var(--accent) 55%, transparent 55%),
    var(--surface-deep);
  box-shadow: 0 0 0 5px rgba(255, 69, 2, 0.035), 0 0 32px rgba(255, 69, 2, 0.12);
  transform: rotate(45deg);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span::before,
.brand-mark span::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
  content: "";
}

.brand-mark::before { left: 5px; top: 5px; }
.brand-mark::after { right: 5px; top: 5px; }
.brand-mark span::before { left: 5px; bottom: 5px; }
.brand-mark span::after { right: 5px; bottom: 5px; }

.eyebrow,
.subtitle,
.monitor-head p,
.module-note,
.workbench-footer p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-shadow: 0 0 14px rgba(255, 69, 2, 0.3);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(29px, 4vw, 50px);
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 0.9;
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.system-status {
  display: grid;
  width: 198px;
  flex: 0 0 198px;
  grid-template-columns: 8px 180px;
  align-items: center;
  gap: 10px;
  padding-bottom: 2px;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-align: left;
}

.header-tools {
  display: grid;
  width: 288px;
  flex: 0 0 288px;
  grid-template-columns: 72px 198px;
  align-items: center;
  gap: 18px;
}

.language-toggle {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  justify-self: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--mauve);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.language-toggle::before {
  position: absolute;
  z-index: -1;
  inset: 5px;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: radial-gradient(circle, var(--blue-dim), transparent 70%), var(--surface-deep);
  box-shadow: 0 0 12px rgba(0, 68, 255, 0.22);
  content: "";
}

.language-toggle:hover {
  color: #000;
  background: transparent;
  box-shadow: none;
}

.language-toggle:hover::before {
  border-color: var(--lime);
  background: var(--lime);
  box-shadow: 0 0 16px rgba(194, 255, 1, 0.3);
}

.system-status div {
  display: grid;
  width: 180px;
  min-width: 0;
}

.system-status small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 15px rgba(194, 255, 1, 0.62);
  animation: status-pulse 2.8s ease-in-out infinite;
}

main {
  position: relative;
  z-index: 1;
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 2.7vw, 42px);
}

.stage-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 28px);
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 17%),
    var(--surface-deep);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.018),
    0 28px 80px rgba(0, 0, 0, 0.3);
  animation: machine-wake 700ms both;
}

.frame-toolbar {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto repeat(4, minmax(92px, 1fr));
  align-items: stretch;
  gap: 1px;
  padding: 0 4px;
  background: var(--line);
}

.frame-toolbar > span,
.frame-toolbar button {
  min-height: 42px;
  border: 0;
  background: var(--surface-deep);
  color: var(--muted);
  font: 700 9px var(--mono);
  letter-spacing: 0.1em;
}

.frame-toolbar > span {
  display: flex;
  min-width: 72px;
  align-items: center;
  padding: 0 14px;
  color: var(--accent);
}

.frame-toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.frame-toolbar button b {
  color: var(--ink);
  font-size: 11px;
}

.frame-toolbar button small {
  color: var(--muted-dark);
  font-size: 8px;
}

.frame-toolbar button.is-active {
  color: var(--lime);
  background: rgba(194, 255, 1, 0.075);
  box-shadow: inset 0 -2px var(--lime);
}

.frame-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.monitor {
  position: relative;
  min-width: 0;
  animation: panel-in 600ms both;
}

.monitor-output {
  animation-delay: 80ms;
}

.monitor-head {
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 6px 11px;
  border-top: 0;
  border-bottom: 1px solid var(--line-soft);
}

.monitor-head > div {
  display: grid;
  min-width: 0;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 10px;
}

.monitor-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(18px, 2vw, 25px);
  letter-spacing: 0.08em;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.65);
}

.monitor-head p {
  min-width: 0;
  grid-column: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-index {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.machine-tag {
  min-width: 108px;
  padding: 6px 8px;
  border: 1px solid var(--metal-hi);
  color: var(--muted);
  background: linear-gradient(180deg, var(--metal), #10110f);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.monitor-source .machine-tag {
  border-color: var(--blue);
  color: var(--mauve);
}

.monitor-output .machine-tag {
  border-color: var(--lime);
  color: var(--lime);
}

.canvas-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--metal-hi);
  border-radius: var(--radius);
  background: #080908;
  box-shadow:
    inset 0 0 0 8px #0a0b0a,
    inset 0 0 0 9px rgba(255, 255, 255, 0.045),
    0 22px 55px rgba(0, 0, 0, 0.44),
    0 0 0 5px #11120f;
}

.monitor-source .canvas-frame {
  box-shadow:
    inset 0 0 0 8px #0a0b0a,
    inset 0 0 0 9px rgba(255, 255, 255, 0.045),
    0 22px 55px rgba(0, 0, 0, 0.44),
    0 0 0 5px #11120f,
    -10px 0 36px rgba(0, 68, 255, 0.11);
}

.canvas-frame::before,
.canvas-frame::after {
  position: absolute;
  z-index: 2;
  width: 28px;
  height: 28px;
  pointer-events: none;
  content: "";
}

.canvas-frame::before {
  top: 8px;
  left: 8px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  filter: drop-shadow(0 0 4px rgba(255, 69, 2, 0.38));
}

.monitor-source .canvas-frame::before {
  border-top-color: var(--blue);
  border-left-color: var(--blue);
  filter: drop-shadow(0 0 5px rgba(0, 68, 255, 0.48));
}

.monitor-source .canvas-frame::after {
  border-right-color: var(--blue);
  border-bottom-color: var(--blue);
  filter: drop-shadow(0 0 5px rgba(0, 68, 255, 0.48));
}

.canvas-frame::after {
  right: 8px;
  bottom: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  filter: drop-shadow(0 0 4px rgba(255, 69, 2, 0.38));
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

#sourceCanvas {
  cursor: grab;
  touch-action: none;
}

#sourceCanvas:active {
  cursor: grabbing;
}

#sourceCanvas:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -4px;
}

.canvas-coordinate {
  position: absolute;
  z-index: 3;
  color: rgba(255, 255, 255, 0.3);
  font-size: 8px;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.coordinate-top {
  top: 12px;
  right: 15px;
}

.coordinate-side {
  right: 7px;
  bottom: 50%;
  transform: rotate(90deg) translateX(50%);
  transform-origin: right bottom;
}

.canvas-status {
  position: absolute;
  z-index: 3;
  right: 13px;
  bottom: 12px;
  left: 13px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.54);
  font-size: 8px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.output-stamp {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 18px;
  padding: 5px 8px;
  border: 1px solid rgba(16, 16, 16, 0.38);
  color: rgba(16, 16, 16, 0.5);
  font-size: 9px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 11px;
  border: 1px solid var(--line);
  background: var(--surface-deep);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.22);
}

.quick-actions .button {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.quick-actions .button:last-child {
  border-right: 0;
}

.quick-actions .button > span:first-child {
  text-align: center;
}

.output-actions {
  grid-template-columns: 0.8fr 1fr 1.2fr;
}

.button-record.is-recording {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(255, 69, 2, 0.11);
  box-shadow: inset 0 0 24px rgba(255, 69, 2, 0.08);
}

.button {
  min-height: var(--control-height);
  padding: 0 13px;
  border: 1px solid var(--metal-hi);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--font-control);
  font-weight: 650;
  letter-spacing: 0.035em;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
  background-color: rgba(255, 69, 2, 0.07);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:focus-visible,
.language-toggle:focus-visible,
.segmented button:focus-visible,
.segmented input:focus-visible + span,
input[type="range"]:focus-visible,
input[type="color"]:focus-visible,
.check-control input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.language-toggle:focus-visible {
  outline: 0;
}

.language-toggle:focus-visible::before {
  outline: 2px solid var(--mauve);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.button-quiet {
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--surface);
}

.button-accent {
  border-color: var(--accent);
  color: #140b08;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: 0 0 24px rgba(255, 69, 2, 0.12), inset 0 1px rgba(255, 255, 255, 0.22);
}

.button-accent:hover:not(:disabled) {
  border-color: var(--accent-bright);
  background: var(--accent-bright);
}

.button-full {
  width: 100%;
  color: var(--ink);
  background: transparent;
}

.source-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--line);
}

.source-buttons .button {
  border: 0;
  border-radius: 0;
  text-align: left;
}

.source-buttons .button + .button {
  border-left: 1px solid var(--line);
}

.button-cutout {
  border-color: rgba(255, 69, 2, 0.58);
  color: var(--accent-bright);
}

.button-cutout[aria-pressed="true"] {
  border-color: var(--accent);
  color: #140b08;
  background: var(--accent);
}

.control-deck {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr 1.28fr;
  margin-top: clamp(28px, 4vw, 58px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28px),
    rgba(12, 13, 12, 0.94);
  box-shadow: 0 26px 65px rgba(0, 0, 0, 0.32), inset 0 1px rgba(255, 255, 255, 0.025);
}

.control-module {
  position: relative;
  min-width: 0;
  min-height: 316px;
  padding: 25px clamp(15px, 1.8vw, 27px) 23px;
  border-right: 1px solid var(--line);
  animation: panel-in 600ms 140ms both;
  isolation: isolate;
}

.control-module:last-child {
  border-right: 0;
}

.control-module::before {
  position: absolute;
  top: -1px;
  left: 0;
  width: 42px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 69, 2, 0.28);
  content: "";
}

.control-module::after {
  position: absolute;
  z-index: -1;
  top: 8px;
  right: 13px;
  color: rgba(255, 255, 255, 0.026);
  font-family: var(--display);
  font-size: 66px;
  font-weight: 800;
  line-height: 1;
  content: "01";
  pointer-events: none;
}

.control-module:nth-child(2)::after { content: "02"; }
.control-module:nth-child(3)::after { content: "03"; }
.control-module:nth-child(4)::after { content: "04"; }

.control-module:nth-child(2)::before { background: var(--lime); box-shadow: 0 0 12px rgba(194, 255, 1, 0.28); }
.control-module:nth-child(3)::before { background: var(--blue); box-shadow: 0 0 12px rgba(0, 68, 255, 0.32); }
.control-module:nth-child(4)::before { background: var(--mauve); box-shadow: 0 0 12px rgba(220, 184, 255, 0.28); }

.control-module:nth-child(2)::after { color: rgba(194, 255, 1, 0.035); }
.control-module:nth-child(3)::after { color: rgba(0, 68, 255, 0.07); }
.control-module:nth-child(4)::after { color: rgba(220, 184, 255, 0.055); }

.module-head {
  min-height: 48px;
  margin-bottom: 17px;
}

.module-head span {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.control-module:nth-child(2) .module-head span { color: var(--lime); }
.control-module:nth-child(3) .module-head span { color: var(--blue); }
.control-module:nth-child(4) .module-head span { color: var(--mauve); }

.module-head h3 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.08em;
}

.upload-zone {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 103px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid var(--accent);
  cursor: pointer;
  color: var(--ink);
  background:
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 69, 2, 0.065) 18px 19px),
    #0e0f0e;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.38);
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.upload-zone::after {
  position: absolute;
  right: -21px;
  bottom: -21px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--accent);
  content: "";
  transform: rotate(45deg);
}

.upload-zone:hover,
.upload-zone:focus-within,
.upload-zone.is-dragging {
  border-color: var(--accent);
  background-color: rgba(255, 69, 2, 0.055);
  box-shadow: inset 0 0 35px rgba(255, 69, 2, 0.07), 0 0 20px rgba(255, 69, 2, 0.08);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.upload-icon {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 23px;
  font-weight: 200;
  line-height: 1;
}

.upload-zone > span:not(.upload-icon) {
  font-size: var(--font-control);
}

.upload-zone small {
  margin-top: 5px;
  color: var(--muted-dark);
  font-size: var(--font-meta);
  letter-spacing: 0.06em;
}

.layer-edit-bar {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
  margin-top: 8px;
}

.selection-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.selection-mode button,
.rotation-control {
  min-height: 48px;
}

.rotation-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  padding: 6px 9px;
  border: 1px solid var(--metal-hi);
  color: var(--muted);
  background: #0f100f;
  font-size: var(--font-meta);
}

.rotation-control output {
  color: var(--accent);
  font: 9px var(--mono);
}

.rotation-control input[type="range"] {
  height: 12px;
  grid-column: 1 / -1;
}

.layer-list {
  display: grid;
  max-height: 102px;
  gap: 4px;
  margin-top: 8px;
  overflow: auto;
}

.layer-list:empty {
  display: none;
}

.layer-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) repeat(3, 28px);
  border: 1px solid var(--line);
  background: #0f100f;
}

.layer-row button {
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  overflow: hidden;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: 9px var(--mono);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.layer-row.is-active {
  border-color: var(--accent);
  box-shadow: inset 2px 0 var(--accent);
}

.layer-row.is-selected:not(.is-active) {
  border-color: var(--lime);
  box-shadow: inset 2px 0 var(--lime);
}

.layer-row.is-active button:first-child {
  color: var(--ink);
}

.layer-row .layer-remove {
  border-left: 1px solid var(--line);
  color: var(--accent);
  text-align: center;
}

.layer-row .layer-order {
  padding: 0;
  border-left: 1px solid var(--line);
  color: var(--lime);
  text-align: center;
}

.layer-row .layer-order:disabled {
  color: var(--muted-dark);
  cursor: not-allowed;
  opacity: 0.35;
}

.module-note {
  margin-top: 11px;
  color: var(--muted-dark);
  font-size: 10px;
  line-height: 1.55;
}

.scan-module {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
}

.button-scan {
  display: flex;
  width: clamp(280px, 30vw, 320px);
  min-height: 0;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  place-self: center;
  margin: 0;
  padding: 18px;
  border-radius: 50%;
  border-color: var(--lime);
  color: #000;
  background: var(--lime);
  box-shadow: 0 0 22px rgba(194, 255, 1, 0.14), inset 0 1px rgba(255, 255, 255, 0.32);
  text-align: center;
}

.button-scan:hover:not(:disabled) {
  border-color: var(--lime);
  color: #000;
  background: var(--lime);
}

.button-scan.is-running {
  border-color: var(--lime);
  color: var(--lime);
  background: transparent;
  box-shadow: inset 0 0 26px rgba(194, 255, 1, 0.07), 0 0 20px rgba(194, 255, 1, 0.08);
}

.play-icon {
  font-size: 13px;
}

.range-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  color: var(--muted);
  font-size: var(--font-control);
}

.range-control output {
  color: var(--accent);
  font-family: var(--mono);
  font-size: var(--font-control);
}

#scanState {
  color: var(--lime);
}

input[type="range"] {
  width: 100%;
  height: 18px;
  grid-column: 1 / -1;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, var(--accent-dim), #3a3b36 34%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -6px;
  appearance: none;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: #3a3b36;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0;
  padding-top: 11px;
  border-top: 0;
  color: var(--muted-dark);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--control-gap);
}

.segmented-direction label {
  position: relative;
}

.segmented-direction {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-direction input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-direction label > span,
.segmented button {
  display: flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--metal-hi);
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent), #0f100f;
  cursor: pointer;
  font-size: var(--font-control);
  font-weight: 650;
  letter-spacing: 0.035em;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.segmented-direction label > span {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-rows: auto auto;
  justify-items: start;
  gap: 2px 7px;
  padding: 8px 9px;
}

.segmented-direction label > span > b {
  grid-row: 1 / 3;
  align-self: center;
}

.segmented-direction label > span > [data-i18n],
.segmented-direction label > span > small {
  grid-column: 2;
  line-height: 1;
  white-space: nowrap;
}

.segmented-direction span b {
  color: var(--blue);
  font-size: 16px;
}

.segmented small {
  color: var(--muted-dark);
  font-size: var(--font-meta);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.segmented-direction input:checked + span,
.segmented button.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 69, 2, 0.12), rgba(255, 69, 2, 0.045));
  box-shadow: inset 0 -2px var(--accent), 0 0 16px rgba(255, 69, 2, 0.05);
}

.segmented-direction input:checked + span {
  border-color: var(--blue);
  background: linear-gradient(180deg, var(--blue-dim), rgba(0, 68, 255, 0.045));
  box-shadow: inset 0 -2px var(--blue), 0 0 16px rgba(0, 68, 255, 0.12);
}

.segmented-direction input:disabled + span {
  cursor: not-allowed;
  opacity: 0.35;
}

.direction-tuning {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.direction-settings {
  display: grid;
  grid-template-columns: 38px repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 68, 255, 0.035);
}

.direction-reverse {
  align-self: center;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(0, 68, 255, 0.5);
  color: var(--blue);
  background: rgba(0, 68, 255, 0.06);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.direction-reverse[aria-pressed="true"] {
  color: var(--ink);
  background: var(--blue-dim);
}

.direction-reverse:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.direction-settings label {
  display: grid;
  min-width: 0;
  grid-template-columns: 1fr auto;
  gap: 3px 6px;
  color: var(--muted-dark);
  font-size: 8px;
}

.direction-settings output {
  color: var(--mauve);
  font: 8px var(--mono);
}

.direction-settings input[type="range"] {
  height: 12px;
}

.direction-settings input[type="range"]::-webkit-slider-thumb {
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.direction-settings input[type="range"]::-moz-range-thumb {
  background: var(--blue);
}

.mode-switch button {
  min-height: var(--control-height);
  padding: 0 6px;
  justify-content: space-between;
  text-align: left;
}

.mode-switch button.is-active {
  border-color: var(--mauve);
  color: var(--ink);
  background: linear-gradient(180deg, var(--mauve-dim), rgba(220, 184, 255, 0.045));
  box-shadow: inset 0 -2px var(--mauve), 0 0 16px rgba(220, 184, 255, 0.1);
}

.color-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: var(--font-control);
}

.color-value {
  display: flex;
  align-items: center;
  gap: 7px;
}

.color-value i {
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid #fff;
  background: var(--paper);
}

.color-value code {
  color: var(--mauve);
  font: 9px var(--mono);
}

input[type="color"] {
  position: absolute;
  right: 0;
  width: 70px;
  height: 25px;
  opacity: 0;
  cursor: pointer;
}

.range-control.compact {
  margin-top: 12px;
}

.texture-module .range-control output {
  color: var(--mauve);
}

#noiseRange::-webkit-slider-thumb {
  background: var(--mauve);
  box-shadow: 0 0 0 1px var(--mauve);
}

#noiseRange::-moz-range-thumb {
  background: var(--mauve);
}

.check-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--font-control);
}

.check-control input {
  position: absolute;
  opacity: 0;
}

.check-control > span:first-of-type {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line);
  background: #0d0e0d;
}

.check-label {
  width: auto;
  height: auto;
}

.check-control input:checked + span {
  border-color: var(--mauve);
  background: var(--mauve);
}

.check-control input:checked + span::after {
  position: absolute;
  top: 1px;
  left: 3px;
  width: 4px;
  height: 7px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  content: "";
  transform: rotate(45deg);
}

.workbench-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(0, 68, 255, 0.075), transparent 22%),
    rgba(7, 8, 7, 0.72);
  color: var(--muted);
  font-size: 10px;
}

.workbench-footer p {
  display: flex;
  align-items: baseline;
  min-height: 18px;
  line-height: 1.4;
}

.workbench-footer p:first-child span {
  margin-right: 8px;
  color: var(--accent);
}

#message {
  justify-content: flex-end;
  max-width: 46%;
  color: var(--ink);
  text-align: right;
  letter-spacing: 0.02em;
}

#message[data-type="error"] {
  color: var(--danger);
}

#message[data-type="success"] {
  color: var(--accent-bright);
}

body.is-dragging .monitor-source .canvas-frame,
body.is-dragging .upload-zone {
  border-color: var(--accent);
}

/* Physical copy-console skin: the existing controls stay intact; only their housing changes. */
body {
  background:
    radial-gradient(circle at 50% -18%, rgba(255, 255, 255, 0.9), transparent 42%),
    linear-gradient(rgba(68, 65, 58, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 65, 58, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 32px 32px, 32px 32px, auto;
  font-family: var(--display);
}

.page-noise {
  z-index: 0;
  opacity: 0.035;
  mix-blend-mode: multiply;
}

.site-header {
  width: min(1680px, calc(100% - 32px));
  min-height: 132px;
  margin: 18px auto 0;
  padding: 34px clamp(22px, 3vw, 48px) 25px;
  border: 1px solid rgba(157, 150, 139, 0.72);
  border-radius: 26px;
  background: linear-gradient(145deg, #fffdf7, #e8e3da);
  box-shadow: var(--shadow-raised), inset 0 1px rgba(255, 255, 255, 0.9);
}

.site-header::before {
  top: 14px;
  height: 9px;
  background:
    repeating-linear-gradient(90deg, rgba(56, 55, 51, 0.35) 0 1px, transparent 1px 20px),
    linear-gradient(var(--line), var(--line)) 0 8px / 100% 1px no-repeat;
}

.site-header::after {
  right: 34px;
  bottom: 17px;
  width: 96px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent-bright);
  box-shadow: 0 0 15px rgba(121, 217, 186, 0.9);
}

.brand-mark {
  border: 1px solid #aaa49b;
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent 45%, #4f4d47 45% 55%, transparent 55%),
    linear-gradient(transparent 45%, #4f4d47 45% 55%, transparent 55%),
    linear-gradient(145deg, #fffdf7, #d8d3ca);
  box-shadow: var(--shadow-small);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span::before,
.brand-mark span::after {
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 1px 1px 2px rgba(37, 91, 74, 0.25), 0 0 6px rgba(121, 217, 186, 0.55);
}

.eyebrow {
  color: #4d7168;
  text-shadow: none;
}

h1,
.monitor-head h2 {
  text-shadow: 0 1px rgba(255, 255, 255, 0.85);
}

.language-toggle::before {
  border-color: #b9b3aa;
  background: linear-gradient(145deg, #fffdf7, #ddd8cf);
  box-shadow: var(--shadow-small);
}

.language-toggle:hover::before,
.language-toggle:focus-visible::before {
  border-color: var(--accent);
  background: var(--accent-bright);
  box-shadow: 0 0 0 4px rgba(121, 217, 186, 0.2), var(--shadow-small);
}

.system-status {
  color: var(--ink);
}

.status-light {
  border: 1px solid #579c84;
  background: var(--accent-bright);
  box-shadow: 0 0 12px rgba(121, 217, 186, 0.85), inset 0 1px rgba(255, 255, 255, 0.8);
}

main {
  width: min(1680px, 100%);
}

.stage-grid {
  gap: clamp(18px, 2vw, 30px);
  padding: 22px;
  border: 1px solid rgba(165, 158, 147, 0.75);
  border-radius: 28px;
  background:
    linear-gradient(rgba(70, 67, 61, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 67, 61, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, #f8f5ee, #ded9d0);
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: var(--shadow-raised), inset 0 1px rgba(255, 255, 255, 0.94);
}

.frame-toolbar {
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(170, 163, 153, 0.62);
  border-radius: 18px;
  background: #d9d4cb;
  box-shadow: var(--shadow-inset);
}

.frame-toolbar > span,
.frame-toolbar button {
  min-height: 45px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}

.frame-toolbar > span {
  color: #4e7068;
}

.frame-toolbar button {
  background: linear-gradient(145deg, #faf7f0, #ddd8cf);
  box-shadow: var(--shadow-small);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.frame-toolbar button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.frame-toolbar button:active:not(:disabled),
.frame-toolbar button.is-active {
  color: var(--ink);
  background: var(--accent-bright);
  box-shadow: inset 2px 3px 6px rgba(41, 108, 85, 0.2), inset -2px -2px 5px rgba(255, 255, 255, 0.55), 0 0 13px rgba(121, 217, 186, 0.42);
  transform: translateY(1px);
}

.frame-toolbar button b {
  color: var(--ink);
}

.monitor-head {
  border-bottom-color: rgba(172, 165, 154, 0.55);
}

.section-index {
  color: #4d7168;
}

.machine-tag {
  border-color: #aaa49a;
  border-radius: 999px;
  color: var(--muted);
  background: #ded9d0;
  box-shadow: var(--shadow-inset);
}

.monitor-source .machine-tag,
.monitor-output .machine-tag {
  border-color: #8abfad;
  color: #35685e;
}

.canvas-frame,
.monitor-source .canvas-frame {
  border: 8px solid #ddd8cf;
  border-radius: 20px;
  background: #cbc5bb;
  box-shadow: var(--shadow-inset), 0 12px 22px rgba(71, 64, 55, 0.18);
}

.monitor-source .canvas-frame {
  box-shadow: var(--shadow-inset), 0 12px 22px rgba(71, 64, 55, 0.18), 0 0 0 1px rgba(121, 217, 186, 0.35);
}

.canvas-frame::before,
.canvas-frame::after,
.monitor-source .canvas-frame::before,
.monitor-source .canvas-frame::after {
  border-color: var(--accent);
  filter: drop-shadow(0 0 5px rgba(121, 217, 186, 0.55));
}

#sourceCanvas:focus-visible {
  outline-color: var(--accent);
}

.quick-actions,
.source-buttons {
  gap: 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.quick-actions .button,
.quick-actions .button:last-child,
.source-buttons .button,
.source-buttons .button + .button {
  border: 1px solid #bcb5ab;
  border-radius: 12px;
}

.button,
.segmented button,
.segmented-direction label > span,
.direction-reverse {
  border-color: #bbb5ab;
  color: var(--ink);
  background: linear-gradient(145deg, #faf7f0, #ddd8cf);
  box-shadow: var(--shadow-small);
}

.button:hover:not(:disabled),
.segmented button:hover:not(:disabled),
.segmented-direction label:hover > span {
  border-color: #9ecdbd;
  color: var(--ink);
  background: linear-gradient(145deg, #fffdf7, #e4dfd6);
  transform: translateY(-1px);
}

.button:active:not(:disabled),
.segmented button:active:not(:disabled),
.direction-reverse:active:not(:disabled) {
  box-shadow: var(--shadow-inset);
  transform: translateY(1px);
}

.button-accent,
.button-cutout[aria-pressed="true"] {
  border-color: #75bfa7;
  color: #17382f;
  background: linear-gradient(145deg, #adf3dc, #69c9aa);
  box-shadow: -3px -3px 7px rgba(255, 255, 255, 0.84), 4px 6px 11px rgba(66, 106, 92, 0.28), inset 0 1px rgba(255, 255, 255, 0.66);
}

.button-accent:hover:not(:disabled) {
  border-color: #69b79f;
  background: linear-gradient(145deg, #b9f7e2, #70d2b2);
}

.button-quiet,
.button-full {
  color: var(--muted);
  background: linear-gradient(145deg, #f7f4ed, #ddd8cf);
}

.button-record.is-recording {
  border-color: var(--mauve);
  color: #7e302b;
  background: #efaaa3;
  box-shadow: inset 2px 3px 6px rgba(123, 47, 42, 0.18), 0 0 14px rgba(215, 125, 114, 0.32);
}

.control-deck {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.control-module {
  min-height: 360px;
  padding: 27px clamp(16px, 1.8vw, 28px) 24px;
  border: 1px solid rgba(165, 158, 147, 0.72);
  border-radius: 22px;
  background: linear-gradient(145deg, #f7f4ed, #e2ddd4);
  box-shadow: var(--shadow-raised), inset 0 1px rgba(255, 255, 255, 0.9);
}

.control-module:last-child {
  border-right: 1px solid rgba(165, 158, 147, 0.72);
}

.control-module::before,
.control-module:nth-child(2)::before,
.control-module:nth-child(3)::before,
.control-module:nth-child(4)::before {
  top: 16px;
  left: 18px;
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(121, 217, 186, 0.62);
}

.control-module::after,
.control-module:nth-child(2)::after,
.control-module:nth-child(3)::after,
.control-module:nth-child(4)::after {
  color: rgba(47, 46, 42, 0.045);
}

.module-head span,
.control-module:nth-child(2) .module-head span,
.control-module:nth-child(3) .module-head span,
.control-module:nth-child(4) .module-head span {
  color: #4d7168;
}

.upload-zone {
  border: 1px solid #aaa49a;
  border-radius: 18px;
  color: var(--ink);
  background:
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(61, 107, 95, 0.04) 18px 19px),
    #ded9d0;
  box-shadow: var(--shadow-inset);
}

.upload-zone::after {
  border-color: var(--accent);
}

.upload-zone:hover,
.upload-zone:focus-within,
.upload-zone.is-dragging {
  border-color: var(--accent);
  background-color: #e5e1d8;
  box-shadow: var(--shadow-inset), 0 0 0 4px rgba(121, 217, 186, 0.16), 0 0 18px rgba(121, 217, 186, 0.36);
}

.upload-icon {
  color: #4d8e7c;
}

.rotation-control,
.layer-row,
.direction-settings {
  border-color: #b9b3a9;
  color: var(--muted);
  background: #ded9d0;
  box-shadow: var(--shadow-inset);
}

.rotation-control {
  border-radius: 12px;
}

.layer-row {
  border-radius: 9px;
}

.layer-row.is-active {
  border-color: #61b596;
  box-shadow: inset 3px 0 var(--accent), var(--shadow-inset);
}

.layer-row.is-selected:not(.is-active) {
  border-color: var(--mauve);
  box-shadow: inset 3px 0 var(--mauve), var(--shadow-inset);
}

.layer-row .layer-remove,
.layer-row .layer-order {
  border-left-color: #c0baaf;
}

.scan-module {
  grid-template-rows: auto minmax(320px, 1fr) auto;
}

.button-scan {
  border: 1px solid #68b89f;
  color: #17382f;
  background: linear-gradient(145deg, #b6f5df, #69c9aa);
  box-shadow: -9px -9px 18px rgba(255, 255, 255, 0.88), 12px 15px 27px rgba(68, 95, 83, 0.27), inset 3px 4px 7px rgba(255, 255, 255, 0.52), inset -6px -7px 12px rgba(52, 134, 106, 0.18);
}

.button-scan:hover:not(:disabled) {
  border-color: #66b89e;
  color: #17382f;
  background: linear-gradient(145deg, #c3fae8, #71d0b0);
  transform: translateY(-2px);
}

.button-scan:active:not(:disabled),
.button-scan.is-running {
  border-color: #60ae94;
  color: #245a4b;
  background: #8ddbbf;
  box-shadow: inset 8px 10px 18px rgba(48, 112, 91, 0.25), inset -5px -5px 12px rgba(255, 255, 255, 0.42), 0 0 18px rgba(121, 217, 186, 0.55);
  transform: translateY(2px);
}

.progress-row {
  padding: 10px 12px;
  border: 1px solid #bbb5ab;
  border-radius: 999px;
  background: #dcd7ce;
  box-shadow: var(--shadow-inset);
}

.segmented {
  padding: 5px;
  border: 1px solid #b9b3a9;
  border-radius: 15px;
  background: #d7d2c9;
  box-shadow: var(--shadow-inset);
}

.segmented button,
.segmented-direction label > span {
  border-radius: 10px;
}

.segmented-direction input:checked + span,
.segmented button.is-active,
.mode-switch button.is-active {
  border-color: #72bca4;
  color: #17382f;
  background: var(--accent-bright);
  box-shadow: inset 2px 3px 5px rgba(46, 116, 92, 0.18), inset -2px -2px 4px rgba(255, 255, 255, 0.54), 0 0 10px rgba(121, 217, 186, 0.34);
}

.segmented-direction span b,
.direction-reverse,
.direction-settings output {
  color: #3e756c;
}

.direction-settings {
  border-radius: 13px;
}

.direction-reverse {
  border-radius: 9px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: #c6c0b6;
  box-shadow: inset 1px 2px 3px rgba(73, 67, 59, 0.25), inset -1px -1px rgba(255, 255, 255, 0.72);
}

input[type="range"]::-webkit-slider-thumb,
.direction-settings input[type="range"]::-webkit-slider-thumb,
#noiseRange::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 1px solid #72bca4;
  background: var(--accent-bright);
  box-shadow: -2px -2px 4px rgba(255, 255, 255, 0.9), 2px 3px 5px rgba(63, 83, 74, 0.3), inset 0 1px rgba(255, 255, 255, 0.6);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #c6c0b6;
}

input[type="range"]::-moz-range-thumb,
.direction-settings input[type="range"]::-moz-range-thumb,
#noiseRange::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-color: #72bca4;
  background: var(--accent-bright);
}

.range-control output,
.texture-module .range-control output,
.rotation-control output,
.color-value code {
  color: #3e756c;
}

.color-value i {
  border-color: #aaa49a;
  border-radius: 5px;
  box-shadow: var(--shadow-small);
}

.check-control > span:first-of-type {
  border-color: #aaa49a;
  border-radius: 5px;
  background: #ddd8cf;
  box-shadow: var(--shadow-inset);
}

.check-control input:checked + span {
  border-color: #68b89f;
  background: var(--accent-bright);
}

.workbench-footer {
  border-color: rgba(165, 158, 147, 0.7);
  border-radius: 18px;
  background: linear-gradient(145deg, #f4f1e9, #ded9d0);
  box-shadow: var(--shadow-small), inset 0 1px rgba(255, 255, 255, 0.88);
}

.workbench-footer p:first-child span,
#message[data-type="success"] {
  color: #3e756c;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes machine-wake {
  from {
    opacity: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0), 0 0 0 rgba(0, 0, 0, 0);
  }
  to {
    opacity: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.018), 0 28px 80px rgba(0, 0, 0, 0.3);
  }
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (max-width: 1120px) {
  .control-deck {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
  }

  .control-module {
    min-height: 360px;
  }
}

@media (max-width: 780px) {
  .site-header {
    min-height: 108px;
    align-items: center;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .system-status {
    display: none;
  }

  .header-tools {
    width: 72px;
    flex-basis: 72px;
    grid-template-columns: 72px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 10px;
  }

  .control-deck {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .frame-toolbar {
    grid-template-columns: repeat(4, 1fr);
  }

  .frame-toolbar > span {
    display: none;
  }

  .frame-toolbar button {
    min-width: 0;
    flex-direction: column;
    gap: 2px;
  }

  .control-module,
  .control-module:nth-child(2),
  .control-module:nth-child(3) {
    min-height: unset;
  }

  .workbench-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  #message {
    justify-content: flex-start;
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand-block {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .brand-block > div {
    width: auto;
    min-width: 0;
  }

  h1 {
    overflow: hidden;
    font-size: clamp(22px, 7vw, 28px);
    text-overflow: ellipsis;
  }

  .eyebrow {
    font-size: 7px;
  }

  .subtitle {
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  .language-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .header-tools {
    width: 42px;
    flex-basis: 42px;
    grid-template-columns: 42px;
  }

  main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .machine-tag {
    min-width: 94px;
    font-size: 8px;
  }

  .quick-actions {
    gap: 4px;
  }

  .button {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
