:root {
  /* Claude warm palette */
  --bg: #faf9f5;
  --bg-deep: #f3f0e7;
  --bg-card: #ffffff;
  --bg-soft: #f0eee5;
  --border: #ebe9df;
  --border-strong: #d9d6c7;
  --text: #1f1e1d;
  --text-soft: #6b6960;
  --text-faint: #9c9888;
  --accent: #c96442;
  --accent-soft: #f2e0d6;
  --accent-deep: #a4502f;
  --accent-glow: rgba(201,100,66,.22);

  /* Liquid glass */
  --glass-bg: rgba(255,255,255,.58);
  --glass-bg-strong: rgba(255,255,255,.72);
  --glass-border: rgba(255,255,255,.7);
  --glass-hi: rgba(255,255,255,.9);
  --glass-shadow: 0 1px 1px rgba(31,30,29,.04), 0 8px 24px rgba(31,30,29,.07), 0 2px 6px rgba(31,30,29,.05);
  --blur: 18px;

  --shadow: 0 1px 2px rgba(31,30,29,.04), 0 4px 14px rgba(31,30,29,.06);
  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --header-h: 56px;
  --tab-h: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1917;
    --bg-deep: #141312;
    --bg-card: #262524;
    --bg-soft: #2c2b29;
    --border: #34322d;
    --border-strong: #44423c;
    --text: #f5f3ed;
    --text-soft: #b5b3a8;
    --text-faint: #807d72;
    --accent: #e08568;
    --accent-soft: #3a261d;
    --accent-deep: #f0a484;
    --accent-glow: rgba(224,133,104,.22);
    --glass-bg: rgba(44,42,39,.55);
    --glass-bg-strong: rgba(44,42,39,.74);
    --glass-border: rgba(255,255,255,.08);
    --glass-hi: rgba(255,255,255,.14);
    --glass-shadow: 0 1px 1px rgba(0,0,0,.25), 0 10px 28px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient liquid background — soft drifting colour blobs behind the glass */
body::before {
  content: "";
  position: fixed;
  inset: -20vh -20vw;
  z-index: -1;
  background:
    radial-gradient(38vw 38vw at 12% 8%, var(--accent-glow), transparent 60%),
    radial-gradient(42vw 42vw at 88% 18%, rgba(120,150,210,.14), transparent 62%),
    radial-gradient(46vw 46vw at 70% 92%, rgba(201,100,66,.14), transparent 60%),
    radial-gradient(40vw 40vw at 18% 88%, rgba(150,190,160,.12), transparent 62%);
  filter: saturate(1.05);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

#app { min-height: 100vh; }

.screen {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}

/* ---------- Glass utility ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
}

/* ---------- Header ---------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.hdr.scrolled { border-bottom-color: var(--glass-border); }

.hdr-back {
  background: transparent;
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
}
.hdr-back:active { background: var(--bg-soft); }

.hdr-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-icon-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hdr-icon-btn:active { background: var(--bg-soft); }
.hdr-icon-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.logo-mark { font-family: 'Source Serif 4', Georgia, serif; font-size: 23px; font-weight: 600; letter-spacing: -0.02em; flex: 1; }
.logo-mark .accent { color: var(--accent); }

/* streak chip in header */
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,170,90,.22), rgba(201,100,66,.16));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 600; color: var(--accent-deep);
  white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero { padding: 14px 20px 6px; }
.hero-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(27px, 6.5vw, 34px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
.hero-sub { margin-top: 6px; color: var(--text-soft); font-size: 14px; }

/* ---------- Section heading ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 20px 8px;
}
.section-head h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em;
}
.section-head a { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 500; }

/* ---------- Continue rail ---------- */
.rail {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 4px 20px 8px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.rail::-webkit-scrollbar { display: none; }
.rail-card {
  flex: 0 0 auto; width: 132px; scroll-snap-align: start;
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: transform .15s;
}
.rail-card:active { transform: scale(.96); }
.rail-cover {
  height: 88px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft));
}
.rail-cover img { width: 100%; height: 100%; object-fit: cover; }
.rail-body { padding: 8px 10px 10px; }
.rail-name {
  font-family: 'Source Serif 4', Georgia, serif; font-size: 13.5px; font-weight: 600;
  line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-last {
  font-size: 11px; color: var(--text-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Search ---------- */
.search-wrap { padding: 8px 20px; }
.search-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-faint); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin: 4px 20px 10px; border-bottom: 1px solid var(--border); }
.tab {
  background: transparent; border: none; color: var(--text-soft);
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Tag strip / chips ---------- */
.tag-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 20px 14px; scrollbar-width: none; }
.tag-strip::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }

/* ---------- Grid / cards ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 24px; }
@media (min-width: 540px) { .grid { grid-template-columns: 1fr 1fr 1fr; padding-inline: 20px; } }

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--glass-shadow);
  transition: transform .15s, box-shadow .15s;
}
.card:active { transform: scale(.97); }

.card-cover {
  aspect-ratio: 3 / 2;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px; position: relative;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-soft) 100%);
  overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.22;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-greet {
  color: var(--text-soft); font-size: 12px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: auto; padding-top: 5px; font-size: 11px; color: var(--text-faint);
}
.card-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-stats { display: flex; gap: 7px; flex: 0 0 auto; }

.card-tag {
  position: absolute; top: 8px; left: 8px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid var(--glass-border);
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; color: var(--text);
}
@media (prefers-color-scheme: dark) { .card-tag { background: rgba(40,38,35,.5); } }

/* share button floating on card cover */
.card-share {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid var(--glass-border);
  font-size: 14px; cursor: pointer; color: var(--text);
  z-index: 2;
}
.card-share:active { transform: scale(.88); }
@media (prefers-color-scheme: dark) { .card-share { background: rgba(40,38,35,.5); } }

/* ---------- RP detail ---------- */
.detail-cover {
  height: 230px; position: relative;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-soft) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 84px; overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 55%, var(--bg) 100%);
}
.detail-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-top: -28px; position: relative; z-index: 1; }
.detail-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15;
}
.detail-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); align-items: center; }
.detail-greet {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  border-radius: var(--radius);
  padding: 14px 16px; font-style: italic; color: var(--text-soft); line-height: 1.55;
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 18px; border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--text); white-space: nowrap;
  transition: transform .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent); flex: 1;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.btn-primary:active { background: var(--accent-deep); }
.btn-ghost {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.btn-icon {
  width: 46px; height: 46px; padding: 0; border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  font-size: 18px;
}

/* invite banner */
.ref-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 16px 0; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,170,90,.16), var(--glass-bg));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
}
.ref-banner .emo { font-size: 26px; }
.ref-banner .txt { flex: 1; }
.ref-banner .t1 { font-family: 'Source Serif 4', Georgia, serif; font-size: 15px; font-weight: 600; }
.ref-banner .t2 { font-size: 12.5px; color: var(--text-soft); margin-top: 1px; }
.ref-banner .arr { color: var(--accent); font-size: 18px; }

/* ---------- Chat ---------- */
.chat-screen { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 720px; margin: 0 auto; }
.chat-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border-bottom: 1px solid var(--glass-border);
  height: var(--header-h);
}
.chat-avatar {
  width: 38px; height: 38px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0; font-size: 18px;
  border: 1px solid var(--glass-border);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-title { font-family: 'Source Serif 4', Georgia, serif; font-size: 16px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tokens { font-size: 11px; color: var(--text-faint); }

.chat-stream { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }

.msg { display: flex; gap: 8px; max-width: 88%; animation: msg-in .26s cubic-bezier(.2,.7,.3,1); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble { padding: 11px 15px; border-radius: 20px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg.user .msg-bubble {
  background: var(--accent); color: #fff; border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.msg.assistant .msg-bubble {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 6px;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.scene-img {
  display: block; width: 100%; max-width: 340px;
  border-radius: 14px; margin: 8px 0 2px;
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  animation: msg-in .3s ease;
}
.msg-bubble em, .msg-bubble i { color: var(--text-soft); font-style: italic; }
.msg.user .msg-bubble em, .msg.user .msg-bubble i { color: rgba(255,255,255,.85); }
.msg-bubble strong, .msg-bubble b { font-weight: 600; }

.msg-actions { display: flex; gap: 4px; margin-top: 5px; opacity: 0; transition: opacity .15s; }
.msg.assistant:last-child .msg-actions { opacity: 1; }
.msg-act {
  background: var(--glass-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 5px 9px; font-size: 13px; color: var(--text-soft); cursor: pointer;
}
.msg-act.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }
.msg-act:active { background: var(--bg-soft); }

.typing {
  display: flex; gap: 4px; padding: 13px 16px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px; border-bottom-left-radius: 6px; width: max-content;
}
.typing-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--text-soft); opacity: .5; animation: typing 1.2s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer {
  position: sticky; bottom: 0;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border-top: 1px solid var(--glass-border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: flex-end;
}
.composer-input {
  flex: 1; resize: none;
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 11px 15px;
  background: var(--glass-bg);
  color: var(--text); font-family: inherit; font-size: 15px; line-height: 1.4;
  max-height: 120px; min-height: 42px; outline: none;
}
.composer-input:focus { border-color: var(--accent); }
.composer-send, .composer-mic {
  width: 42px; height: 42px; background: var(--accent); color: #fff; border: none;
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 14px var(--accent-glow);
}
.composer-send:disabled { background: var(--text-faint); cursor: not-allowed; box-shadow: none; }
.composer-mic { background: var(--glass-bg); color: var(--text-soft); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-hi); }
.composer-mic.rec { background: #d33; color: #fff; border-color: #d33; animation: pulse-rec 1.2s infinite; }
@keyframes pulse-rec { 0%, 100% { box-shadow: 0 0 0 0 rgba(211,51,51,.5); } 50% { box-shadow: 0 0 0 8px rgba(211,51,51,0); } }

/* ---------- Create form ---------- */
.form { padding: 16px 20px 90px; display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-soft); font-weight: 500; }
.form input, .form textarea, .form select {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px 15px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--text); font-family: inherit; font-size: 15px; outline: none;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); }
.form textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.form-tags { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.form-tag {
  padding: 11px 12px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 13.5px; text-align: left; cursor: pointer; color: var(--text);
}
.form-tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.form-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 var(--glass-hi); cursor: pointer;
}
.form-toggle .lbl { font-size: 14px; }
.form-toggle .sw { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .18s; flex-shrink: 0; }
.form-toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.form-toggle.on .sw { background: var(--accent); }
.form-toggle.on .sw::after { transform: translateX(18px); }
.form-hint { font-size: 12px; color: var(--text-faint); margin-top: -6px; }

/* model switcher */
.model-seg { display: flex; gap: 8px; }
.model-opt {
  flex: 1; padding: 11px 12px; border-radius: var(--radius);
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  cursor: pointer; text-align: center; transition: transform .12s;
}
.model-opt:active { transform: scale(.97); }
.model-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }
.model-opt.locked { opacity: .6; }
.model-opt-t { font-family: 'Source Serif 4', Georgia, serif; font-size: 14px; font-weight: 600; }
.model-opt-s { font-size: 11px; margin-top: 2px; opacity: .8; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); grid-column: 1 / -1; }

.skeleton {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  aspect-ratio: 3 / 4;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.toast {
  position: fixed; bottom: calc(var(--tab-h) + 16px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border);
  color: var(--text); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  opacity: 0; transition: all .22s; z-index: 100; pointer-events: none;
  box-shadow: var(--glass-shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Bottom nav — floating glass pill */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  max-width: 720px; margin: 0 auto;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border-top: 1px solid var(--glass-border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 40;
  box-shadow: 0 -4px 24px rgba(31,30,29,.06);
}
.tabbar-btn {
  flex: 1; background: transparent; border: none; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-faint); font-family: inherit; font-size: 11px; font-weight: 500; cursor: pointer;
  transition: color .15s, transform .12s;
}
.tabbar-btn:active { transform: scale(.92); }
.tabbar-btn.active { color: var(--accent); }

.spinner { width: 26px; height: 26px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 999px; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- roAI Live (voice call) ---------- */
.live-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #2a2825 0%, #16100d 75%);
  color: #f5f3ed; padding: 60px 24px 48px; gap: 18px; position: relative;
}
.live-cover {
  width: 80px; height: 80px; border-radius: 999px;
  background: linear-gradient(135deg, #c96442, #6b3b29);
  display: flex; align-items: center; justify-content: center; font-size: 36px;
  overflow: hidden; position: absolute; top: 28px; border: 2px solid rgba(255,255,255,.12);
}
.live-cover img { width: 100%; height: 100%; object-fit: cover; }
.live-orb {
  width: 200px; height: 200px; border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,210,180,.95), rgba(201,100,66,.85) 40%, rgba(120,55,30,.4) 70%, transparent 90%),
    radial-gradient(circle at 70% 80%, rgba(255,140,90,.4), transparent 60%);
  box-shadow: 0 0 60px rgba(201,100,66,.5), inset 0 0 40px rgba(255,180,140,.3);
  transition: transform .2s, box-shadow .2s; position: relative;
}
.live-orb.idle, .live-orb.listening { animation: orb-breathe 3.6s infinite ease-in-out; }
@keyframes orb-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); box-shadow: 0 0 80px rgba(201,100,66,.7), inset 0 0 50px rgba(255,180,140,.4); } }
.live-orb.listening::after { content: ''; position: absolute; inset: -16px; border-radius: 999px; border: 2px solid rgba(201,100,66,.4); animation: orb-ring 1.6s infinite ease-out; }
@keyframes orb-ring { 0% { transform: scale(.95); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }
.live-orb.processing { animation: orb-process 1.4s infinite linear; }
@keyframes orb-process { 0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); } 100% { transform: rotate(360deg) scale(1); filter: hue-rotate(30deg); } }
.live-orb.speaking {
  animation: orb-speak .3s infinite alternate;
  background: radial-gradient(circle at 30% 30%, rgba(255,230,200,1), rgba(255,140,90,.9) 40%, rgba(160,80,50,.5) 70%, transparent 90%);
  box-shadow: 0 0 90px rgba(255,150,100,.8), inset 0 0 60px rgba(255,220,180,.5);
}
@keyframes orb-speak { from { transform: scale(1); } to { transform: scale(1.05); } }
.live-title { font-family: 'Source Serif 4', Georgia, serif; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; text-align: center; }
.live-status { font-size: 14px; opacity: .65; font-weight: 500; letter-spacing: .02em; }
.live-subtitle { font-size: 14px; opacity: .85; text-align: center; max-width: 360px; min-height: 56px; line-height: 1.5; font-style: italic; color: rgba(245,243,237,.75); }
.live-end {
  margin-top: 12px; padding: 14px 36px;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px; font-family: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; letter-spacing: .02em;
}
.live-end:active { background: rgba(255,255,255,.16); }

/* ---------- Modal / sheet ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; z-index: 200; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(26px) saturate(1.6);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--glass-border);
  width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .25s ease-out;
  box-shadow: 0 -8px 40px rgba(0,0,0,.18);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
