/* Desktop gameplay windows. The terminal and command input keep their own DOM. */
#terminal-pane:has(> #gameplay-windows) { grid-template-rows: auto minmax(0, 1fr) auto; }
#terminal-pane:has(> #gameplay-windows) > #command-form { grid-row: 3; }
#gameplay-windows {
  grid-row: 2;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}
#window-center {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}
#window-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.window-dock {
  position: absolute;
  display: flex;
  gap: 3px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface, #0b0f11);
  z-index: 1;
}
.window-dock[hidden] { display: none; }
#window-dock-top, #window-dock-bottom { flex-direction: row; overflow-y: hidden; }
#window-dock-left, #window-dock-right { flex-direction: column; overflow-x: hidden; }
.game-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid #435563;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(13, 20, 25, var(--window-opacity, .96));
  color: var(--text, #d7e0e4);
  box-shadow: 0 4px 16px #0006;
  pointer-events: auto;
  box-sizing: border-box;
}
.game-window[hidden] { display: none; }
.game-window:focus-within { border-color: var(--cyan, #61c3cf); }
.window-dock > .game-window { position: relative; flex: 0 0 auto; border-radius: 3px; box-shadow: none; }
.game-window-header {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 30px;
  min-width: 0;
  padding: 2px 4px 2px 9px;
  border-bottom: 1px solid #ffffff12;
  background: #ffffff06;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.game-window-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.game-window-header button { flex: 0 0 24px; width: 24px; min-height: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--muted, #91a4af); }
.game-window-header button:hover { background: #ffffff12; color: var(--text, white); }
.game-window-header button[aria-pressed="true"] { color: var(--gold, #d8b45d); }
.game-window-content { flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 8px; }
.game-window-native > .game-window-content { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.game-window-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, transparent 55%, #91a4af 56%, #91a4af 62%, transparent 63%, transparent 75%, #91a4af 76%, #91a4af 82%, transparent 83%);
  cursor: nwse-resize;
  touch-action: none;
}
.game-window[data-dock="right"] > .game-window-resize { left: 0; right: auto; transform: scaleX(-1); cursor: nesw-resize; }
.game-window[data-dock="bottom"] > .game-window-resize { top: 0; bottom: auto; transform: scaleY(-1); cursor: nesw-resize; }
.game-window-resize[hidden] { display: none; }
.window-locked > .game-window-header, .window-fixed > .game-window-header { cursor: default; }
.window-borderless > .game-window-header { flex-basis: 8px; height: 8px; padding: 0; background: transparent; border-bottom: 0; }
.window-borderless > .game-window-header > * { display: none; }
.window-borderless > .game-window-header:focus { flex-basis: 30px; }
.window-borderless > .game-window-header:focus > * { display: block; }
.window-arranging { user-select: none; }
#window-preview { position: absolute; z-index: 3; pointer-events: none; border: 2px solid var(--cyan, #61c3cf); background: #61c3cf24; border-radius: 5px; box-sizing: border-box; }
#window-preview[hidden] { display: none; }
#window-preview[data-kind="snap"] { background: transparent; border-style: dashed; }
#panel-windows .windows-panel-help { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
#panel-windows a { color: var(--cyan); }
.window-panel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.window-panel-copy { flex: 1 1 140px; min-width: 0; }
.window-panel-copy strong, .window-panel-copy span { display: block; overflow-wrap: anywhere; }
.window-panel-copy strong { font-size: 13px; }
.window-panel-copy span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.window-panel-controls { display: flex; flex-wrap: wrap; gap: 5px; }
.window-panel-controls button { padding: 4px 8px; min-height: 30px; }
.window-panel-opacity { display: flex; flex: 1 0 100%; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.window-panel-opacity input { flex: 1 1 80px; min-width: 60px; padding: 0; accent-color: var(--cyan); }
.window-panel-opacity output { flex: 0 0 38px; text-align: right; font-variant-numeric: tabular-nums; }
.windows-reset-all { margin-top: 16px; }
