.room-page {
  --room-ink: #f6eee6;
  --room-muted: #c5b8cc;
  --room-edge: #4d4363;
  --room-light: #ecd0a6;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 15%, #332840, #191623 57%, #111019 100%);
  color: var(--room-ink);
}

.room-shell {
  width: min(100% - 2rem, 49rem);
  margin-inline: auto;
  padding-block: clamp(.9rem, 3.2vh, 2.1rem) max(.9rem, env(safe-area-inset-bottom));
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .75rem;
}

.room-header h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4.3vw, 1.9rem);
  line-height: 1.15;
}

.room-back {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: .9rem;
  color: var(--room-muted);
  white-space: nowrap;
}

.room-back:hover { color: var(--room-light); }

.room-scene {
  overflow: clip;
  border: 1px solid var(--room-edge);
  border-radius: .5rem .5rem 0 0;
  background: #171528;
  box-shadow: 0 .85rem 3rem rgb(8 5 17 / 42%);
}

.room-scene canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: crosshair;
}

.room-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--room-edge);
  border-top: 0;
  border-radius: 0 0 .5rem .5rem;
  background: #211c2d;
}

.room-text { min-width: 0; }
.room-text p { margin: 0; }
.room-text #room-target { color: var(--room-light); }
.room-text #room-caption { margin-top: .2rem; color: var(--room-muted); font-weight: 500; }
.room-text #room-caption:empty { margin: 0; }

.room-controls { display: flex; align-items: center; gap: .65rem; }
.room-controls button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .35rem .65rem;
  border: 1px solid #665573;
  border-radius: .25rem;
  color: var(--room-ink);
  background: #352a44;
  font: inherit;
  cursor: pointer;
}

.room-controls button:disabled { color: var(--room-muted); opacity: .58; cursor: default; }
.room-controls button:not(:disabled):is(:hover, :active) { border-color: var(--room-light); background: #493750; }
.room-page :is(a, canvas, button):focus-visible { outline: 2px solid var(--room-light); outline-offset: 3px; }
.room-scene canvas:focus-visible { outline-offset: -3px; }
.room-pad { display: none; }
.room-pad button { padding: .3rem; font-size: 1.15rem; touch-action: none; user-select: none; }
.room-keys { margin: .65rem 0 0; font-size: .84rem; color: var(--room-muted); }
.room-keys kbd { font: inherit; color: var(--room-ink); }
.room-touch { display: none; }

@media (min-width: 760px) and (pointer: fine) {
  .room-shell {
    width: min(100% - 2rem, 49rem, max(36rem, calc((100svh - 12rem) * 1.4667)));
  }
}

@media (max-width: 700px), (pointer: coarse) {
  .room-console { grid-template-columns: 1fr; }
  .room-controls { justify-content: space-between; }
  .room-pad {
    display: grid;
    grid-template-columns: repeat(3, 2.75rem);
    gap: .25rem;
  }
  .room-pad button:first-child { grid-column: 2; }
  .room-pad button:nth-child(2) { grid-column: 1; }
  .room-touch { display: inline; }
}

@media (pointer: coarse) {
  .room-keyboard { display: none; }
}

@media (max-width: 420px) {
  .room-shell { width: calc(100% - 1.25rem); }
  .room-console { padding: .65rem; }
  .room-keys .room-touch { display: block; }
}
