:root {
  color-scheme: dark;
  font-family: "Bahnschrift", "Aptos Narrow", "DIN Alternate", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #0a0c0f;
  --raised: #101419;
  --panel: #151a20;
  --line: #303740;
  --paper: #e7e1d5;
  --muted: #8c918f;
  --clay: #e9936b;
  --clay-deep: #b85f45;
  --mint: #a8dadc;
  --acid: #d7e45d;
  --danger: #ff7777;
  --mono: "Cascadia Code", "JetBrains Mono", "IBM Plex Mono", monospace;
  --shadow: 0 28px 90px rgb(0 0 0 / 34%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

code,
kbd {
  font-family: var(--mono);
}

[hidden] {
  display: none !important;
}

.ambient-grid {
  position: fixed;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(255 255 255 / 2.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2.5%) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.ambient-grid::after {
  position: absolute;
  content: "";
  inset: 0;
  opacity: 0.22;
  background:
    radial-gradient(circle at 14% 12%, rgb(233 147 107 / 30%), transparent 27rem),
    radial-gradient(circle at 84% 45%, rgb(168 218 220 / 13%), transparent 30rem);
}

.site-header {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(320px, 1.4fr) minmax(180px, 0.55fr);
  align-items: end;
  gap: 32px;
  width: min(1480px, calc(100% - 64px));
  margin: 0 auto;
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
}

.app-ready .site-header,
.app-ready .preview-column,
.app-ready .control-column {
  animation: enter-up 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.app-ready .preview-column {
  animation-delay: 80ms;
}

.app-ready .control-column {
  animation-delay: 150ms;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  color: var(--paper);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template: repeat(2, 10px) / repeat(2, 10px);
  gap: 3px;
  transform: rotate(-8deg);
}

.brand-mark i {
  background: var(--clay);
}

.brand-mark i:nth-child(2),
.brand-mark i:nth-child(3) {
  background: var(--clay-deep);
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0.13em;
}

.header-title p,
.eyebrow {
  margin: 0 0 7px;
  color: var(--clay);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.header-title h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 57px);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.header-title h1 em {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.system-status {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
}

.system-status span,
.signal {
  display: flex;
  align-items: center;
  gap: 7px;
}

.system-status i,
.signal i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 10px var(--acid);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(370px, 0.84fr) minmax(0, 1.16fr);
  gap: 28px;
  width: min(1480px, calc(100% - 64px));
  margin: 28px auto 80px;
}

.preview-column {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.control-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stage-panel,
.control-section,
.editor-section,
.runtime-note {
  border: 1px solid var(--line);
  background: rgb(16 20 25 / 95%);
  box-shadow: var(--shadow);
}

.stage-panel,
.control-section {
  position: relative;
}

.stage-panel::before,
.control-section::before {
  position: absolute;
  content: "";
  top: -1px;
  left: 24px;
  width: 72px;
  height: 2px;
  background: var(--clay);
}

.stage-panel {
  min-height: calc(100vh - 150px);
  padding: 18px;
}

.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 23px;
  color: #747c82;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.signal {
  color: var(--acid);
}

.stage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 10px 20px;
}

.stage-heading h2,
.section-title-row h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 39px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.pose-emoji {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--ink);
  font-size: 20px;
}

.stage-frame {
  position: relative;
  margin: 0 10px;
  padding: 22px 0 0 24px;
}

.axis {
  position: absolute;
  z-index: 1;
  color: #565e65;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  user-select: none;
}

.axis-x {
  top: 4px;
  right: 0;
  left: 24px;
  display: flex;
  justify-content: space-around;
}

.axis-y {
  top: 22px;
  bottom: 0;
  left: 2px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.axis-y span {
  writing-mode: vertical-rl;
}

.canvas-well {
  position: relative;
  display: grid;
  width: 100%;
  min-height: clamp(390px, 52vh, 620px);
  place-items: center;
  overflow: hidden;
  border: 1px solid #384049;
  background-color: #11161b;
  background-image:
    linear-gradient(45deg, #1b2128 25%, transparent 25%),
    linear-gradient(-45deg, #1b2128 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1b2128 75%),
    linear-gradient(-45deg, transparent 75%, #1b2128 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.canvas-well::before {
  position: absolute;
  content: "";
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 84px rgb(0 0 0 / 36%);
}

.canvas-well.has-background {
  background-image: none;
}

.mascot-canvas {
  z-index: 1;
  display: block;
  max-width: min(82%, 520px);
  max-height: min(78%, 500px);
  width: auto;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 24px 16px rgb(0 0 0 / 26%));
}

.app-ready .mascot-canvas {
  animation: mascot-pop 500ms 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.corner-mark {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-color: var(--clay);
}

.corner-mark--tl {
  top: 10px;
  left: 10px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.corner-mark--br {
  right: 10px;
  bottom: 10px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.stage-readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 10px 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.stage-readout > div {
  display: grid;
  gap: 5px;
  padding: 12px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stage-readout span {
  color: #667078;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.stage-readout strong {
  color: #c8c6be;
  font-family: var(--mono);
  font-size: 10px;
}

.runtime-note {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  box-shadow: none;
}

.runtime-note > span {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #4d5746;
  color: var(--acid);
}

.runtime-note strong {
  display: block;
  margin-bottom: 3px;
  color: #c0c990;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.runtime-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.control-section {
  padding: 22px;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-title-row > p {
  max-width: 240px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.expression-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.expression-button {
  position: relative;
  display: grid;
  grid-template: auto 1fr / auto 1fr;
  min-height: 99px;
  padding: 11px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0f1317;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.expression-button:hover {
  z-index: 1;
  background: #1b2127;
}

.expression-button.is-active {
  z-index: 2;
  background: var(--clay);
  color: #18110e;
  box-shadow: inset 0 0 0 1px var(--clay);
}

.expression-button.is-active::after {
  position: absolute;
  content: "";
  right: 7px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  background: #18110e;
}

.expression-index {
  color: #5c666d;
  font-family: var(--mono);
  font-size: 8px;
}

.expression-emoji {
  justify-self: end;
  font-size: 18px;
}

.expression-button > span:last-of-type {
  align-self: end;
  display: grid;
  grid-column: 1 / -1;
}

.expression-button strong,
.palette-button strong {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.expression-button small {
  margin-top: 2px;
  color: #788087;
  font-size: 10px;
}

.expression-button.is-active .expression-index,
.expression-button.is-active small {
  color: rgb(24 17 14 / 60%);
}

.custom-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 8px var(--acid);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.palette-button {
  display: grid;
  min-width: 0;
  min-height: 94px;
  padding: 10px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0f1317;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.palette-button:hover,
.palette-button.is-active {
  background: #1c2228;
}

.palette-button.is-active {
  box-shadow: inset 0 -2px var(--clay);
}

.palette-code {
  color: #647078;
  font-family: var(--mono);
  font-size: 8px;
}

.palette-swatches {
  display: flex;
  align-self: end;
  margin: 14px 0 8px;
}

.palette-swatches i {
  width: 13px;
  height: 16px;
  border: 1px solid rgb(255 255 255 / 8%);
}

.palette-button strong {
  overflow: hidden;
  color: #b2b5b0;
  font-size: 9px;
  text-overflow: ellipsis;
}

.color-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--line);
}

.color-field {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: var(--raised);
  color: #788087;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.color-field > span:last-child,
.background-field {
  display: flex;
  align-items: center;
  gap: 9px;
}

input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #586169;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
}

.color-field code,
.background-field code {
  overflow: hidden;
  color: #c0c2bd;
  font-size: 10px;
  text-overflow: ellipsis;
}

.render-title output {
  color: var(--clay);
  font-family: var(--mono);
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
}

.range-wrap {
  padding: 4px 2px 0;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 12px 0;
  border-radius: 0;
  outline: none;
  background: #3d464d;
  accent-color: var(--clay);
  cursor: ew-resize;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: var(--clay);
  box-shadow: 0 0 0 4px var(--raised);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: var(--clay);
  box-shadow: 0 0 0 4px var(--raised);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: #566068;
  font-family: var(--mono);
  font-size: 7px;
}

.background-control {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.switch-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 26px;
  border: 1px solid #465058;
  background: #0d1014;
}

.switch-track i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  background: #5c656b;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease;
}

.switch-label input:checked + .switch-track {
  border-color: var(--clay);
}

.switch-label input:checked + .switch-track i {
  background: var(--clay);
  transform: translateX(22px);
}

.switch-label input:focus-visible + .switch-track {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.switch-label > span:last-child {
  display: grid;
}

.switch-label strong {
  font-size: 13px;
  font-weight: 600;
}

.switch-label small {
  margin-top: 2px;
  color: #747d83;
  font-size: 10px;
}

.background-field {
  padding: 7px 9px;
  border: 1px solid var(--line);
  color: #737d84;
  font-family: var(--mono);
  font-size: 8px;
}

.background-field input {
  width: 26px;
  height: 26px;
}

.editor-section {
  overflow: hidden;
  box-shadow: none;
}

.editor-section.is-open {
  border-color: #4c5148;
}

.editor-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border: 0;
  background: var(--raised);
  cursor: pointer;
}

.editor-toggle:hover {
  background: #181e24;
}

.editor-toggle > span {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.editor-toggle > span > span:last-child {
  display: grid;
  gap: 3px;
}

.section-index,
.editor-toggle > i {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--clay);
  font-family: var(--mono);
  font-size: 9px;
}

.editor-toggle strong {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
}

.editor-toggle small {
  color: #6d767c;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
}

.editor-toggle > i {
  font-size: 20px;
  font-style: normal;
}

.pixel-editor {
  border-top: 1px solid var(--line);
  background: #0d1115;
}

.editor-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.paint-tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: #151a20;
  color: #999d98;
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}

.paint-tool.is-active {
  border-color: var(--clay);
  color: var(--paper);
  box-shadow: inset 0 -2px var(--clay);
}

.paint-tool kbd {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  background: #262d33;
  color: #747d84;
  font-size: 7px;
}

.tool-swatch {
  width: 15px;
  height: 15px;
  border: 1px solid rgb(255 255 255 / 15%);
}

.tool-swatch.is-eraser {
  background:
    linear-gradient(45deg, #343b42 25%, transparent 25%) 0 0 / 6px 6px,
    linear-gradient(45deg, transparent 75%, #343b42 75%) 0 0 / 6px 6px;
}

.editor-actions {
  display: flex;
  gap: 7px;
}

.text-button,
.commit-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #171c22;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.commit-button {
  border-color: var(--clay);
  background: var(--clay);
  color: #17100d;
  font-weight: 800;
}

.text-button:disabled,
.commit-button:disabled {
  border-color: #2a3036;
  background: #12171b;
  color: #4b5358;
}

.editor-scroll {
  max-width: 100%;
  padding: 18px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.editor-grid {
  --cell-size: 27px;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), var(--cell-size));
  width: max-content;
  padding: 5px;
  border: 1px solid #394149;
  background:
    linear-gradient(45deg, #191f25 25%, transparent 25%) 0 0 / 10px 10px,
    linear-gradient(45deg, transparent 75%, #191f25 75%) 0 0 / 10px 10px,
    #11161b;
  touch-action: none;
}

.pixel-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  border: 0.5px solid rgb(255 255 255 / 7%);
  border-radius: 0;
  cursor: crosshair;
}

.pixel-cell.is-empty {
  background: transparent;
}

.pixel-cell:hover,
.pixel-cell:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--mint);
  outline-offset: -2px;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: #606a71;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.draft-status {
  color: #788078;
}

.draft-status.is-dirty {
  color: var(--clay);
}

.export-section {
  margin-top: 12px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.export-grid > button {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0f1317;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.export-grid > button:hover:not(:disabled) {
  position: relative;
  z-index: 1;
  background: #20272d;
  transform: translateY(-2px);
}

.export-grid > button.is-success {
  background: #202817;
}

.export-grid > button > span:first-child {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #444e55;
  color: var(--clay);
  font-family: var(--mono);
  font-size: 12px;
}

.export-grid > button.is-busy > span:first-child {
  color: var(--mint);
  animation: blink 700ms infinite alternate;
}

.export-grid > button.is-success > span:first-child {
  border-color: var(--acid);
  color: var(--acid);
}

.export-grid > button > span:last-child {
  display: grid;
  min-width: 0;
}

.export-grid strong {
  font-size: 12px;
  font-weight: 600;
}

.export-grid small {
  margin-top: 4px;
  overflow: hidden;
  color: #68727a;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
}

.export-hint {
  margin: 14px 0 0;
  color: #687178;
  font-size: 11px;
  line-height: 1.5;
}

.export-hint code {
  color: #aaaca7;
  font-size: 10px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1480px, calc(100% - 64px));
  margin: 0 auto;
  padding: 20px 0 32px;
  border-top: 1px solid var(--line);
  color: #586168;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.site-footer a {
  color: #999e98;
  text-decoration: none;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  display: flex;
  max-width: min(390px, calc(100vw - 32px));
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border: 1px solid #66723d;
  background: #1b2214;
  color: #dbe2b9;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: #7d3a3a;
  background: #2a1717;
  color: #ffc8c8;
}

.toast > span:first-child {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid currentColor;
}

.noscript {
  position: fixed;
  z-index: 100;
  inset: auto 16px 16px;
  padding: 14px;
  border: 1px solid var(--danger);
  background: #2a1717;
  color: #ffc8c8;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

@keyframes enter-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mascot-pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes blink {
  to {
    opacity: 0.35;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  }

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

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

  .export-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-readout {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr auto;
    width: min(100% - 36px, 720px);
    gap: 26px;
    padding-top: 28px;
  }

  .header-title {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .system-status {
    align-self: center;
  }

  .workspace {
    grid-template-columns: 1fr;
    width: min(100% - 36px, 720px);
  }

  .preview-column {
    position: static;
  }

  .stage-panel {
    min-height: auto;
  }

  .canvas-well {
    min-height: min(70vw, 520px);
  }

  .site-footer {
    flex-wrap: wrap;
    width: min(100% - 36px, 720px);
  }
}

@media (max-width: 560px) {
  .site-header,
  .workspace,
  .site-footer {
    width: calc(100% - 24px);
  }

  .site-header {
    gap: 18px;
    padding-top: 20px;
  }

  .system-status span:last-child {
    display: none;
  }

  .header-title h1 {
    font-size: 36px;
  }

  .workspace {
    margin-top: 14px;
  }

  .stage-panel,
  .control-section {
    padding: 15px;
  }

  .stage-heading,
  .stage-frame,
  .stage-readout {
    margin-right: 0;
    margin-left: 0;
  }

  .canvas-well {
    min-height: 330px;
  }

  .section-title-row {
    align-items: flex-start;
  }

  .section-title-row > p {
    display: none;
  }

  .expression-grid,
  .palette-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .palette-button {
    min-height: 82px;
  }

  .color-fields {
    grid-template-columns: 1fr;
  }

  .background-control,
  .editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .background-field {
    width: 100%;
  }

  .editor-actions > button {
    flex: 1;
  }

  .editor-grid {
    --cell-size: 23px;
  }

  .editor-footer span:nth-child(2) {
    display: none;
  }

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

  .export-grid > button {
    min-height: 74px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer span:nth-child(2) {
    display: none;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}

@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;
  }
}
