.playtest-rolebar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 8px 0 15px; padding: 16px; border: 1px solid #3a515f; border-radius: 12px; background: linear-gradient(115deg, #17332e, #151e2a 65%); }
.playtest-rolebar strong { color: var(--heading); font-size: 16px; }
.playtest-rolebar p { max-width: 530px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.workspace-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.workspace-controls button { font-size: 12px; padding: 9px 12px; }
.workspace-controls .selected { background: #2c5147; border-color: #7ecdb5; color: #c4ffeb; opacity: 1; }
.workspace-controls label { margin: 0 0 0 8px; font-size: 11px; color: var(--muted); }
.workspace-controls select { min-width: 170px; padding: 7px 9px; font-size: 12px; }
.quick-dice { display: flex; flex-wrap: wrap; gap: 4px; }
.quick-dice button { min-width: 40px; margin: 0; font-weight: 650; color: var(--secondary); }
.stage-dice p { overflow-wrap: anywhere; }
.playtest-tabs, .stage-toolbar, .stage-tokens { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.playtest-tabs { padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: #121923; margin: 7px 0 21px; }
.playtest-tabs button { padding: 8px 12px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 550; border-radius: 7px; }
.playtest-tabs button:hover { background: #1d2937; border-color: #314353; color: var(--heading); }
.playtest-tabs .selected, .stage-tokens .selected { border-color: #49605c; background: #243c36; color: #b4f1dc; }
.stage-toolbar select { width: auto; max-width: 310px; }
.stage-toolbar button, .stage-toolbar select { padding: 7px 10px; font-size: 11px; }
.stage-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.stage-toolbar .sz-icon { width: 15px; height: 15px; }
.tabletop-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 17px; }
.tabletop-heading h2 { margin: 4px 0 5px; font-size: 24px; font-weight: 650; }
.tabletop-heading p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
.tabletop-heading .stage-toolbar { justify-content: flex-end; max-width: 62%; margin: 0; }
.tabletop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.tabletop-map { min-width: 0; }
.tabletop-map > .stage-toolbar { margin-top: 0; }
.tabletop-viewport { width: 100%; height: min(52vh, 680px); overflow: auto; background: #080d14; border: 1px solid #3a495c; border-radius: 12px; overscroll-behavior: contain; box-shadow: 0 10px 28px #0003; }
.stage-canvas { display: block; height: auto; max-height: none; object-fit: fill; background: #080d14; touch-action: none; outline-offset: -3px; }
.stage-canvas[data-zoom="1"], .stage-canvas[data-zoom="0.5"], .stage-canvas[data-zoom="0.75"] { margin-inline: auto; }
.player-map-guidance { border: 1px solid #6a826a; border-radius: 9px; padding: 12px; background: #1a3029; color: #c6efd9; }
.stage-canvas[data-tool=pan] { cursor: grab; }
.stage-canvas[data-tool=pan]:active { cursor: grabbing; }
.stage-canvas[data-tool=fog], .stage-canvas[data-tool=reveal], .stage-canvas[data-tool=wall], .stage-canvas[data-tool=light], .stage-canvas[data-tool=measure], .stage-canvas[data-tool=template], .stage-canvas[data-tool=draw], .stage-canvas[data-tool=pin] { cursor: crosshair; }
.stage-canvas[data-tool=erase] { cursor: cell; }
.tabletop-panel { background: var(--panel); border: 1px solid var(--border); border-top-color: #3b4d5c; border-radius: 11px; padding: 15px; margin-bottom: 12px; }
.tabletop-panel h3 { font-size: 12px; margin: 0 0 13px; color: var(--heading); letter-spacing: .35px; font-weight: 650; }
.tabletop-panel label { margin: 10px 0; font-size: 11px; gap: 6px; }
.tabletop-panel select, .tabletop-panel input { padding: 8px 9px; font-size: 12px; }
.tabletop-panel input[type=range] { padding: 0; accent-color: var(--accent); }
.tabletop-panel label:has(> input[type=checkbox]) { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tabletop-panel input[type=checkbox] { width: 15px; height: 15px; padding: 0; margin: 0; flex-shrink: 0; }
.tabletop-panel input[type=color] { width: 100%; height: 32px; padding: 3px; }
.tabletop-panel button { padding: 7px 9px; font-size: 11px; margin: 3px 4px 3px 0; }
.tabletop-panel button .sz-icon { width: 14px; height: 14px; }
.tabletop-panel p, .tabletop-map > p { font-size: 11px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.tabletop-panel details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.tabletop-panel summary { font-size: 11px; cursor: pointer; color: var(--muted); line-height: 1.6; }
.tabletop-panel details p { white-space: pre-wrap; }
.tabletop-effects { display: flex; flex-wrap: wrap; margin-top: 10px; }
.tabletop-effects button { text-transform: capitalize; }
.stage-tokens { padding: 10px 0 0; }
.stage-tokens button { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 7px 10px; border-radius: 20px; background: #151f2c; }
.stage-tokens img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.playtest-content > p { white-space: pre-wrap; line-height: 1.7; color: var(--muted); font-size: 12px; }
.playtest-status { min-height: 0; color: var(--accent); font-size: 12px; line-height: 1.6; }
.playtest-status:empty { display: none; }
.immersion-dock { margin-top: 25px; border: 1px solid var(--border); border-radius: 11px; padding: 13px 16px; background: var(--panel); }
.immersion-dock > summary { cursor: pointer; color: var(--secondary); font-size: 12px; font-weight: 600; line-height: 1.6; }
body.in-play-area main { padding: 22px 24px; max-width: none; }
body.in-play-area h1 { font-size: 25px; margin-bottom: 14px; }
body.in-play-area main > header { padding: 0; justify-content: flex-end; min-height: 17px; gap: 0; }
body.in-play-area main > header > div { display: none; }
.scene-browser { margin: 0 0 10px; }
.scene-browser > summary { font-size: 11px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.scene-browser .scene-strip { margin: 9px 0 0; }

/* Scene preparation, canvas tools and playback remain adjacent to the map. */
.scene-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 17px; }
.scene-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 11px; align-items: center; min-width: 0; min-height: 72px; overflow: hidden; text-align: left; padding: 6px 10px 6px 6px; background: #151e2a; border: 1px solid #2c3b4d; border-radius: 10px; }
.scene-card img { width: 88px; height: 58px; object-fit: cover; border-radius: 6px; }
.scene-card > span { display: block; min-width: 0; }
.scene-card:not(:has(> img)) { grid-template-columns: minmax(0, 1fr); padding: 11px 14px; }
.scene-card strong { display: block; font-size: 12px; font-weight: 650; line-height: 1.4; color: var(--heading); overflow-wrap: anywhere; }
.scene-card small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; line-height: 1.4; }
.scene-card:hover { background: #1c2a38; border-color: #566d7c; }
.scene-card.selected, .scene-card[selected], .scene-card[aria-pressed=true] { background: #20392f; border-color: #6aa18d; box-shadow: inset 0 0 0 1px #4b786c; }
.scene-card.selected strong, .scene-card[selected] strong, .scene-card[aria-pressed=true] strong { color: #c0f2df; }
.stage-tools { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; padding: 6px; background: #111923; border: 1px solid #2d3c4b; border-radius: 9px; }
.stage-tools .tool-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border-color: transparent; border-radius: 6px; background: transparent; color: #a8b9cb; font-size: 11px; font-weight: 550; }
.stage-tools .tool-button .sz-icon { width: 16px; height: 16px; }
.stage-tools .tool-button:hover { background: #21303d; border-color: #3c5261; color: var(--heading); }
.stage-tools .tool-button[aria-pressed=true] { background: #295144; color: #c2f5df; border-color: #4f7c69; }
.tool-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; padding: 9px 12px; margin: 0 0 10px; background: #151d28; border: 1px solid var(--border); border-radius: 8px; font-size: 11px; color: var(--muted); }
.tool-options label { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 11px; min-width: 0; }
.tool-options input, .tool-options select { width: auto; max-width: 170px; padding: 6px 8px; font-size: 11px; }
.tool-options input[type=checkbox] { width: 14px; }
.tool-options input[type=number] { width: 72px; }
.tool-options input[type=color] { padding: 2px; width: 30px; height: 28px; }
.tool-options button { padding: 6px 9px; font-size: 11px; }
.stage-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; line-height: 1.5; padding: 7px 2px; color: var(--muted); }
.stage-hud strong, .stage-hud output { color: var(--accent); font-variant-numeric: tabular-nums; }
.tabletop-viewport:has(.stage-canvas[data-tool=measure]) + .stage-hud { color: #f1ddb4; font-variant-numeric: tabular-nums; }
.sound-dock { background: #18232b; border: 1px solid #334b52; border-radius: 10px; margin: 14px 0 0; padding: 14px 16px; }
.sound-dock header { display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin-bottom: 11px; }
.sound-dock header > strong { flex: 1; }
.sound-dock header > .sz-icon { color: var(--accent); width: 17px; height: 17px; }
.sound-dock header strong, .sound-dock h3 { color: var(--heading); font-size: 12px; letter-spacing: .1px; margin: 0; }
.sound-dock header small, .sound-dock p { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 4px 0 10px; }
.sound-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sound-actions > select { flex: 1 1 150px; width: auto; max-width: 260px; padding: 7px 10px; font-size: 11px; }
.sound-actions > label { display: flex; align-items: center; gap: 8px; flex: 1 1 150px; max-width: 250px; margin: 0; font-size: 10px; }
.sound-actions > label input[type=range] { flex: 1; width: 100px; min-width: 70px; padding: 0; }
.sound-actions button { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 7px 10px; background: #20343a; border-color: #39565c; }
.sound-actions button.primary { color: #132c26; background: #8fe0c5; border-color: #8fe0c5; }
.sound-actions button .sz-icon { width: 15px; height: 15px; }
.sound-volumes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.sound-volumes label { font-size: 10px; margin: 0; gap: 6px; }
.sound-volumes input[type=range] { padding: 0; height: 14px; }
.sound-volumes output { color: var(--accent); font-variant-numeric: tabular-nums; }
.token-inspector .token-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.token-inspector { margin-top: 0; }
.token-title img { width: 44px; height: 44px; border: 1px solid #617380; border-radius: 50%; object-fit: cover; }
.token-title strong { font-size: 14px; color: var(--heading); }
.token-title small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.token-inspector .actions { gap: 4px; }
.token-inspector .actions button { flex: 1 1 70px; margin: 0; }

dialog { max-width: 700px; width: 80%; color: inherit; background: var(--panel); border: 1px solid #577c72; border-radius: 13px; padding: 24px; box-shadow: 0 25px 70px #0005; }
dialog::backdrop { background: #050a12b8; }
dialog pre { max-height: 60vh; overflow: auto; }
.high-contrast { --muted: #e1e7f4; --border: #a1b1cc; }
body.light .playtest-tabs, body.light .stage-tools, body.light .tool-options { background: #e7edf2; }
body.light .playtest-tabs .selected, body.light .stage-tokens .selected, body.light .stage-tools .tool-button[aria-pressed=true] { background: #c7e7d9; color: #175444; border-color: #89b9a7; }
body.light .scene-card { background: #f8fafb; border-color: var(--border); }
body.light .scene-card.selected, body.light .scene-card[selected], body.light .scene-card[aria-pressed=true] { background: #d9ece5; border-color: #73a993; }
body.light .scene-card.selected strong, body.light .scene-card[selected] strong, body.light .scene-card[aria-pressed=true] strong { color: #205345; }
body.light .sound-dock { background: #e3eff0; border-color: #adc5cb; }
body.light .sound-actions button { background: #d4e5e7; color: #2b4753; border-color: #91b4bd; }
body.light .sound-actions button.primary { background: #8fe0c5; color: #132c26; }
body.light .stage-tools .tool-button { color: #4e6577; }
body.light .stage-tokens button { background: #edf3f5; color: #375367; }

/* Focus mode keeps its Exit focus control, playback and proportional scrollable canvas. */
body.map-focus > aside, body.map-focus main > header { display: none; }
body.map-focus.in-play-area main { margin-left: 0; width: 100%; padding: 16px 22px; }
.tabletop-focus > .playtest-tabs, .tabletop-focus > .playtest-rolebar, .tabletop-focus .scene-strip, .tabletop-focus .tabletop-rail, .tabletop-focus .campaign-data { display: none; }
.tabletop-focus .tabletop-layout { grid-template-columns: minmax(0, 1fr); }
.tabletop-focus .tabletop-heading { margin: 0 0 12px; }
.tabletop-focus .stage-tools { margin-bottom: 6px; }
.tabletop-focus .sound-dock { margin-top: 8px; }
@media(max-width: 1220px) {
  .scene-card { grid-template-columns: 65px minmax(0, 1fr); column-gap: 9px; }
  .scene-card img { width: 65px; height: 53px; }
  .scene-card strong { font-size: 11px; }
  .scene-card small { font-size: 9px; }
  .tabletop-layout { grid-template-columns: minmax(0, 1fr) 238px; gap: 13px; }
  .stage-tools .tool-button { padding: 7px 8px; gap: 4px; }
}
@media(max-width: 1100px) {
  body.in-play-area main { padding: 22px 20px; }
  .tabletop-layout { grid-template-columns: minmax(0, 1fr); }
  .tabletop-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tabletop-panel { margin: 0; }
  .tabletop-heading { align-items: flex-start; }
  .tabletop-heading .stage-toolbar { max-width: 58%; }
  .playtest-tabs { gap: 4px; }
  .playtest-tabs button { font-size: 11px; padding: 7px 9px; }
}
@media(max-width: 850px) {
  .tabletop-heading { display: block; }
  .tabletop-heading .stage-toolbar { max-width: none; justify-content: flex-start; margin-top: 10px; }
  .scene-strip { gap: 7px; }
  .scene-card { display: flex; flex-direction: column; align-items: stretch; padding: 5px; gap: 5px; }
  .scene-card img { width: 100%; height: 54px; }
  .scene-card strong, .scene-card small { align-self: auto; margin: 0; padding: 0 3px; }
  .scene-card small { padding-bottom: 3px; }
  .stage-tools .tool-button { padding: 7px; }
}
@media(max-width: 650px) {
  body.in-play-area main { padding: 19px 14px; }
  .tabletop-heading h2 { font-size: 22px; }
  .tabletop-rail { display: block; }
  .tabletop-panel { margin-bottom: 12px; }
  .stage-toolbar select { max-width: 100%; width: 100%; }
  .tabletop-viewport { border-radius: 8px; }
  .scene-card img { height: 48px; }
  .scene-card strong { font-size: 10px; }
  .scene-card small { font-size: 9px; }
  .stage-tools { gap: 3px; padding: 5px; }
  .stage-tools .tool-button { padding: 7px 6px; font-size: 10px; gap: 4px; }
  .stage-tools .tool-button .sz-icon { width: 14px; height: 14px; }
  .tool-options { gap: 8px; padding: 9px; }
  .sound-dock { padding: 12px; }
  .sound-dock header { flex-wrap: wrap; }
  .sound-dock header > small { flex: 1 1 100%; margin: 0 0 2px; }
  .sound-actions > select { max-width: none; }
  .sound-actions > label { flex-basis: 100%; max-width: none; margin-top: 5px; }
  .sound-volumes { gap: 8px; }
  .stage-hud { align-items: flex-start; flex-wrap: wrap; }
  dialog { width: calc(100% - 24px); padding: 18px; }
  body.map-focus.in-play-area main { padding: 15px 12px; }
}
.tabletop-mixer { margin-top: 12px; }
.tabletop-mixer label { display: inline-flex; align-items: center; gap: 8px; width: 30%; margin: 10px 2% 8px 0; }
.tabletop-mixer input[type=range] { width: 100%; min-width: 40px; padding: 0; }
.tabletop-mixer small { display: block; color: var(--muted); font-size: 11px; }
@media(max-width:650px) { .tabletop-mixer label { display: flex; width: 100%; } }

.weather-control { display: grid; grid-template-columns: 1fr auto; gap: 5px 8px; align-items: center; }
.weather-control input { grid-column: 1 / -1; grid-row: 2; width: 100%; accent-color: #74dac0; }
.weather-control output { color: #b4f1dc; font-size: 11px; }
.pending-move { border-color: #b99a63; }
.stage-canvas[data-tool=move]:active { cursor: grabbing; }
