*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #F3F0E8;
  --bg2:        #FFFFFF;
  --bg3:        #EAE7DF;
  --bg4:        #DDD9D0;
  --border:     rgba(0,0,0,0.08);
  --border-s:   rgba(0,0,0,0.14);
  --text:       #1A1915;
  --text2:      #6B6560;
  --text3:      #9C958C;
  --accent:     #C4713B;
  --accent-dim: rgba(196,113,59,0.10);
  --accent-h:   #B5652F;
  --danger:     #C53030;
  --bubble-u:   #FFFFFF;
  --bubble-a:   #FFFFFF;
  --r:     12px;
  --r-sm:  6px;
  --r-lg:  16px;
  --r-xl:  24px;
  --shadow:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --h: 100dvh;
  --mono: 'SF Mono','JetBrains Mono','Cascadia Code',Menlo,monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #2A2520;
    --bg2:      #352F29;
    --bg3:      #3D362F;
    --bg4:      #4A433B;
    --border:   rgba(255,255,255,0.08);
    --border-s: rgba(255,255,255,0.14);
    --text:     #ECE8E1;
    --text2:    #A39E96;
    --text3:    #706B63;
    --accent:   #D4885A;
    --accent-dim: rgba(212,136,90,0.12);
    --accent-h: #E09568;
    --danger:   #F87171;
    --bubble-u: #352F29;
    --bubble-a: #352F29;
    --shadow:    0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.24);
  }
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.6;
  height: 100%; overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
.sr-only { position:absolute; width:0; height:0; opacity:0; pointer-events:none; }

#app {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  position: fixed; top:0; left:0; right:0; bottom:0;
  height: var(--h); overflow: hidden;
  max-width: 720px; margin: 0 auto;
}

/* ── Setup ────────────────────────────────────────────── */
#setup {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
  gap: 20px; padding: 32px 24px calc(32px + var(--safe-b));
  padding-top: calc(32px + var(--safe-t));
}
.setup-logo { font-size: 40px; line-height:1; color: var(--accent); }
.setup-title { font-size: 26px; font-weight: 500; letter-spacing: -0.5px; }
.setup-sub { color: var(--text2); font-size: 14px; text-align: center; max-width: 320px; }
.input-wrap { width: 100%; max-width: 420px; }
.input-wrap input {
  width: 100%; padding: 14px 18px;
  background: var(--bg2); border: 1px solid var(--border-s);
  border-radius: var(--r-lg); color: var(--text); font-size: 15px;
  outline: none; font-family: inherit;
  -webkit-appearance: none;
}
.input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input-wrap input::placeholder { color: var(--text3); }
.btn-primary {
  width: 100%; max-width: 420px; padding: 12px;
  background: var(--accent); border: none; border-radius: var(--r);
  color: #fff; font-size: 15px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled { opacity: 0.4; }
.setup-err { color: var(--danger); font-size: 13px; display: none; text-align: center; }

/* ── Chat shell ───────────────────────────────────────── */
#chat { display: none; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow: hidden; }
#chat.active { display: -webkit-box; display: -webkit-flex; display: flex; }

header {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  padding: 10px 20px; padding-top: calc(10px + var(--safe-t));
  background: var(--bg); gap: 10px; -webkit-flex-shrink: 0; flex-shrink: 0;
  position: relative; z-index: 10;
}
.hdr-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-dim);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; align-items: center;
  -webkit-box-pack: center; justify-content: center;
  font-size: 16px; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.hdr-avatar:hover { background: var(--bg3); }
.hdr-center { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; }
.hdr-meta { font-size: 13px; color: var(--text2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 10px; border-radius: var(--r-sm); }
.hdr-meta:hover { background: var(--bg3); }
.hdr-btn { background: none; border: none; color: var(--text3); font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: var(--r-sm); font-family: inherit; }
.hdr-btn:hover { background: var(--bg3); color: var(--text); }

/* Dropdowns */
.dropdown { display: none; position: fixed; z-index: 200; background: var(--bg); border: 1px solid var(--border-s); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-lg); min-width: 160px; max-width: 260px; }
.dropdown.show { display: block; }
.dd-item { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.dd-item:hover { background: var(--bg3); }
.dd-item .check { width: 14px; text-align: center; font-size: 12px; color: var(--accent); }
.dd-item.active { color: var(--accent); }

/* ── Messages ─────────────────────────────────────────── */
#messages {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 12px 20px 20px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.date-sep { text-align: center; font-size: 12px; color: var(--text3); padding: 12px 0 6px; -webkit-user-select: none; user-select: none; font-weight: 500; }
.load-more { text-align: center; font-size: 13px; color: var(--text2); cursor: pointer; padding: 8px; border-radius: var(--r-sm); }
.load-more:hover { background: var(--bg3); }

/* Message layout */
.msg { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; max-width: 100%; gap: 2px; padding: 6px 0; }
.msg.user { -webkit-box-align: end; -webkit-align-items: flex-end; align-items: flex-end; }
.msg.ai   { -webkit-box-align: start; -webkit-align-items: flex-start; align-items: flex-start; }

/* Unified bubble style */
.bubble {
  padding: 12px 16px; border-radius: var(--r-xl);
  word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.6; font-size: 15px;
  border: 1px solid var(--border);
}
.msg.user .bubble {
  background: var(--bubble-u);
  max-width: 85%;
}
.msg.ai .bubble {
  background: var(--bubble-a);
  max-width: 92%;
}

/* Streaming cursor */
.cursor::after {
  content: ''; display: inline-block;
  width: 2px; height: 1.1em; vertical-align: text-bottom;
  background: var(--accent); margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.ts { font-size: 11px; color: var(--text3); padding: 0 4px; }

/* Images in message bubbles */
.msg-images { display: -webkit-flex; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.msg-img { max-width: 200px; max-height: 150px; border-radius: var(--r); object-fit: cover; }

/* Markdown */
.bubble code { font-family: var(--mono); font-size: 13px; background: var(--bg3); padding: 2px 6px; border-radius: var(--r-sm); }
.bubble pre { background: var(--bg3); border-radius: var(--r); padding: 12px 14px; overflow-x: auto; margin: 6px 0; font-size: 13px; border: 1px solid var(--border); font-family: var(--mono); }
.bubble pre code { font-family: var(--mono); background: none; padding: 0; }
.bubble strong { font-weight: 600; }
.bubble em { font-style: italic; }
.bubble a { color: var(--accent); text-decoration: none; }
.bubble a:hover { text-decoration: underline; }
.bubble ul, .bubble ol { padding-left: 20px; }
.bubble li { margin: 2px 0; }
.bubble h1,.bubble h2,.bubble h3,.bubble h4,.bubble h5,.bubble h6 { font-weight: 600; margin: 8px 0 4px; }
.bubble h1 { font-size: 1.4em; } .bubble h2 { font-size: 1.25em; } .bubble h3 { font-size: 1.1em; }
.bubble h4 { font-size: 1em; } .bubble h5 { font-size: .95em; color: var(--text2); } .bubble h6 { font-size: .9em; color: var(--text2); }
.bubble del { text-decoration: line-through; color: var(--text3); }
.bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.bubble blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--accent-dim); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text2); font-size: 14px; }
.bubble blockquote blockquote { margin: 4px 0; }
.bubble table { border-collapse: collapse; margin: 6px 0; font-size: 13px; width: 100%; overflow-x: auto; display: block; }
.bubble thead { border-bottom: 2px solid var(--border-s); }
.bubble th, .bubble td { padding: 4px 10px; text-align: left; border: 1px solid var(--border); white-space: nowrap; }
.bubble th { font-weight: 600; background: var(--bg3); }
.bubble tbody tr:hover { background: var(--bg3); }
.bubble .task-list { list-style: none; padding-left: 4px; }
.bubble .task-item { display: -webkit-flex; display: flex; -webkit-align-items: baseline; align-items: baseline; gap: 6px; }
.bubble .task-item input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.bubble .md-img { max-width: 100%; border-radius: var(--r); margin: 4px 0; }
.bubble .md-embed { position: relative; display: block; margin: 8px 0; padding: 0; }
.bubble .md-embed a { display: block; }
.bubble .md-embed-img { display: block; max-width: 100%; border-radius: var(--r); border: 1px solid var(--border); background: var(--bg3); }
.bubble .md-embed-cap { font-size: 12px; color: var(--text2); margin-top: 4px; text-align: center; }
.bubble .md-copy {
  position: absolute; top: 8px; right: 8px;
  padding: 4px 10px; font-size: 11px; font-family: inherit;
  background: rgba(0,0,0,0.55); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  backdrop-filter: blur(4px);
}
.bubble .md-copy:hover { background: rgba(0,0,0,0.7); }
.bubble .md-embed--file { display: flex; align-items: stretch; gap: 6px; }
.bubble .md-embed--file .md-embed-tile {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none; color: var(--text);
  font-family: var(--mono);
  transition: background 120ms;
}
.bubble .md-embed--file .md-embed-tile:hover { background: var(--bg4); }
.bubble .md-embed-tile__name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.bubble .md-embed-tile__ext { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.bubble .md-embed--file .md-copy {
  position: static;
  background: transparent; color: var(--text2);
  border: 1px solid var(--border-s); border-radius: var(--r);
  padding: 0 12px; font-size: 12px;
  white-space: nowrap; flex-shrink: 0;
  backdrop-filter: none;
}
.bubble .md-embed--file .md-copy:hover { background: var(--bg3); color: var(--text); }
.bubble .md-copy--inline {
  position: static; margin-left: 6px;
  padding: 1px 8px; font-size: 11px;
  background: transparent; color: var(--text3);
  border: 1px solid var(--border-s);
  vertical-align: baseline;
}
.bubble .md-copy--inline:hover { background: var(--bg3); color: var(--text); }

/* Empty state */
.empty-state { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; gap: 8px; -webkit-user-select: none; user-select: none; padding-bottom: 60px; }
.empty-state .icon { font-size: 48px; line-height: 1; margin-bottom: 4px; }
.empty-state .hint { font-size: 20px; font-weight: 400; color: var(--text); }

/* Attachments */
#attach-strip { display: none; gap: 8px; padding: 8px 20px; overflow-x: auto; background: var(--bg); -webkit-flex-shrink: 0; flex-shrink: 0; }
#attach-strip::-webkit-scrollbar { display: none; }
.thumb { position: relative; width: 56px; height: 56px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); cursor: pointer; -webkit-flex-shrink: 0; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .file-icon { width: 100%; height: 100%; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; background: var(--bg3); font-size: 22px; }
.thumb .rm { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; background: rgba(0,0,0,0.5); border: none; border-radius: 50%; color: #fff; font-size: 10px; cursor: pointer; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; line-height: 1; }

/* ── Input bar ────────────────────────────────────────── */
#input-bar {
  padding: 12px 20px; padding-bottom: calc(12px + var(--safe-b));
  background: var(--bg); -webkit-flex-shrink: 0; flex-shrink: 0;
}
#input-card {
  background: var(--bg2); border: 1px solid var(--border-s);
  border-radius: var(--r-lg); overflow: hidden;
}
#input-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
#input {
  display: block; width: 100%;
  padding: 12px 16px 4px; background: transparent; border: none;
  color: var(--text); font-size: 15px; font-family: inherit;
  resize: none; outline: none;
  min-height: 24px; max-height: 140px;
  overflow-y: auto; line-height: 1.5;
  -webkit-appearance: none; scrollbar-width: none;
}
#input::-webkit-scrollbar { display: none; }
#input::placeholder { color: var(--text3); }

#input-actions {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: horizontal; -webkit-flex-direction: row; flex-direction: row;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  padding: 4px 8px 8px; gap: 4px;
}
#input-spacer { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }

.ia-btn {
  width: 32px; height: 32px;
  -webkit-flex-shrink: 0; flex-shrink: 0;
  background: transparent; border: none; border-radius: var(--r-sm);
  display: -webkit-inline-box; display: -webkit-inline-flex; display: inline-flex;
  -webkit-box-align: center; align-items: center;
  -webkit-box-pack: center; justify-content: center;
  cursor: pointer; color: var(--text3);
}
.ia-btn:hover { background: var(--bg3); color: var(--text2); }
.ia-send { background: var(--accent); color: #fff; }
.ia-send:hover { background: var(--accent-h); color: #fff; }
.ia-send:disabled { opacity: 0.25; cursor: default; }
.ia-stop { display: none; }
.ia-stop.show { display: -webkit-inline-box; display: -webkit-inline-flex; display: inline-flex; }

/* ── Reading indicator ────────────────────────────────── */
.bubble.reading { padding: 12px 14px; }
.reading-dots {
  display: -webkit-inline-box; display: -webkit-inline-flex; display: inline-flex;
  -webkit-box-align: center; align-items: center; gap: 5px; height: 20px;
}
.reading-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  -webkit-animation: rpulse 1.4s ease-in-out infinite; animation: rpulse 1.4s ease-in-out infinite;
}
.reading-dots span:nth-child(2) { -webkit-animation-delay: .15s; animation-delay: .15s; }
.reading-dots span:nth-child(3) { -webkit-animation-delay: .3s; animation-delay: .3s; }
@-webkit-keyframes rpulse { 0%,60%,100%{opacity:.2;-webkit-transform:scale(.85);transform:scale(.85)} 30%{opacity:.8;-webkit-transform:scale(1);transform:scale(1)} }
@keyframes rpulse { 0%,60%,100%{opacity:.2;transform:scale(.85)} 30%{opacity:.8;transform:scale(1)} }


.detail-section { margin-bottom: 4px; }
.detail-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); margin-bottom: 2px; }
.detail-content {
  padding: 6px 10px; border-left: 2px solid var(--accent); background: var(--accent-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12px; color: var(--text2); line-height: 1.5; white-space: pre-wrap;
}

/* ── Pill (tool + thinking, claude.ai-style: neutral, restrained) ── */
.chat-tools-inline { margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.tool-collapse, .chat-think { margin: 2px 0; }
.tool-summary, .think-summary {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
  padding: 4px 11px;
  background: transparent;
  border: 1px solid var(--border-s);
  color: var(--text2);
  border-radius: var(--r-lg);
  font: inherit; font-size: 12px;
  cursor: pointer; user-select: none;
  transition: background 120ms, color 120ms;
}
.tool-summary:hover, .think-summary:hover {
  background: var(--bg3);
  color: var(--text);
}
.tool-summary__name, .think-summary__label {
  font-family: var(--mono); font-weight: 600; flex-shrink: 0;
}
.tool-summary__hint, .tool-detail {
  font-family: var(--mono); font-size: 11px; opacity: 0.7;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.tool-summary__chevron, .think-summary__chevron {
  margin-left: 2px; opacity: 0.55; font-size: 10px; transition: transform 150ms; flex-shrink: 0;
}
.tool-collapse.is-open .tool-summary__chevron,
.chat-think.is-open .think-summary__chevron { transform: rotate(90deg); }

/* Expanded body: inner pre matches .bubble pre exactly */
.tool-body, .think-body {
  margin-top: 6px;
  display: flex; flex-direction: column; gap: 8px;
}
.tool-body[hidden], .think-body[hidden] { display: none; }
.tool-block__content {
  margin: 0; padding: 12px 14px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  max-height: 280px; overflow: auto;
}
.tool-block__content code { font-family: var(--mono); background: none; padding: 0; font-size: inherit; }
.tool-block__empty { padding: 6px 0; font-size: 12px; color: var(--text3); }
.tool-block__image { display: block; max-width: 100%; max-height: 280px; border-radius: var(--r); border: 1px solid var(--border); background: var(--bg3); cursor: zoom-in; }

/* Trace body: container for thinking text + tool pills */
.think-body {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
/* Inner thinking text: prose, left-border italic */
.think-text {
  margin: 0 0 0 2px;
  padding: 4px 0 4px 14px;
  border-left: 2px solid var(--border-s);
  color: var(--text2);
  font-size: 14px; line-height: 1.6;
  font-style: italic;
  white-space: pre-wrap; word-break: break-word;
  max-height: 360px; overflow-y: auto;
}

/* ── Token usage bar ──────────────────────────────────── */
#token-bar {
  position: relative; height: 2px; flex-shrink: 0;
  background: var(--bg3);
  display: none;
}
#token-bar.show { display: block; }
#token-bar__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  width: 0; transition: width 300ms, background 200ms;
}
#token-bar.warn #token-bar__fill { background: var(--danger); }

/* ── Toasts ───────────────────────────────────────────── */
#toast-container { position: fixed; top: 0; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); z-index: 500; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; gap: 6px; padding-top: calc(10px + var(--safe-t)); max-width: 400px; width: 90%; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-size: 13px; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; align-items: center; gap: 8px; box-shadow: var(--shadow-lg); -webkit-animation: toast-in .25s ease-out; animation: toast-in .25s ease-out; pointer-events: auto; }
.toast--compaction { border-left: 3px solid var(--accent); }
.toast--compaction.toast--done { border-left-color: #22c55e; }
.toast--fallback { border-left: 3px solid #f59e0b; }
.toast__spinner { width: 14px; height: 14px; border: 2px solid var(--bg4); border-top-color: var(--accent); border-radius: 50%; -webkit-animation: spin .8s linear infinite; animation: spin .8s linear infinite; -webkit-flex-shrink: 0; flex-shrink: 0; }
@-webkit-keyframes toast-in { from{opacity:0;-webkit-transform:translateY(-8px)} to{opacity:1;-webkit-transform:translateY(0)} }
@keyframes toast-in { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }
@-webkit-keyframes spin { to{-webkit-transform:rotate(360deg)} }
@keyframes spin { to{transform:rotate(360deg)} }

/* Queue indicator */
#queue-indicator { display: none; font-size: 11px; color: var(--accent); padding: 3px 10px; text-align: center; background: var(--accent-dim); border-radius: var(--r-sm); margin: 0 20px 4px; }

/* ── Pairing ──────────────────────────────────────────── */
#pairing { display: none; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; gap: 16px; padding: 32px 24px; height: 100%; text-align: center; }
#pairing.active { display: -webkit-box; display: -webkit-flex; display: flex; }
.pairing-spinner { width: 36px; height: 36px; border: 2px solid var(--bg4); border-top-color: var(--accent); border-radius: 50%; -webkit-animation: spin .9s linear infinite; animation: spin .9s linear infinite; margin: 8px 0; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 28px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; }
.btn-secondary:hover { background: var(--bg4); }
