/* The Play page. The console is drawn on the LCD's own pixel grid: --p is one LCD pixel. */
:root { --u: 1px; --p: calc(var(--u) * 2); }

.play {
  display: grid;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 24px 8px;
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "stage intro" "stage talk";
  column-gap: 48px;
}
.intro { grid-area: intro; padding-top: 12px; }
.intro h1 { margin: 0 0 14px; font-size: clamp(22px, 2.7vw, 36px); line-height: 1.4; text-transform: uppercase; }
.intro p { margin: 0; font-size: 28px; line-height: 1.15; color: var(--cream); max-width: 34ch; }
.stage { grid-area: stage; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.talk { grid-area: talk; display: flex; flex-direction: column; gap: 14px; padding-top: 22px; min-width: 0; }

/* ---- The console ---- */
.device { position: relative; flex: none; width: calc(var(--p) * 192); height: calc(var(--p) * 318); }
.shell { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.cover { position: absolute; inset: 0; z-index: 1; transform-origin: 20% 90%; }
.power, .led, .lcd { z-index: 2; }

.power { position: absolute; left: calc(var(--p) * 19); top: calc(var(--p) * 3); width: calc(var(--p) * 27); height: calc(var(--p) * 6); padding: 0; border: 0; background: #4e5048; transform: translateX(calc(var(--u) * var(--dodge, 0))); transition: transform .12s steps(3); }
.power-knob { position: absolute; left: var(--p); top: var(--p); width: calc(var(--p) * 12); height: calc(var(--p) * 4); background: #f4eedc; }
.power[aria-pressed="true"] .power-knob { left: calc(var(--p) * 14); }
.power.flick .power-knob { left: var(--p); }
.power-label { position: absolute; left: calc(var(--p) * 49); top: calc(var(--p) * 3.5); font: 400 calc(var(--u) * 6)/1 var(--display); color: #6b6652; }
.bezel-label { position: absolute; left: 0; width: 100%; top: calc(var(--p) * 19.5); text-align: center; font: 400 calc(var(--u) * 7)/1 var(--display); color: #c4c6b8; }
.led { position: absolute; left: calc(var(--p) * 10); top: calc(var(--p) * 72); width: calc(var(--p) * 4); height: calc(var(--p) * 4); background: #2e1518; }
.led.on { background: #e8433a; }
[data-phase="busy"] .led.on { animation: led-work 1s steps(2) infinite; }
@keyframes led-work { 50% { background: #8c2a26; } }

.lcd { position: absolute; left: calc(var(--p) * 16); top: calc(var(--p) * 27); width: calc(var(--p) * 160); height: calc(var(--p) * 144); background: #7d8c5c; overflow: hidden; }
.lcd canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity .3s steps(4); }
.lcd.on canvas { opacity: 1; }
.lcd-grid, .lcd-glass, .lcd-msg { position: absolute; inset: 0; pointer-events: none; }
.lcd-grid { display: none; background-image: linear-gradient(rgba(40,52,30,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(40,52,30,.16) 1px, transparent 1px); background-size: var(--p) var(--p); }
.lcd-glass { display: none; background: rgba(255,255,235,.05); }
.opt-grid .lcd-grid, .opt-glow .lcd-glass { display: block; }
.lcd-msg { display: flex; align-items: center; justify-content: center; padding: 12%; text-align: center; color: #1d2612; font-size: calc(var(--u) * 20); line-height: 1.1; }
.clean .lcd { background: #fff; }
.clean .lcd-grid, .clean .lcd-glass { display: none !important; }

.board { position: absolute; inset: 0; }
.board-art { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.brand { position: absolute; left: calc(var(--p) * 12); top: calc(var(--p) * 181); font: 400 calc(var(--u) * 16)/1 var(--display); color: #2f3a70; letter-spacing: -.04em; pointer-events: none; }

.dpad { position: absolute; left: calc(var(--p) * 17); top: calc(var(--p) * 212); width: calc(var(--p) * 51); height: calc(var(--p) * 51); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.dpad::before { content: ""; position: absolute; inset: 0 0 calc(var(--p) * -2); background: url("../assets/dpad.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated; pointer-events: none; }
.dpad button { position: relative; padding: 0; border: 0; background: none; touch-action: none; }
.dpad button.down { background: rgba(0,0,0,.45); }
.dpad [data-pad="up"] { grid-area: 1 / 2; }
.dpad [data-pad="left"] { grid-area: 2 / 1; }
.dpad [data-pad="right"] { grid-area: 2 / 3; }
.dpad [data-pad="down"] { grid-area: 3 / 2; }
.dpad-hub { grid-area: 2 / 2; }

.ab-well { position: absolute; display: block; }
.ab-b { left: calc(var(--p) * 115); top: calc(var(--p) * 234); }
.ab-a { left: calc(var(--p) * 149); top: calc(var(--p) * 218); }
.ab-well span { position: absolute; left: 0; width: calc(var(--p) * 26); top: calc(var(--p) * 31); text-align: center; font: 400 calc(var(--u) * 8)/1 var(--display); color: #2f3a70; pointer-events: none; }
.round { display: block; width: calc(var(--p) * 26); height: calc(var(--p) * 29); padding: 0; border: 0; background: url("../assets/button.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated; touch-action: none; }
.round.down { transform: translateY(calc(var(--p) * 2)); }

.pills > div { position: absolute; top: calc(var(--p) * 278); }
.pills > div:first-child { left: calc(var(--p) * 60); }
.pills > div:last-child { left: calc(var(--p) * 92); }
.pills span { position: absolute; left: 0; width: calc(var(--p) * 26); top: calc(var(--p) * 17); text-align: center; font: 400 calc(var(--u) * 5.5)/1 var(--display); color: #2f3a70; pointer-events: none; }
.pill { display: block; width: calc(var(--p) * 26); height: calc(var(--p) * 15); padding: 0; border: 0; background: url("../assets/pill.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated; touch-action: none; }
.pill.down { transform: translateY(var(--p)); }

.keys { margin: 0; color: var(--cream-soft); font-size: 20px; line-height: 1.15; text-align: center; max-width: 46ch; }
kbd { font: inherit; color: var(--cream); }

/* ---- Talking to it ---- */
.dock { display: flex; flex-direction: column; gap: 14px; }
.moves { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.moves .menu-button { padding-inline: 2px; font-size: clamp(9px, .85vw, 12px); }
.say-row { display: flex; gap: 12px; align-items: stretch; }
#say { flex: 1; min-width: 0; height: 60px; padding: 0 14px; border: var(--px) solid var(--ink); border-radius: 0; background: var(--lcd); color: var(--ink); font: 400 30px/1 var(--body); text-transform: uppercase; caret-color: var(--ink); }
#say::placeholder { color: var(--olive-dark); text-transform: none; opacity: 1; }
#say:focus { outline: var(--px) solid var(--cream); outline-offset: 0; }
.send { text-transform: uppercase; flex: none; width: 104px; font-size: 13px; background: var(--magenta); color: var(--cream); }
.send:hover:not(:disabled) { background: #a93a70; }
.send:active:not(:disabled) { background: var(--magenta); }
.send:disabled { color: var(--ink); }

.status { margin: 0; color: var(--lcd); font: 400 12px/1.5 var(--display); }
.cursor { animation: blink 1.1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0; } }
[data-phase="busy"] .cursor { animation: none; opacity: 0; }
.coach { margin: -8px 0 0; min-height: 2.5em; color: var(--cream); }
.heard-line { margin: -6px 0 0; color: var(--cream-soft); }
.heard-line[hidden] { display: none; }
.heard-line b { font-weight: 400; color: var(--lcd); }
.limits { margin: 0; color: var(--cream-soft); font-size: 21px; line-height: 1.15; }
.quiet { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.quiet button { padding: 0; border: 0; background: none; color: var(--cream-soft); font-size: 21px; text-decoration: underline; text-underline-offset: 3px; }
.quiet button:hover { color: var(--cream); }

.more { color: var(--cream-soft); font-size: 21px; }
.more summary { cursor: pointer; }
.more > * + * { margin-top: 12px; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.row-buttons button { padding: 4px 10px; border: 2px solid var(--cream-soft); background: none; color: var(--cream); }
.row-buttons button:hover:not(:disabled) { background: var(--forest-deep); }
.row-buttons button:disabled { opacity: .5; cursor: default; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.toggles label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.toggles input { width: 16px; height: 16px; accent-color: var(--olive); }
.note { margin: 0; color: var(--cream-soft); line-height: 1.15; }

.fullscreen .top, .fullscreen .credit, .fullscreen .intro, .fullscreen .talk, .fullscreen .keys { display: none; }
.fullscreen .play { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 0; }

@media (max-width: 900px) {
  /* Like an app: the console fills the screen, and everything you press stays docked at the bottom. */
  .top { flex-wrap: nowrap; padding: 6px 10px; }
  .logo { font-size: 0; gap: 0; }
  .logo img { width: 28px; height: 28px; }
  .top nav a { padding: 7px 8px; font-size: 9px; }
  .play { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "intro" "stage" "talk"; padding: 0 8px; }
  .intro { padding: 0 4px 8px; text-align: center; }
  .intro h1 { margin: 0; font-size: clamp(8px, 2.75vw, 22px); line-height: 1.4; white-space: nowrap; }
  .intro p { display: none; }
  .stage { gap: 0; }
  .keys { display: none; }
  .device, .device * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  .talk { padding: 12px 8px var(--dock-space, 150px); }
  .dock { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; gap: 6px; padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--forest-deep); border-top: var(--px) solid var(--ink); }
  .moves { gap: 6px; }
  .moves .menu-button { padding: 8px 0 7px; border-width: 2px; font-size: clamp(7px, 2.25vw, 11px); box-shadow: 2px 2px 0 var(--ink); }
  .say-row { gap: 8px; }
  #say { height: 42px; padding: 0 10px; border-width: 2px; font-size: 22px; }
  #say:focus { outline-width: 2px; }
  .send { width: 72px; border-width: 2px; font-size: 11px; box-shadow: 2px 2px 0 var(--ink); }
  .status { order: -1; min-height: 1.2em; font-size: 9px; line-height: 1.2; }
  .credit { padding-bottom: var(--dock-space, 150px); }
  .talk { padding-bottom: 12px; }
  .coach { display: none; }
  .limits { font-size: 18px; line-height: 1.1; text-align: center; }
  .heard-line { margin: 0; font-size: 16px; line-height: 1.1; text-align: center; }
  .heard-line:not([hidden]) ~ .limits { display: none; }
}
