/* chat.daemons.art: mobile first. Phone: directory and chat are two screens; tablet: directory + chat, record as a
   drawer; desktop (1180+): directory, chat and record side by side. */
@font-face { font-family: 'DAEMONS'; src: url('/fonts/heading.ttf') format('truetype'); font-display: swap; }
:root {
  --bg: #090b0a; --s1: #101312; --s2: #161a18; --s3: #1f2421; --s4: #2a302c; --line: #262c28;
  --text: #eef2ea; --mute: #a3aca5; --dim: #7d867f;
  --lime: #c3ff5c; --lime-ink: #10180a; --lime-soft: rgba(195, 255, 92, .12);
  --lav: #b9a7ff; --coral: #ff8a70;
  --r: 14px; --r-s: 10px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: 'DAEMONS', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lime); }
svg { width: 22px; height: 22px; flex: none; }
canvas.face, .empty-face, .row canvas, .big-face, .chip-face { image-rendering: pixelated; image-rendering: crisp-edges; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .02em; }
.desk-only { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { position: fixed; inset: 0; overflow: hidden; }
.dir, .chat { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); transition: transform .24s var(--ease), opacity .24s var(--ease); }
.chat { transform: translateX(100%); }
.app.in-chat .chat { transform: none; }
.app.in-chat .dir { transform: translateX(-24%); opacity: .4; }

.bar { display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 6px 8px; padding-left: calc(8px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); }
.dir-bar, .chat-bar { padding-top: calc(6px + var(--safe-t)); border-bottom: 1px solid var(--line); background: rgba(9, 11, 10, .92); }
.bar-actions { display: flex; gap: 2px; margin-left: auto; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text); transition: background .15s, transform .15s; }
.icon-btn:hover { background: var(--s2); }
.icon-btn:active { transform: scale(.92); background: var(--s3); }
.icon-btn[aria-pressed="true"] { color: var(--lime); }
.dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; background: var(--lime); border: 2px solid var(--bg); box-sizing: content-box; }
.holder-dot { background: var(--lav); }

.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; color: var(--text); text-decoration: none; }
.logo { width: 28px; height: 28px; background: url('/favicon.svg') center / contain no-repeat; image-rendering: pixelated; }
.brand-text { font-family: var(--display); font-size: 17px; letter-spacing: .03em; }
.brand-text b { color: var(--lime); font-weight: 400; }

/* ---------- directory ---------- */
.dir-tools { padding: 10px 12px 6px; padding-left: calc(12px + var(--safe-l)); padding-right: calc(12px + var(--safe-r)); display: grid; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); color: var(--mute); }
.search:focus-within { border-color: var(--lime); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: 0; font-size: 16px; color: var(--text); }
.search input::placeholder { color: var(--dim); }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--s4); border-bottom-width: 2px; border-radius: 6px; font: 12px ui-monospace, monospace; color: var(--mute); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 4px; scroll-padding: 12px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--s1); color: var(--mute); font-size: 14px; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.chip[aria-pressed="true"] { background: var(--lime-soft); border-color: rgba(195, 255, 92, .5); color: var(--lime); }
.chip .n { color: var(--dim); font-size: 12px; }
.dir-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 calc(16px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 16px 8px; padding-left: calc(16px + var(--safe-l)); font: 600 12px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: var(--lime-soft); color: var(--lime); letter-spacing: .06em; }
.pulse { width: 6px; height: 6px; background: var(--lime); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.list { list-style: none; margin: 0; padding: 0 8px; padding-left: calc(8px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); }
.list li { content-visibility: auto; contain-intrinsic-size: auto 72px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 10px 10px; border: 0; border-radius: var(--r); background: transparent; text-align: left; transition: background .15s, transform .15s; }
.row:hover { background: var(--s1); }
.row:active { transform: scale(.985); background: var(--s2); }
.row[aria-current="true"] { background: var(--s2); box-shadow: inset 3px 0 0 var(--lime); }
.row .av { position: relative; flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--s2); overflow: hidden; }
.row canvas { width: 100%; height: 100%; display: block; }
.row .meta { flex: 1; min-width: 0; display: grid; gap: 3px; }
.row .top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .nm { font-weight: 650; font-size: 15px; white-space: nowrap; }
.row .tag { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .line { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .badge { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 12px; line-height: 18px; }
.badge.onchain { background: rgba(185, 167, 255, .14); color: var(--lav); }
.badge.mine { background: var(--lime-soft); color: var(--lime); }
.badge.dead { background: rgba(255, 138, 112, .12); color: var(--coral); }
.badge svg { width: 14px; height: 14px; }
.row.sleeping { opacity: .6; }
.row .go { color: var(--dim); width: 18px; height: 18px; }
.row.skel .av, .row.skel .sk { background: linear-gradient(90deg, var(--s1), var(--s3), var(--s1)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.row.skel .sk { height: 12px; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-note { margin: 12px 16px; padding: 18px; border: 1px dashed var(--s4); border-radius: var(--r); color: var(--mute); font-size: 14px; }
.empty-note .btn { margin-top: 12px; }
.sig { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 20px 18px 8px; font-size: 13px; color: var(--dim); }
.sig a { color: var(--mute); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.sig a:hover { color: var(--lime); }
.sig .sep { width: 4px; height: 4px; background: var(--s4); }

/* ---------- chat ---------- */
.chat-empty { display: none; }
.back { margin-right: -4px; }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 2px 6px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.who:hover { background: var(--s1); }
.face-wrap { flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--s2); overflow: hidden; }
.face-wrap .face { width: 100%; height: 100%; display: block; transform-origin: 50% 100%; }
.speaking .face-wrap .face { animation: talk .32s steps(2) infinite; }
@keyframes talk { 50% { transform: translateY(-2px); } }
.who-text { min-width: 0; display: grid; }
.who-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font-size: 12.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub .live { color: var(--lime); }

.log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 12px 8px; padding-left: calc(12px + var(--safe-l)); padding-right: calc(12px + var(--safe-r)); display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.intro { align-self: center; max-width: 360px; margin: 6px auto 10px; text-align: center; color: var(--mute); font-size: 13.5px; }
.intro .big-face { width: 120px; height: 120px; margin: 0 auto 10px; display: block; border-radius: 22px; background: var(--s1); }
.intro h3 { margin: 0 0 4px; color: var(--text); font-family: var(--display); font-weight: 400; font-size: 20px; }
.msg { display: flex; gap: 8px; max-width: min(88%, 620px); animation: rise .2s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .mini { flex: none; width: 28px; height: 28px; margin-top: 2px; border-radius: 8px; background: var(--s2); overflow: hidden; }
.msg .mini canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.bubble { position: relative; padding: 10px 13px; border-radius: 16px; background: var(--s2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.45; }
.msg.me .bubble { background: #19240d; border-color: rgba(195, 255, 92, .28); border-bottom-right-radius: 6px; }
.msg.them .bubble { border-bottom-left-radius: 6px; }
.msg.err .bubble { border-color: rgba(255, 138, 112, .45); color: #ffd2c8; background: #1d1310; }
.msg .stack { display: grid; gap: 2px; min-width: 0; }
.acts { display: flex; gap: 0; margin-left: -8px; }
.acts .icon-btn { width: 40px; height: 36px; color: var(--dim); }
.acts .icon-btn svg { width: 18px; height: 18px; }
.acts .icon-btn:hover { color: var(--text); }
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; background: var(--mute); animation: blink 1s steps(1) infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.day { align-self: center; font-size: 12px; color: var(--dim); padding: 4px 10px; border-radius: 999px; background: var(--s1); }

.composer { border-top: 1px solid var(--line); background: rgba(9, 11, 10, .96); padding: 8px 10px calc(8px + var(--safe-b)); padding-left: calc(10px + var(--safe-l)); padding-right: calc(10px + var(--safe-r)); display: grid; gap: 8px; }
.openers { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 0 10px; }
.openers::-webkit-scrollbar { display: none; }
.openers .chip { color: var(--text); }
.input-row { display: flex; align-items: flex-end; gap: 6px; }
.field { flex: 1; min-width: 0; display: flex; background: var(--s1); border: 1px solid var(--line); border-radius: 22px; transition: border-color .15s; }
.field:focus-within { border-color: rgba(195, 255, 92, .6); }
.field textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 132px; padding: 11px 16px; border: 0; background: transparent; resize: none; outline: 0; font-size: 16px; line-height: 1.35; }
.field textarea::placeholder { color: var(--dim); }
.send { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--lime); color: var(--lime-ink); transition: transform .15s, opacity .15s; }
.send:active { transform: scale(.9); }
.send:disabled { opacity: .35; cursor: default; }
.send.stop { background: var(--s3); color: var(--text); }
.mic.on { color: var(--coral); background: rgba(255, 138, 112, .12); }
.nokey { display: grid; gap: 6px; text-align: center; }
.fine { margin: 0; font-size: 13px; color: var(--mute); }
.pad { padding: 16px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border: 1px solid var(--s4); border-radius: 12px; background: var(--s2); font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text); transition: transform .15s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn.danger { color: var(--coral); border-color: rgba(255, 138, 112, .35); background: transparent; }
.btn.wide { width: 100%; }
.btn svg { width: 20px; height: 20px; }

/* ---------- record (profile) ---------- */
.profile { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 86dvh; display: flex; flex-direction: column; background: var(--s1); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; transform: translateY(102%); transition: transform .24s var(--ease); visibility: hidden; }
.profile.open { transform: none; visibility: visible; }
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .55); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--s4); flex: none; }
.prof-bar { min-height: 52px; }
.prof-title { margin: 0 0 0 8px; font-size: 18px; }
.prof-close { margin-left: auto; }
.prof-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(20px + var(--safe-b)); }
.p-head { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; }
.p-head .big-face { width: 88px; height: 88px; border-radius: 18px; background: var(--s2); flex: none; }
.p-head h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 20px; }
.p-head .sub { color: var(--mute); font-size: 13.5px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badges .badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.badge.realm { background: var(--lime-soft); color: var(--lime); }
.p-sec { margin: 0 0 16px; }
.p-sec h4 { margin: 0 0 8px; font: 600 12px/1 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.p-sec p { margin: 0; font-size: 14px; color: var(--text); }
.p-quote { padding: 10px 12px; border-left: 3px solid var(--lav); background: var(--s2); border-radius: 0 10px 10px 0; font-size: 14px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { padding: 10px; border-radius: 10px; background: var(--s2); }
.kv b { display: block; font-size: 16px; }
.kv span { font-size: 12px; color: var(--mute); }
.bars { display: grid; gap: 8px; }
.bars .b { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--mute); }
.bars .track { height: 8px; background: var(--s3); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--lime); border-radius: 4px; transform-origin: left; animation: grow .5s var(--ease) both; }
.bars .w { grid-column: 2; font-size: 12px; color: var(--dim); margin-top: -4px; }
@keyframes grow { from { transform: scaleX(0); } }
.ties { display: flex; flex-wrap: wrap; gap: 6px; }
.tie { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--s2); font-size: 13px; }
.tie canvas { width: 34px; height: 34px; border-radius: 8px; background: var(--s3); image-rendering: pixelated; }
.tie.grudge { border-color: rgba(255, 138, 112, .35); }
.tie .sc { color: var(--dim); font-size: 12px; }
.story { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.story li { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 13.5px; }
.story .t { color: var(--dim); font-size: 12px; padding-top: 2px; }
details.why { border: 1px solid var(--line); border-radius: 12px; background: var(--s2); }
details.why summary { min-height: 46px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary svg { margin-left: auto; width: 18px; height: 18px; transition: transform .2s; }
details.why[open] summary svg { transform: rotate(90deg); }
details.why pre { margin: 0; padding: 0 12px 12px; white-space: pre-wrap; font: 12px/1.5 ui-monospace, monospace; color: var(--mute); max-height: 320px; overflow: auto; }
details.why .fine { padding: 0 12px 12px; }
.voice-pick select, .group select, .group input:not([type=checkbox]) { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 16px; color: var(--text); }
.p-actions { display: grid; gap: 8px; }

/* ---------- sheets (dialogs) ---------- */
dialog.sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 92dvh; margin: 0; padding: 0; border: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; background: var(--s1); color: var(--text); }
dialog.sheet[open] { animation: up .24s var(--ease) both; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet-inner { display: flex; flex-direction: column; max-height: 92dvh; margin: 0; }
.sheet-inner .bar h2 { margin: 0 0 0 8px; font-size: 19px; }
.sheet-inner .bar .icon-btn { margin-left: auto; }
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; display: grid; gap: 14px; }
.sheet-foot { padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.privacy { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px; border-radius: 12px; background: var(--lime-soft); color: var(--text); font-size: 13.5px; }
.privacy svg { color: var(--lime); margin-top: 1px; }
.group { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.group legend { padding: 0; margin-bottom: 8px; font: 600 12px/1 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--mute); font-weight: 600; font-size: 14px; }
.seg button[aria-checked="true"] { background: var(--s3); color: var(--text); box-shadow: inset 0 -2px 0 var(--lime); }
.lbl { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--mute); }
.lbl .get { font-size: 13px; min-height: 32px; display: inline-flex; align-items: center; }
.lbl .opt { font-size: 12px; color: var(--dim); }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; min-width: 0; }
.key-row .btn { flex: none; }
.status { margin: 0; min-height: 18px; font-size: 13px; color: var(--mute); }
.status.ok { color: var(--lime); }
.status.bad { color: var(--coral); }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; cursor: pointer; }
.switch input { appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 14px; background: var(--s4); transition: background .15s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--lime); }
.switch input:checked::after { transform: translateX(18px); background: var(--lime-ink); }
.wallets { display: grid; gap: 8px; }
.wallet { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--s2); text-align: left; }
.wallet img, .wallet .wico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--s3); }
.wallet .wname { font-weight: 600; }
.wallet .wsub { margin-left: auto; font-size: 12px; color: var(--dim); }
.holder-line { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; color: var(--lav); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 60; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 11px 16px; border-radius: 12px; background: var(--s3); border: 1px solid var(--s4); color: var(--text); font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: rise .2s var(--ease) both; }

/* plain pages (404, offline) */
body.plain { display: grid; place-items: center; min-height: 100%; padding: 24px; overflow: auto; }
.plain-card { max-width: 420px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.plain-card h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 28px; }
.plain-card p { margin: 0; color: var(--mute); }

/* ---------- phone landscape and short screens ---------- */
@media (max-height: 500px) {
  .bar { min-height: 48px; padding-top: 2px; padding-bottom: 2px; }
  .dir-bar, .chat-bar { padding-top: calc(2px + var(--safe-t)); }
  .dir-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: center; padding-top: 6px; }
  .chips { margin: 0; padding: 0; }
  .intro .big-face { width: 72px; height: 72px; }
  .openers { display: none; }
  .composer { padding-top: 6px; }
}

/* ---------- tablet: directory + chat; record as a drawer ---------- */
@media (min-width: 768px) {
  .app { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
  .dir, .chat { position: relative; inset: auto; transform: none !important; opacity: 1 !important; min-height: 0; }
  .dir { border-right: 1px solid var(--line); background: var(--s1); }
  .dir-bar { background: transparent; }
  .back { display: none; }
  .chat-empty { display: grid; flex: 1; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; color: var(--mute); }
  .chat-empty h1 { margin: 8px 0 0; color: var(--text); font-size: 30px; }
  .chat-empty p { margin: 0; max-width: 380px; }
  .empty-face { width: 150px; height: 150px; border-radius: 28px; background: var(--s1); animation: bob 2.4s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-6px); } }
  .app.in-chat .chat-empty { display: none; }
  .log { padding: 22px 28px 10px; }
  .composer { padding-left: 24px; padding-right: 24px; }
  .profile { left: auto; top: 0; width: 400px; max-height: none; border-top: 0; border-left: 1px solid var(--line); border-radius: 0; transform: translateX(102%); padding-top: var(--safe-t); }
  .profile .sheet-grip { display: none; }
  dialog.sheet { inset: 0; margin: auto; width: min(480px, calc(100% - 48px)); max-height: min(760px, calc(100dvh - 48px)); border: 1px solid var(--line); border-radius: 22px; }
  dialog.sheet .sheet-grip { display: none; }
  .sheet-inner { max-height: min(760px, calc(100dvh - 48px)); }
  .toast { bottom: 32px; }
  .row .go { display: none; }
}
@media (min-width: 768px) and (max-height: 500px) {
  .app { grid-template-columns: 300px minmax(0, 1fr); }
  .dir-tools { grid-template-columns: 1fr; }
}

/* ---------- desktop: directory | chat | record ---------- */
@media (min-width: 1180px) {
  .app { grid-template-columns: 340px minmax(0, 1fr) 380px; }
  .app:not(.has-daemon) { grid-template-columns: 340px minmax(0, 1fr) 0; }
  .profile { position: relative; inset: auto; width: auto; transform: none; visibility: visible; border-left: 1px solid var(--line); background: var(--s1); transition: none; z-index: 1; padding-top: 0; }
  .app:not(.has-daemon) .profile { visibility: hidden; }
  .prof-close, .info-btn { display: none; }
  .scrim { display: none !important; }
  .desk-only { display: inline-flex !important; }
  .kbd-hint { gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 13px; }
  .log { padding: 26px 40px 12px; }
  .msg { max-width: min(78%, 640px); }
  .composer { padding: 12px 36px 16px; }
}
@media (min-width: 1600px) {
  .app { grid-template-columns: 380px minmax(0, 1fr) 420px; }
  .log, .composer { padding-left: max(40px, calc((100% - 860px) / 2)); padding-right: max(40px, calc((100% - 860px) / 2)); }
}

/* Reduced motion: movement becomes fades; nothing loops. */
@media (prefers-reduced-motion: reduce) {
  .dir, .chat, .profile { transition: opacity .2s linear, visibility .2s; }
  .chat { transform: none; opacity: 0; visibility: hidden; }
  .app.in-chat .chat { opacity: 1; visibility: visible; }
  .app.in-chat .dir { transform: none; opacity: 0; }
  .profile { transform: none; opacity: 0; }
  .profile.open { opacity: 1; }
  .msg, dialog.sheet[open], .toast { animation: fade .2s both; }
  .pulse, .empty-face, .speaking .face-wrap .face, .row.skel .av, .row.skel .sk, .bars .fill { animation: none; }
  .typing i { animation-duration: 1.6s; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 768px) {
  .chat { opacity: 1; visibility: visible; }
  .dir { opacity: 1 !important; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 1180px) { .profile { opacity: 1; } }
