/* The display owns the artwork; the case owns the controls. */
.television {
  container-type: inline-size;
}
.display-assembly {
  display: flex;
  align-items: center;
  gap: 26px;
}
.display-assembly > .bezel {
  flex: 1;
  min-width: 0;
  padding: 12px;
}
.catalog-mode .display-assembly {
  /* One case height across all three catalogs, even with the external keypad. */
  height: calc((100cqw - 26px) * .5625 + 26px);
  align-items: stretch;
}
.catalog-mode .display-assembly > .bezel {
  height: 100%;
}
.screen[data-mode="catalog"] {
  height: 100%;
  aspect-ratio: auto;
}
.screen[data-mode="catalog"] > .catalog-view {
  position: absolute;
  inset: 0;
}
.catalog-toolbar {
  padding: 13px 26px 10px;
}
.alphabet-panel {
  padding: 14px 26px 16px;
}
.alphabet-display > svg {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* The SVG viewBox and xMidYMid meet preserve the complete AI composition. */
}
.alphabet-foot {
  display: block;
  margin-top: 14px;
  padding-top: 9px;
}
.alphabet-foot > span {
  display: block;
  margin-bottom: 8px;
  font-size: 9px;
  letter-spacing: 1px;
}
.alphabet-index {
  display: grid;
  grid-template-columns: repeat(26, minmax(0, 1fr));
  gap: 5px;
}
.alphabet-index button {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 34px;
  padding: 0;
  color: #273026;
  background: #c6cac0;
  border: 1px solid #60695b;
  border-radius: 2px;
  box-shadow: inset 2px 2px #eef0e7, inset -2px -2px #99a08f, 0 2px #182017;
  font: 13px var(--mono);
}
.alphabet-index button:hover {
  color: #172016;
  background: #e0e3d8;
}
.alphabet-index button:active {
  background: #b0b7a8;
  box-shadow: inset 1px 1px #69735e;
  transform: translateY(2px);
}

/* Give the taller lowercase source more of the screen, without cropping or stretching it. */
.screen[data-group="lowercase"] .catalog-toolbar {
  padding-block: 7px;
}
.screen[data-group="lowercase"] .catalog-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.screen[data-group="lowercase"] .catalog-heading h2 {
  margin-top: 0;
  font-size: 19px;
}
.screen[data-group="lowercase"] .alphabet-panel {
  padding-block: 6px 8px;
}
.screen[data-group="lowercase"] .alphabet-foot {
  margin-top: 7px;
  padding-top: 5px;
}
.screen[data-group="lowercase"] .alphabet-foot > span {
  margin-bottom: 4px;
}
.screen[data-group="lowercase"] .alphabet-index button {
  height: 30px;
}

/* A compact ten-key keyboard, outside the screen rather than a second screen. */
.numeric-mode .window-bar {
  padding-inline: 22px;
}
.numeric-mode .catalog-toolbar {
  padding: 12px 22px 10px;
}
.numeric-mode .catalog-toolbar h2 {
  font-size: 21px;
}
.numeric-mode .group-switch .retro-button {
  padding: 9px 11px;
}
.digits-panel {
  padding: 16px 30px 24px;
  gap: 0;
}
.digit-specimen {
  width: 100%;
  max-width: none;
}
.digit-channel {
  font-size: 9px;
}
.digit-display {
  padding: 18px 12px 4px;
}
.digit-display svg {
  width: 100%;
  height: 100%;
}
.numeric-deck {
  width: 244px;
  flex: 0 0 244px;
  color: #c7cbc2;
  padding: 0 2px;
  align-self: center;
}
.numeric-deck-label {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 15px;
  margin-bottom: 17px;
  border-bottom: 1px solid #66705e;
  font: 10px var(--mono);
  letter-spacing: 2px;
}
.numeric-deck .digit-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, 70px);
  gap: 10px;
  padding: 0 0 5px;
}
.numeric-deck .digit-key {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 12px 14px;
  border: 1px solid #182017;
  border-radius: 3px;
  background: #c6cac0;
  color: #273026;
  box-shadow: inset 3px 3px #eef0e7, inset -4px -5px #909986, 0 4px #182017;
}
.numeric-deck .digit-key-label {
  position: static;
  font: 23px/1 var(--mono);
}
.numeric-deck .digit-key:last-child {
  grid-column: 1 / span 2;
}
.numeric-deck .digit-key:hover {
  background: #dce0d4;
}
.numeric-deck .digit-key[aria-pressed="true"] {
  outline: none;
  background: #aab69b;
  box-shadow: inset 2px 2px #66765b, inset -2px -2px #bfc9b2, 0 1px #182017;
  transform: translateY(3px);
}
.numeric-deck .digit-key[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 13px;
  height: 3px;
  background: #33452b;
}
.numeric-deck .digit-key:focus-visible {
  outline: 2px solid #d1d76f;
  outline-offset: 4px;
}

/* Discrete signal jumps, then a single palette lock at 2.45s. Never fade the artwork. */
.booting .boot-overlay {
  animation: none;
  background: transparent;
}
.booting .boot-overlay > i {
  animation: television-scan 3.6s steps(1, end) both;
}
.booting .boot-overlay > span {
  display: none;
}
.booting .home-wordmark {
  animation: remnant-jitter 3.6s steps(1, end) both;
  opacity: 1;
}
@keyframes remnant-jitter {
  0%, 7%, 16%, 25%, 58%, 70%, 81%, 100% { transform: none; }
  5% { transform: translate(2px, -1px); }
  14% { transform: translate(-4px, 0); }
  23% { transform: translate(1px, 0); }
  56% { transform: translate(2px, 1px); }
  65% { transform: translate(-5px, 2px); }
  68% { transform: translate(3px, -1px); }
  79% { transform: translate(-2px, 0); }
}
@keyframes television-scan {
  0% { transform: translateY(0); opacity: 0; }
  5% { transform: translateY(80px); opacity: .3; }
  7% { opacity: 0; }
  14% { transform: translateY(230px); opacity: .2; }
  16% { opacity: 0; }
  65% { transform: translateY(330px); opacity: .3; }
  68% { transform: translateY(400px); opacity: .2; }
  70%, 100% { opacity: 0; }
}

/* Original vectors form the only collage materials. Controls never judge the result. */
.glyph-dialog {
  width: min(1040px, calc(100vw - 96px));
  max-height: 90vh;
}
.glyph-dialog[open] {
  display: flex;
  flex-direction: column;
}
.glyph-dialog .dialog-bar {
  flex-shrink: 0;
}
.collage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.collage-toolbar p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}
.collage-toolbar > div {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.collage-toolbar .retro-button {
  font-size: 12px;
  padding: 8px 12px;
}
.dialog-glyph {
  height: min(56vw, 60vh, 560px);
  min-height: 0;
  padding: 0;
}
.dialog-glyph .collage-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}
.collage-piece {
  cursor: grab;
  touch-action: none;
  outline: none;
}
.collage-piece.is-dragging {
  cursor: grabbing;
}
.collage-piece-outline {
  opacity: 0;
  pointer-events: all;
}
.collage-piece.is-selected > .collage-piece-outline,
.collage-piece:focus-visible > .collage-piece-outline {
  opacity: .55;
}
.collage-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font-size: 10px;
  line-height: 1.5;
}
@media (max-width: 1200px) {
  .display-assembly { gap: 20px; }
  .display-assembly > .bezel { padding: 10px; }
  .catalog-mode .display-assembly { height: calc((100cqw - 22px) * .5625 + 22px); }
  .alphabet-panel { padding: 12px 22px 14px; }
  .alphabet-index { gap: 4px; }
  .alphabet-index button { height: 30px; font-size: 12px; }
  .numeric-deck { width: 210px; flex-basis: 210px; }
  .numeric-deck .digit-keys { gap: 8px; grid-template-rows: repeat(4, 62px); }
  .numeric-mode .group-switch .retro-button { padding: 8px; font-size: 11px; }
  .numeric-mode .catalog-toolbar { padding-inline: 18px; }
}

/* Preserve the original desktop artwork; stack its controls on smaller screens. */
@media (max-width: 999px) {
  body { min-width: 0; }
  .page-caption, .page-footer { padding: 20px 16px; gap: 12px; }
  .television { margin-inline: 16px; padding-inline: 12px; }
  .display-assembly { gap: 16px; }
  .main-controls { height: auto; min-height: 116px; display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 16px 0; }
  .device-logo { min-width: 0; }
  .mode-switch { grid-row: 2; grid-column: 1 / -1; }
  .mode-button { justify-content: center; flex: 1; min-width: 0; }
  .power-unit { grid-column: 2; grid-row: 1; padding-left: 0; }
  .color-console { display: grid; grid-template-columns: auto 1fr; gap: 16px 12px; padding-block: 20px 12px; }
  .color-targets { min-width: 0; }
  .color-target { flex: 1; min-width: 0; }
  .tuning-section { grid-column: 2; min-width: 0; }
  .preset-section { grid-row: 2; }
  .preset-buttons { gap: 8px; flex-wrap: wrap; }
  .preset-buttons button { width: 28px; height: 28px; }
  .alphabet-index { grid-template-columns: repeat(13, minmax(0, 1fr)); }
  .catalog-mode .display-assembly { height: 560px; }
  .numeric-deck { width: 150px; flex-basis: 150px; }
  .numeric-deck .digit-keys { grid-template-rows: repeat(4, 56px); }
  .catalog-toolbar { flex-wrap: wrap; gap: 12px; }
  .glyph-dialog { width: calc(100vw - 32px); }
  .collage-toolbar { flex-wrap: wrap; gap: 12px; }
  .dialog-glyph { height: min(60vw, 60vh); }
}

@media (max-width: 599px) {
  .page-caption, .page-footer { padding: 16px; font-size: 9px; letter-spacing: .4px; flex-wrap: wrap; }
  .page-caption { gap: 8px; }
  .page-caption > span:last-child { width: 100%; }
  .caption-divider { padding-inline: 6px; }
  .television { margin-inline: 10px; padding-inline: 8px; border-radius: 20px 20px 12px 12px; }
  .top-case { padding-inline: 6px; letter-spacing: 1px; }
  .vent-top { width: 100px; }
  .display-assembly, .catalog-mode .display-assembly { display: flex; flex-direction: column; align-items: stretch; height: auto; gap: 16px; }
  .display-assembly > .bezel, .catalog-mode .display-assembly > .bezel { flex: none; height: auto; padding: 7px; border-radius: 28px; }
  .screen { height: 450px; border-radius: 21px; }
  .screen[data-mode="catalog"] { height: 570px; }
  .screen[data-group="digits"] { height: 420px; }
  .screen[data-mode="type"] { height: 560px; }
  .home-view { padding: 22px 16px 16px; }
  .broadcast-meta { font-size: 8px; letter-spacing: .4px; }
  .broadcast-meta > span { gap: 5px; }
  .home-heading { margin-top: 24px; flex-direction: column; gap: 10px; }
  .home-heading p { font-size: 12px; letter-spacing: 1px; }
  .home-heading > span { font-size: 8px; }
  .home-wordmark { margin: 16px 0; min-height: 88px; }
  .home-bottom { flex-direction: column; align-items: stretch; gap: 20px; padding-bottom: 16px; }
  .home-statement p { font-size: 21px; }
  .home-statement > span { font-size: 10px; letter-spacing: 0; }
  .screen-link { min-width: 0; font-size: 13px; padding-bottom: 8px; }
  .screen-link small { font-size: 8px; }
  .home-index { gap: 6px; justify-content: space-between; flex-wrap: wrap; font-size: 7px; letter-spacing: 0; }
  .home-index span:last-child { margin-left: 0; }
  .window-bar, .numeric-mode .window-bar { padding-inline: 14px; font-size: 8px; letter-spacing: .3px; }
  .window-bar > span:last-child { font-size: 9px; letter-spacing: 0; }
  .catalog-toolbar, .numeric-mode .catalog-toolbar, .screen[data-group="lowercase"] .catalog-toolbar { padding: 14px; gap: 12px; }
  .catalog-heading h2, .screen[data-group="lowercase"] .catalog-heading h2 { font-size: 19px; }
  .group-switch { width: 100%; gap: 6px; }
  .group-switch .retro-button, .numeric-mode .group-switch .retro-button { flex: 1; min-width: 0; padding: 10px 4px; font-size: 12px; }
  .retro-button span { margin-left: 2px; }
  .alphabet-panel, .screen[data-group="lowercase"] .alphabet-panel { padding: 10px 14px 16px; }
  .alphabet-foot, .screen[data-group="lowercase"] .alphabet-foot { margin-top: 12px; padding-top: 8px; }
  .alphabet-foot > span, .screen[data-group="lowercase"] .alphabet-foot > span { margin-bottom: 8px; }
  .alphabet-index { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .alphabet-index button, .screen[data-group="lowercase"] .alphabet-index button { height: 36px; font-size: 13px; }
  .numeric-deck { width: 100%; flex: none; padding-inline: 8px; }
  .numeric-deck-label { padding-bottom: 8px; margin-bottom: 12px; }
  .numeric-deck .digit-keys { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(2, 48px); gap: 8px; }
  .numeric-deck .digit-key { padding: 10px; }
  .numeric-deck .digit-key:last-child { grid-column: auto; }
  .digits-panel { padding: 16px; }
  .type-toolbar { padding: 14px; gap: 8px; }
  .size-control input { width: 90px; }
  .type-output { padding: 16px 14px 8px; }
  .terminal-input { margin: 8px 14px 16px; padding: 10px; }
  .input-label label span { margin-right: 4px; font-size: 9px; }
  .input-footer { gap: 8px; align-items: flex-start; }
  .input-footer p { max-width: 70%; }
  .sample-controls { gap: 8px; }
  .sample-controls button { padding-block: 4px; }
  .device-console { padding-inline: 8px; }
  .device-logo strong { font-size: 19px; letter-spacing: 3px; }
  .power-unit { gap: 10px; }
  .power-unit > span:last-child { display: none; }
  .mode-switch { gap: 8px; }
  .mode-button { gap: 8px; padding: 12px 8px; }
  .color-console { grid-template-columns: 1fr; gap: 16px; }
  .color-console-label { width: auto; display: flex; gap: 12px; align-items: baseline; }
  .color-console-label br { display: none; }
  .color-console-label small { margin-top: 0; }
  .color-target { padding: 8px 5px; gap: 5px; }
  .color-target > span { font-size: 10px; }
  .color-target small { font-size: 8px; }
  .color-chip { width: 11px; }
  .tuning-section, .preset-section { grid-column: auto; grid-row: auto; }
  .tuning-fields input[type=text] { width: 76px; font-size: 12px; }
  .tuning-fields input[type=color] { width: 32px; height: 32px; }
  .preset-section { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .preset-section > span { font-size: 8px; margin-bottom: 0; }
  .preset-buttons { flex-wrap: nowrap; }
  .preset-buttons button { width: 30px; height: 30px; }
  .bottom-case { gap: 20px; }
  .bottom-case > span { width: 80px; }
  .bottom-case .vent { width: 60px; }
  .page-footer { margin-block: 14px; gap: 16px; }
  .page-footer button { padding-block: 8px; }
  .glyph-dialog, .about-dialog { width: calc(100vw - 24px); max-width: none; max-height: 92dvh; }
  .dialog-bar { min-height: 42px; height: auto; padding-block: 6px; font-size: 10px; }
  .dialog-bar button { width: 30px; height: 30px; }
  .collage-toolbar { padding: 12px; gap: 10px; }
  .collage-toolbar p { font-size: 11px; }
  .collage-toolbar > div { width: 100%; }
  .collage-toolbar .retro-button { flex: 1; padding: 10px 8px; }
  .dialog-glyph { height: 68vw; min-height: 180px; }
  .collage-footer { padding: 12px; flex-wrap: wrap; gap: 6px; }
  .about-content { padding: 20px; }
  .about-content h2 { font-size: 24px; }
  .about-content dt { width: 90px; }
}
