/* The same Options panel follows the chat column; the video stays mounted. */
#nav-room-menu, #lounge-section-bar, #lounge-section, .speech-rocker, #lounge-menu[hidden] { display:none; }
body.room-page #chat-opts-panel.cool-modal:not(.hidden) {
  position:relative; inset:auto; transform:none; animation:none; z-index:5;
  box-sizing:border-box; flex:0 1 auto; align-self:stretch;
  width:100%; max-width:none; min-width:0; height:auto; min-height:0;
  max-height:min(78%, 480px); padding:0; margin:0; overflow:auto;
}
body.room-page #chat-opts-panel .cool-modal-body { min-height:0; overflow:auto; }
body.room-page #chat-opts-panel .opts-shell { min-height:0; }
body.room-page #chat-opts-panel .sound-level {
  display:grid; grid-template-columns:minmax(0,1fr) 3.2em; align-items:center; gap:2px 8px;
}
.sound-level > span:first-child { grid-column:1/-1; }
.sound-level input { width:100%; margin:0; cursor:pointer; }
.sound-level > span:last-child { text-align:right; font-variant-numeric:tabular-nums; }
.sound-mix { margin-top:8px; padding-top:8px; border-top:1px solid var(--border); }
#opt-test-speech { padding:2px 0; border:0; background:transparent; text-decoration:underline; }
#opt-test-speech:disabled { opacity:.54; }
@media (max-width:768px) {
  body.room-page #main > #chat-opts-panel.cool-modal:not(.hidden) {
    order:1; flex:0 0 auto; max-height:min(48dvh, 420px);
  }
}
@media (min-width:641px) and (max-width:768px) {
  body:not(.layout-cinema) #mainpage > #main:has(> #chat-opts-panel:not(.hidden)) {
    display:grid; grid-template-columns:minmax(270px, 40%) minmax(0,1fr); gap:0 8px;
    grid-template-areas:"options picture" "chat picture"; flex:none; height:auto;
  }
  body.layout-synchtube #mainpage > #main:has(> #chat-opts-panel:not(.hidden)) {
    grid-template-columns:minmax(0,1fr) minmax(270px,40%); grid-template-areas:"picture options" "picture chat";
  }
  #main:has(> #chat-opts-panel:not(.hidden)) > #videowrap { grid-area:picture; align-self:start; }
  #main:has(> #chat-opts-panel:not(.hidden)) > #chatwrap { grid-area:chat; width:100%; height:200px; }
  body.room-page #main > #chat-opts-panel.cool-modal:not(.hidden) { grid-area:options; max-height:min(460px,66dvh); }
}
@media (min-width:641px) {
  body.layout-cinema:has(> #chat-opts-panel:not(.hidden)) { --options-width:min(410px,44vw); }
  html body.layout-cinema > #chat-opts-panel.cool-modal:not(.hidden) {
    position:fixed; inset:0 auto auto 0; width:var(--options-width); max-height:100dvh; z-index:1901;
  }
  html body.layout-cinema:has(> #chat-opts-panel:not(.hidden)) #videowrap {
    left:var(--options-width); right:0; width:calc(100% - var(--options-width));
  }
}

/* The lounge uses the recap theatre, the room wordmark and its bitmap lettering. */
html[data-theme="lounge"] {
  --bg:#100f15; --bg-panel:#19161e; --bg-card:#221d26; --bg-input:#242029;
  --bg-chat:#110f16; --border:#4e424d; --border-light:#726270; --text:#fff3dd;
  --text-dim:#dbcdc9; --text-muted:#c0aeb4; --accent:#e5c895; --cta:#e5c895;
  --player-idle-text:#fff1da; --player-idle-font:'PixelOperator', monospace;
  --lounge-type:'PixelOperator', monospace;
}
html[data-theme="lounge"] #navbar { background:#100e14; border-color:#342d37; }
html[data-theme="lounge"] #daynight-band { display:none; }
html[data-theme="lounge"] #nav-room-menu { display:inline-block; }
html[data-theme="lounge"] #nav-links :is(#room-games-toggle,#nav-coolhost) { display:none; }
html[data-theme="lounge"] #nav-links :is(a, #nav-room-menu) {
  font:700 19px/1 var(--lounge-type); background:transparent; border:0; color:var(--text); padding:6px 9px;
}
html[data-theme="lounge"] #nav-links [aria-expanded=true] { color:var(--accent); }
html[data-theme="lounge"] :is(#chatheader,#videowrap-header,#bottom-queue,#chatline-wrap) { background:var(--bg-panel); }
html[data-theme="lounge"] :is(#chatheader,#currenttitle,#chatline,#messagebuffer,#plcontrol) { font-family:var(--lounge-type); }
html[data-theme="lounge"] #messagebuffer { font-size:calc(18px * var(--chat-scale,1)); }
html[data-theme="lounge"] :is(#player.no-media,.player-idle) {
  background:#17111d url(/static/img/lounge-theatre.png) center 54% / cover no-repeat; image-rendering:pixelated;
}
html[data-theme="lounge"] #chat-opts-panel {
  color:var(--text); background:#19151d; border:0; border-bottom:1px solid var(--border);
  border-radius:0; box-shadow:none; font:19px/1.12 var(--lounge-type);
}
html[data-theme="lounge"] #chat-opts-panel .cool-modal-header {
  padding:9px 56px 4px 16px; min-height:34px; background:none; border:0;
}
html[data-theme="lounge"] #chat-opts-panel .cool-modal-body { padding:4px 16px 12px; }
html[data-theme="lounge"] #inventory-panel .cool-modal-body { padding:6px 8px 10px; }
html[data-theme="lounge"] #inventory-panel .inventory-views { gap:3px; flex-wrap:wrap; }
html[data-theme="lounge"] #inventory-panel .inventory-views button {
  flex:0 0 auto; min-width:0; width:auto; padding:4px 7px; min-height:38px;
  font:600 14px/1.2 system-ui,sans-serif; white-space:nowrap; border-color:transparent;
  text-decoration:underline; text-underline-offset:3px;
}
html[data-theme="lounge"] #inventory-health { white-space:nowrap; }
html[data-theme="lounge"] #inventory-grid-full .store-item-name { font:700 23px/1.02 var(--lounge-type); }
html[data-theme="lounge"] #inventory-grid-full .store-item-meta { font:14px/1.25 system-ui,sans-serif; color:var(--text-dim); }
html[data-theme="lounge"] #inventory-grid-full .store-item-img { width:52px; height:52px; image-rendering:pixelated; }
html[data-theme="lounge"] #inventory-panel .store-item-actions button { min-width:68px; padding-inline:8px; font:600 14px/1.2 system-ui,sans-serif; }
html[data-theme="lounge"] #inventory-grid-full .store-use-btn[data-weapon="0"] {
  color:var(--bg); background:var(--accent);
}
@media (max-width:640px) {
  html[data-theme="lounge"] #inventory-panel .cool-modal-header.has-you-tabs { padding:0 24px 2px 0; min-height:40px; }
  html[data-theme="lounge"] #inventory-panel .you-tabs { column-gap:0; }
  html[data-theme="lounge"] #inventory-panel .you-tab { padding-inline:6px; min-height:40px; }
  html[data-theme="lounge"] #inventory-panel:not(.hidden).cool-modal {
    inset:auto 0 0; height:auto; max-height:76dvh; padding:10px 10px max(10px,env(safe-area-inset-bottom));
    transform:none; animation-name:cm-pop; resize:none;
  }
}
html[data-theme="lounge"] #chat-opts-panel .cool-modal-title { font:700 29px/1 var(--lounge-type); color:var(--text); }
html[data-theme="lounge"] #chat-opts-panel:not(.room-menu-open) #options-title {
  position:absolute; inline-size:1px; block-size:1px; overflow:hidden; clip-path:inset(50%);
}
html[data-theme="lounge"] #chat-opts-panel:not(.room-menu-open) #lounge-section {
  display:block; field-sizing:content; width:auto; flex:none; max-width:100%; color:#fff1d8; background:#19151d;
  border:0; padding:1px 3px; font:700 28px/1 var(--lounge-type);
}
html[data-theme="lounge"] #chat-opts-panel .opts-shell > #opts-nav,
html[data-theme="lounge"] #chat-opts-panel .opts-pages > .cool-section > .cool-section-label,
#chat-opts-panel.room-menu-open .opts-shell { display:none; }
html[data-theme="lounge"] #chat-opts-panel .opts-shell { display:block; }
html[data-theme="lounge"] #chat-opts-panel.room-menu-open .opts-shell { display:none; }
html[data-theme="lounge"] #chat-opts-panel .opts-pages { padding:0; }
html[data-theme="lounge"] #chat-opts-panel :is(.opt-row,.cool-check,#opt-test-speech) { font:19px/1.1 var(--lounge-type); color:var(--text); }
html[data-theme="lounge"] #chat-opts-panel .cool-check { min-height:23px; }
html[data-theme="lounge"] #chat-opts-panel .speech-switch {
  position:relative; display:flex; justify-content:space-between; gap:8px; font-weight:700; cursor:pointer;
}
html[data-theme="lounge"] .speech-switch input { position:absolute; opacity:0; }
html[data-theme="lounge"] .speech-rocker { display:inline-flex; border:1px solid #99867d; }
.speech-rocker b { padding:3px 8px; font-weight:400; }
.speech-switch input:checked ~ .speech-rocker b:last-child,
.speech-switch input:not(:checked) ~ .speech-rocker b:first-child { color:#261d22; background:#e5c895; font-weight:700; }
.speech-switch input:focus-visible ~ .speech-rocker { outline:2px solid white; outline-offset:2px; }
html[data-theme="lounge"] .sound-level input {
  appearance:none; padding:0; height:17px; border:0; border-radius:0; background:
    repeating-linear-gradient(90deg,transparent 0 calc(6.25% - 2px),#19151d calc(6.25% - 2px) 6.25%),
    linear-gradient(90deg,#e5c895 var(--level),#514850 var(--level));
}
html[data-theme="lounge"] .sound-level input::-webkit-slider-thumb {
  appearance:none; background:#fff3d9; width:5px; height:20px; border:1px solid #514850; border-radius:0;
}
html[data-theme="lounge"] .sound-level input::-moz-range-thumb { background:#fff3d9; width:5px; height:20px; border:0; border-radius:0; }
html[data-theme="lounge"] :is(input,select) { accent-color:#e5c895; }
#lounge-menu:not([hidden]) { display:grid; align-content:start; gap:2px; }
#chat-opts-panel #lounge-menu :is(button,a) {
  text-align:left; font:22px/1.1 'PixelOperator',monospace; min-height:32px; padding:4px 8px;
  border:0; background:transparent; color:var(--text); text-decoration:none;
}
#chat-opts-panel #lounge-menu :is(button,a):is(:hover,:focus-visible) { color:#211923; background:#e5c895; }
#lounge-menu button[hidden] { display:none; }
@media (max-width:640px) { #lounge-menu { grid-template-columns:1fr 1fr; } }

@media (min-width:769px) {
  body.room-page:not(.layout-cinema) #mainpage > #main:has(#chat-opts-panel:not(.hidden)) {
    min-height:min(540px, calc(100dvh - 100px));
  }
}
html[data-theme="lounge"] #chat-opts-panel .opts-pages > [data-opts=Sound] { padding:0; }
html[data-theme="lounge"] #chat-opts-panel .sound-level { margin:4px 0 0; }
html[data-theme="lounge"] #chat-opts-panel .sound-level input[type=range] {
  min-height:24px; padding:0; background-size:100% 14px; background-repeat:no-repeat; background-position:center;
}
html[data-theme="lounge"] #chat-opts-panel .sound-mix { margin:6px 0 0; padding:5px 0 0; }
@media (max-width:640px) {
  html[data-theme="lounge"] #chat-opts-panel .sound-mix { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px 12px; }
  html[data-theme="lounge"] #chat-opts-panel .sound-mix .cool-check { grid-column:1/-1; }
  html[data-theme="lounge"] #chat-opts-panel .speech-switch { min-height:34px; }
  html[data-theme="lounge"] #chat-opts-panel .sound-level { min-height:0; }
}

/* Lounge uses the same short command row for settings and player moves. */
html[data-theme="lounge"] #chat-opts-panel:not(.room-menu-open) #lounge-section-bar {
  display:flex; align-items:stretch; flex-wrap:wrap; gap:2px; min-width:0;
}
html[data-theme="lounge"] #chat-opts-panel:not(.room-menu-open) #lounge-section {
  position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer;
}
html[data-theme="lounge"] #lounge-section-bar :is(button,label) {
  position:relative; display:inline-flex; align-items:center; min-height:32px; padding:2px 6px;
  border:0; border-radius:0; background:transparent; color:var(--text); font:700 19px/1 var(--lounge-type);
}
html[data-theme="lounge"] #lounge-section-bar :is([aria-pressed=true],.selected) { background:var(--accent); color:var(--bg); }
html[data-theme="lounge"] #lounge-section-bar :is(button,label):focus-within { outline:1px solid var(--text); outline-offset:-2px; }
html[data-theme="lounge"] body.room-page #leftcontrols #game-rail :is(#fishing-action,#fishing-journal-open,.job-actions-toggle,#rail-poll):not(.hidden) {
  background:#29232c; border:1px solid #675763; border-bottom:3px solid #50424e;
  color:var(--text); border-radius:2px; box-shadow:none; text-shadow:none; padding-inline:10px;
}
html[data-theme="lounge"] body.room-page #leftcontrols #game-rail :is(#fishing-action,#fishing-journal-open,.job-actions-toggle,#rail-poll) .btn-label {
  font:700 20px/1 var(--lounge-type) !important; color:inherit; text-transform:none; letter-spacing:0;
}
html[data-theme="lounge"] body.room-page #leftcontrols #game-rail :is(button[aria-expanded=true],#fishing-action:not(:disabled)):not(.hidden) {
  background:var(--accent); color:#241b23; border-color:#bba378;
}
html[data-theme="lounge"] body.room-page #leftcontrols #game-rail button:focus-visible { outline:2px solid var(--text); outline-offset:-4px; }
#lounge-inventory { display:none; }
html[data-theme="lounge"] body:not(.mobile-room-queue):not(.layout-cinema) #leftcontrols #game-rail:has(#action-tools-toggle:not(.hidden)) #lounge-inventory {
  display:inline-flex; align-items:center; min-height:var(--room-action-height); padding:0 10px;
  font:700 20px/1 var(--lounge-type); color:var(--text); background:#29232c;
  border:1px solid #675763; border-bottom:3px solid #50424e; border-radius:2px;
}
html[data-theme="lounge"] body:not(.mobile-room-queue):not(.layout-cinema) #action-tools-menu [data-tool="btn-inventory"] { display:none; }
html[data-theme="lounge"] #game-rail :is(#job-actions-menu,#action-tools-menu) {
  background:var(--bg-panel); border:1px solid var(--border-light); border-radius:0;
}
html[data-theme="lounge"] #game-rail :is(.job-action-label,[data-tool] span) { font:700 19px/1.1 var(--lounge-type); }
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-plate {
  height:auto; min-height:44px; padding:7px 10px; align-items:center; text-align:left;
}
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-text {
  display:grid; gap:2px; min-width:0; flex:1; text-align:left;
}
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-label {
  font:700 21px/1 var(--lounge-type); color:var(--text); white-space:normal;
}
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-plate .job-action-desc {
  display:block; font:16px/1.05 var(--lounge-type); text-align:left;
  color:var(--text-dim); white-space:normal; overflow:visible; overflow-wrap:anywhere;
}
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-plate:hover,
html[data-theme="lounge"] #game-rail #job-actions-menu .job-action-plate:focus-visible { background:#39303a; }
html[data-theme="lounge"] #leftcontrols.room-action-bar #job-bar { flex:0 0 auto; width:max-content; max-width:100%; }
html[data-theme="lounge"] #leftcontrols.room-action-bar #hp-text { min-width:max-content; flex-shrink:0; }
.lounge-moves-cover { display:none; }
html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu {
  --text:#282626; --text-dim:#413831; --text-bright:#121211; --bg-card:#ded3b9; --bg-input:#fff9ea;
  background:#f0e6ce; color:var(--text); padding:0; border:1px solid #5d5040;
}
html[data-theme="lounge"] #job-actions-menu .lounge-moves-cover {
  display:flex; flex-direction:column; align-items:flex-start; justify-content:center; grid-column:1/-1;
  min-height:67px; padding:5px 12px; background:#332938 url(/static/img/lounge-coolsville.png) right 54% / auto 130px repeat-x;
  image-rendering:pixelated; color:#fff5d8; font:700 22px/1 var(--lounge-type);
}
.lounge-moves-cover span,.lounge-moves-cover strong { padding:2px 5px; background:#272128; }
.lounge-moves-cover strong { font-size:26px; }
html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-plate {
  background:transparent; color:#282626; border:0; box-shadow:none;
}
html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-plate:is(:focus-visible,:hover) {
  background:#d5c6a4; outline:1px solid #6f5b40; outline-offset:-2px;
}
@media (max-width:640px) {
  html[data-theme="lounge"] body.room-page #leftcontrols #game-rail #job-actions-menu {
    width:calc(100vw - 16px); min-width:0; max-width:calc(100vw - 16px); box-sizing:border-box;
    max-height:min(65dvh,var(--room-control-menu-available,65dvh)); overflow-y:auto;
    padding:0; border:1px solid #5d5040;
  }
  html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-plate {
    height:auto; min-height:48px; padding:6px 10px; border:0; background:transparent;
  }
  html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-label {
    font:700 23px/1 var(--lounge-type); font-size:23px !important; color:var(--text);
  }
  html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-plate .job-action-desc {
    font:16px/1.35 system-ui,sans-serif; font-size:16px !important; color:#413831;
  }
  html[data-theme="lounge"] #leftcontrols #game-rail #job-actions-menu .job-action-plate:is(:focus-visible,:hover) {
    background:#d5c6a4; outline:1px solid #6f5b40; outline-offset:-2px;
  }
}
