/* ============================================================
   App workspace — 3 column studio
   ============================================================ */

body.app-body { height: 100dvh; overflow: hidden; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr) var(--studio-w);
  height: 100dvh;
  background: var(--bg);
}

/* ---------------- sidebar ---------------- */
.sidebar {
  display: flex; flex-direction: column; gap: 12px;
  border-inline-end: 1px solid var(--line);
  background: var(--card-2);
  padding: 14px 12px;
  overflow-y: auto;
  min-width: 0;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 4px; }
.sidebar-close { display: none; }

.plan-card {
  background: linear-gradient(135deg, rgba(139, 212, 80, .22), rgba(59, 165, 93, .10));
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--line));
  border-radius: 14px; padding: 12px;
}
.plan-card .row { justify-content: space-between; }
.plan-card h4 { font-size: 13px; }
.plan-card p { font-size: 11.8px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.plan-card .btn { margin-top: 9px; width: 100%; }

.search-box { display: flex; gap: 6px; }
.search-box input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 8px 11px; font-size: 13px; font-family: inherit;
}
.search-box button { width: 36px; flex: 0 0 auto; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }

.sec-head-sm {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  padding: 6px 4px 2px;
}
.sec-head-sm button { border: 0; background: transparent; color: var(--brand); font-size: 16px; line-height: 1; padding: 0 4px; }

.room-list { display: flex; flex-direction: column; gap: 2px; }
.room-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; border: 1px solid transparent;
  min-width: 0;
}
.room-item span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.room-item .em { font-size: 15px; }
.room-item:hover { background: var(--bg-2); }
.room-item.active { background: color-mix(in srgb, var(--brand) 12%, var(--card)); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); color: var(--ink); }
.room-item.active::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.room-item.locked { opacity: .55; }

.macro-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
.macro-chip {
  border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.macro-chip:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--ink); }

.routine-list { display: flex; flex-direction: column; gap: 4px; }
.routine-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 4px 6px; }
.routine-item .tm { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.routine-item .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.share-box { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.share-link {
  font-size: 11.5px; font-family: var(--mono); background: var(--bg-2); border-radius: 8px; padding: 7px 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2);
}
.sidebar-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.sidebar-foot a, .sidebar-foot button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
  border: 0; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 9px;
}
.sidebar-foot a:hover, .sidebar-foot button:hover { background: var(--bg-2); color: var(--ink); }

/* locked feature row */
.locked-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: 9px; background: var(--bg-2);
}
.locked-row b { color: var(--brand); font-size: 11px; }

/* ---------------- chat column ---------------- */
.chat-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, var(--card));
  backdrop-filter: blur(8px); flex-wrap: nowrap;
}
.topbar .menu-btn { display: none; }
.ws-title { min-width: 0; flex: 1; }
.ws-title h1 { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 11.5px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 5px 10px; border-radius: 999px; background: var(--bg-2); white-space: nowrap; }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.conn.live .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 158, 91, .16); }
.topbar select { max-width: 118px; font-size: 12px; padding: 6px 26px 6px 10px; border-radius: 999px; }

.upgrade-banner {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 8px 16px; font-size: 12.5px; background: linear-gradient(90deg, rgba(255, 215, 110, .22), rgba(59, 165, 93, .12));
  border-bottom: 1px solid var(--line); color: var(--ink-2);
}
.upgrade-banner b { color: var(--ink); }
.upgrade-banner .btn { flex: 0 0 auto; }

.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 16px 6px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.messages > :first-child { margin-top: auto; }
.msg { display: flex; flex-direction: column; gap: 5px; max-width: 78%; min-width: 0; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }
.msg-head { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
.msg-head .who { font-weight: 800; color: var(--ink-2); }
.bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 14.2px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user .bubble { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: var(--brand-ink); border-bottom-right-radius: 5px; }
body[dir="rtl"] .msg.user .bubble { border-bottom-right-radius: 16px; border-bottom-left-radius: 5px; }
.msg.assistant .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
body[dir="rtl"] .msg.assistant .bubble { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.msg .badge-status {
  font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em;
}
.st-pending { background: rgba(109, 131, 119, .16); color: var(--muted); }
.st-checking { background: rgba(58, 123, 213, .14); color: var(--info); }
.st-working { background: rgba(208, 138, 26, .16); color: var(--warn); }
.st-needs_confirm { background: rgba(212, 69, 63, .14); color: var(--danger); }
.st-done { background: rgba(47, 158, 91, .16); color: var(--ok); }
.msg .del { opacity: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; padding: 0 2px; transition: opacity .15s; }
.msg:hover .del { opacity: 1; }

.attachments { display: flex; flex-wrap: wrap; gap: 7px; }
.att {
  display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: 12px; color: var(--ink-2); max-width: 100%;
}
.att img { width: 34px; height: 34px; object-fit: cover; border-radius: 7px; }
.att .nm { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { color: var(--muted); font-size: 10.5px; }

.empty-state { margin: auto; text-align: center; color: var(--muted); padding: 30px 16px; }
.empty-state .big { font-size: 44px; margin-bottom: 8px; }
.empty-state h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* composer */
.composer-wrap { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--card) 72%, var(--bg)); padding: 8px 12px 12px; position: relative; }
.music-bar { display: flex; align-items: center; gap: 6px; padding: 2px 2px 8px; flex-wrap: wrap; }
.music-bar .lbl { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-inline-end: 2px; }
.snd-btn, .pomo-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px;
  font-size: 11.5px; font-weight: 700; padding: 5px 11px; display: inline-flex; align-items: center; gap: 5px;
}
.snd-btn.active, .pomo-btn.active { background: color-mix(in srgb, var(--brand) 16%, var(--card)); border-color: var(--brand); color: var(--brand); }
.pomo { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.pomo-time { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink-2); min-width: 44px; text-align: center; }

.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 7px 8px 7px 10px; }
.composer textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; resize: none; color: var(--ink);
  font-family: inherit; font-size: 14.5px; line-height: 1.5; padding: 7px 2px; max-height: 150px; outline: none;
}
.composer .send { border: 0; border-radius: 12px; padding: 9px 16px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: var(--brand-ink); font-weight: 800; font-size: 13px; }
.drop-hint {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 16%, var(--card)); border: 2px dashed var(--brand); border-radius: 14px;
  font-weight: 800; color: var(--brand); z-index: 5; margin: 8px;
}
.composer-wrap.dragging .drop-hint { display: flex; }

/* ---------------- studio ---------------- */
.studio { display: flex; flex-direction: column; border-inline-start: 1px solid var(--line); background: var(--card-2); min-width: 0; min-height: 0; }
.studio-tabs { display: flex; gap: 2px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); }
.studio-tabs button {
  flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700;
  padding: 9px 4px; border-bottom: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.studio-tabs button .i { font-size: 15px; }
.studio-tabs button.active { color: var(--brand); border-color: var(--brand); }
.studio-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.studio-locked { padding: 22px 18px; text-align: center; }
.studio-locked .lock-ico { font-size: 34px; }
.studio-locked h3 { font-size: 15.5px; margin: 10px 0 6px; }
.studio-locked p { font-size: 12.8px; color: var(--muted); }
.studio-locked ul { text-align: start; margin: 14px 0; display: grid; gap: 7px; font-size: 12.5px; }
.studio-locked li::before { content: "✓"; color: var(--brand); font-weight: 900; margin-inline-end: 6px; }

/* kanban */
.kanban { display: flex; flex-direction: column; gap: 10px; }
.kcol { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 8px; }
.kcol.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 800; color: var(--ink-2); padding: 2px 4px 7px; }
.kcol-head .cnt { font-size: 10.5px; color: var(--muted); background: var(--bg-2); border-radius: 999px; padding: 1px 7px; }
.kcol[data-status="todo"] .kcol-head b { color: var(--muted); }
.kcol[data-status="doing"] .kcol-head b { color: var(--warn); }
.kcol[data-status="review"] .kcol-head b { color: var(--danger); }
.kcol[data-status="done"] .kcol-head b { color: var(--ok); }
.kcards { display: flex; flex-direction: column; gap: 6px; min-height: 34px; }
.kcard {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font-size: 12.8px; line-height: 1.45; cursor: grab; position: relative;
}
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard .kfx { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.kcard.done .kt { text-decoration: line-through; color: var(--muted); }
.kempty { font-size: 11.5px; color: var(--muted); text-align: center; padding: 8px 0; }

/* vault */
.vault-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vfile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vfile .thumb { height: 62px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.vfile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.vfile .nm { font-size: 11.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vfile .meta { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--muted); }
.vfile .acts { display: flex; gap: 4px; }
.vfile .acts a, .vfile .acts button { flex: 1; text-align: center; font-size: 10.5px; border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 3px 0; color: var(--ink-2); }

/* pet */
.pet-stage {
  position: relative; border-radius: 16px; padding: 12px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%),
              linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line); text-align: center;
}
.pet-stage.night { background: linear-gradient(180deg, #16233a, #0f1727); }
.pet-svg { width: 132px; height: 132px; margin: 4px auto 0; display: block; }
.pet-name { font-size: 13px; font-weight: 800; margin-top: 4px; }
.pet-state { font-size: 11px; color: var(--muted); }
.pet-bubble { position: absolute; top: 8px; inset-inline-start: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 5px 9px; font-size: 11px; box-shadow: var(--shadow-sm); max-width: 62%; }

@keyframes pet-idle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-1deg); } }
@keyframes pet-work { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(-2px) rotate(1.5deg); } 75% { transform: translateY(-2px) rotate(-1.5deg); } }
@keyframes pet-done { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-14px) scale(1.05); } 70% { transform: translateY(0) scale(.98); } 100% { transform: translateY(0) scale(1); } }
@keyframes pet-sleep { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.pet-body { transform-origin: 66px 110px; animation: pet-idle 3.2s ease-in-out infinite; }
.pet-stage[data-state="working"] .pet-body { animation: pet-work .9s ease-in-out infinite; }
.pet-stage[data-state="done"] .pet-body { animation: pet-done 1.1s ease-in-out 2; }
.pet-stage[data-state="night"] .pet-body { animation: pet-sleep 4s ease-in-out infinite; }
.pet-zzz { opacity: 0; }

.pet-stage[data-state="night"] .pet-zzz { opacity: 1; animation: floatz 3s ease-in-out infinite; }
@keyframes floatz { 0%, 100% { transform: translateY(0); opacity: .3; } 50% { transform: translateY(-8px); opacity: 1; } }

.xp-bar { margin-top: 10px; }
.xp-bar .track { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.xp-bar .track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .4s ease; }
.xp-bar .row { justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.costume-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.costume-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 3px; font-size: 9.5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-2); font-weight: 700;
}
.costume-btn .e { font-size: 15px; }
.costume-btn.active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--card)); color: var(--brand); }
.costume-btn.locked { opacity: .5; }
.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge-pill { background: var(--bg-2); border-radius: 999px; padding: 3px 8px; font-size: 10.5px; color: var(--ink-2); font-weight: 700; }
.badge-pill.off { opacity: .35; }

/* fun */
.seg { display: flex; gap: 3px; background: var(--bg-2); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; min-width: 0; border: 0; background: transparent; border-radius: 8px; padding: 7px 3px; font-size: 10.8px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.fun-panel { display: none; }
.fun-panel.active { display: block; }
.fun-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fun-head .sc { font-size: 12px; font-weight: 800; }
.fun-head .sc span { color: var(--muted); font-weight: 600; }

.g2048 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; background: var(--bg-2); border-radius: 12px; padding: 6px; touch-action: none; }
.g2048 .t {
  aspect-ratio: 1 / 1; border-radius: 7px; display: grid; place-items: center; font-weight: 900; font-size: 15px;
  background: color-mix(in srgb, var(--card) 70%, var(--bg-2)); color: var(--ink);
}
.g2048 .t[data-v="0"] { color: transparent; }
.g2048 .t[data-v="2"] { background: #eee7d8; color: #6c6353; }
.g2048 .t[data-v="4"] { background: #ecdcb4; color: #6c5a2f; }
.g2048 .t[data-v="8"] { background: #f6b26b; color: #4c2c05; }
.g2048 .t[data-v="16"] { background: #f0913f; color: #fff; }
.g2048 .t[data-v="32"] { background: #ef7a45; color: #fff; }
.g2048 .t[data-v="64"] { background: #ea5a3d; color: #fff; }
.g2048 .t[data-v="128"] { background: #e9c94a; color: #3a2f00; }
.g2048 .t[data-v="256"] { background: #e9c23a; color: #3a2f00; }
.g2048 .t[data-v="512"] { background: #d8b02c; color: #fff; }
.g2048 .t[data-v="1024"] { background: #b58a12; color: #fff; font-size: 12px; }
.g2048 .t[data-v="2048"] { background: #2b8a4b; color: #fff; font-size: 12px; }
.g2048 .t.pop { animation: tpop .14s ease; }
@keyframes tpop { from { transform: scale(.86); } to { transform: scale(1); } }

canvas.snake-canvas { width: 100%; border-radius: 12px; background: var(--bg-2); display: block; touch-action: none; }
.game-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 6px; }
.game-foot .tip { font-size: 10.5px; }

.tarot-card {
  border-radius: 14px; padding: 18px; text-align: center;
  background: linear-gradient(160deg, #2b2350, #4a3a86 60%, #6b52b8); color: #f3eeff;
  border: 1px solid rgba(255,255,255,.14);
}
.tarot-card .sym { font-size: 40px; }
.tarot-card h4 { font-size: 17px; margin: 6px 0; }
.tarot-card p { font-size: 12.5px; opacity: .92; line-height: 1.5; }
.tarot-card.back { background: linear-gradient(160deg, #1f2a44, #2e3f66); }
.tarot-card.back .sym { opacity: .5; }

.wheel-wrap { text-align: center; }
.wheel-result { font-size: 20px; font-weight: 900; padding: 14px; border-radius: 14px; background: var(--bg-2); margin-bottom: 10px; min-height: 56px; display: grid; place-items: center; }
.wheel-result.spin { animation: wob .35s linear infinite; }
@keyframes wob { 0% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } 100% { transform: rotate(-2deg); } }

.meme-preview { border-radius: 12px; overflow: hidden; background: #111; position: relative; }
.meme-preview canvas { width: 100%; display: block; }
.meme-inputs input { margin-bottom: 6px; }

/* ---------------- toast / drawer helpers ---------------- */
.bottom-nav { display: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 1280px) {
  :root { --sb-w: 244px; --studio-w: 340px; }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 84vw); z-index: 60;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  body[dir="rtl"] .sidebar { transform: translateX(102%); }
  body.nav-open .sidebar { transform: none; }
  .sidebar-close { display: inline-flex; }
  .topbar .menu-btn { display: inline-flex; }
  .studio {
    position: fixed; inset-inline: 0; inset-block-end: 0; top: auto; height: min(76dvh, 640px);
    z-index: 55; border-inline-start: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0;
    transform: translateY(102%); transition: transform .24s ease; box-shadow: 0 -20px 50px rgba(0,0,0,.18);
  }
  body.studio-open .studio { transform: none; }
  .studio-tabs button { flex-direction: row; gap: 5px; }
  .bottom-nav {
    display: flex; position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 50;
    background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  }
  .bottom-nav button {
    flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700;
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border-radius: 10px;
  }
  .bottom-nav button .i { font-size: 17px; }
  .bottom-nav button.active { color: var(--brand); }
  .chat-col { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .messages { padding-bottom: 10px; }
  body[data-plan="free"] .chat-col { padding-bottom: 58px; }
}

@media (max-width: 720px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .ws-title h1 { font-size: 15px; }
  .topbar-right .conn { display: none; }
  .topbar-right select.theme-select { display: none; }
  .messages { padding: 14px 10px 4px; }
  .msg { max-width: 90%; }
  .bubble { font-size: 14px; }
  .composer-wrap { padding: 6px 8px 8px; }
  .music-bar .lbl { display: none; }
  .studio-body { padding: 10px; }
  .vault-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- settings modal internals ---------------- */
.set-sec { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; background: var(--card-2); }
.set-sec h4 { font-size: 13px; margin-bottom: 4px; }
.set-sec .desc { font-size: 11.8px; color: var(--muted); margin-bottom: 9px; }
.code-box {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 220px; overflow: auto; color: var(--ink-2);
}
.token-box { display: flex; gap: 6px; align-items: center; }
.token-box code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 700; }

/* pricing modal */
.plan-toggle { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.plan-toggle button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 800; font-size: 13px; color: var(--muted); }
.plan-toggle button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.plan-price-line { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 14px; }
.plan-price-line .big { font-size: 38px; font-weight: 900; letter-spacing: -.03em; }
.plan-price-line .per { color: var(--muted); font-size: 13px; }
.plan-perks { display: grid; gap: 7px; font-size: 13px; margin-bottom: 16px; }
.plan-perks li::before { content: "✓"; color: var(--ok); font-weight: 900; margin-inline-end: 7px; }
#paypal-buttons { min-height: 46px; }
.demo-wrap { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.demo-wrap .tip { margin-top: 6px; }

/* ============================================================
   Connection banner (15-second onboarding) · QR · usage tips
   ============================================================ */

.conn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
  border: 1px solid transparent; background: var(--bg-2); color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.conn-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn-pill.on {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--card));
  border-color: color-mix(in srgb, var(--ok) 32%, transparent);
}
.conn-pill.off {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--card));
  border-color: color-mix(in srgb, var(--warn) 32%, transparent);
}
.conn-pill:hover { filter: brightness(.98); }

.conn-banner {
  position: relative;
  margin: 10px 12px 0;
  padding: 15px 18px 14px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 16px;
  color: #eafff1;
  background:
    radial-gradient(130% 130% at 100% 0%, rgba(201, 242, 122, .42), transparent 58%),
    linear-gradient(135deg, #0c3320 0%, #155c36 58%, #1f7a48 100%);
  box-shadow: 0 16px 36px rgba(9, 39, 23, .26);
  overflow: hidden;
}
.conn-banner-close {
  position: absolute; top: 8px; inset-inline-end: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .18); color: #d9f5e4;
  font-size: 12px; line-height: 1; cursor: pointer; z-index: 2;
}
.conn-banner-close:hover { background: rgba(0, 0, 0, .32); color: #fff; }

.cb-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.cb-head { display: flex; align-items: center; gap: 12px; }
.cb-head-txt { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cb-mascot {
  width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto; display: block;
  background: #fff; object-fit: cover;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .28), 0 0 0 2px rgba(201, 242, 122, .55);
}
.cb-badge {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: #c9f27a; color: #0c3320;
  font-size: 11px; font-weight: 900; letter-spacing: .01em;
}
.cb-title {
  font-size: 18px; font-weight: 900; letter-spacing: -.02em;
  color: #ffffff; line-height: 1.3; margin: 0; padding-inline-end: 22px;
  word-break: keep-all;
}
.cb-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; list-style: none; }
.cb-steps li {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .13);
  font-size: 12px; font-weight: 800; color: #f2fff7; white-space: nowrap;
}
.cb-steps li b {
  width: 17px; height: 17px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #c9f27a; color: #0c3320; font-size: 10.5px; font-weight: 900;
}
.cb-steps .cb-ar { background: none; padding: 0 1px; color: #a9dcbd; font-weight: 900; }
.cb-steps .cb-step-done { background: rgba(201, 242, 122, .2); border: 1px solid rgba(201, 242, 122, .45); }

.cb-line { font-size: 12.5px; line-height: 1.55; color: #d8f3e3; word-break: keep-all; }
.cb-url-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9fd3b3; margin-top: 1px; }

.cb-url {
  font-family: var(--mono); font-size: 11.5px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px; padding: 7px 10px;
  color: #eafff1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.set-sec .cb-url, .cm-copy .cb-url {
  background: var(--bg); border-color: var(--line); color: var(--ink-2);
  white-space: normal; word-break: break-all;
}

.cb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; }
.cb-copy {
  border: 0; border-radius: 11px; padding: 11px 18px;
  background: #c9f27a; color: #0c3320; font-size: 14px; font-weight: 900;
}
.cb-copy:hover { background: #d6f894; }
.cb-copy.copied { background: #ffffff; }
.cb-more {
  border-radius: 11px; padding: 11px 15px;
  background: rgba(255, 255, 255, .10); color: #eafff1;
  border: 1px solid rgba(255, 255, 255, .28); font-size: 13px; font-weight: 800;
}
.cb-more:hover { background: rgba(255, 255, 255, .18); }
.cb-state { font-size: 11.5px; color: #9fd3b3; font-weight: 700; }

.cb-side { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.cb-qr {
  background: rgba(255, 255, 255, .97); border-radius: 14px;
  padding: 9px 10px 8px; text-align: center; color: #0c3320;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}
.cb-qr-head { font-size: 10.5px; font-weight: 900; color: #155c36; margin-bottom: 5px; }
.cb-qr-box { width: 148px; height: 148px; margin: 0 auto; }
.cb-qr-box svg { display: block; width: 100%; height: 100%; }
.cb-qr-hint { font-size: 10.2px; line-height: 1.4; color: #3f6b52; margin-top: 6px; word-break: keep-all; }

.cb-tips {
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 13px; padding: 9px 11px;
}
.cb-tips-head { font-size: 10.8px; font-weight: 900; color: #c9f27a; margin-bottom: 6px; }
.cb-tips ul { display: grid; gap: 7px; list-style: none; }
.cb-tips li { display: grid; grid-template-columns: 15px minmax(0, 1fr); column-gap: 5px; }
.cb-tips li .ti { grid-row: span 2; font-size: 11.5px; line-height: 1.35; }
.cb-tips li .tt { font-size: 10.8px; font-weight: 800; color: #ffffff; line-height: 1.35; }
.cb-tips li .td { font-size: 10.2px; line-height: 1.42; color: #b6dfc6; }

/* connect modal QR */
.cm-connect {
  display: grid; grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px; align-items: center;
  margin-top: 14px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card-2);
}
.cm-qr { text-align: center; min-width: 0; }
.cm-qr-box { width: 132px; height: 132px; margin: 0 auto; }
.cm-qr-box svg { display: block; width: 100%; height: 100%; }
.cm-qr-cap { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 800; color: var(--muted); }
.cm-copy { min-width: 0; display: flex; flex-direction: column; gap: 8px; }

/* usage tips modal */
.tips-list { display: grid; gap: 8px; list-style: none; }
.tips-list li {
  display: flex; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card-2);
}
.tips-list .ti { font-size: 18px; line-height: 1.15; flex: 0 0 auto; }
.tips-list b { font-size: 13px; color: var(--ink); }
.tips-list p { font-size: 11.8px; line-height: 1.5; color: var(--muted); margin-top: 2px; word-break: keep-all; }

@media (max-width: 1100px) {
  .conn-banner { grid-template-columns: minmax(0, 1fr); }
  .cb-side { flex-direction: row; }
  .cb-qr { flex: 1 1 180px; }
  .cb-tips { flex: 2 1 240px; }
}

@media (max-width: 720px) {
  .conn-banner { margin: 8px 8px 0; padding: 13px 12px 12px; max-height: 50dvh; overflow-y: auto; border-radius: 15px; }
  .cb-title { font-size: 16px; padding-inline-end: 26px; }
  .cb-title { font-size: 15.5px; }
  .cb-steps { gap: 4px; }
  .cb-steps li { font-size: 11.5px; padding: 3px 7px; }
  .cb-side { flex-direction: row; align-items: stretch; gap: 8px; }
  .cb-qr { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 108px; padding: 8px; }
  .cb-qr-head { display: none; }
  .cb-qr-box { flex: 0 0 auto; width: 90px; height: 90px; margin: 0; }
  .cb-qr-hint { display: none; }
  .cb-line { display: none; }
  .cb-tips { flex: 1 1 auto; padding: 8px 9px; }
  .cb-tips li .td { display: none; }
  .cb-tips li .tt { font-size: 10.5px; }
  .cb-tips li { grid-template-columns: 14px minmax(0, 1fr); gap: 4px; }
  .cb-actions { flex-wrap: nowrap; }
  .cb-copy { flex: 2 1 auto; padding: 12px 12px; font-size: 13.5px; }
  .cb-more { flex: 1 1 auto; padding: 12px 10px; font-size: 12px; white-space: nowrap; }
  .cb-url-label { display: none; }
  .topbar-right .conn-pill { display: none; }
  .ws-title h1 { font-size: 14.5px; }
  .cm-connect { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .cm-qr-box { width: 92px; height: 92px; }
  /* 폰에서는 복사 버튼을 단계 바로 아래로 */
  .cb-badge { order: 1; }
  .cb-title { order: 2; }
  .cb-steps { order: 3; }
  .cb-actions { order: 4; }
  .cb-state { order: 5; }
  .cb-line { order: 6; }
  .cb-url-label { order: 7; }
  .cb-url { order: 8; }
  .cb-line { font-size: 12px; }
}

/* ============================================================
   Guest demo mode (맛보기) — browser-local only
   ============================================================ */
body.demo-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
body.demo-body .app-shell { flex: 1 1 auto; min-height: 0; height: auto; }

.demo-bar {
  flex: 0 0 auto;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(90deg, #0c3320 0%, #1f7a48 62%, #2f8f55 100%);
  color: #eafff1; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 2px 10px rgba(9, 39, 23, .18);
}
.demo-bar .db-ico { font-size: 15px; line-height: 1; flex: 0 0 auto; }
.demo-bar .db-text { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.demo-bar .db-cta {
  flex: 0 0 auto; border: 0; border-radius: 10px;
  background: #c9f27a; color: #0c3320; font-weight: 900;
  padding: 7px 14px; font-size: 12.5px;
}
.demo-bar .db-cta:hover { background: #d6f894; }

.demo-plan-card { border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); }
.demo-plan-card .chip-pro { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--warn); }
.demo-room[data-act] { cursor: pointer; }

.demo-gate {
  background: color-mix(in srgb, var(--warn) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--ink-2); border-radius: 10px;
  padding: 9px 11px; font-size: 12px; line-height: 1.5; margin-bottom: 12px;
}

@media (max-width: 720px) {
  .demo-bar { padding: 7px 10px; gap: 8px; }
  .demo-bar .db-text { font-size: 11px; }
  .demo-bar .db-cta { padding: 6px 10px; font-size: 11.5px; white-space: nowrap; }
  .demo-plan-card { display: none; }
}

/* ==================================================================
   v2.0 — 알림 · 바로 부르기 · 첨부 미리보기 · 마스코트 상태 · 공유 CTA
   ================================================================== */

/* --- topbar 아바타 · 알림 버튼 --- */
.pickly-avatar {
  position: relative; width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--brand) 26%, var(--card)), var(--card));
  border: 1px solid var(--line);
}
.pickly-avatar img { width: 30px; height: 30px; display: block; border-radius: 50%; }
.pickly-avatar .pa-spark { position: absolute; top: -5px; inset-inline-end: -4px; font-size: 12px; opacity: 0; transform: scale(.6); }
.pickly-avatar .pa-dots { position: absolute; bottom: -3px; inset-inline-start: 50%; transform: translateX(-50%); display: none; gap: 2px; }
.pickly-avatar .pa-dots i { width: 3.4px; height: 3.4px; border-radius: 50%; background: var(--brand); display: block; }
.pickly-avatar[data-state="working"] { animation: pk-bob 1.1s ease-in-out infinite; }
.pickly-avatar[data-state="working"] .pa-dots { display: flex; }
.pickly-avatar[data-state="working"] .pa-dots i { animation: pk-typing 1s infinite; }
.pickly-avatar[data-state="working"] .pa-dots i:nth-child(2) { animation-delay: .16s; }
.pickly-avatar[data-state="working"] .pa-dots i:nth-child(3) { animation-delay: .32s; }
.pickly-avatar[data-state="working"] .pa-spark { opacity: 1; animation: pk-sparkle 1.6s ease-in-out infinite; }
.pickly-avatar[data-state="done"] { animation: pk-bounce .62s ease-out 2; }
.pickly-avatar[data-state="done"] .pa-spark { opacity: 1; animation: pk-sparkle .8s ease-in-out 3; }
.pickly-avatar[data-state="night"] { filter: grayscale(.35) brightness(.9); }

@keyframes pk-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
@keyframes pk-typing { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-3px); opacity: 1; } }
@keyframes pk-sparkle { 0%, 100% { transform: scale(.7) rotate(0); opacity: .35; } 50% { transform: scale(1.1) rotate(12deg); opacity: 1; } }
@keyframes pk-bounce { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-9px) scale(1.08); } 70% { transform: translateY(0) scale(.96); } 100% { transform: translateY(0) scale(1); } }

/* --- 답장 알림 배너 --- */
.notify-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; font-size: 12.5px;
  background: linear-gradient(90deg, rgba(59, 165, 93, .14), rgba(255, 215, 110, .16));
  border-bottom: 1px solid var(--line);
}
.notify-banner.hidden { display: none; }
.notify-banner .nb-ico { font-size: 16px; }
.notify-banner .nb-txt { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 160px; }
.notify-banner .nb-txt b { font-size: 12.5px; }
.notify-banner .nb-txt span { font-size: 11.5px; color: var(--muted); }
.notify-banner .nb-close { margin-inline-start: auto; }

/* --- [바로 부르기] (v2.0 · v3.0에서 제거) --- */
.composer-hint { font-size: 11px; color: var(--muted); padding: 6px 4px 0; line-height: 1.45; }
.composer-hint b { color: var(--ink-2); }
.tip-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5;
  background: color-mix(in srgb, var(--brand) 9%, var(--card)); border: 1px dashed color-mix(in srgb, var(--brand) 38%, var(--line));
  color: var(--ink-2);
}

/* --- 첨부 썸네일 · 파일 카드 --- */
.att-thumb {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 4px;
  display: inline-flex; flex-direction: column; gap: 3px; max-width: 148px; overflow: hidden; cursor: zoom-in;
}
.att-thumb img { width: 132px; height: 92px; object-fit: cover; border-radius: 7px; display: block; }
.att-thumb .att-thumb-nm {
  font-size: 10.5px; color: var(--muted); max-width: 132px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.file-card {
  display: inline-flex; align-items: center; gap: 9px; background: var(--card);
  border: 1px solid var(--line); border-radius: 11px; padding: 8px 11px;
  min-width: 168px; max-width: 260px; color: var(--ink-2); text-decoration: none;
}
.file-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.file-card .fc-ico { font-size: 20px; line-height: 1; }
.file-card .fc-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-card .fc-nm { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fc-meta { font-size: 10.5px; color: var(--muted); }
.file-card .fc-dl { color: var(--brand); font-weight: 900; font-size: 14px; }

.vfile.is-image .thumb { padding: 0; position: relative; }
.vfile .thumb-btn { position: relative; display: block; width: 100%; height: 100%; border: 0; padding: 0; background: transparent; cursor: zoom-in; }
.vfile .thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vfile .thumb-zoom {
  position: absolute; inset-inline-end: 5px; bottom: 5px; font-size: 11px;
  background: rgba(12, 26, 18, .55); color: #fff; border-radius: 6px; padding: 2px 5px; opacity: 0; transition: opacity .15s;
}
.vfile .thumb-btn:hover .thumb-zoom { opacity: 1; }
.vfile-ico { font-size: 24px; }

/* --- 라이트박스 --- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  background: rgba(8, 16, 12, .82); padding: 24px; backdrop-filter: blur(3px);
}
.lightbox.open { display: grid; }
.lightbox .lb-figure { max-width: min(1100px, 96vw); max-height: 92vh; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.lightbox .lb-figure img {
  max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 12px;
  background: #0e1a13; box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.lightbox figcaption { color: #eaf3ed; font-size: 12.5px; text-align: center; }
.lightbox figcaption a { color: #9be7b3; font-weight: 700; }
.lightbox .lb-close {
  position: absolute; top: 14px; inset-inline-end: 16px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .12); color: #fff; font-size: 16px;
}

/* --- 공유 페이지 CTA --- */
.share-cta {
  margin-top: 26px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 12%, var(--card)), color-mix(in srgb, #ffd76e 18%, var(--card)));
}
.share-cta-mascot { width: 82px; height: 82px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(24, 60, 38, .18)); }
.share-cta-txt { flex: 1; min-width: 190px; }
.share-cta-txt b { display: block; font-size: 15px; letter-spacing: -.01em; }
.share-cta-txt p { font-size: 13px; color: var(--ink-2); margin: 3px 0 2px; }
.share-cta-txt .tip { font-size: 11.5px; }
.share-cta .btn { flex: 0 0 auto; }

@media (max-width: 720px) {
  .composer .call-now { padding: 8px 9px; font-size: 11.5px; }
  .composer-hint { font-size: 10.5px; }
  .pickly-avatar { width: 30px; height: 30px; }
  .pickly-avatar img { width: 26px; height: 26px; }
  .notify-banner { padding: 8px 10px; }
  .notify-banner .btn { flex: 1 0 auto; }
  .att-thumb img { width: 108px; height: 78px; }
  .file-card { min-width: 150px; }
  .share-cta { padding: 14px; gap: 12px; }
  .share-cta-mascot { width: 64px; height: 64px; }
}

/* --- 모바일 상단바: 제목이 눌리지 않도록 폭을 양보합니다 (v2.0) --- */
@media (max-width: 720px) {
  .topbar { gap: 4px; padding: 7px 9px; }
  .ws-title h1 { font-size: 14px; }
  .ws-sub { display: none; }
  .topbar-right { gap: 1px; }
  .topbar .icon-btn { width: 29px; height: 29px; font-size: 14px; border-radius: 8px; }
  .topbar .conn-pill { padding: 4px 7px; font-size: 10px; }
  .topbar select { max-width: 76px; font-size: 10.5px; padding: 4px 15px 4px 6px; }
  .topbar .menu-btn { display: inline-flex; width: 29px; height: 29px; }
}
@media (max-width: 380px) {
  .topbar select { max-width: 60px; }
  .ws-title h1 { font-size: 13px; }
}

/* ==================================================================
   v3.0 — 모노라인 아이콘 · Markdown · 커맨드 팔레트 · 테마 정돈
   ================================================================== */

/* 아이콘 정렬 */
.studio-tabs button .i { display: grid; place-items: center; height: 20px; }
.studio-tabs button .i svg { display: block; }
.bottom-nav button .i { display: grid; place-items: center; height: 20px; }
.bottom-nav button .i svg { display: block; }
.snd-btn svg, .pomo-btn svg { opacity: .85; }
.snd-btn.active svg, .pomo-btn.active svg { opacity: 1; }
.locked-row svg { color: var(--muted); }
.sidebar-foot svg { opacity: .8; }
.sidebar-foot a:hover svg, .sidebar-foot button:hover svg { opacity: 1; }
.set-sec h4 { display: flex; align-items: center; gap: 7px; }
.set-sec h4 svg { color: var(--brand); }
.tips-list .ti svg { display: block; color: var(--brand); }
.cb-tips li .ti svg { display: block; color: #c9f27a; }
.cb-qr-head svg, .cm-qr-cap svg { vertical-align: -2px; }
.upgrade-banner svg { color: var(--brand); }
.studio-locked .lock-ico { color: var(--muted); display: grid; place-items: center; }

/* 컴포저 상태 필 (가입 없이 맛보기에서도 동일) */
.composer-status {
  display: flex; align-items: center; gap: 7px;
  margin: 7px 2px 0; padding: 0 4px;
  font-size: 11px; line-height: 1.45; color: var(--muted);
}
.composer-status .cs-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ok); flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 14%, transparent);
}
.composer-status .cs-txt { min-width: 0; }

/* ---------- Markdown ---------- */
.msg.assistant .bubble.md { white-space: normal; }
.bubble.md > :first-child { margin-top: 0; }
.bubble.md > :last-child { margin-bottom: 0; }
.bubble.md p { margin: 0 0 8px; }
.bubble.md h3, .bubble.md h4, .bubble.md h5, .bubble.md h6 {
  font-size: 14.5px; line-height: 1.35; margin: 12px 0 6px; letter-spacing: -.01em;
}
.bubble.md h4 { font-size: 13.8px; }
.bubble.md h5, .bubble.md h6 { font-size: 13.2px; color: var(--ink-2); }
.bubble.md strong { font-weight: 800; }
.bubble.md a { color: var(--brand); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.bubble.md .md-list { margin: 4px 0 8px; padding-inline-start: 18px; display: grid; gap: 3px; }
.bubble.md .md-list li { list-style: disc; }
.bubble.md ol.md-list li { list-style: decimal; }
.bubble.md .md-quote {
  margin: 6px 0 8px; padding: 6px 12px; border-inline-start: 2px solid color-mix(in srgb, var(--brand) 45%, var(--line));
  background: var(--bg-2); border-radius: 0 8px 8px 0; color: var(--ink-2); font-size: 13.4px;
}
body[dir="rtl"] .bubble.md .md-quote { border-radius: 8px 0 0 8px; }
.bubble.md .md-hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.md-icode {
  font-family: var(--mono); font-size: 12.4px; padding: 1px 5px; border-radius: 5px;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink);
  word-break: break-word;
}
.md-codeblock {
  margin: 8px 0 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--ink) 4%, var(--card));
}
.md-cb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px 5px 11px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 3%, var(--card-2));
}
.md-cb-lang {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.md-copy {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 700; line-height: 1.6;
}
.md-copy:hover { border-color: var(--brand); color: var(--brand); }
.md-copy.done { border-color: var(--ok); color: var(--ok); }
.md-codeblock pre { margin: 0; padding: 11px 12px; overflow-x: auto; max-height: 360px; }
.md-codeblock code {
  font-family: var(--mono); font-size: 12.3px; line-height: 1.6; color: var(--ink);
  white-space: pre; display: block;
}

/* ---------- 커맨드 팔레트 ---------- */
.palette {
  position: fixed; inset: 0; z-index: 130; display: none;
  align-items: flex-start; justify-content: center; padding: 12vh 18px 18px;
  background: rgba(8, 16, 12, .42); backdrop-filter: blur(4px);
}
.palette.open { display: flex; }
.palette-card {
  width: min(560px, 100%); max-height: 68vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(8, 20, 12, .32); overflow: hidden;
  animation: pal-in .16s ease;
}
@keyframes pal-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
.palette-input {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--card-2);
}
.palette-input .pi-ico { color: var(--muted); }
.palette-input input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 550; padding: 2px 0;
}
.palette-input input::placeholder { color: var(--muted); font-weight: 500; }
.palette-list { overflow-y: auto; padding: 6px; min-height: 60px; }
.palette-group {
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px 4px;
}
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 9px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
}
.palette-item .pi-ico { color: var(--muted); display: grid; place-items: center; width: 18px; }
.palette-item .pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-hint {
  font-size: 9.5px; font-weight: 800; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
  border-radius: 999px; padding: 1px 7px; letter-spacing: .04em;
}
.palette-item.active { background: color-mix(in srgb, var(--brand) 12%, var(--bg-2)); color: var(--ink); }
.palette-item.active .pi-ico { color: var(--brand); }
.palette-empty { padding: 18px 12px; font-size: 13px; color: var(--muted); text-align: center; }
.palette-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--line); background: var(--card-2);
  font-size: 11px; color: var(--muted);
}
.palette-foot .pf-key { display: inline-flex; gap: 3px; }

/* ---------- 테마 정돈 (light · dark) ---------- */
.topbar { box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 3%, transparent); }
.sidebar, .studio { background: color-mix(in srgb, var(--card) 55%, var(--bg)); }
.msg.assistant .bubble { box-shadow: 0 1px 2px rgba(16, 40, 24, .04); }
.msg.user .bubble { box-shadow: 0 6px 16px -12px rgba(35, 121, 74, .8); }
.composer {
  box-shadow: 0 1px 2px rgba(16, 40, 24, .04), 0 10px 24px -22px rgba(16, 40, 24, .5);
}
.composer:focus-within { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
body[data-theme="cafe"] .msg.assistant .bubble,
body[data-theme="neon"] .msg.assistant .bubble { box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset; }
body[data-theme="cafe"] .sidebar, body[data-theme="cafe"] .studio { background: color-mix(in srgb, var(--card) 70%, #000); }
body[data-theme="neon"] .sidebar, body[data-theme="neon"] .studio { background: color-mix(in srgb, var(--card) 82%, #000); }
body[data-theme="neon"] .kcol, body[data-theme="neon"] .kcard { background: var(--card-2); }
body[data-theme="retro"] .bubble { border-radius: 6px; }

@media (max-width: 720px) {
  .palette { padding-top: 8vh; }
  .palette-card { max-height: 76vh; border-radius: 14px; }
  .palette-input input { font-size: 14.5px; }
  .composer-status { font-size: 10.2px; margin-top: 5px; padding: 0 2px; }
  .md-codeblock code { font-size: 11.6px; }
}
