/* ==========================================================================
   M4c+ Web Tavern 2.0 — Warm Cotton Journal x Cinematic VN Stage
   Palette: Cotton #FBF9F1, Carbon Ink #2C2A29, Action Italic #6E6257,
            Vermilion Seal #B85D48 (<=8%), Sage #6B7A6A, Akari Amber Glow
   ========================================================================== */

[data-view='tavern'] {
  --tavern-paper: #fbf9f1;
  --tavern-paper-translucent: rgba(251, 249, 241, 0.9);
  --tavern-paper-solid: rgba(251, 249, 241, 0.97);
  --tavern-ink: #2c2a29;
  --tavern-action: #6e6257;
  --tavern-muted: #7c6f64;
  --tavern-vermilion: #b85d48;
  --tavern-vermilion-soft: #f6e7e2;
  --tavern-sage: #6b7a6a;
  --tavern-sage-soft: #e9efe8;
  --tavern-line: #e4dccd;
  --tavern-line-strong: #cfc4b0;
}

.tavern-stage {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 20px 28px;
}

/* Desktop 1440x900 7:5 asymmetric spread (collapses to full theater) */
.tavern-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  transition: grid-template-columns 220ms var(--motion-ease, ease);
}

.tavern-layout.drawer-open {
  grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr);
}

.tavern-main-stage {
  background-color: #fbf9f1;
  background-image:
    linear-gradient(to right, rgba(228, 220, 205, 0.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(228, 220, 205, 0.24) 1px, transparent 1px);
  background-size: 14px 14px;
  border: 1px solid #e4dccd;
  border-radius: 14px;
  box-shadow: 0 3px 16px rgba(44, 42, 41, 0.05);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Top bar */
.tavern-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e4dccd;
  transition: opacity 200ms ease, max-height 200ms ease;
}

.tavern-layout.is-hide-ui .tavern-topbar,
.tavern-layout.is-hide-ui .tavern-dialogue-pane,
.tavern-layout.is-hide-ui .tavern-composer-dock {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border: 0;
}

/* --- Visual Novel Stage (L0 Daypart/House Lighting + L1 6-Core Portrait) --- */
.tavern-vn-stage {
  position: relative;
  height: clamp(280px, 46vh, 460px);
  border-radius: 12px;
  border: 1px solid #e4dccd;
  overflow: hidden;
  background: #f5efe2;
  transition: height 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tavern-layout.is-hide-ui .tavern-vn-stage {
  height: clamp(460px, 74vh, 720px);
}

.tavern-stage-l0 {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tavern-l0-sky {
  position: absolute;
  inset: 0;
  transition: background 480ms ease;
  background: linear-gradient(180deg, #f6f1e4 0%, #fbf9f1 68%, #f1e9d7 100%);
}

.tavern-vn-stage[data-daypart='morning'] .tavern-l0-sky {
  background: linear-gradient(180deg, #eef2ec 0%, #fbf9f1 64%, #f4ecda 100%);
}

.tavern-vn-stage[data-daypart='afternoon'] .tavern-l0-sky {
  background: linear-gradient(180deg, #f7f0de 0%, #fbf9f1 68%, #efe5cf 100%);
}

.tavern-vn-stage[data-daypart='dusk'] .tavern-l0-sky {
  background: linear-gradient(180deg, #e7d7c6 0%, #f5ebd9 56%, #ebe0cd 100%);
}

.tavern-vn-stage[data-daypart='night'] .tavern-l0-sky {
  background: linear-gradient(180deg, #d7d4cc 0%, #e7e1d5 58%, #dfd7c7 100%);
}

/* Akari washi paper lantern radial warm glow */
.tavern-l0-akari {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  transition: opacity 420ms ease;
  background: radial-gradient(circle at 78% 24%, rgba(242, 206, 146, 0.52) 0%, rgba(242, 206, 146, 0.14) 36%, transparent 66%);
}

.tavern-vn-stage[data-lamp='on'] .tavern-l0-akari {
  opacity: 0.92;
}

/* Subtle shoji window mullions */
.tavern-l0-shoji {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(124, 111, 100, 0.16);
  border-radius: 8px;
  background-image:
    linear-gradient(to right, rgba(124, 111, 100, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(124, 111, 100, 0.08) 1px, transparent 1px);
  background-size: 92px 92px;
}

/* L1 Portrait Layer */
.tavern-stage-l1 {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 24px;
  pointer-events: none;
}

.tavern-portrait-rig {
  position: relative;
  width: min(320px, 68%);
  height: 92%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  will-change: transform;
  animation: tavernBreath 4.8s ease-in-out infinite;
}

.tavern-portrait-rig[data-motion='hop'] {
  animation: tavernHop 4.2s ease-in-out infinite;
}

.tavern-portrait-rig[data-motion='tilt'] {
  animation: tavernTilt 4.6s ease-in-out infinite;
}

.tavern-portrait-rig[data-motion='doze'] {
  animation: tavernDoze 5.8s ease-in-out infinite;
}

@keyframes tavernBreath {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-3px) scale(1.008); }
}

@keyframes tavernHop {
  0%, 100% { transform: translateY(0px); }
  22% { transform: translateY(-6px); }
  45% { transform: translateY(0px); }
}

@keyframes tavernTilt {
  0%, 100% { transform: rotate(0deg) translateY(0px); }
  50% { transform: rotate(1.1deg) translateY(-2px); }
}

@keyframes tavernDoze {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .tavern-portrait-rig,
  .tavern-portrait-rig[data-motion] {
    animation: none !important;
  }
}

.tavern-portrait-img {
  position: absolute;
  bottom: 0;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center 38%;
  opacity: 0;
  transition: opacity 220ms ease;
}

.tavern-portrait-img.is-visible {
  opacity: 1;
}

.tavern-portrait-fallback-wrap {
  position: relative;
  width: 220px;
  height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 220ms ease;
}

.tavern-portrait-fallback-wrap.is-hidden {
  opacity: 0;
}

.tavern-fallback-portrait {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tavern-portrait-silhouette {
  width: 100%;
  height: 100%;
}

.tavern-fallback-seal {
  position: absolute;
  bottom: 34px;
  right: 36px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1.5px solid #b85d48;
  background: rgba(251, 249, 241, 0.9);
  color: #b85d48;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Stage overlay bar */
.tavern-stage-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
}

.tavern-stage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tavern-stage-ambient-tag,
.tavern-stage-speaker,
.tavern-stage-expr-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #e4dccd;
  background: rgba(251, 249, 241, 0.88);
  color: #2c2a29;
}

.tavern-stage-ambient-tag {
  color: #6e6257;
}

.tavern-stage-expr-pill {
  border-color: #d5dfd4;
  background: rgba(233, 239, 232, 0.92);
  color: #465746;
}

.tavern-stage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tavern-stage-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #cfc4b0;
  background: rgba(251, 249, 241, 0.92);
  color: #2c2a29;
  font-size: 12px;
  cursor: pointer;
}

.tavern-stage-pill-btn:hover {
  border-color: #b85d48;
  color: #b85d48;
}

.tavern-mobile-expand-btn {
  display: none;
}

/* Mobile 56px keyboard-collapsed horizontal strip (hidden on desktop) */
.tavern-compact-strip {
  display: none;
}

/* --- L2 Semi-Translucent Dialogue Pane --- */
.tavern-dialogue-pane {
  background: rgba(251, 249, 241, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #e4dccd;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Streaming performance downgrade: replace blur with opaque cotton paper */
.tavern-dialogue-pane.is-streaming,
.tavern-layout.is-streaming .tavern-dialogue-pane {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(251, 249, 241, 0.97);
}

.tavern-paper-notice {
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e4dccd;
  background: #f5efe2;
  color: #6e6257;
  font-size: 12px;
}

.tavern-scroll-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  max-height: 34vh;
  overflow-y: auto;
  padding: 4px 2px;
}

/* Literary AST Typography: 17px serif, line-height 1.75, 34-38 CJK chars/line */
.tavern-msg-body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.75;
  color: #2c2a29;
  max-width: 38em;
  text-align: left;
  word-break: break-word;
}

.tavern-lit-para {
  margin: 0;
}

.tavern-lit-gap {
  height: 0.65em;
}

.tavern-lit-action {
  font-style: italic;
  color: #6e6257;
}

.tavern-lit-dialogue {
  color: #2c2a29;
  font-weight: 500;
}

.tavern-lit-quote {
  margin: 6px 0;
  padding: 6px 12px;
  border-left: 2.5px solid #6b7a6a;
  background: rgba(233, 239, 232, 0.45);
  color: #465746;
  border-radius: 0 8px 8px 0;
}

.tavern-lit-quote-line {
  margin: 0;
}

.tavern-stream-caret {
  display: inline-block;
  width: 7px;
  height: 1.1em;
  background: #b85d48;
  vertical-align: text-bottom;
  animation: tavernCaret 900ms steps(2) infinite;
}

@keyframes tavernCaret {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.2; }
}

.tavern-interrupted-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed #cfc4b0;
  background: #f5efe2;
  color: #6e6257;
  font-size: 11px;
}

.tavern-action-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #e4dccd;
  background: #fbf9f1;
  color: #6e6257;
  font-size: 12px;
  cursor: pointer;
}

.tavern-action-chip:hover:not(:disabled) {
  border-color: #b85d48;
  color: #b85d48;
  background: #f6e7e2;
}

.tavern-inline-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tavern-inline-edit-actions {
  display: flex;
  gap: 8px;
}

/* Composer Dock + Stop (轻停) Button */
.tavern-composer-dock {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 8px;
  border-top: 1px solid #e4dccd;
}

.tavern-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 78px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #b85d48;
  background: #f6e7e2;
  color: #b85d48;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.tavern-stop-btn:hover {
  background: #b85d48;
  color: #fbf9f1;
}

/* --- Right 5fr Journal Drawer --- */
.tavern-drawer-host {
  display: none;
  min-width: 0;
}

.tavern-drawer-host.is-open {
  display: block;
}

.tavern-drawer-backdrop {
  display: none;
}

.tavern-journal-drawer {
  background: #fbf9f1;
  border: 1px solid #e4dccd;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tavern-drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.tavern-drawer-tab {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #e4dccd;
  background: #fffdf8;
  color: #6e6257;
  font-size: 13px;
  cursor: pointer;
}

.tavern-drawer-tab.active {
  border-color: #b85d48;
  background: #f6e7e2;
  color: #b85d48;
  font-weight: 600;
}

.tavern-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 68vh;
  overflow-y: auto;
}

.tavern-journal-card {
  border: 1px solid #e4dccd;
  border-radius: 12px;
  background: #fffdf8;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tavern-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tavern-char-counter {
  font-size: 12px;
  color: #7c6f64;
  font-variant-numeric: tabular-nums;
}

.tavern-polaroid-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tavern-polaroid-card {
  border: 1px solid #e4dccd;
  border-bottom: 6px solid #efe7d8;
  border-radius: 10px;
  background: #fbf9f1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(44, 42, 41, 0.04);
}

.tavern-polaroid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tavern-polaroid-title {
  font-size: 13px;
  color: #2c2a29;
}

.tavern-polaroid-excerpt {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.6;
  color: #595047;
}

.tavern-polaroid-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.tavern-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tavern-scroll-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e4dccd;
  background: #fffdf8;
  color: #2c2a29;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}

.tavern-scroll-item.is-active {
  border-color: #b85d48;
  background: #f6e7e2;
}

.tavern-primary-btn.compact,
.tavern-ghost-btn.compact {
  min-height: 44px;
  padding: 0 12px;
  font-size: 13px;
}

/* --- Tablet / Narrow Desktop --- */
@media (max-width: 1079px) {
  .tavern-layout.drawer-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .tavern-drawer-host.is-open {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    justify-content: flex-end;
  }
  .tavern-drawer-host.is-open .tavern-drawer-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(44, 42, 41, 0.28);
  }
  .tavern-drawer-host.is-open .tavern-journal-drawer {
    position: relative;
    z-index: 1;
    width: min(360px, 92vw);
    height: 100%;
    border-radius: 14px 0 0 14px;
    overflow-y: auto;
  }
}

/* --- Mobile 390x844 Hard Spec: <=30% Stage + 56px Keyboard Collapse + Zero Horizontal Overflow --- */
@media (max-width: 768px) {
  .tavern-stage {
    max-width: 100%;
    padding: 8px 8px 80px;
    overflow-x: hidden;
  }

  .tavern-main-stage {
    padding: 10px;
    gap: 10px;
    border-radius: 12px;
  }

  .tavern-topbar {
    gap: 8px;
    padding-bottom: 8px;
  }

  .tavern-controls {
    width: 100%;
  }

  .tavern-session-select {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Resting state: <=30% viewport height (~230-250px) */
  .tavern-vn-stage {
    height: min(29vh, 244px);
  }

  .tavern-vn-stage.is-mobile-expanded {
    height: min(68vh, 560px);
  }

  .tavern-mobile-expand-btn {
    display: inline-flex;
  }

  .tavern-hide-ui-btn {
    display: none;
  }

  .tavern-stage-ambient-tag {
    display: none;
  }

  /* Keyboard open (>120px shrink): 180ms collapse to 56px horizontal portrait + expression bar */
  .tavern-vn-stage.is-keyboard-collapsed {
    height: 56px;
    border-radius: 10px;
  }

  .tavern-vn-stage.is-keyboard-collapsed .tavern-stage-l0,
  .tavern-vn-stage.is-keyboard-collapsed .tavern-stage-l1,
  .tavern-vn-stage.is-keyboard-collapsed .tavern-stage-overlay {
    display: none;
  }

  .tavern-vn-stage.is-keyboard-collapsed .tavern-compact-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 10px;
    background: #fbf9f1;
  }

  .tavern-compact-seal {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid #b85d48;
    background: #f6e7e2;
    color: #b85d48;
    font-family: var(--font-serif);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .tavern-compact-name {
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 600;
    color: #2c2a29;
  }

  .tavern-compact-strip .tavern-stage-pill-btn {
    margin-left: auto;
  }

  .tavern-dialogue-pane {
    padding: 10px;
  }

  .tavern-scroll-page {
    max-height: 40vh;
    min-height: 160px;
  }

  .tavern-msg-body {
    font-size: 16px;
    max-width: 100%;
  }

  .tavern-composer-dock {
    flex-wrap: wrap;
  }

  .tavern-composer-input {
    flex: 1 1 100%;
  }

  .tavern-send-btn,
  .tavern-stop-btn {
    flex: 1 1 auto;
  }
}

/* ==========================================================================
   T3 Dual-Speaker Warm Paper Stage & Group Picker Popover
   ========================================================================== */
.tavern-group-popover {
  border: 1px solid #e4dccd;
  border-radius: 12px;
  background: #fbf9f1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(44, 42, 41, 0.06);
  max-width: 100%;
  box-sizing: border-box;
}

.tavern-group-popover[hidden] {
  display: none;
}

.tavern-group-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #2c2a29;
  font-size: 14px;
}

.tavern-group-popover-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #d5dfd4;
  background: #e9efe8;
  color: #465746;
}

.tavern-group-picker-hint {
  margin: 0;
  font-size: 12px;
  color: #6e6257;
}

.tavern-group-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tavern-group-bot-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid #e4dccd;
  background: #fffdf8;
  color: #2c2a29;
  font-size: 13px;
  cursor: pointer;
}

.tavern-group-bot-option.is-picked {
  border-color: #b85d48;
  background: #f6e7e2;
  color: #b85d48;
  font-weight: 600;
}

.tavern-group-turn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tavern-group-turn-label {
  font-size: 12px;
  color: #6e6257;
}

.tavern-group-turn-pills {
  display: inline-flex;
  gap: 6px;
}

.tavern-group-turn-btn {
  min-height: 44px;
  min-width: 56px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e4dccd;
  background: #fffdf8;
  color: #2c2a29;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.tavern-group-turn-btn.is-active {
  border-color: #b85d48;
  background: #f6e7e2;
  color: #b85d48;
  font-weight: 600;
}

.tavern-group-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Desktop Dual-Speaker Side-by-Side Stage */
.tavern-vn-stage[hidden] {
  display: none;
}

.tavern-group-l1 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  justify-items: center;
  gap: 12px;
  padding: 36px 18px 0;
}

.tavern-group-slot {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: opacity 240ms ease, transform 240ms ease, filter 240ms ease;
}

.tavern-group-slot.is-speaking {
  opacity: 1;
  transform: translateY(0) scale(1);
  z-index: 2;
}

.tavern-group-slot.is-listening {
  opacity: 0.72;
  transform: translateY(6px) scale(0.95);
  filter: saturate(0.86);
  z-index: 1;
}

.tavern-group-spotlight {
  position: absolute;
  inset: 8% 8% 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms ease;
  background: radial-gradient(circle at 50% 42%, rgba(242, 206, 146, 0.56) 0%, rgba(242, 206, 146, 0.16) 44%, transparent 72%);
}

.tavern-group-slot.is-speaking .tavern-group-spotlight {
  opacity: 1;
}

.tavern-group-rig {
  width: min(260px, 90%);
  height: 88%;
}

.tavern-group-plate {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e4dccd;
  background: rgba(251, 249, 241, 0.92);
  color: #2c2a29;
  font-size: 12px;
  white-space: nowrap;
  z-index: 3;
}

.tavern-group-slot.is-speaking .tavern-group-plate {
  border-color: #b85d48;
  box-shadow: 0 2px 8px rgba(184, 93, 72, 0.14);
}

.tavern-group-chips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tavern-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #e4dccd;
  background: rgba(251, 249, 241, 0.92);
  color: #2c2a29;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.tavern-group-chip.is-active {
  border-color: #b85d48;
  background: #f6e7e2;
  color: #b85d48;
  font-weight: 600;
}

.tavern-group-chip-seal {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #b85d48;
  background: #fbf9f1;
  color: #b85d48;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tavern-group-chip-expr {
  font-size: 11px;
  color: #465746;
  background: #e9efe8;
  border-radius: 999px;
  padding: 2px 6px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .tavern-group-l1 {
    grid-template-columns: minmax(0, 1fr);
    padding: 50px 8px 0;
  }

  .tavern-group-slot.is-listening {
    display: none;
  }

  .tavern-group-slot.is-speaking .tavern-group-plate {
    display: none;
  }

  .tavern-group-overlay {
    top: 6px;
    left: 6px;
    right: 6px;
    gap: 4px;
  }

  .tavern-group-chips {
    flex-wrap: nowrap;
    gap: 4px;
    max-width: calc(100vw - 88px);
    overflow: hidden;
  }

  .tavern-group-chip {
    padding: 0 8px;
    gap: 4px;
    max-width: 148px;
  }

  .tavern-group-chip-seal {
    display: none;
  }

  .tavern-group-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* T4 TTS Button & Cross-Session Gallery Drawer Tab */
.tavern-tts-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tavern-tts-btn.is-speaking {
  color: #b85d48;
  border-color: rgba(184, 93, 72, 0.45);
  background: rgba(184, 93, 72, 0.10);
}

.tavern-drawer-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tavern-drawer-tab {
  min-height: 44px;
  padding: 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tavern-gallery-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tavern-gallery-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(124, 111, 100, 0.22);
  background: #fbf9f1;
  box-shadow: 0 2px 6px rgba(44, 42, 41, 0.05);
}

.tavern-gallery-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(124, 111, 100, 0.10);
  display: block;
}

@media (max-width: 768px) {
  .tavern-action-chip,
  .tavern-swipe-btn,
  .tavern-mini-btn {
    min-height: 44px;
    min-width: 44px;
  }
}
