*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

.app-world {
  --bg-desk: #eff1eb;
  --bg-sheet: #fafaf6;
  --bg-stage: #e7ece5;
  --bg-subtle: #f2f4ee;
  --ink: #1b2621;
  --ink-secondary: #4c5d55;
  --ink-tertiary: #53675e;
  --line: #d6dfd7;
  --line-strong: #bac8bc;
  --accent: #275d4c;
  --accent-soft: #dfece6;
  --accent-ink: #173d31;
  --warm-lamp: #b8732a;
  --warm-lamp-soft: #f6ead9;
  --buddy-body: #2f6b58;
  --buddy-belly: #e4efe9;
  --buddy-cheek: #e09178;
  --drawer-bg: #1e2723;
  --drawer-surface: #28332e;
  --drawer-line: #394740;
  --drawer-ink: #edf2ee;
  --drawer-muted: #a6b5ad;

  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg-desk);
  color: var(--ink);
  font: 15px/1.58 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  padding: 20px 20px 0;
  transition: background-color 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-world[data-actor="B"] {
  --bg-stage: #efeae3;
  --accent: #8f4e2b;
  --accent-soft: #f3e5dc;
  --accent-ink: #5c2e15;
  --buddy-body: #9e5a34;
  --buddy-belly: #f5e8de;
  --buddy-cheek: #de8168;
}

.app-world ::selection { background: var(--accent-soft); color: var(--accent-ink); }
.app-world :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg-group {
  display: inline-flex;
  background: #e4e8e0;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-weight: 550;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.seg-btn[aria-pressed="true"] {
  background: var(--bg-sheet);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 32, 26, 0.08);
}

.workspace {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto 20px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 0.92fr) minmax(0, 1.16fr);
  gap: 16px;
  align-items: stretch;
  transition: max-width 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel {
  background: var(--bg-sheet);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 676px;
  min-width: 0;
  transition: height 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-world[data-drawer-open="true"] .panel {
  height: 556px;
}

.mobile-tabs {
  display: none;
  max-width: 390px;
  margin: 0 auto 10px;
  background: #e4e8e0;
  padding: 3px;
  border-radius: 11px;
}
.mobile-tabs button { flex: 1; }
/* Center Column: Dedicated Buddy Stage */
.stage-panel {
  background: var(--bg-stage);
  transition: background-color 300ms ease;
}
.stage-header {
  background: transparent;
  padding: 20px 20px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 14px;
}
.app-world[data-state="probe"],
.app-world[data-state="speaking"] {
  --bg-stage: #f2ebe0;
}
.app-world[data-state="outing"] {
  --bg-stage: #e5e9e6;
}

.stage-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.buddy-title-group h1 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.buddy-bio {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-secondary);
}
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-sheet);
  color: var(--accent-ink);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}
.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.app-world[data-state="speaking"] .state-dot,
.app-world[data-state="probe"] .state-dot { background: var(--warm-lamp); }
.app-world[data-state="outing"] .state-dot { background: var(--ink-tertiary); }

.avatar-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 1 1 auto;
  padding: 16px 0 2px;
}
.avatar-box {
  position: relative;
  width: 210px;
  height: 196px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto 0;
}
.buddy-svg { width: 198px; height: 182px; overflow: visible; }

/* 6-State Minimalist Geometric Motion */
@keyframes idleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3.5px) scale(1.015, 0.99); }
}
@keyframes shadowBreath {
  0%, 100% { transform: scaleX(1); opacity: 0.16; }
  50% { transform: scaleX(0.88); opacity: 0.11; }
}
@keyframes naturalBlink {
  0%, 44%, 48%, 92%, 96%, 100% { transform: scaleY(1); }
  46%, 94% { transform: scaleY(0.12); }
}
@keyframes listenLean {
  0%, 100% { transform: translateY(-2px) rotate(-3.5deg); }
  50% { transform: translateY(-4px) rotate(-2deg); }
}
@keyframes rippleOut {
  0% { transform: scale(0.75); opacity: 0.55; }
  100% { transform: scale(1.45); opacity: 0; }
}
@keyframes thinkTilt {
  0%, 100% { transform: rotate(5deg) translateY(-1px); }
  50% { transform: rotate(2.5deg) translateY(-3px); }
}
@keyframes orbitDot {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-5px); opacity: 1; }
}
@keyframes speakCadence {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-3px) scale(1.02, 0.985); }
  70% { transform: translateY(-1px) scale(0.99, 1.015); }
}
@keyframes mouthTalk {
  0%, 100% { transform: scaleY(0.45); }
  40% { transform: scaleY(1.35); }
  75% { transform: scaleY(0.85); }
}
@keyframes strollWalk {
  0%, 100% { transform: translateX(-3px) translateY(0) rotate(-3deg); }
  50% { transform: translateX(3px) translateY(-4px) rotate(3deg); }
}
@keyframes probePeek {
  0%, 100% { transform: translateY(1px) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

.buddy-rig { transform-origin: 60px 78px; animation: idleFloat 4.2s ease-in-out infinite; }
.buddy-shadow { transform-origin: 60px 98px; animation: shadowBreath 4.2s ease-in-out infinite; }
.buddy-eyes { transform-origin: 60px 56px; animation: naturalBlink 6.4s ease-in-out infinite; }
.buddy-mouth-speak, .listen-rings, .think-dots, .outing-badge, .warm-halo { opacity: 0; transition: opacity 180ms ease; }
.buddy-mouth-calm { opacity: 1; }

.app-world[data-state="listening"] .buddy-rig { animation: listenLean 2.2s ease-in-out infinite; }
.app-world[data-state="listening"] .listen-rings { opacity: 1; }
.app-world[data-state="listening"] .ring-1 { transform-origin: 60px 62px; animation: rippleOut 1.8s cubic-bezier(0.16, 1, 0.3, 1) infinite; }
.app-world[data-state="listening"] .ring-2 { transform-origin: 60px 62px; animation: rippleOut 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s infinite; }

.app-world[data-state="thinking"] .buddy-rig { animation: thinkTilt 2.6s ease-in-out infinite; }
.app-world[data-state="thinking"] .buddy-eyes { transform: translate(3px, -2px); animation: none; }
.app-world[data-state="thinking"] .think-dots { opacity: 1; }
.app-world[data-state="thinking"] .td-1 { animation: orbitDot 1.2s ease-in-out infinite; }
.app-world[data-state="thinking"] .td-2 { animation: orbitDot 1.2s ease-in-out 0.2s infinite; }
.app-world[data-state="thinking"] .td-3 { animation: orbitDot 1.2s ease-in-out 0.4s infinite; }

.app-world[data-state="speaking"] .buddy-rig { animation: speakCadence 0.9s ease-in-out infinite; }
.app-world[data-state="speaking"] .buddy-mouth-calm { opacity: 0; }
.app-world[data-state="speaking"] .buddy-mouth-speak { opacity: 1; transform-origin: 60px 68px; animation: mouthTalk 0.42s ease-in-out infinite; }
.app-world[data-state="speaking"] .warm-halo { opacity: 0.85; }

.app-world[data-state="outing"] .buddy-rig { animation: strollWalk 1.6s ease-in-out infinite; opacity: 0.72; }
.app-world[data-state="outing"] .outing-badge { opacity: 1; }

.app-world[data-state="probe"] .buddy-rig { animation: probePeek 2.8s ease-in-out infinite; }
.app-world[data-state="probe"] .warm-halo { opacity: 0.7; }

/* Actor A vs B crest switch */
.crest-b { display: none; }
.app-world[data-actor="B"] .crest-a { display: none; }
.app-world[data-actor="B"] .crest-b { display: block; }

.stage-right {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.whisper-card {
  background: var(--bg-sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
}
.app-world[data-state="probe"] .whisper-card {
  background: var(--warm-lamp-soft);
  border-color: #dec19a;
}
.whisper-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
/* Right Column: Full Persistent Chat Stream */
.chat-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sheet);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-header h2 {
  font-size: 17px;
  letter-spacing: -0.015em;
  margin: 0;
}
.chat-header-sub {
  font-size: 12px;
  color: var(--ink-tertiary);
}
.chat-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.chat-anchor {
  text-align: center;
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}
.msg-row { display: flex; flex-direction: column; gap: 4px; max-width: 86%; }
.msg-row.buddy { align-self: flex-start; }
.msg-row.user { align-self: flex-end; align-items: flex-end; }
.msg-meta {
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-row.buddy .msg-bubble {
  background: var(--bg-subtle);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.msg-row.buddy.probe .msg-bubble {
  background: var(--warm-lamp-soft);
  color: #3f2810;
}
.msg-row.user .msg-bubble {
  background: var(--accent);
  color: #ffffff;
  border-top-right-radius: 4px;
}
.mem-note-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 2px;
  width: fit-content;
}

/* Composer */
.composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
  background: var(--bg-sheet);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}
.composer input[type="text"]::placeholder { color: var(--ink-tertiary); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-sheet);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.btn:hover { border-color: var(--accent); background: var(--bg-subtle); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; }
.voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.voice-controls { display: flex; align-items: center; gap: 6px; }
.wave-bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.wave-bars span {
  width: 2.5px; height: 5px; border-radius: 2px; background: var(--warm-lamp);
  animation: wavePulse 0.7s ease-in-out infinite;
}
.wave-bars span:nth-child(2) { animation-delay: 0.14s; }
.wave-bars span:nth-child(3) { animation-delay: 0.28s; }
@keyframes wavePulse { 0%, 100% { height: 4px; } 50% { height: 13px; } }

/* Right Column: Journal */
.journal-header {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sheet);
}
.journal-header h2 {
  font-size: 17px;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.tab-row {
  display: flex;
  gap: 20px;
}
.tab-btn {
  border: 0;
  background: transparent;
  padding: 0 2px 10px;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 550;
  color: var(--ink-secondary);
  cursor: pointer;
  position: relative;
  transition: color 140ms ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn[aria-selected="true"] { color: var(--accent-ink); font-weight: 650; }
.tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.journal-body {
  padding: 18px 20px 22px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.journal-entry {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.journal-entry:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.entry-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.entry-time {
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
}
.entry-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 8px;
  color: var(--ink);
}
.dialogue-slice {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.58;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.dialogue-slice strong { color: var(--accent-ink); font-weight: 650; }
.entry-mood {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

/* Impressions & Badges */
.section-block { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.section-title { font-size: 14px; font-weight: 650; margin: 0 0 10px; color: var(--ink); }
.section-hint { font-size: 12.5px; color: var(--ink-tertiary); margin: -4px 0 10px; }
.impression-list { display: flex; flex-direction: column; gap: 8px; }
.impression-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-size: 13.5px;
}
.forget-btn {
  border: 0;
  background: transparent;
  color: var(--ink-tertiary);
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.forget-btn:hover { background: var(--line); color: var(--ink); }

.badge-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.interest-badge {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink-secondary);
  padding: 6px 11px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 550;
  cursor: pointer;
  transition: all 140ms ease;
}
.interest-badge[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.outing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: 11px;
  margin-top: 12px;
}
.setting-grid { display: grid; gap: 14px; }
.time-range { display: flex; align-items: center; gap: 8px; }
.time-range input, .select-input {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* Bottom Collapsible Director Drawer */
.director-dock {
  position: sticky;
  bottom: 0;
  margin: auto -20px 0;
  z-index: 40;
  background: var(--drawer-bg);
  color: var(--drawer-ink);
  border-top: 1px solid var(--drawer-line);
  box-shadow: 0 -8px 28px rgba(15, 22, 18, 0.16);
}
.director-bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.director-status {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--drawer-muted);
}
.director-status strong { color: var(--drawer-ink); font-weight: 600; }
.sse-dot { width: 7px; height: 7px; border-radius: 50%; background: #5cc98f; display: inline-block; margin-right: 5px; }

.director-drawer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 18px;
  border-top: 1px solid var(--drawer-line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 14px;
}
.director-col { display: flex; flex-direction: column; gap: 8px; }
.director-col h3 { margin: 0 0 2px; font-size: 13px; color: var(--drawer-muted); font-weight: 600; }
.d-btn {
  border: 1px solid var(--drawer-line);
  background: var(--drawer-surface);
  color: var(--drawer-ink);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.d-btn:hover { border-color: #6ea88f; background: #313f39; }
.d-btn[aria-pressed="true"] { border-color: #6ea88f; background: #2d4c3e; }
.d-input {
  width: 100%;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--drawer-line);
  background: #171e1b;
  color: var(--drawer-ink);
  padding: 0 9px;
  font: inherit;
  font-size: 12.5px;
}
.d-row { display: flex; gap: 6px; flex-wrap: wrap; }
.d-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: #a9c7b9;
  background: #161d1a;
  overflow-wrap: anywhere;
  border: 1px solid var(--drawer-line);
  border-radius: 8px;
  padding: 7px 9px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .buddy-rig, .buddy-shadow, .buddy-eyes, .ring-1, .ring-2, .td-1, .td-2, .td-3, .buddy-mouth-speak, .wave-bars span {
    animation: none !important;
  }
}
  

body { margin: 0; }
button:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto 12px;
  padding: 8px 12px;
  background: var(--warm-lamp-soft);
  color: #56360d;
  border: 1px solid #dfc4a1;
  border-radius: 10px;
  font-size: 13px;
}
.notice p { margin: 0; overflow-wrap: anywhere; }
.journal-body, .chat-stream { overscroll-behavior: contain; }
.entry-time { flex: 0 0 auto; }
.entry-title, .dialogue-slice, .entry-mood, .impression-item, .outing-row { overflow-wrap: anywhere; }
.voice-bar { flex-wrap: wrap; }
.voice-controls { flex-wrap: wrap; }
.buddy-title-group { min-width: 0; }
.stage-right { flex: 0 1 auto; }
.whisper-card { overflow-wrap: anywhere; }
.whisper-actions { flex-wrap: wrap; }
.empty-state { color: var(--ink-secondary); font-size: 13.5px; margin: 0; }
.chat-stream > .empty-state { align-self: center; margin: auto 0; text-align: center; }
.chat-stream > * { flex-shrink: 0; }
.msg-meta time { white-space: nowrap; }
.msg-play {
  border: 0;
  padding: 1px 4px;
  background: transparent;
  border-radius: 4px;
  color: var(--accent-ink);
  font: inherit;
  cursor: pointer;
}
.msg-play:hover { background: var(--accent-soft); }
.mem-note-tag { max-width: 100%; overflow-wrap: anywhere; border-radius: 10px; }
.typing-row { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-secondary); }
.chat-header .btn { height: auto; min-height: 30px; padding-block: 4px; }
#chat-stream { scroll-behavior: auto; }
#chat-stream :is(.msg-row, .chat-anchor) { overflow-anchor: none; }
.field-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.field-row :is(input, textarea, select) { flex: 1 1 120px; min-width: 0; max-width: 100%; }
.quick-impression { margin-top: 12px; }
.quick-impression summary { width: fit-content; color: var(--accent-ink); font-size: 13px; cursor: pointer; }
.quick-impression .field-row { margin-top: 8px; }
.quick-impression input {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  padding: 4px 8px;
  font: inherit;
}
.setting-actions { margin-top: 10px; }
.setting-grid .section-block { margin-bottom: 0; }
.time-range { flex-wrap: wrap; }
.time-range input { width: 108px; min-width: 0; max-width: 100%; }

.director-dock { position: relative; bottom: auto; }
.director-drawer { font-size: 13px; }
.director-dock :focus-visible { outline-color: #7fccaa; }
.director-col, .director-form, .director-status { min-width: 0; }
.director-col h2 { margin: 0 0 2px; font-size: 13px; color: var(--drawer-muted); font-weight: 600; }
.director-status { gap: 6px 14px; }
.director-status :is(span, strong) { overflow-wrap: anywhere; }
#btn-toggle-drawer { flex: 0 0 auto; }
.connection-pip { white-space: nowrap; }
.sse-dot[data-connection="idle"] { background: #a6b5ad; }
.sse-dot[data-connection="retry"] { background: #f3ba68; }
.sse-dot[data-connection="error"] { background: #df827b; }
.d-log { margin: 0; }
.d-input::placeholder { color: var(--drawer-muted); }
.director-form { display: grid; gap: 8px; }
.director-form label { display: grid; gap: 4px; min-width: 0; color: var(--drawer-muted); }
.director-form button { justify-self: start; }
.director-feedback { margin: 0; color: var(--drawer-muted); overflow-wrap: anywhere; }
.observation { border-top: 1px solid var(--drawer-line); padding-top: 10px; margin-top: 6px; }
.observation-form, #observation-form { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.observation-detail { grid-column: 1 / -1; }
.observation-list { margin: 8px 0 0; padding: 0; list-style: none; color: var(--drawer-muted); }
.observation-list li { margin-top: 4px; overflow-wrap: anywhere; }

@media (max-width: 1070px) and (min-width: 981px) {
  .tab-row { gap: 10px; }
  .journal-header, .journal-body, .stage-header, .chat-header { padding-inline: 14px; }
}

@media (max-width: 980px) {
  .workspace { max-width: 620px; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mobile-tabs { display: flex; max-width: 620px; width: 100%; }
  .app-world .workspace .panel { height: auto; }
  .stage-panel .stage-header { padding: 14px 14px 12px; gap: 10px; }
  .avatar-stage { flex-direction: row; align-items: center; justify-content: center; gap: 12px; padding: 4px 0; }
  .avatar-box { width: 88px; height: 84px; flex: 0 0 88px; }
  .buddy-svg { width: 84px; height: 78px; }
  .stage-right { flex: 1 1 auto; }
  .chat-stream { height: 360px; flex: 0 0 auto; }
  .app-world[data-director="true"] .chat-stream {
    height: clamp(224px, calc(100dvh - 558px), 360px);
  }
  .journal-body { max-height: 580px; }
  .app-world[data-mobile-pane="journal"] :is(.stage-panel, .chat-panel),
  .app-world[data-mobile-pane="chat"] .journal-panel { display: none; }
  .director-drawer { grid-template-columns: minmax(0, 1fr); }
  .director-bar { align-items: flex-start; }
  .director-status { gap: 4px 10px; }
  .director-col { padding-bottom: 6px; }
}

@media (max-width: 420px) {
  .tab-row { gap: 14px; }
  .stage-top-row { gap: 8px; }
  .stage-right .btn-sm { padding-inline: 8px; }
  .director-status > span { max-width: 15ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

/* Away at the street, the desk retains its quiet place. */
.empty-seat .seat-shadow { fill: var(--ink); opacity: 0.12; }
.empty-seat .seat-base { fill: var(--line-strong); }
.empty-seat .seat-top { fill: var(--accent-soft); stroke: var(--line-strong); }
.empty-seat .seat-seam { fill: none; stroke: var(--accent); stroke-width: 1.5px; stroke-linecap: round; opacity: 0.48; }
.app-world[data-presence="outing"] .stage-panel,
.app-world[data-presence="returning"] .stage-panel { background: var(--stage-surface, #e6ebe1); }
.app-world:is([data-presence="outing"], [data-presence="returning"]) .whisper-card {
  background: #f8f5e9;
  border-color: #dbcfb8;
}
.return-clock, .contact-stamp, .idea-current {
  margin: 7px 0 0;
  color: var(--accent-ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.idea-current { margin: 0 0 8px; font-size: 13px; }
.contact-stamp { color: #825323; }
.idea-form input, .remote-compose input {
  flex: 1 1 130px;
  min-width: 0;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-sheet);
  color: var(--ink);
  font: inherit;
}
.idea-form input::placeholder, .remote-compose input::placeholder { color: var(--ink-secondary); }
.impression-group + .impression-group { margin-top: 12px; }
.impression-group h4 {
  margin: 0 0 5px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 650;
}
.impression-group.is-archived .impression-item { opacity: 0.78; }
.fog-entry { display: flex; gap: 11px; align-items: flex-start; }
.fog-details { flex: 1; min-width: 0; }
.fog-venue { margin: 0; color: var(--ink); font-size: 13.5px; font-weight: 630; }
.fog-teaser { margin: 6px 0 0; color: var(--ink-secondary); font-size: 13px; overflow-wrap: anywhere; }
.fog-sticker {
  position: relative;
  flex: 0 0 24px;
  height: 29px;
  margin: 1px 1px 0 3px;
  border: 1px solid #c9bd9d;
  border-radius: 4px;
  background: #f4eddc;
  transform: rotate(-7deg);
}
.fog-sticker::before, .fog-sticker::after {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 7px;
  height: 5px;
  border-top: 1px solid #a99572;
  border-radius: 50%;
  content: "";
}
.fog-sticker::after { left: 10px; top: 5px; right: auto; width: 4px; height: 4px; border: 1px solid #a99572; }
.director-check, .scene-options label { color: var(--drawer-muted); font-size: 12px; }
.director-check { display: inline-flex; min-height: 32px; align-items: center; gap: 5px; cursor: pointer; }
.director-check input { accent-color: #74bfa0; }
.scene-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scene-options label { display: grid; gap: 4px; min-width: 0; }
.scene-options select { min-width: 0; width: 100%; }
.scene-options .scene-npc { display: inline-flex; align-self: end; }

.desk-remote { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.remote-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 13px 16px 16px; }
.remote-tabs, .call-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.remote-tabs { margin-bottom: 13px; }
.remote-tabs .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.remote-service { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.remote-inbox, .call-transcript {
  list-style: none;
  flex: 1;
  min-height: 94px;
  overflow: auto;
  padding: 0;
  margin: 0;
}
.remote-inbox { display: flex; flex-direction: column; gap: 8px; padding-right: 3px; }
.remote-inbox > li { flex-shrink: 0; }
.remote-message { max-width: 88%; align-self: flex-start; }
.remote-message[data-sender="you"] { align-self: flex-end; }
.remote-message time { display: block; color: var(--ink-secondary); font-size: 11px; margin-bottom: 3px; }
.remote-message[data-sender="you"] time { text-align: right; }
.remote-message p {
  border-radius: 10px;
  background: var(--bg-chip, #e8eee5);
  color: var(--ink);
  margin: 0;
  padding: 6px 9px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.remote-message[data-sender="you"] p { background: var(--accent); color: #fff; }
.remote-compose { display: flex; gap: 7px; align-items: center; margin-top: 10px; }
.remote-compose input { font-size: 14px; }
.call-line { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.call-status { margin: 0 0 8px; color: var(--ink-secondary); font-size: 14px; }
.call-clock { color: var(--accent-ink); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.call-transcript { margin-top: 10px; }
.call-transcript li { padding: 6px 0; color: var(--ink); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.remote-error { margin: 8px 0 0; color: #74431d; font-size: 13px; overflow-wrap: anywhere; }
.remote-error:empty { display: none; }
@media (max-width: 980px) {
  .desk-remote { min-height: 270px; }
  .desk-remote :is(.remote-inbox, .call-transcript) { max-height: 270px; }
}
.hub-controls {
  display: grid;
  gap: .5rem;
  align-items: start;
}

#hub-pair-qr {
  width: min(100%, 184px);
  justify-self: start;
  border-radius: 10px;
  background: #fff;
  image-rendering: pixelated;
}
