/* Same slate instrument frame as the practice modes: navigation above,
   scrollable content in the middle and the actual contact at the bottom. */
.chat-workspace { position: fixed; inset-inline: 0; top: var(--trainer-viewport-top, 0px); height: var(--trainer-viewport-height, 100dvh); min-height: 0; overflow: hidden; }
.chat-workspace .app-shell { height: 100%; width: 100%; padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-workspace .topbar { flex: none; min-height: 42px; height: auto; padding-block: 2px; }
.chat-workspace .connection-strip { display: flex; align-items: center; gap: 6px; }
.chat-workspace .connection-strip .eyebrow { display: none; }
.chat-workspace #disconnect-button { min-height: 36px; padding: 4px 8px; font-size: 12px; }
.chat-navigation { flex: none; display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--line); }
.chat-navigation #workspace-nav { display: contents; }
.chat-navigation .workspace-hint { display: none; }
.chat-navigation button { min-height: 44px; padding: 8px; border: 0; border-radius: 0; background: transparent; color: var(--text); }
.chat-navigation button[aria-pressed=true] { box-shadow: inset 0 -3px var(--blue-strong); color: var(--blue); }
.chat-navigation #chat-settings-button { margin-left: auto; }
.chat-navigation #chat-back {
    flex: none;
    margin-block: 4px;
    padding: 8px 14px;
    border: 1px solid #a3ddff;
    border-radius: 8px;
    background: var(--blue);
    color: var(--page-deep);
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}
.chat-navigation #chat-back:hover { background: #9adaff; }
.chat-navigation #chat-back:active { background: #52b7ee; }
.chat-workspace:not(.chat-auxiliary) #chat-back { display: none; }
.chat-auxiliary #workspace-nav { display: none; }
.chat-workspace main { display: flex; flex: 1 1 0; min-height: 0; flex-direction: column; gap: 6px; padding: 0; overflow: auto; }
.chat-workspace .login-card { flex: none; min-height: 0; padding: 10px; }
.chat-workspace .login-card.is-connected { display: none; }
.chat-workspace .login-card:not(.is-connected) .login-copy { display: none; }
.chat-workspace .login-controls { grid-template-columns: minmax(0, 1fr) auto; }
.chat-workspace .login-controls label { grid-column: 1 / -1; }
.chat-workspace .login-controls .status { grid-column: 1 / -1; }
.chat-workspace .panel { box-shadow: none; border-radius: 8px; }
/* Reserve three short messages even with enlarged text. Short viewports scroll
   the whole panel instead of clipping its controls or either scrollable list. */
.chat-workspace #lobby-panel { display: flex; flex-direction: column; flex: 1 0 0; min-height: min-content; }
.chat-workspace #lobby-panel > .panel-header { flex: none; }
.chat-workspace .lobby-layout { flex: 1 0 auto; }
.chat-workspace .lobby-main { display: flex; flex-direction: column; min-height: 0; }
.chat-workspace .lobby-main > :not(.lobby-log) { flex: none; }
/* The 1.5em fallback matches the log line-height on iOS 15. Newer engines use
   lh, which also follows Android's enlarged WebView text metrics. */
.chat-workspace .lobby-log { height: auto; min-height: calc(3 * max(1.5em, 24px) + 23px); min-height: calc(3 * max(1lh, 24px) + 23px); flex: 1 1 0; overscroll-behavior: contain; }
.chat-workspace .lobby-log .log-entry { grid-template-columns: max-content fit-content(10ch) minmax(0, 1fr); gap: 0 8px; padding: 3px 8px; }
.chat-workspace .lobby-log .log-message-body { grid-column: auto; }
.chat-workspace .roster-card { min-height: 0; }
.chat-workspace .presence-list { min-height: 132px; scrollbar-gutter: stable; overscroll-behavior: contain; }
@media (max-width: 760px) {
    .chat-workspace .lobby-layout { grid-template-rows: minmax(0, 1fr) auto; }
    .chat-workspace .roster-card { padding-block: 4px; }
    .chat-workspace .presence-list { flex: 0 0 132px; max-height: 132px; margin-bottom: 3px; }
}
.chat-workspace #room-panel { display: flex; flex-direction: column; flex: 1 1 0; min-height: 200px; }
.chat-workspace .room-header { padding: 6px 10px; gap: 8px; flex-wrap: nowrap; }
.chat-workspace .room-header .header-actions { flex: none; width: auto; }
.chat-workspace .room-header .panel-index { display: none; }
.chat-workspace .room-header .button { padding: 6px 10px; min-height: 44px; }
.chat-workspace .room-keying-actions .button { padding-inline: 8px; }
.chat-workspace .room-header small, .chat-workspace #room-collapse-button { display: none; }
.chat-workspace .room-content { display: flex; flex: 1 1 0; min-height: 0; flex-direction: column; }
.chat-workspace .room-toolbar { display: none; }
.chat-workspace .room-layout { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; }
.chat-workspace .chat-column { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; border: 0; padding: 6px 8px; }
.chat-workspace .room-log { height: auto; min-height: 60px; flex: 1 1 0; }
.chat-workspace .composer { flex: none; margin: 4px 0 0; padding: 0; }
.chat-workspace .section-label { min-height: 16px; font-size: 10px; }
.chat-workspace .room-side { flex: none; padding: 0 8px 4px; max-height: 25%; overflow: auto; }
.chat-workspace .participant-card { padding: 0 6px; }
.chat-workspace .participant-card summary { min-height: 28px; padding-block: 4px; }
.chat-workspace #keyer-workspace { flex: none; padding: 0; border: 0; background: none; }
.chat-workspace .keyer-workspace .keyer-heading { display: none; }
.chat-workspace .paddle-dock { margin: 0 auto; max-width: none; }
.chat-workspace .pd-body { padding: 5px; }
.chat-workspace .pd-zones { height: clamp(64px, 13vh, 110px); }
.chat-workspace .pd-zone-hint { display: none; }
.chat-workspace.chat-auxiliary #keyer-workspace { display: none; }
.chat-workspace .chat-surface { flex: 1 1 0; min-height: 0; overflow: auto; padding: 12px 4px; }
.chat-surface h2 { margin: 0 0 16px; }
.chat-surface h3 { margin-top: 24px; }
.chat-surface details { padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-block: 12px; }
.chat-surface summary { min-height: 44px; font-size: 15px; }
.chat-key-settings {
    /* These controls move out of .paddle-dock, so restore their palette here. */
    --pd-panel-soft: var(--panel-soft);
    --pd-text: var(--text);
    --pd-text-soft: var(--text-soft);
    --pd-muted: var(--muted);
    --pd-line: var(--line);
    --pd-blue-strong: var(--blue-strong);
    color-scheme: dark;
}
.chat-key-settings select option { background: var(--pd-panel-soft); color: var(--pd-text); }
.chat-surface .pd-settings { padding: 8px; gap: 16px; }
.chat-surface .pd-field { flex-wrap: wrap; max-width: 100%; }
.chat-surface .pd-field:has(.pd-remap) { flex-basis: 100%; }
.chat-surface .pd-keys-label { white-space: normal; }
.chat-surface :is(button, select, input:not([type=checkbox])) { min-height: 44px; }
.chat-audio-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.chat-audio-fields .options-body { flex-basis: 100%; }
.chat-surface .legal-footer { width: 100%; flex-wrap: wrap; margin-top: 24px; }
.chat-workspace.trainer-short .pd-zones { height: 56px; }
.chat-workspace.trainer-short.trainer-chat .topbar { grid-template-columns: minmax(0, 1fr) auto; }
.chat-workspace.trainer-short.trainer-chat .brand { display: none; }
.chat-workspace.trainer-short.trainer-chat .trainer-mode { grid-column: 1; grid-row: 1; min-height: 40px; }
.chat-workspace.trainer-short.trainer-chat .connection-strip { grid-column: 2; grid-row: 1; }
.chat-workspace.trainer-short #room-panel { min-height: 0; }
.chat-workspace.trainer-short .room-log { min-height: 32px; }
.chat-workspace.trainer-short .room-header { padding-block: 2px; }
.chat-workspace.trainer-short .room-side, .chat-workspace.trainer-short .section-label { display: none; }
@media (max-width: 420px) { .chat-navigation button { font-size: 12px; padding-inline: 6px; } .chat-workspace .brand small { display: none; } }
.room-access-settings { width: 100%; border-top: 1px solid var(--border, #435167); margin-top: 1rem; padding-top: .8rem; }
.room-access-settings h3 { margin: 0 0 .7rem; }
.room-key-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .4rem 0 .8rem; }
.room-key-row input { width: 8rem; min-width: 6rem; max-width: 100%; font-size: 1rem; letter-spacing: .15em; }
.room-key-row button { min-height: 44px; white-space: normal; }
#room-entry-key { font-size: 1.2rem; letter-spacing: .15em; max-width: 100%; }
#room-key-dialog { max-width: min(28rem, calc(100vw - 2rem)); }
#room-key-room { overflow-wrap: anywhere; }
