/* The page, laid out like a video page: the game plays in a player, the comments stand beside it, and below
   them are the call for the next story and the proposals. Nothing here changes the game: the stage sizes the
   picture to the room it is given, as it always did. Full screen drops this layout (body loses .docked) and the
   stage fills the window again; the floating window never has it. */
:where(#next-story) { --ink:#2e231c; --paper:#f4ead3; --panel:#e6d9bb; --card:#fbf4e2; --rule:#b3a284; --blue:#3a6462; --blue-dark:#2c5250; --soft:#6a5b4d; --gold:#e3b55a; --red:#a9412b; --shade:rgba(38,27,20,.82); }
body:not(.docked) :is(#next-story, #community-rail) { display:none; }
html:has(body.docked) { height:auto; overflow-x:hidden; overflow-y:auto; overscroll-behavior:auto; }
body.docked { height:auto; min-height:100dvh; overflow:visible; }
body.docked #watch { --side:clamp(300px,27vw,400px); display:grid; grid-template-columns:minmax(0,1fr) var(--side); column-gap:16px; --player-height-limit:max(var(--player-min-height,220px),calc(100dvh - var(--bar,48px) - 6px - var(--peek-gap,44px) - 244px)); max-width:min(1720px,calc((var(--player-height-limit) - 4px) * var(--world-max-aspect) + var(--side) + 60px)); margin:0 auto; padding:16px 20px 0; }
body.docked.community-closed #watch { --side:0px; grid-template-columns:minmax(0,1fr); }

/* the player: everything that used to hang on the window's edges now hangs on the player's */
/* Reserve the bar, CTA gap, button, two subtitle lines and bottom breathing room. */
body.docked #player-slot { position:relative; grid-column:1; grid-row:1; width:100%; aspect-ratio:16 / 9; max-height:var(--player-height-limit); min-height:var(--player-min-height,220px); max-width:calc((var(--player-height-limit) - 4px) * var(--world-max-aspect) + 4px); justify-self:center; }
body.docked #player { position:absolute; inset:0; overflow:hidden; background:#131124; border:2px solid #0c0a16; box-shadow:6px 6px 0 rgba(0,0,0,.4); }
body.docked :is(#stage, #floated) { position:absolute; inset:0; }
body.docked #player .dock { position:absolute; top:10px; }
body.docked #player .dock.left { left:10px; }
body.docked #player .dock.right { right:10px; }
body.docked #player .dock.right [data-panel=chat] { display:none; }
body.docked #player .drawer { position:absolute; top:58px; max-height:calc(100% - 68px); }
body.docked #player .drawer.left { left:10px; }
body.docked #player .drawer.right { right:10px; }
body.docked #pad { position:absolute; inset:auto 0 12px 0; }

/* Chapter details belong beside the chapters control, over the picture. */
.dock.left { align-items:center; }
#now { min-width:0; max-width:220px; display:grid; gap:1px; color:#fbf1dc; text-shadow:0 1px 3px #100d18, 0 0 12px #100d18; }
#now-chapter { font:600 16px/1.2 Georgia,"Iowan Old Style",serif; color:#fbf1dc; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#now-story { font:10px/1.4 "Courier New",monospace; color:#f4ead3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.docked #player { container:game-player / inline-size; }
/* the floating window's button: the bottom right corner of the picture */
body.docked #player .top-actions { position:absolute; inset:auto 12px 12px auto; transform:none; width:max-content; max-width:calc(100% - 190px); text-align:right; }
body.docked #player .top-actions #float { margin:0 0 0 auto; text-align:left; }
body.docked #player .top-actions #float-error { margin:0 0 6px auto; }
body.docked #player:has(#float:not([hidden])) #sound-wait { bottom:calc(1.4cqw + 44px); }
body.docked.mini #player :is(#now, .top-actions) { display:none; }
@media (max-width:1000px) {
  body:not(.docked) .top-actions { top:58px; max-width:calc(100vw - 130px); }
  body:not(.docked) #now { max-width:calc(100vw - 130px); }
}
@container game-player (max-width:1000px) {
  #now { max-width:175px; }
  #now-chapter { font-size:14px; }
  body.docked #player .top-actions { max-width:calc(100% - 190px); }
  body.docked #player .top-actions #float { font-size:11px; padding:6px 10px; }
}
@container game-player (max-width:420px) {
  #now { max-width:calc(100cqw - 130px); }
  #now-chapter { font-size:12px; }
  #now-story { font-size:9px; }
  body.docked #player .top-actions { max-width:calc(100% - 130px); right:8px; bottom:8px; }
  body.docked #player .top-actions #float { font-size:10px; padding:5px 8px; }
}

/* the comments: their own pane, as tall as the player */
body.docked #community-rail { grid-column:2; grid-row:1; display:flex; flex-direction:column; height:0; min-height:100%; overflow:hidden; background:var(--paper); color:var(--ink); border:2px solid var(--ink); box-shadow:6px 6px 0 rgba(0,0,0,.4); }
body.docked.community-closed #community-rail { display:none; }
#community-bar { flex-shrink:0; }
#community-bar #community-status { margin:0; padding:8px 12px; max-width:100%; }
#community-bar button:focus-visible { outline:2px solid var(--red); outline-offset:-2px; }
body.docked .drawer.docked { position:static; width:100%; min-height:0; max-height:none; height:auto; flex:1; border:0; z-index:auto; animation:none; box-shadow:none; background-image:none; }
body.docked .drawer.docked header { display:none; }
body.docked #comment-scroll:has(#comment-list:empty) { display:flex; flex-direction:column; justify-content:center; text-align:center; }
body.docked #comment-status { margin:0; padding:24px 12px; }

/* below: the next story is the players' to choose */
#next-story { max-width:1720px; margin:0 auto; padding:26px 20px 72px; }
#cta { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:22px 24px; color:var(--ink); background:var(--paper); border:2px solid var(--ink); box-shadow:6px 6px 0 rgba(0,0,0,.4); }
#tagline { margin:0 0 6px; font:600 clamp(21px,2.3vw,30px)/1.2 Georgia,"Iowan Old Style",serif; letter-spacing:0; text-transform:none; color:var(--ink); }
#cta p { margin:0; max-width:62ch; color:var(--soft); font-size:15px; }
#suggest-cta { flex-shrink:0; padding:13px 22px; border:2px solid var(--ink); border-radius:0; background:var(--gold); color:var(--ink); box-shadow:4px 4px 0 var(--shade); font:700 15px/1.3 "Courier New",monospace; white-space:nowrap; transition:translate .06s, box-shadow .06s; }
#suggest-cta:hover { background:#efc878; }
#suggest-cta:active { translate:3px 3px; box-shadow:1px 1px 0 var(--shade); }
#proposal-browse-heading { margin:30px 0 4px; font:700 13px/1.5 "Courier New",monospace; letter-spacing:.12em; text-transform:uppercase; color:#f4ead3; }
#next-story #proposal-status { color:#c9c3dd; }
#next-story #proposal-status:empty { display:none; }
#proposal-list { grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; align-items:start; }
#next-story :is(button, select) { border-radius:0; }
#next-story button:focus-visible, #next-story summary:focus-visible { outline:3px solid var(--gold); outline-offset:2px; }
#proposal-more { margin-top:8px; color:#f4ead3; border:2px solid #f4ead3; }
.admin-accept { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; padding-top:12px; border-top:1px dashed var(--rule); }
.admin-accept select { flex:1; min-width:0; padding:6px 8px; font:12px/1.4 "Courier New",monospace; color:var(--ink); background:var(--paper); border:2px solid var(--ink); }
.admin-accept button { padding:6px 12px; background:var(--blue); color:#fff6df; border:2px solid var(--ink); font:700 12px/1.4 "Courier New",monospace; box-shadow:2px 2px 0 var(--shade); }
.admin-accept .small { flex-basis:100%; margin:0; }

/* the form alone is what opens over the game now */
#panel-board { width:min(600px,calc(100vw - 32px)); height:auto; max-height:92dvh; }
#proposal-workspace { display:block; overflow-y:auto; }
#proposal-workspace > section { overflow:visible; }
#proposal-compose { border-left:0; }

/* the other games, in the chapters drawer */
#games { list-style:none; margin:0 0 16px; padding:0 0 14px; display:grid; gap:6px; border-bottom:1px dashed var(--rule); }
#games:empty { display:none; }
#games a { display:flex; justify-content:space-between; gap:8px; padding:8px; color:var(--ink); background:var(--card); border:1px solid var(--rule); border-left:4px solid var(--blue); text-decoration:none; font-size:14px; }
#games a[aria-current] { border:2px solid var(--ink); border-left:6px solid var(--red); background:#f3dfae; }
#games .tag { color:var(--red); font:700 11px/1.8 "Courier New",monospace; text-transform:uppercase; }

@media (max-width:899px) {
  body.docked #watch { grid-template-columns:minmax(0,1fr); max-width:100%; padding:0; --player-min-height:160px; --player-height-limit:max(var(--player-min-height),min(62dvh,calc(100dvh - var(--bar,46px) - var(--peek-gap,44px) - 244px - var(--mobile-toolbar-height,56px)))); }
  body.docked #player-slot { aspect-ratio:16 / 10; max-height:var(--player-height-limit); max-width:calc((var(--player-height-limit) - 2px) * var(--world-max-aspect)); margin-bottom:var(--mobile-toolbar-height,56px); }
  body.docked #player { border-width:0 0 2px; box-shadow:none; }
  body.docked #community-rail { grid-column:1; grid-row:3; height:min(64dvh,520px); min-height:0; margin:16px 12px 0; }
  #next-story { padding:22px 12px 56px; }
  #cta { flex-direction:column; align-items:stretch; padding:18px 16px; }
  #suggest-cta { white-space:normal; }
}
