/* The v3 gameplay viewer presentation, scoped to the shared Play shell. */
.room-viewer { color-scheme: dark; background: #10241f; color: #faf5dc; }
.room-viewer .viewer-screen {
  position: relative;
  aspect-ratio: 8 / 5;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #091310;
}
.room-viewer:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.room-viewer:fullscreen .viewer-screen { flex: 1; min-height: 0; aspect-ratio: auto; }
.viewer-screen video { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; image-rendering: pixelated; }
#room-start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}
#room-start { min-width: 7rem; min-height: 2.75rem; background: #f2ca89; border-color: #f2ca89; color: #22352a; }
#room-start[aria-disabled=true] { cursor: wait; opacity: .65; }
#room-start-status { max-width: 30ch; margin: .65rem 0 0; color: inherit; }
#room-start-status:empty { margin: 0; }
[data-viewer=status] { margin: 0; padding: .25rem .85rem; font-size: .8rem; color: #c7d7d1; }
.viewer-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .65rem; padding: .35rem .75rem .6rem; }
.viewer-controls:has(button:not([hidden])) { min-height: 2.6rem; }
.viewer-controls button { color: inherit; background: #203d35; border: 1px solid #52685e; border-radius: .3rem; padding: .28rem .65rem; }
.viewer-controls :focus-visible { outline-color: #f2ca89; }

.ui-dialog[data-size=game-room] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.ui-dialog[data-size=game-room] > .shell-content { padding: 0; overflow: hidden; }
.ui-dialog[data-size=game-room] > .shell-header { min-height: 2.9rem; }
.ui-dialog[data-size=game-room] .shell-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-dialog[data-size=game-room] .shell-tools { display: flex; align-items: center; gap: .3rem; }
.room-chat-toggle { white-space: nowrap; }

.ui-dialog[data-size=game-room] #play-room { height: 100%; max-width: none; padding: 0; }
.ui-dialog[data-size=game-room] .room-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  background: var(--edge);
}
.ui-dialog[data-size=game-room] .room-layout.chat-expanded {
  grid-template-columns: minmax(0, 1fr) .65rem var(--room-chat-width, 35%);
}
.ui-dialog[data-size=game-room] .room-viewer {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}
.ui-dialog[data-size=game-room] .viewer-screen {
  flex: 1;
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
}
.ui-dialog[data-size=game-room] :is(.viewer-controls, [data-viewer=status]) { flex: none; }
.room-divider {
  position: relative;
  cursor: col-resize;
  background: color-mix(in srgb, var(--edge) 65%, var(--muted));
  touch-action: none;
}
.room-divider::before {
  position: absolute;
  content: '';
  inset: 50% auto auto 50%;
  width: .35rem;
  height: 2.5rem;
  transform: translate(-50%, -50%);
  border: 1px solid var(--header);
  border-radius: .25rem;
  background: var(--header-line);
}
.room-divider:focus-visible { outline-offset: -2px; }
.room-divider:hover, .room-divider:focus-visible { background: var(--muted); }

.ui-dialog[data-size=game-room] .room-conversation {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
}
.ui-dialog[data-size=game-room] .room-conversation > :not(.room-messages) { flex: none; }
.room-progress, .room-progress-status { display: flex; align-items: center; gap: .35rem .55rem; flex-wrap: wrap; }
.room-progress { justify-content: space-between; padding: .35rem .75rem; border-bottom: 1px solid var(--edge); }
.room-progress p { margin: 0; }
.room-progress time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
#room-rename { display: grid; place-items: center; padding: .22rem .32rem; }
#room-rename svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ui-dialog[data-size=game-room] .room-messages {
  min-height: 4.25rem;
  max-height: none;
  padding: .4rem .65rem;
  background: #f3f0e7;
}
.ui-dialog[data-size=game-room] .room-messages :is(.room-message-assistant, .room-message-visitor) {
  width: fit-content;
  max-width: 90%;
  margin: .5rem auto .5rem 0;
  padding: .42rem .65rem;
  border: 1px solid #ddc4bd;
  border-radius: .85rem .85rem .85rem .25rem;
  background: #f9e5e2;
}
.ui-dialog[data-size=game-room] .room-messages .room-message-visitor {
  margin-inline: auto 0;
  border-color: #b9d2c3;
  border-radius: .85rem .85rem .25rem .85rem;
  background: #e0eee4;
}
.ui-dialog[data-size=game-room] .room-messages :is(.room-message-heading > strong, .room-game-action > strong) { font-size: .82em; }
.ui-dialog[data-size=game-room] #room-composer { padding: .4rem .55rem; }
.ui-dialog[data-size=game-room] #composer-status:empty { display: none; }
.ui-dialog[data-size=game-room] #room-message { resize: none; }

@media (max-width: 760px) {
  .ui-dialog[data-size=game-room] .room-layout.chat-expanded { grid-template-columns: minmax(0, 1fr); }
  .ui-dialog[data-size=game-room] .room-conversation {
    position: absolute;
    z-index: 1;
    inset: auto 0 0;
    height: 72%;
    border-top: 1px solid var(--edge);
    box-shadow: 0 -.4rem 1.2rem #10241f45;
  }
  .ui-dialog[data-size=game-room] .shell-title { font-size: 1.2rem; }
  .ui-dialog[data-size=game-room] .room-chat-toggle { font-size: .85rem; }
}
