/* ==========================================================================
   SenWari Web · 专属桌面小手机 PWA Stylesheet
   Zero external CDN · Instant mainland China load · Safe-area native feel
   4 Classic Skins ("神似不贴标") + Adaptive Night Mode
   ========================================================================== */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "PMingLiU", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Default Skin: deepseek (深海清风) */
  --bg-outer: #e9eef6;
  --bg-app: #f7f9fc;
  --bg-surface: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --bg-subtle: #eff3f9;
  --border-color: rgba(25, 45, 85, 0.09);
  --border-strong: rgba(25, 45, 85, 0.16);
  --text-primary: #1a2233;
  --text-secondary: #58657d;
  --text-muted: #8b97ad;
  --accent: #4d6bfe;
  --accent-hover: #3b59eb;
  --accent-soft: #edf1ff;
  --accent-text: #ffffff;
  --user-bubble-bg: #eaf0ff;
  --user-bubble-text: #18233d;
  --user-bubble-radius: 18px 18px 4px 18px;
  --asst-bg: transparent;
  --think-bg: #f1f4fa;
  --think-border: #c5d2ec;
  --think-text: #5a6782;
  --composer-bg: #ffffff;
  --composer-radius: 22px;
  --composer-shadow: 0 6px 24px rgba(32, 52, 97, 0.08);
  --font-chat: var(--font-sans);
  --danger: #e5484d;
  --success: #29a36a;
  --warning: #e59500;
}

/* Skin 1: DeepSeek Night */
[data-skin="deepseek"][data-theme="dark"] {
  --bg-outer: #0c0e14;
  --bg-app: #151821;
  --bg-surface: #1e222f;
  --bg-elevated: rgba(26, 30, 42, 0.9);
  --bg-subtle: #232838;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #eceff7;
  --text-secondary: #a2adc2;
  --text-muted: #6e7991;
  --accent: #637eff;
  --accent-hover: #7991ff;
  --accent-soft: rgba(99, 126, 255, 0.16);
  --accent-text: #ffffff;
  --user-bubble-bg: #263254;
  --user-bubble-text: #eef2ff;
  --think-bg: #1b1f2c;
  --think-border: #3d4b73;
  --think-text: #95a2bd;
  --composer-bg: #1e2331;
  --composer-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Skin 2: Claude (暖羊皮纸) */
[data-skin="claude"] {
  --bg-outer: #e7e1d5;
  --bg-app: #f5f2eb;
  --bg-surface: #fbf9f5;
  --bg-elevated: rgba(248, 245, 238, 0.9);
  --bg-subtle: #ece6da;
  --border-color: rgba(68, 52, 34, 0.1);
  --border-strong: rgba(68, 52, 34, 0.18);
  --text-primary: #29241e;
  --text-secondary: #685f53;
  --text-muted: #968c7e;
  --accent: #d97757;
  --accent-hover: #c56444;
  --accent-soft: #f7e6df;
  --accent-text: #ffffff;
  --user-bubble-bg: #eae3d5;
  --user-bubble-text: #26211b;
  --user-bubble-radius: 16px;
  --think-bg: #efeae0;
  --think-border: #d97757;
  --think-text: #6b6154;
  --composer-bg: #fcfaf6;
  --composer-radius: 18px;
  --composer-shadow: 0 4px 20px rgba(65, 48, 28, 0.07);
  --font-chat: var(--font-serif);
}

[data-skin="claude"][data-theme="dark"] {
  --bg-outer: #131210;
  --bg-app: #1f1d1a;
  --bg-surface: #292622;
  --bg-elevated: rgba(36, 33, 29, 0.92);
  --bg-subtle: #312d28;
  --border-color: rgba(255, 244, 228, 0.09);
  --border-strong: rgba(255, 244, 228, 0.17);
  --text-primary: #efeae1;
  --text-secondary: #b3aa9d;
  --text-muted: #7d7569;
  --accent: #e08567;
  --accent-hover: #ea967a;
  --accent-soft: rgba(224, 133, 103, 0.17);
  --accent-text: #ffffff;
  --user-bubble-bg: #332f29;
  --user-bubble-text: #f3eee5;
  --think-bg: #26231f;
  --think-border: #c26d51;
  --think-text: #aaa092;
  --composer-bg: #292622;
  --composer-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
}

/* Skin 3: GPT (极简圆点) */
[data-skin="gpt"] {
  --bg-outer: #ececec;
  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.92);
  --bg-subtle: #f4f4f4;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text-primary: #0d0d0d;
  --text-secondary: #5d5d5d;
  --text-muted: #8e8e8e;
  --accent: #111111;
  --accent-hover: #2c2c2c;
  --accent-soft: #efefef;
  --accent-text: #ffffff;
  --user-bubble-bg: #f4f4f4;
  --user-bubble-text: #0d0d0d;
  --user-bubble-radius: 22px;
  --think-bg: #f7f7f7;
  --think-border: #d0d0d0;
  --think-text: #5e5e5e;
  --composer-bg: #f4f4f4;
  --composer-radius: 26px;
  --composer-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --font-chat: var(--font-sans);
}

[data-skin="gpt"][data-theme="dark"] {
  --bg-outer: #0d0d0d;
  --bg-app: #171717;
  --bg-surface: #212121;
  --bg-elevated: rgba(26, 26, 26, 0.92);
  --bg-subtle: #2a2a2a;
  --border-color: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #7a7a7a;
  --accent: #f0f0f0;
  --accent-hover: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --accent-text: #111111;
  --user-bubble-bg: #2f2f2f;
  --user-bubble-text: #f2f2f2;
  --think-bg: #202020;
  --think-border: #4a4a4a;
  --think-text: #a3a3a3;
  --composer-bg: #2a2a2a;
  --composer-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* Skin 4: Gemini (晨雾星芒) */
[data-skin="gemini"] {
  --bg-outer: #e1e8f2;
  --bg-app: #f0f4f9;
  --bg-surface: #ffffff;
  --bg-elevated: rgba(240, 244, 249, 0.9);
  --bg-subtle: #e3eaf4;
  --border-color: rgba(31, 61, 112, 0.09);
  --border-strong: rgba(31, 61, 112, 0.17);
  --text-primary: #1b1f24;
  --text-secondary: #4e5969;
  --text-muted: #7f8b9c;
  --accent: #3b78e7;
  --accent-hover: #2a66d4;
  --accent-soft: #dfe9fb;
  --accent-text: #ffffff;
  --user-bubble-bg: #e1eaf8;
  --user-bubble-text: #16253f;
  --user-bubble-radius: 22px 6px 22px 22px;
  --think-bg: #e8eef8;
  --think-border: #8ab4f8;
  --think-text: #495870;
  --composer-bg: #ffffff;
  --composer-radius: 28px;
  --composer-shadow: 0 8px 28px rgba(52, 98, 182, 0.11);
  --font-chat: var(--font-sans);
}

[data-skin="gemini"][data-theme="dark"] {
  --bg-outer: #0b0d12;
  --bg-app: #13161c;
  --bg-surface: #1e222b;
  --bg-elevated: rgba(20, 24, 31, 0.92);
  --bg-subtle: #252b36;
  --border-color: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text-primary: #e8eef7;
  --text-secondary: #a4b0c2;
  --text-muted: #6f7c90;
  --accent: #7cacf8;
  --accent-hover: #93bbfa;
  --accent-soft: rgba(124, 172, 248, 0.16);
  --accent-text: #0f1726;
  --user-bubble-bg: #253247;
  --user-bubble-text: #eaf2fd;
  --think-bg: #1a1f29;
  --think-border: #537cc2;
  --think-text: #99a7bd;
  --composer-bg: #1e232d;
  --composer-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   BASE RESET & PHONE SHELL LAYOUT
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-outer);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

.app-viewport {
  width: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.phone-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.25s ease, max-width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Desktop "桌面小手机" framing */
@media (min-width: 720px) {
  .app-viewport {
    padding: 16px;
  }
  .phone-shell {
    max-width: 440px;
    border-radius: 34px;
    border: 1px solid var(--border-strong);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  }
  .phone-shell.wide-mode {
    max-width: 880px;
    border-radius: 24px;
  }
}

/* ==========================================================================
   TOP NAVIGATION BAR
   ========================================================================== */
.topbar {
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: 8px;
  padding-left: 12px;
  padding-right: 12px;
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 20;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.16s, color 0.16s, transform 0.12s;
  font-size: 17px;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.93);
}

.desktop-only {
  display: none;
}
@media (min-width: 720px) {
  .desktop-only {
    display: inline-flex;
  }
}

.companion-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  transition: background 0.18s, border-color 0.18s;
}

.companion-pill:hover {
  background: var(--bg-subtle);
  border-color: var(--border-color);
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.companion-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.companion-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 135px;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa4b8;
  flex-shrink: 0;
}

.online-dot.ready {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(41, 163, 106, 0.16);
}

.companion-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}

.pro-pill-btn {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(229, 149, 0, 0.32);
  background: linear-gradient(135deg, rgba(255, 213, 128, 0.2), rgba(255, 160, 122, 0.18));
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s, opacity 0.16s;
}

.pro-pill-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   QUICK SKIN SWITCHER BAR (COLLAPSIBLE POPOVER STRIP)
   ========================================================================== */
.skin-strip {
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  animation: slideDown 0.18s ease-out;
}

.skin-strip[hidden] {
  display: none !important;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.skin-options {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.skin-options::-webkit-scrollbar { display: none; }

.skin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.skin-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 600;
}

.skin-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.night-toggle-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   CHAT MESSAGE STREAM AREA
   ========================================================================== */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 18px;
  scroll-behavior: smooth;
  font-family: var(--font-chat);
  -webkit-overflow-scrolling: touch;
}

.chat-scroll::-webkit-scrollbar {
  width: 4px;
}
.chat-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* Welcome Empty State */
.welcome-card {
  margin: 8px auto 16px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-sans);
}

.welcome-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 18px 16px;
  text-align: center;
}

.welcome-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.welcome-hero h1 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.welcome-hero p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.16s, background 0.16s;
}

.quick-action-card:hover {
  border-color: var(--accent);
}

.quick-action-card:active {
  transform: scale(0.985);
}

.qa-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.qa-body {
  flex: 1;
  min-width: 0;
}

.qa-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.qa-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.qa-arrow {
  color: var(--text-muted);
  font-size: 15px;
}

/* Message Rows */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeInMsg 0.18s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.assistant {
  align-items: flex-start;
}

.msg-user-bubble {
  max-width: 85%;
  padding: 10px 15px;
  background: var(--user-bubble-bg);
  color: var(--user-bubble-text);
  border-radius: var(--user-bubble-radius);
  font-size: 15px;
  line-height: 1.58;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-asst-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
}

.msg-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.msg-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-sender-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.memory-recall-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

/* Collapsible Reasoning / DeepSeek R1 Think Card */
.think-card {
  width: 100%;
  background: var(--think-bg);
  border-left: 3px solid var(--think-border);
  border-radius: 6px 12px 12px 6px;
  overflow: hidden;
  margin: 2px 0 4px;
  font-family: var(--font-sans);
}

.think-summary {
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--think-text);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.think-summary::-webkit-details-marker { display: none; }

.think-chevron {
  font-size: 11px;
  transition: transform 0.18s;
}
details[open] .think-chevron {
  transform: rotate(180deg);
}

.think-body {
  padding: 0 12px 10px;
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--think-text);
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

/* Assistant Prose */
.msg-asst-body {
  width: 100%;
  padding: 2px 4px;
  font-size: 15.2px;
  line-height: 1.68;
  color: var(--text-primary);
  word-break: break-word;
}

.msg-asst-body p {
  margin: 0 0 10px;
}
.msg-asst-body p:last-child {
  margin-bottom: 0;
}

.msg-asst-body em.rp-action {
  color: var(--text-secondary);
  font-style: italic;
}

.msg-asst-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--bg-subtle);
}

.msg-asst-body pre {
  margin: 8px 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--bg-subtle);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}

.msg-asst-body pre code {
  padding: 0;
  background: transparent;
}

.msg-asst-body blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-radius: 0 8px 8px 0;
}

/* Streaming Cursors per Skin */
.stream-cursor {
  display: inline-block;
  margin-left: 3px;
  vertical-align: baseline;
}

[data-skin="gpt"] .stream-cursor::after {
  content: "●";
  font-size: 13px;
  color: var(--accent);
  animation: pulseDot 0.9s infinite ease-in-out;
}

[data-skin="claude"] .stream-cursor::after {
  content: "✻";
  font-size: 14px;
  color: var(--accent);
  animation: pulseDot 1s infinite ease-in-out;
}

[data-skin="gemini"] .stream-cursor::after {
  content: "✦";
  font-size: 14px;
  color: var(--accent);
  animation: pulseDot 1s infinite ease-in-out;
}

[data-skin="deepseek"] .stream-cursor::after {
  content: "▍";
  font-size: 14px;
  color: var(--accent);
  animation: pulseDot 0.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.86); }
}

/* Message Action Toolbar */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.72;
  font-family: var(--font-sans);
}

.msg-act-btn {
  padding: 3px 7px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.msg-act-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Memory Recall Expanded Drawer inside Message */
.recalled-box {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recalled-item {
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-subtle);
  line-height: 1.45;
}

/* ==========================================================================
   BOTTOM COMPOSER AREA
   ========================================================================== */
.composer-wrap {
  padding: 8px 12px calc(var(--safe-bottom) + 10px);
  background: linear-gradient(180deg, transparent 0%, var(--bg-app) 28%);
  flex-shrink: 0;
  z-index: 15;
}

.composer-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--composer-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--composer-radius);
  box-shadow: var(--composer-shadow);
  padding: 8px 10px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

[data-skin="gemini"] .composer-card:focus-within {
  border-color: #7cacf8;
  box-shadow: 0 8px 30px rgba(66, 133, 244, 0.18);
}

.composer-card:focus-within {
  border-color: var(--accent);
}

.composer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 15px;
  line-height: 1.5;
  max-height: 132px;
  min-height: 24px;
  padding: 2px 0;
  color: var(--text-primary);
}

.composer-input::placeholder {
  color: var(--text-muted);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.composer-tools-left::-webkit-scrollbar { display: none; }

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tool-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s, opacity 0.15s, background 0.15s;
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.send-btn.stop-mode {
  background: var(--danger);
  color: #ffffff;
}

.send-btn:not(:disabled):active {
  transform: scale(0.91);
}

/* ==========================================================================
   SIDEBAR DRAWER & BOTTOM SHEETS / MODALS
   ========================================================================== */
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 22, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.side-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84%;
  max-width: 320px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--safe-top) + 12px);
  padding-bottom: calc(var(--safe-bottom) + 12px);
  transform: translateX(-103%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 0 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.new-chat-btn {
  padding: 7px 12px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.drawer-search-wrap {
  padding: 0 14px 10px;
}

.drawer-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 13px;
  outline: none;
}
.drawer-search:focus {
  border-color: var(--accent);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-item {
  padding: 10px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background 0.14s;
}

.conv-item:hover {
  background: var(--bg-subtle);
}

.conv-item.active {
  background: var(--accent-soft);
}

.conv-item-main {
  flex: 1;
  min-width: 0;
}

.conv-item-title {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-del-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.conv-del-btn:hover {
  color: var(--danger);
  background: rgba(229, 72, 77, 0.1);
}

.drawer-footer {
  padding: 10px 14px 0;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.drawer-action-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.drawer-action-btn.primary-soft {
  background: var(--accent-soft);
  border-color: rgba(77, 107, 254, 0.25);
  font-weight: 600;
}

/* iOS Bottom Sheet */
.sheet-modal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90%;
  background: var(--bg-surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border-strong);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateY(104%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
}

.sheet-modal.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 9px auto 4px;
  flex-shrink: 0;
}

.sheet-header {
  padding: 6px 18px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sheet-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
}

.sheet-body {
  padding: 16px 18px calc(var(--safe-bottom) + 22px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Form Elements inside Sheets */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-input, .textarea-input, .select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-app);
  font-size: 14px;
  outline: none;
}

.text-input:focus, .textarea-input:focus, .select-input:focus {
  border-color: var(--accent);
}

.textarea-input {
  resize: vertical;
  min-height: 86px;
  line-height: 1.5;
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-pill {
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.14s;
}

.preset-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.primary-btn {
  flex: 1;
  padding: 11px 16px;
  border-radius: 13px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn {
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.info-banner {
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.status-box {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.5;
}
.status-box.ok {
  background: rgba(41, 163, 106, 0.12);
  color: var(--success);
  border: 1px solid rgba(41, 163, 106, 0.3);
}
.status-box.err {
  background: rgba(229, 72, 77, 0.12);
  color: var(--danger);
  border: 1px solid rgba(229, 72, 77, 0.3);
}

/* Companion Avatar Picker Row */
.avatar-editor-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
}

.avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dropzone for Universal Importer */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 18px;
  padding: 24px 16px;
  text-align: center;
  background: var(--bg-app);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.dropzone.dragover, .dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  font-size: 30px;
  margin-bottom: 6px;
}

.dropzone-title {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Pinned Memory Cards */
.mem-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mem-card {
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.48;
}

/* Tutorial Step Cards */
.tutorial-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 12px;
}

.tut-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.tut-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.step-card {
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
}

.step-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.58;
  color: var(--text-secondary);
}

/* Pro Native App Funnel Showcase */
.pro-hero-banner {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1b2238 0%, #2f3c6e 55%, #4d6bfe 100%);
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.pro-island-mock {
  margin: 0 auto 12px;
  width: 176px;
  height: 32px;
  border-radius: 999px;
  background: #090b10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11.5px;
  color: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.island-wave {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.island-wave span {
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: #6ee7b7;
  animation: waveBar 1s infinite ease-in-out;
}
.island-wave span:nth-child(2) { height: 15px; animation-delay: 0.15s; }
.island-wave span:nth-child(3) { height: 8px; animation-delay: 0.3s; }

@keyframes waveBar {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1.15); }
}

.pro-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 360px) {
  .pro-feature-grid { grid-template-columns: 1fr; }
}

.pro-feat-card {
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.pro-feat-icon {
  font-size: 20px;
  margin-bottom: 5px;
}

.pro-feat-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pro-feat-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.apple-id-guide {
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-app);
  overflow: hidden;
}

.apple-id-guide summary {
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.apple-id-guide summary::-webkit-details-marker { display: none; }

.apple-id-body {
  padding: 0 14px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

/* Toast Notification */
.toast {
  position: absolute;
  top: calc(var(--safe-top) + 58px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(20, 24, 34, 0.92);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
