.tavern-room-dialog{width:min(1060px,calc(100% - 24px));max-width:none;height:auto;max-height:calc(100dvh - 24px)}
.tavern-room-dialog [hidden]{display:none!important}
.tavern-room-body{padding:20px!important;overflow:auto;min-height:0}
.tavern-section-heading,.tavern-card-top,.tavern-chat-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.tavern-section-heading h3,.tavern-card-top h3,.tavern-chat-heading h3{margin:0}
.tavern-help{font-size:.88rem;line-height:1.6;color:var(--ui-muted);margin:8px 0 14px}
.tavern-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
.tavern-actions button{min-height:44px;margin:0}.tavern-actions small,.tavern-room-card>small{color:var(--ui-muted);line-height:1.5}
.tavern-room-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:18px}
.tavern-room-card,.tavern-control-card,.tavern-editor{padding:18px;border:1px solid var(--ui-line);border-radius:16px;background:var(--ui-control);min-width:0}
.tavern-room-card{display:flex;flex-direction:column}.tavern-room-card h3{margin:14px 0 4px;overflow-wrap:anywhere}.tavern-room-card p{font-size:.9rem;line-height:1.6;flex:1;overflow-wrap:anywhere}
.tavern-room-mark{display:grid;place-items:center;width:36px;height:36px;border-radius:12px;background:var(--ui-surface);color:var(--ui-mint);font-size:1.25rem}
.tavern-pill{border:1px solid var(--ui-line);border-radius:100px;padding:4px 9px;color:var(--ui-muted);font-size:.72rem;white-space:nowrap}
.tavern-editor{margin:18px 0}.tavern-editor label,.tavern-room-chat label,.tavern-control-card label{display:grid;gap:7px;font-size:.9rem;margin-top:12px}
.tavern-room-dialog input:not([type=range]),.tavern-room-dialog textarea,.tavern-room-dialog select{box-sizing:border-box;width:100%;max-width:100%;min-height:44px;background:var(--ui-bg);color:var(--ui-text);border:1px solid var(--ui-line);border-radius:10px;padding:10px;font:inherit}
.tavern-room-dialog textarea{resize:vertical}.tavern-room-dialog button:focus-visible,.tavern-room-dialog a:focus-visible,.tavern-room-dialog input:focus-visible,.tavern-room-dialog textarea:focus-visible,.tavern-room-dialog select:focus-visible{outline:3px solid var(--ui-mint);outline-offset:3px}
.tavern-presence{padding:10px 12px;border-radius:10px;background:var(--ui-control);font-size:.85rem;overflow-wrap:anywhere}
.tavern-room-columns{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:18px;align-items:start;margin-top:18px}
.tavern-room-chat{min-width:0}.tavern-room-chat .chat-message p{white-space:pre-wrap;overflow-wrap:anywhere}.tavern-room-chat .chat-message{padding:12px;border:1px solid var(--ui-line);border-radius:12px;margin:10px 0;background:var(--ui-control)}
.tavern-room-chat time{font-size:.75rem;color:var(--ui-muted);margin-left:10px}.tavern-room-chat .chat-message button{font-size:.75rem;min-height:36px}
.tavern-empty{padding:28px 14px;text-align:center;border:1px dashed var(--ui-line);border-radius:12px;color:var(--ui-muted)}
.tavern-room-controls{display:grid;gap:14px}.tavern-control-card audio{width:100%;margin-top:10px}.tavern-control-card>a{display:inline-block;margin-top:14px;font-size:.85rem}.tavern-control-card details{margin-top:14px}.tavern-control-card summary{cursor:pointer}
.tavern-compose-tools,.tavern-notify-tools{border:1px solid var(--ui-line);background:var(--ui-control);border-radius:12px;padding:12px;margin-top:12px;font-size:.85rem}.tavern-compose-tools summary,.tavern-notify-tools summary{cursor:pointer;font-weight:700;min-height:28px}.tavern-compose-tools fieldset{border:0;padding:0;min-width:0}.tavern-compose-tools fieldset:disabled{opacity:.65}.tavern-compose-tools button,.tavern-notify-tools button{margin-top:8px}.tavern-selection,.tavern-attachments,.tavern-mentions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.tavern-selection button,.tavern-attachments button{max-width:100%;overflow-wrap:anywhere;text-align:left}.tavern-mentions span{border-radius:8px;background:var(--ui-bg);color:var(--ui-mint);padding:3px 7px;font-size:.8rem}.tavern-chat-image{display:block;max-width:100%;max-height:360px;object-fit:contain;margin:10px 0}.tavern-room-chat [data-media-preview] a{display:block;overflow-wrap:anywhere;margin-top:8px}
@media(max-width:800px){.tavern-room-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.tavern-room-columns{grid-template-columns:1fr}.tavern-room-controls{grid-template-columns:1fr 1fr}}
@media(max-width:540px){.tavern-room-dialog{width:calc(100% - 12px);max-height:calc(100dvh - 12px)}.tavern-room-body{padding:14px!important}.tavern-room-grid,.tavern-room-controls{grid-template-columns:1fr}.tavern-room-card,.tavern-control-card,.tavern-editor{padding:14px}.tavern-section-heading{align-items:flex-start}.tavern-section-heading>button{width:100%}}

html:has(.tavern-room-dialog[open]),html:has(.tavern-room-dialog[open]) body{overflow:hidden}
.tavern-window-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex:none}
.tavern-window-actions>button{width:44px;height:44px;min-width:44px;padding:8px}
.tavern-room-chat [data-messages]:focus-visible{outline:2px solid var(--ui-mint);outline-offset:-2px}
@media(min-width:900px) and (min-height:600px){
  .tavern-room-dialog.tavern-active{height:min(680px,calc(100dvh - 48px))}
  .tavern-room-dialog.tavern-active:not(.tavern-editing)>.tavern-room-body{display:flex;flex-direction:column;overflow:hidden;padding:14px!important}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) [data-active]{display:flex;flex-direction:column;flex:1;min-height:0;margin:0;padding:0;border:0}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) .tavern-room-columns{flex:1;min-height:0;align-items:stretch;margin-top:10px;gap:14px}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) .tavern-room-chat{display:flex;flex-direction:column;min-height:0;margin:0;padding:0;border:0}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) [data-messages]{flex:1;min-height:75px;overflow:auto;overscroll-behavior:contain;padding:0 6px 0 2px;scrollbar-gutter:stable}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) [data-chat-form]{flex:none;max-height:50%;overflow:auto;overscroll-behavior:contain}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) .tavern-room-controls{overflow:auto;overscroll-behavior:contain;display:block;padding-right:6px;scrollbar-gutter:stable}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) .tavern-room-controls>section{margin-top:0;margin-bottom:12px}
  .tavern-room-dialog [data-active]>.tavern-section-heading{flex:none;align-items:center;flex-wrap:nowrap}
  .tavern-room-dialog [data-active]>.tavern-section-heading>div:first-child{min-width:0}
  .tavern-room-dialog [data-active]>.tavern-section-heading .tavern-actions{margin:0;flex:none}
  .tavern-room-dialog [data-room-description]{margin:4px 0;max-height:40px;overflow:auto}
  .tavern-room-dialog .tavern-presence{margin:8px 0 0;max-height:96px;overflow:auto;flex:none;padding:6px 10px}
  .tavern-room-dialog .tavern-room-chat>.tavern-help{margin:2px 0 6px;font-size:12px}
  .tavern-room-dialog .tavern-room-chat>.tavern-actions{margin:0}
  .tavern-room-dialog [data-chat-form] label{margin-top:6px;gap:4px}
  .tavern-room-dialog [data-body]{height:64px;min-height:44px;max-height:120px}
  .tavern-room-dialog [data-chat-status]:empty,.tavern-room-dialog [data-status]:empty{display:none}
  .tavern-room-dialog [data-chat-status],.tavern-room-dialog [data-status]{flex:none;font-size:12px;margin:4px 0;max-height:44px;overflow:auto}
  .tavern-room-dialog .tavern-compose-tools,.tavern-room-dialog .tavern-notify-tools{margin-top:6px;padding:6px 10px}
}
.tavern-room-dialog.panel-expanded{height:100dvh;max-height:100dvh;width:100%;max-width:none;border-radius:0}

/* Controls stay before the conversation in reading order, with compact disclosure panels. */
.tavern-room-controls{grid-column:2;grid-row:1}
.tavern-room-chat{grid-column:1;grid-row:1}
.tavern-media-panel{margin:0 0 10px;padding:12px}
.tavern-media-panel>summary{min-height:44px;cursor:pointer;font-weight:700;line-height:1.4}
.tavern-media-panel>summary small{display:block;font-weight:400;color:var(--ui-muted);font-size:.75rem;margin:3px 0 0 18px}
.tavern-room-dialog summary:focus-visible{outline:3px solid var(--ui-mint);outline-offset:3px;border-radius:6px}
@media(max-width:899px),(max-height:599px){
  .tavern-room-columns{display:flex;flex-direction:column;gap:10px;margin-top:10px}
  .tavern-room-controls,.tavern-room-chat{width:100%;box-sizing:border-box}
  .tavern-room-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .tavern-room-controls>[data-portrait-choice]{grid-column:1/-1;order:3}
  .tavern-media-panel{padding:8px 10px;margin:0}
  .tavern-media-panel[open]{grid-column:1/-1}
  .tavern-room-chat [data-messages]{max-height:clamp(180px,43dvh,390px);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
  .tavern-room-chat [data-body]{height:64px;min-height:44px;max-height:140px}
  .tavern-room-dialog .tavern-compose-tools,.tavern-room-dialog .tavern-notify-tools{margin-top:6px;padding:8px 10px}
  .tavern-room-dialog [data-active]>.tavern-section-heading{gap:6px}
  .tavern-room-dialog [data-active]>.tavern-section-heading .tavern-actions{margin:0}
  .tavern-room-dialog [data-room-description]{margin:4px 0 8px}
  .tavern-room-dialog .tavern-presence{max-height:76px;overflow:auto;margin-top:8px;padding:6px 8px}
  .tavern-room-dialog [data-status],.tavern-room-dialog [data-chat-status]{font-size:.8rem;margin:6px 0}
}

.tavern-room-chat [data-chat-form]{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;align-items:start;margin:6px 0 0}
.tavern-room-dialog [data-chat-form] .tavern-compose-message{margin:0}
.tavern-compose-message>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.tavern-room-dialog [data-chat-form] [data-body]{height:44px;min-height:44px;resize:none}
.tavern-room-dialog [data-chat-form] [data-body]:is(:focus,:not(:placeholder-shown)){height:76px;resize:vertical}
.tavern-room-chat [data-chat-form]>button{min-height:44px}
.tavern-room-chat [data-social]{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 8px}
.tavern-room-dialog [data-social] > details{margin:0;padding:0 8px;background:transparent}
.tavern-room-dialog [data-social] > details summary{min-height:44px;align-content:center}
.tavern-room-dialog [data-social] > details[open],.tavern-room-chat [data-social] > [data-selection]{grid-column:1/-1}
.tavern-room-chat [data-social] > [data-selection]:empty{display:none}
.tavern-music-group{margin-top:12px;padding-top:10px;border-top:1px solid var(--ui-line)}
.tavern-music-group h4{margin:0;font-size:.9rem}
.tavern-music-group [data-listen]{border-color:var(--ui-mint)}

.tavern-room-dialog .chat-search label{margin:0}
.tavern-history-actions{display:flex;gap:8px;flex-wrap:wrap}
.tavern-history-actions:not(:has(button:not([hidden]))){display:none}
@media(min-width:900px){
  .member-dialog.adventure-dialog.tavern-room-dialog:not(.panel-expanded){width:min(1060px,calc(100% - 24px));max-width:1060px}
}

.tavern-room-chat .chat-message{padding:8px 10px;margin:6px 0}
.tavern-room-chat .chat-message>p{margin:4px 0 6px;line-height:1.45}
@media(min-width:900px){
  .tavern-room-chat .chat-search{grid-template-columns:auto minmax(110px,1fr);align-items:center;gap:2px 8px}
  .tavern-room-chat .chat-search small{grid-column:1/-1}
}
@media(min-width:900px) and (min-height:600px) and (max-height:660px){
  .tavern-room-dialog.tavern-active:not(.tavern-editing)>.tavern-room-body{overflow:auto}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) [data-messages]{flex:none;min-height:180px;max-height:230px}
  .tavern-room-dialog.tavern-active:not(.tavern-editing) [data-chat-form]{max-height:none}
}
