/* ──────────────────────────────────────────────
   MindBuddhi × IMDS — Clean White Light Mode
   Primary Color: #d5c2ed (Lavender)
   ────────────────────────────────────────────── */

:root {
  --bg-white: #ffffff;
  --bg-light: #f8f7fc;
  --bg-page: #f3f1f9;
  --surface: #ffffff;
  --surface-hover: #f5f3fa;
  --border: #e8e4f0;
  --border-light: #f0ecf5;
  --primary: #d5c2ed;
  --primary-light: #e5d9f5;
  --primary-deep: #b49bd8;
  --primary-darker: #9a7bc4;
  --primary-glow: rgba(213, 194, 237, 0.3);
  --primary-dim: rgba(213, 194, 237, 0.12);
  --lavender: #d5c2ed;
  --lavender-dim: rgba(213, 194, 237, 0.15);
  --user-bg: linear-gradient(135deg, #d5c2ed, #b49bd8);
  --bot-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #5a5478;
  --text-muted: #9e96b8;
  --sidebar-w: 290px;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  height: 100%;
  font-family: 'Noto Sans KR', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── Background orbs ── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}

.orb1 {
  width: 500px;
  height: 500px;
  top: -200px;
  left: -150px;
  background: radial-gradient(circle, rgba(213, 194, 237, 0.2), transparent 70%);
}

.orb2 {
  width: 400px;
  height: 400px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, rgba(213, 194, 237, 0.15), transparent 70%);
  animation-delay: -4s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(20px, 30px) scale(1.05); }
}

/* ── Lotus Background ── */
.lotus-bg {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 10 C60 40 90 50 50 90 C10 50 40 40 50 10' fill='none' stroke='%23d5c2ed' stroke-opacity='0.06'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ── App layout ── */
.app-wrapper {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 20px;
  flex-shrink: 0;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.03);
}

.sidebar-logo-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.imds-logo-wrapper {
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(213, 194, 237, 0.15);
  animation: pulse-glow 4s ease-in-out infinite;
}

.imds-logo {
  width: 100%;
  max-width: 230px;
  object-fit: contain;
  display: block;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 2px 12px rgba(213, 194, 237, 0.15); }
  50% { box-shadow: 0 4px 24px rgba(213, 194, 237, 0.35); }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.logo-img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }

.logo-text h1 {
  font-family: 'Noto Serif KR', serif;
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(to right, var(--primary-darker), var(--primary-deep));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.track-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-light);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.track-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: inherit;
}

.track-btn:hover { background: rgba(213, 194, 237, 0.1); color: var(--primary-darker); }

.track-btn.active {
  background: white;
  color: var(--primary-darker);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(213, 194, 237, 0.25);
  border: 1px solid rgba(213, 194, 237, 0.2);
}

.sidebar-info { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }

.sidebar-footer-logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 10px;
  margin-top: 10px;
}

.powered-by, .collaboration {
  display: flex;
  align-items: center;
  gap: 8px;
}

.powered-by span:first-child, .collaboration span:first-child {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.deepfountain-text {
  font-family: 'Noto Serif KR', serif;
  font-size: 14px;
  font-weight: 700;
  color: #4a4a4a;
  font-style: italic;
}

.imds-logo-small {
  height: 14px;
  object-fit: contain;
}

.voice-ready-card {
  margin-bottom: 6px;
}

.voice-ready-btn {
  width: 100%;
  padding: 8px 10px;
  background-color: #eafbea;
  border: 1px solid #c9ebd0;
  color: #2b7a3d;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-ready-btn:hover {
  background-color: #dcf2de;
}

.sutras-badge {
  background-color: #fdfcff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 5px 10px;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ── Chat main ── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-page); }

.chat-header {
  padding: 16px 32px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h2 { font-family: 'Noto Serif KR', serif; font-size: 17px; font-weight: 600; line-height: 1.2; }

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-sm {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: white;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 6px rgba(213, 194, 237, 0.2);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #4cd964;
  border-radius: 50%;
  margin-right: 0;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(76, 217, 100, 0.5);
}

.status-text {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 10px;
  vertical-align: middle;
}

.haetsal-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(213, 194, 237, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-darker);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-darker);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-toggle:hover {
  background: white;
  box-shadow: 0 2px 6px rgba(213, 194, 237, 0.3);
}

.share-conversation-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(154, 123, 196, 0.28);
  border-radius: 10px;
  background: #fff;
  color: var(--primary-darker);
  font-size: 13px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-conversation-btn:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.view-mode-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-light);
  color: var(--primary-darker);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.view-mode-btn:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .view-mode-btn { display: inline-flex; }
}

body.force-desktop-mode .view-mode-btn {
    display: inline-flex;
}

/* ── Force Desktop Mode ── */
.force-desktop-mode #appWrapper {
  width: 1200px !important;
  min-width: 1200px !important;
  height: 100vh !important;
  margin: 0 auto !important;
  position: relative !important;
}

.force-desktop-mode .sidebar {
  width: 290px !important;
  display: flex !important;
}

.force-desktop-mode .chat-main {
  flex: 1 !important;
}

/* ── Messages area ── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message { display: flex; gap: 14px; max-width: 820px; animation: fadeSlideIn 0.35s ease; }

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

.message .avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 2px 8px rgba(213, 194, 237, 0.2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  object-fit: cover;
}

.bubble {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  padding: 16px 22px;
  line-height: 1.8;
  font-size: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  position: relative;
}

.bubble:has(.voice-output-wrap) {
  padding-bottom: 62px;
}

/* Markdown Styles */
.bubble.markdown-body h1, .bubble.markdown-body h2, .bubble.markdown-body h3 {
  margin: 1.1em 0 0.55em;
  font-family: 'Noto Serif KR', serif;
  color: var(--primary-darker);
  line-height: 1.45;
}
.bubble.markdown-body h1:first-child,
.bubble.markdown-body h2:first-child,
.bubble.markdown-body h3:first-child {
  margin-top: 0;
}
.bubble.markdown-body h2 {
  font-size: 18px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(213, 194, 237, 0.36);
}
.bubble.markdown-body h3 {
  font-size: 16px;
}
.bubble.markdown-body p {
  position: relative;
  margin: 0 0 10px;
}
.bubble.markdown-body p.has-markdown-citation {
  margin: 14px 0 16px;
  padding: 12px 16px 14px 18px;
  border-left: 4px solid rgba(111, 77, 160, 0.52);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(135deg, rgba(250,247,255,0.96), rgba(255,255,255,0.98));
  color: var(--text-secondary);
}
.markdown-citation-reference {
  display: block;
  margin: 0 0 8px;
  color: #7b62a5;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.bubble.markdown-body strong {
  color: var(--primary-darker);
  background: linear-gradient(transparent 70%, var(--primary-glow) 70%);
}
.bubble.markdown-body a {
  color: var(--primary-darker);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.bubble.markdown-body a:hover {
  color: var(--primary-deep);
}
.bubble.markdown-body blockquote {
  margin: 12px 0 14px;
  padding: 14px 16px 14px 18px;
  border-left: 4px solid rgba(111, 77, 160, 0.52);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(135deg, rgba(245,240,251,0.92), rgba(255,255,255,0.96));
  color: var(--text-secondary);
}
.bubble.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}
.bubble.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(76, 63, 91, 0.08);
  color: var(--primary-darker);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}
.bubble.markdown-body pre {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #282234;
  color: #f7f2ff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.bubble.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}
.bubble.markdown-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 12px 0 14px;
  border-collapse: collapse;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.bubble.markdown-body th,
.bubble.markdown-body td {
  padding: 8px 10px;
  border: 1px solid rgba(213, 194, 237, 0.44);
  text-align: left;
  vertical-align: top;
}
.bubble.markdown-body th {
  background: rgba(213, 194, 237, 0.18);
  color: var(--primary-darker);
  font-weight: 600;
}
.bubble.markdown-body ol {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid rgba(213, 194, 237, 0.42);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(250, 247, 255, 0.98), rgba(255, 255, 255, 0.96));
  box-shadow: 0 8px 22px rgba(111, 88, 145, 0.08);
  counter-reset: markdown-step;
  list-style: none;
}
.bubble.markdown-body ol > li {
  position: relative;
  min-height: 30px;
  padding: 3px 0 3px 40px;
  color: var(--text-primary);
}
.bubble.markdown-body ol > li::before {
  counter-increment: markdown-step;
  content: counter(markdown-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary-darker);
  border: 1px solid rgba(213, 194, 237, 0.58);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.bubble.markdown-body ol > li + li {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(213, 194, 237, 0.24);
}
.bubble.markdown-body ul {
  margin: 10px 0 14px;
  padding-inline-start: 1.55em;
}

.user-message { flex-direction: row-reverse; align-self: flex-end; }
.user-message .bubble {
  background: var(--user-bg);
  border-color: rgba(213, 194, 237, 0.5);
  border-radius: 18px 4px 18px 18px;
  color: #ffffff;
}

.user-message .bubble p {
  color: #ffffff;
}

/* ── Feedback & Suggestions ── */
.quick-prompts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
  width: 100%;
}

.info-card {
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(213, 194, 237, 0.08);
  margin-bottom: 0;
}

.info-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-darker);
  margin-bottom: 4px;
}

.info-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.qr-mobile-card {
  background: linear-gradient(135deg, #fdfbff 0%, #f3ebff 100%);
  border: 1px solid #e9deff;
  padding: 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.qr-mobile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(213, 194, 237, 0.25);
  border-color: var(--primary);
}

.qr-mobile-icon {
  width: 44px;
  height: 44px;
  background: white;
  padding: 4px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.qr-mobile-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-mobile-text .qr-title {
  font-size: 14px;
  font-weight: 600;
  color: #4a4a4a;
  margin-bottom: 2px;
}

.qr-mobile-text .qr-subtitle {
  font-size: 11px;
  color: #9b59b6;
  font-weight: 500;
}

.quick-btn {
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(213, 194, 237, 0.4);
  background: white;
  color: var(--primary-darker);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  word-break: keep-all;
  white-space: normal;
  line-height: 1.3;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
}


.quick-btn:hover { background: var(--lavender-dim); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(213, 194, 237, 0.2); }

.feedback-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.feedback-text { font-size: 11px; color: var(--text-muted); }
.feedback-btns { display: flex; gap: 6px; }
.feedback-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.feedback-btn:hover { border-color: var(--primary); transform: scale(1.1); }
.feedback-btn.active { background: var(--primary-dim); border-color: var(--primary); }

.answer-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.answer-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(213, 194, 237, 0.7);
  border-radius: 999px;
  background: rgba(255,255,255,0.94);
  color: var(--primary-darker);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(111, 88, 145, 0.06);
  transition: all 0.2s ease;
}

.answer-share-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.answer-share-btn:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.answer-share-btn.kakao {
  background: #fee500;
  border-color: #f4d600;
  color: #191919;
}

.answer-share-btn.report {
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(247,241,255,0.98));
  border-color: rgba(185, 145, 223, 0.58);
  color: #6f4da0;
}

.voice-output-wrap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  z-index: 3;
}

.voice-output-hint {
  position: relative;
  max-width: 170px;
  padding: 7px 10px;
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: 8px;
  background: rgba(240,253,244,0.96);
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  white-space: nowrap;
}

.voice-output-hint::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 1px solid rgba(34,197,94,0.22);
  border-right: 1px solid rgba(34,197,94,0.22);
  background: rgba(240,253,244,0.96);
  transform: translateY(-50%) rotate(45deg);
}

.voice-output-btn {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: #15803d;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.2s ease;
  padding: 2px;
}
.voice-icon {
  position: relative;
  z-index: 2;
}
.voice-ring {
  position: absolute;
  inset: -1px;
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
  z-index: 1;
  pointer-events: none;
}
.voice-ring-track,
.voice-ring-progress {
  fill: none;
  stroke-width: 2.4;
}
.voice-ring-track {
  stroke: rgba(34,197,94,0.16);
  opacity: 0;
}
.voice-ring-progress {
  stroke: #22c55e;
  stroke-linecap: round;
  stroke-dasharray: 97.39;
  stroke-dashoffset: var(--voice-ring-offset, 97.39);
  transition: stroke-dashoffset 0.16s linear;
  opacity: 0;
}
.voice-output-btn:hover,
.voice-output-btn.playing {
  border-color: #22c55e;
  background: rgba(236,253,245,0.96);
  transform: translateY(-1px);
}

.voice-time-label {
  display: none;
  min-width: 62px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(34,197,94,0.18);
  color: #166534;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  white-space: nowrap;
}

.voice-time-label.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Sources ── */
.voice-output-btn.loading {
  width: 34px;
  border-radius: 50%;
  border-color: transparent;
  background: white;
  cursor: wait;
}
.voice-output-btn.loading .voice-ring-track,
.voice-output-btn.loading .voice-ring-progress {
  opacity: 1;
}
.voice-output-btn.error {
  border-color: #ef4444;
  color: #dc2626;
  background: rgba(254,242,242,0.96);
}

.voice-output-btn:disabled,
.voice-output-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--text-muted);
  background: #f6f4fa;
}

.voice-save-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: 50%;
  background: rgba(255,255,255,0.96);
  color: #166534;
  font-size: 15px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
  padding: 0;
}

.voice-save-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-save-btn:hover:not(:disabled) {
  background: rgba(240,253,244,0.98);
  border-color: #22c55e;
  transform: translateY(-1px);
}

.voice-save-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.voice-save-btn.ready {
  border-color: rgba(34,197,94,0.34);
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(360px, calc(100vw - 32px));
  background: rgba(31, 26, 43, 0.92);
  color: white;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 12px 30px rgba(31, 26, 43, 0.24);
  z-index: 9999;
  pointer-events: none;
}

.sources-container { margin-top: 16px; padding: 12px; background: var(--bg-light); border-radius: 12px; }
.sources-title { font-size: 12px; font-weight: 700; color: var(--primary-darker); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.source-tag {
  display: inline-block;
  font-size: 11.5px;
  color: var(--primary-darker);
  background: white;
  padding: 4px 10px;
  border-radius: 6px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--border);
  word-break: keep-all;
}

/* ── Image Gallery ── */
.images-gallery { display: flex; gap: 12px; overflow-x: auto; margin-top: 14px; padding-bottom: 8px; }
.images-gallery::-webkit-scrollbar { height: 6px; }
.images-gallery::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
.img-card {
  width: 180px; flex-shrink: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
  background: white; cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.img-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 8px 16px rgba(164,72,212,0.15); }
.img-card img { width: 100%; height: 260px; object-fit: cover; object-position: top; background: #fdfdfd; padding: 4px; }
.img-card .img-label {
  padding: 10px; font-size: 11px; text-align: center; color: var(--text-secondary);
  background: var(--bg-light); border-top: 1px solid var(--border-light); 
  line-height: 1.4; word-break: keep-all; min-height: 48px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Highlighting ── */
mark { background: linear-gradient(120deg, #fff2ac 0%, #fff2ac 100%); background-repeat: no-repeat; background-size: 100% 80%; background-position: 0 80%; padding: 0 2px; }

/* ── Input ── */
.input-area { padding: 12px 24px 10px; background: var(--bg-white); border-top: 1px solid var(--border); }
.input-container {
  max-width: 900px; margin: 0 auto; display: flex; gap: 12px; background: var(--bg-light);
  padding: 8px 16px; border-radius: 24px; border: 1px solid var(--border); transition: var(--transition);
}
.input-container:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); background: white; }
textarea { flex: 1; background: none; border: none; outline: none; padding: 8px 0; font-size: 16px; font-family: inherit; resize: none; overflow-y: auto; }
.input-hint {
  max-width: 900px; margin: 5px auto 0; font-size: 11px;
  color: var(--text-muted); text-align: center; letter-spacing: 0.2px; opacity: 0.75;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.modal-content {
  width: 90vw; max-width: 900px; height: 85vh; background: white; border-radius: 24px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.1);
}
.modal-header-tabs { display: flex; background: var(--bg-light); border-bottom: 1px solid var(--border); }
.modal-tab-btn { flex: 1; padding: 20px; border: none; background: none; font-size: 16px; font-weight: 700; cursor: pointer; color: var(--text-muted); }
.modal-tab-btn.active { color: var(--primary-darker); border-bottom: 3px solid var(--primary); }
.modal-body-content { flex: 1; display: flex; overflow: hidden; }
.modal-split-view { display: flex; width: 100%; height: 100%; }
.modal-left, .modal-right { flex: 1; padding: 40px; overflow-y: auto; }
.modal-left { border-right: 1px solid var(--border-light); background: #fafafa; display: block; text-align: center; }
.modal-left img { width: 100%; height: auto; min-height: 200px; object-fit: contain; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); margin: 0 auto; display: block; }
.modal-right { background: white; font-size: 18px; line-height: 2; word-break: keep-all; }
.modal-close { position: absolute; top: 20px; right: 20px; background: rgba(0,0,0,0.05); border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; }

/* ── Setup/Intro Modal ── */
.setup-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
  z-index: 3000; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.4s ease;
}

.setup-modal-content {
  background: white; width: 90%; max-width: 500px;
  border-radius: 24px; padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  display: flex; flex-direction: column; gap: 24px;
}

.setup-modal-header { text-align: center; }
.setup-logo { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 12px; object-fit: cover; }
.setup-modal-header h2 { font-family: 'Noto Serif KR', serif; font-size: 22px; color: var(--primary-darker); font-weight: 600; }

.meaning-box {
  background: var(--bg-light); border-radius: 12px; padding: 16px;
  font-size: 14.5px; line-height: 1.6; color: var(--text-secondary); text-align: center;
}
.meaning-box strong { color: var(--primary-deep); font-weight: 600; }

.setup-login-box {
  margin: 18px 0 24px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(154, 123, 196, 0.22);
  background: linear-gradient(180deg, rgba(247, 241, 255, 0.92), rgba(255, 255, 255, 0.98));
  box-shadow: 0 12px 28px rgba(154, 123, 196, 0.12);
}

.setup-login-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-login-label {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(25, 25, 25, 0.08);
  color: var(--primary-darker);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.setup-login-copy h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
}

.setup-login-copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.setup-benefit-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  list-style: none;
  margin: 14px 0 16px;
  padding: 0;
}

.setup-benefit-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.setup-benefit-list i {
  margin-top: 3px;
  color: #128c7e;
  font-size: 12px;
}

.setup-kakao-btn {
  height: 48px;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(254, 229, 0, 0.24);
}

.secondary-start {
  background: #fff;
  color: var(--primary-darker);
  border: 1px solid rgba(154, 123, 196, 0.32);
  box-shadow: none;
}

.secondary-start:hover {
  background: var(--bg-light);
  box-shadow: 0 8px 18px rgba(154, 123, 196, 0.12);
}

.setup-login-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.lang-selection-box { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border-light); }
.lang-selection-box h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.lang-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.lang-options { display: flex; gap: 12px; }
.lang-opt-btn {
  flex: 1; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg-light); color: var(--text-secondary); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s ease;
}
.lang-opt-btn:hover { border-color: var(--primary); background: rgba(213,194,237,0.05); }
.lang-opt-btn.active {
  border-color: var(--primary-darker); background: rgba(213,194,237,0.15);
  color: var(--primary-darker); box-shadow: 0 4px 12px rgba(213,194,237,0.25);
}

.voice-selection-box h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.voice-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.voice-options { display: flex; flex-direction: column; gap: 10px; }
.voice-option {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
  border-radius: 12px; border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
}
.voice-option input[type="radio"] { display: none; }

.voice-option.active { border-color: #22c55e; background: rgba(34,197,94,0.08); box-shadow: 0 4px 12px rgba(34,197,94,0.18); }
.voice-option.disabled { opacity: 0.5; cursor: not-allowed; background: #fafafa; }

.voice-option-content { display: flex; flex-direction: column; gap: 4px; }
.voice-name { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.voice-tag { font-size: 12px; color: #a448d4; font-weight: 500; background: rgba(164,72,212,0.1); padding: 2px 8px; border-radius: 20px; align-self: flex-start; }
.voice-option.active .voice-tag { color: #15803d; background: rgba(34,197,94,0.14); }
.voice-option.disabled .voice-tag { color: var(--text-muted); background: var(--border); }
.voice-preview-btn {
  flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--text-primary); font-size: 12px; font-weight: 700;
  padding: 7px 10px; cursor: pointer; transition: all 0.2s;
}
.voice-preview-btn:hover { border-color: var(--primary); color: var(--primary-darker); }
.voice-preview-btn.loading { opacity: 0.7; cursor: wait; }
.voice-preview-btn.playing { border-color: #22c55e; color: #15803d; background: rgba(34,197,94,0.08); }
.voice-preview-btn.error { border-color: #ef4444; color: #b91c1c; }

.setup-modal-footer { display: flex; justify-content: center; margin-top: 10px; }
.start-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-darker)); color: white;
  border: none; border-radius: 30px; padding: 16px 48px; font-size: 17px; font-weight: 600;
  cursor: pointer; transition: all 0.3s ease; box-shadow: 0 8px 24px var(--primary-glow);
}
.start-btn:hover {
  transform: translateY(-2px); box-shadow: 0 12px 30px rgba(154,123,196,0.5);
}

/* ── Multi-step Modal ── */
.setup-step { animation: fadeIn 0.3s ease; }
.step-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.setup-modal-footer {
  display: flex; justify-content: center; align-items: center;
  flex-direction: column; gap: 10px; margin-top: 10px;
}

.skip-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; text-decoration: underline; padding: 4px;
  transition: color 0.2s;
}
.skip-btn:hover { color: var(--primary); }

.setup-step-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; gap: 12px;
}

.nav-back-btn {
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 20px; font-size: 14px;
  color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.nav-back-btn:hover { background: white; }

.step-next-btn { padding: 12px 28px; font-size: 15px; }
.step-next-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── MBTI Grid ── */
.mbti-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  overflow-y: auto; max-height: 320px; padding-right: 4px;
}

.mbti-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; padding: 12px 6px;
  border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg-light); cursor: pointer;
  transition: all 0.2s ease; text-align: center;
}
.mbti-card:hover { border-color: var(--primary); background: rgba(213,194,237,0.1); transform: translateY(-2px); }
.mbti-card.selected {
  border-color: var(--primary-darker); background: rgba(213,194,237,0.2);
  box-shadow: 0 4px 12px rgba(213,194,237,0.3);
}

.mbti-type {
  font-family: 'Noto Sans KR', sans-serif; font-weight: 700; font-size: 14px;
  color: var(--primary-darker); letter-spacing: 0.5px;
}
.mbti-name { font-size: 11px; color: var(--text-muted); }

/* ── Zodiac Grid ── */
.zodiac-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}

.zodiac-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--bg-light);
  cursor: pointer; font-size: 24px; transition: all 0.2s ease;
  line-height: 1;
}
.zodiac-card span { font-size: 11px; color: var(--text-muted); font-family: 'Noto Sans KR', sans-serif; }
.zodiac-card:hover { border-color: var(--primary); background: rgba(213,194,237,0.12); transform: translateY(-2px); }
.zodiac-card.selected {
  border-color: var(--primary-darker); background: rgba(213,194,237,0.22);
  box-shadow: 0 4px 14px rgba(213,194,237,0.35);
}

/* ── Profile Badge ── */
.profile-badge {
  margin-top: 8px; padding: 6px 12px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(213,194,237,0.25), rgba(164,72,212,0.1));
  border: 1px solid rgba(213,194,237,0.5); font-size: 12px;
  color: var(--primary-darker); font-weight: 600; text-align: center;
  animation: fadeIn 0.3s ease; cursor: pointer;
}
.profile-badge:hover { background: rgba(213,194,237,0.35); }

/* ── Personality Track Button ── */
.track-btn-personality { border-color: rgba(164,72,212,0.25) !important; }
.track-btn-personality.active, .track-btn-personality:hover {
  background: linear-gradient(135deg, rgba(213,194,237,0.3), rgba(164,72,212,0.15)) !important;
  border-color: var(--primary) !important;
}

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

/* ── Setup content scroll for smaller screens ── */
.setup-modal-content { max-height: 92vh; overflow-y: auto; }

/* ── CSS version bump to v=15 ── */
/* ── Typing/Loading Indicator ─────────────────── */
.typing-indicator {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 820px;
  margin: 10px 0;
  animation: fadeIn 0.4s ease;
}

.loading-status-box {
  background: white;
  border: 1px solid rgba(213, 194, 237, 0.3);
  border-radius: 20px;
  padding: 20px 24px;
  min-width: 320px;
  box-shadow: 0 10px 30px rgba(213, 194, 237, 0.15);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loading-status-text {
  font-size: 14px;
  color: var(--primary-darker);
  font-weight: 600;
  letter-spacing: -0.2px;
}

.loading-progress-container {
  width: 100%;
  height: 10px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #A448D4, #D5C2ED);
  border-radius: 10px;
  transition: width 0.2s linear;
  box-shadow: 0 0 10px rgba(164, 72, 212, 0.4);
  position: relative;
}

.loading-progress-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Mobile parity with mindbuddi_clean_export_v4 */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.sidebar-track-section {
  margin-bottom: 18px;
}

.conversation-history-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: -2px 0 14px;
}

.conversation-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-history-header .section-label {
  margin-bottom: 0;
}

.history-refresh-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-light);
  color: var(--primary-darker);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.history-refresh-btn:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
}

.conversation-history-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.conversation-history-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  transition: var(--transition);
}

.conversation-history-item:hover,
.conversation-history-item.active {
  border-color: var(--primary);
  background: #fbf8ff;
  box-shadow: 0 8px 22px rgba(154, 123, 196, 0.08);
}

.conversation-open-btn {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 10px 8px 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conversation-title,
.conversation-preview,
.conversation-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-title {
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 800;
}

.conversation-preview {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
}

.conversation-meta {
  color: var(--text-muted);
  font-size: 10.5px;
}

.conversation-delete-btn {
  border: 0;
  border-left: 1px solid var(--border-light);
  border-radius: 0 11px 11px 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.conversation-delete-btn:hover {
  color: #c05656;
  background: rgba(192, 86, 86, 0.08);
}

.conversation-empty {
  margin: 0;
  padding: 10px 8px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.nav-btn,
.send-btn {
  font-family: inherit;
  transition: var(--transition);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary-darker);
}

.logo-text span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.bubble,
.bubble.markdown-body p,
.bubble.markdown-body li,
.bubble.markdown-body h1,
.bubble.markdown-body h2,
.bubble.markdown-body h3 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.bubble.markdown-body ul {
  margin: 10px 0 14px;
  padding-inline-start: 1.55em;
  max-width: 100%;
}

.bubble.markdown-body ul li + li {
  margin-top: 6px;
}

.bubble.markdown-body li > ol,
.bubble.markdown-body li > ul {
  margin: 6px 0 0;
}

.bubble.markdown-body pre,
.bubble.markdown-body code,
.bubble.markdown-body table,
.bubble.markdown-body blockquote,
.bubble.markdown-body * {
  max-width: 100%;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(213, 194, 237, 0.35);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(213, 194, 237, 0.5);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

  .app-wrapper {
    flex-direction: column;
    height: 100dvh;
  }

  .sidebar {
    width: 100%;
    padding: 14px 14px 12px;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  }

  .sidebar-logo-section {
    gap: 10px;
  }

  .sidebar-logo {
    gap: 10px;
    margin-bottom: 0;
  }

  .logo-img {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .logo-text h1 {
    font-size: 18px;
  }

  .logo-text span {
    font-size: 10px;
  }

  .sidebar-nav {
    margin-bottom: 0;
  }

  .nav-btn {
    justify-content: center;
    padding: 11px 14px;
    font-size: 13px;
  }

  .sidebar-track-section {
    margin-bottom: 0;
  }

  .section-label {
    margin-bottom: 8px;
    padding-left: 2px;
  }

  .track-selector {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 4px;
    border-radius: 16px;
    scrollbar-width: none;
  }

  .track-selector::-webkit-scrollbar {
    display: none;
  }

  .track-btn {
    flex: 1 0 118px;
    justify-content: center;
    padding: 11px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .profile-badge {
    margin-top: 8px;
    font-size: 11px;
    padding: 6px 10px;
  }

  .sidebar-info {
    display: none;
  }

  .chat-main {
    min-height: 0;
  }

  .chat-header {
    padding: 12px 14px;
    gap: 10px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .header-left > div {
    min-width: 0;
  }

  .avatar-sm {
    width: 38px;
    height: 38px;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .status-text {
    display: inline-block;
    font-size: 11px;
  }

  .header-actions {
    margin-left: auto;
    gap: 8px;
    flex-shrink: 0;
  }

  .lang-toggle {
    min-height: 34px;
    padding: 0 10px;
  }

  .view-mode-btn {
    display: inline-flex;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    box-shadow: 0 10px 24px rgba(213, 194, 237, 0.22);
  }

  .messages-area {
    padding: 16px 12px;
    gap: 16px;
  }

  .message,
  .typing-indicator {
    max-width: none;
    gap: 10px;
  }

  .message .avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .bubble {
    padding: 14px 15px;
    font-size: 14px;
    line-height: 1.7;
  }

  .voice-output-btn {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .voice-output-wrap {
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .voice-output-hint {
    max-width: 128px;
    padding: 6px 8px;
    font-size: 11px;
    white-space: normal;
  }

  .quick-prompts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-btn {
    min-height: 50px;
    font-size: 11.5px;
    padding: 8px 6px;
  }

  .images-gallery {
    gap: 8px;
  }

  .img-card {
    width: 132px;
  }

  .img-card img {
    height: 190px;
  }

  .input-area {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .input-container {
    max-width: none;
    gap: 10px;
    padding: 8px 10px 8px 14px;
    border-radius: 18px;
  }

  textarea {
    font-size: 16px;
    max-height: 120px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .input-hint {
    font-size: 10px;
    margin-top: 8px;
  }

  .loading-status-box {
    min-width: 0;
    width: min(76vw, 320px);
    padding: 16px 18px;
    border-radius: 16px;
  }

  .modal-content {
    width: calc(100vw - 20px);
    height: auto;
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
  }

  .modal-body-content {
    overflow: auto;
  }

  .modal-split-view {
    flex-direction: column;
    min-height: auto;
  }

  .modal-left,
  .modal-right {
    padding: 20px 18px;
  }

  .modal-left {
    min-height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .modal-tab-btn {
    padding: 15px 12px;
    font-size: 14px;
  }

  .setup-modal-overlay {
    align-items: flex-start;
    padding: 10px;
    overflow-y: auto;
  }

  .setup-modal-content {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    padding: 22px 18px;
    border-radius: 18px;
    gap: 18px;
  }

  .setup-modal-header h2 {
    font-size: 19px;
  }

  .meaning-box {
    padding: 14px;
    font-size: 13.5px;
  }

  .lang-options {
    flex-direction: column;
    gap: 8px;
  }

  .mbti-grid,
  .zodiac-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .setup-step-nav {
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 12px;
  }

  .feedback-area {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  html.force-desktop-mode,
  body.force-desktop-mode {
    overflow: auto;
  }

  body.force-desktop-mode .app-wrapper {
    flex-direction: row;
    min-width: 1200px;
    height: 100vh;
  }

  body.force-desktop-mode .sidebar {
    width: var(--sidebar-w);
    padding: 24px 20px;
    gap: 20px;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.03);
  }

  body.force-desktop-mode .sidebar-info {
    display: flex;
  }

  body.force-desktop-mode .sidebar-logo {
    margin-bottom: 20px;
  }

  body.force-desktop-mode .logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  body.force-desktop-mode .logo-text h1 {
    font-size: 20px;
  }

  body.force-desktop-mode .logo-text span {
    font-size: 11px;
  }

  body.force-desktop-mode .sidebar-nav {
    margin-bottom: 18px;
  }

  body.force-desktop-mode .nav-btn {
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 14px;
  }

  body.force-desktop-mode .track-selector {
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    padding: 6px;
    border-radius: 14px;
  }

  body.force-desktop-mode .track-btn {
    flex: none;
    justify-content: flex-start;
    padding: 9px 12px;
    font-size: 13px;
  }

  body.force-desktop-mode .chat-header {
    padding: 16px 32px;
    gap: 0;
  }

  body.force-desktop-mode .avatar-sm {
    width: 44px;
    height: 44px;
  }

  body.force-desktop-mode .chat-header h2 {
    font-size: 17px;
  }

  body.force-desktop-mode .status-text {
    font-size: 12px;
  }

  body.force-desktop-mode .messages-area {
    padding: 32px;
    gap: 24px;
  }

  body.force-desktop-mode .message {
    max-width: 820px;
    gap: 14px;
  }

  body.force-desktop-mode .message .avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  body.force-desktop-mode .bubble {
    padding: 16px 22px;
    font-size: 15px;
    line-height: 1.8;
  }

  body.force-desktop-mode .quick-prompts {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  body.force-desktop-mode .img-card {
    width: 180px;
  }

  body.force-desktop-mode .img-card img {
    height: 260px;
  }

  body.force-desktop-mode .input-area {
    padding: 12px 24px 10px;
  }

  body.force-desktop-mode .input-container {
    max-width: 900px;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 24px;
  }

  body.force-desktop-mode textarea {
    font-size: 15px;
  }

  body.force-desktop-mode .send-btn {
    width: 42px;
    height: 42px;
  }
}

/* ── Premium Kakao Login & Sidebar Profile Section ────────────────────── */
.sidebar-profile-section {
  margin: 10px 0 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(213, 194, 237, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-profile-section:hover {
  border-color: rgba(213, 194, 237, 0.18);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

/* Kakao Login Button */
.kakao-login-btn {
  width: 100%;
  height: 44px;
  background: #FEE500;
  color: #191919;
  border: none;
  border-radius: 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kakao-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(254, 229, 0, 0.3);
  background: #FEE500;
  opacity: 0.95;
}

.kakao-login-btn:active {
  transform: translateY(0);
}

.kakao-icon {
  font-size: 16px;
}

.login-nudge-title {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.login-nudge-copy {
  margin: 9px 0 0;
  color: rgba(181, 163, 204, 0.86);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: center;
}

.haetsal-badge-anon {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(181, 163, 204, 0.85);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.haetsal-badge-anon span {
  font-weight: 500;
  color: var(--primary);
}

/* Logged in state */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(213, 194, 237, 0.3);
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.logout-btn {
  background: none;
  border: none;
  color: rgba(181, 163, 204, 0.8);
  font-size: 11px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.logout-btn:hover {
  color: var(--primary);
}

/* Haetsal Badge User */
.haetsal-badge-user {
  background: rgba(213, 194, 237, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(213, 194, 237, 0.05);
}

.haetsal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(181, 163, 204, 0.9);
}

.haetsal-row strong {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
}

/* ── Premium Modal Overlays & Contents ────────────────────────────────── */
.lotus-icon-wrapper {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(213, 194, 237, 0.2), rgba(153, 114, 204, 0.2));
  border: 1px solid rgba(213, 194, 237, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  color: var(--primary);
  animation: floatLotus 3s ease-in-out infinite;
}

.lotus-icon-wrapper.star-wrapper {
  color: #ffb703;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.15), rgba(251, 133, 0, 0.15));
  border-color: rgba(255, 183, 3, 0.3);
}

@keyframes floatLotus {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Login Gate Premium Modals */
.login-gate-content {
  background: rgba(18, 14, 24, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(213, 194, 237, 0.15) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6) !important;
  max-width: 440px !important;
  border-radius: 24px !important;
  overflow: hidden;
}

.update-news-content {
  background: white !important;
  border: 1px solid rgba(213, 194, 237, 0.28) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  max-width: 500px !important;
  border-radius: 24px !important;
  overflow: hidden;
}

.update-news-content .setup-modal-header h2 {
  color: var(--primary-darker);
}

.update-news-content .lotus-icon-wrapper {
  background: linear-gradient(135deg, rgba(213, 194, 237, 0.22), rgba(247, 241, 255, 0.9));
  border-color: rgba(154, 123, 196, 0.22);
  color: var(--primary-darker);
}

.limit-reason {
  text-align: center;
  font-size: 14px;
  color: rgba(181, 163, 204, 0.9);
  line-height: 1.6;
  margin-bottom: 20px;
}

.benefit-box {
  background: rgba(213, 194, 237, 0.04);
  border: 1px solid rgba(213, 194, 237, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 8px;
}

.benefit-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.benefit-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.benefit-box li {
  font-size: 13px;
  color: rgba(181, 163, 204, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.benefit-box li i {
  color: #2ec4b6;
  font-size: 12px;
}

.benefit-box li strong {
  color: var(--primary);
  font-weight: 600;
}

.kakao-login-btn.large-btn {
  height: 50px;
  font-size: 15px;
  margin-bottom: 10px;
}

.close-gate-btn {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  font-size: 13px;
}

/* Update News Announcement */
.announcement-card {
  position: relative;
  background: linear-gradient(180deg, rgba(247, 241, 255, 0.92), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(154, 123, 196, 0.18);
  border-radius: 18px;
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 12px 28px rgba(154, 123, 196, 0.1);
}

.version-tag {
  position: absolute;
  top: 18px;
  right: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.announcement-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.update-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.update-divider {
  border: none;
  border-top: 1px solid rgba(154, 123, 196, 0.16);
  margin: 0 0 14px 0;
}

.update-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.update-list li strong {
  display: block;
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.update-list li p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dont-show-again {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.dont-show-again label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.dont-show-again input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

/* Mobile responsive optimization */
@media (max-width: 768px) {
  .app-wrapper {
    overflow: hidden;
  }

  .sidebar-profile-section {
    margin: 2px 0 6px 0;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .sidebar {
    padding: 10px 14px 8px;
    gap: 8px;
    transition: padding 0.28s ease, gap 0.28s ease, max-height 0.28s ease;
  }

  .sidebar-logo {
    gap: 9px;
    transition: margin 0.28s ease, gap 0.28s ease;
  }

  .sidebar-logo-section {
    gap: 6px;
    transition: gap 0.28s ease;
  }

  .sidebar-nav {
    margin-bottom: 4px;
    transition: max-height 0.28s ease, margin 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
  }

  .nav-btn {
    min-height: 40px;
    padding: 9px 12px;
  }

  .user-info {
    margin-bottom: 0;
  }

  .profile-logged-in {
    display: grid !important;
    grid-template-columns: minmax(92px, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  
  .kakao-login-btn {
    height: 36px;
    font-size: 12.5px;
  }
  
  .user-avatar {
    width: 30px;
    height: 30px;
  }
  
  .user-name {
    font-size: 12.5px;
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logout-btn {
    font-size: 10px;
    line-height: 1.1;
  }

  .login-nudge-title {
    display: none;
  }

  .login-nudge-copy {
    margin-top: 6px;
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .haetsal-badge-anon {
    font-size: 10.5px;
    margin-top: 5px;
  }
  
  .haetsal-badge-user {
    padding: 6px 8px;
    gap: 3px;
    min-width: 112px;
    border-radius: 10px;
  }
  
  .haetsal-row {
    font-size: 10.5px;
    gap: 8px;
    white-space: nowrap;
  }
  
  .haetsal-row strong {
    font-size: 11px;
  }

  .sidebar-track-section {
    margin-bottom: 4px;
    transition: max-height 0.28s ease, margin 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
  }

  .section-label {
    margin-bottom: 6px;
  }

  .track-selector {
    gap: 6px;
    scroll-snap-type: x proximity;
  }

  .track-btn {
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 42px;
    padding: 9px 12px;
    scroll-snap-align: start;
  }

  .track-btn-personality {
    min-width: 150px;
  }

  .chat-header {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px 9px;
    gap: 9px;
    transition: padding 0.28s ease, gap 0.28s ease;
  }

  .header-left {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .header-left > div {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 7px;
    row-gap: 2px;
  }

  .header-left h2 {
    grid-column: 1 / -1;
  }

  .status-dot {
    margin-right: 0;
  }

  .status-text {
    display: block;
    white-space: nowrap;
    line-height: 1.3;
  }

  .header-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    gap: 8px;
  }

  .haetsal-status,
  .share-conversation-btn,
  .lang-toggle,
  .view-mode-btn {
    min-width: 0;
  }

  .haetsal-status {
    width: 100%;
    justify-content: center;
    padding: 6px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .share-conversation-btn,
  .lang-toggle,
  .view-mode-btn {
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .share-conversation-btn {
    font-size: 12px;
  }

  .view-mode-btn {
    font-size: 12px;
  }

  .messages-area {
    padding-top: 14px;
  }

  body.mobile-chat-header-collapsed .sidebar {
    padding: 7px 14px;
    gap: 0;
    max-height: 50px;
  }

  body.mobile-chat-header-collapsed .sidebar-logo {
    margin-bottom: 0;
    gap: 8px;
  }

  body.mobile-chat-header-collapsed .logo-img {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  body.mobile-chat-header-collapsed .logo-text h1 {
    font-size: 15px;
    line-height: 1.15;
  }

  body.mobile-chat-header-collapsed .logo-text span {
    display: none;
  }

  body.mobile-chat-header-collapsed .sidebar-nav,
  body.mobile-chat-header-collapsed .sidebar-profile-section,
  body.mobile-chat-header-collapsed .sidebar-track-section {
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-8px);
    pointer-events: none;
  }

  body.mobile-chat-header-collapsed .sidebar-profile-section {
    border-width: 0;
  }

  body.mobile-chat-header-collapsed .chat-header {
    flex-direction: row;
    align-items: center;
    padding: 7px 10px;
    gap: 8px;
  }

  body.mobile-chat-header-collapsed .header-left {
    width: auto;
    flex: 1 1 auto;
  }

  body.mobile-chat-header-collapsed .header-left > div {
    display: block;
  }

  body.mobile-chat-header-collapsed .avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  body.mobile-chat-header-collapsed .chat-header h2 {
    font-size: 14px;
    line-height: 1;
  }

  body.mobile-chat-header-collapsed .status-dot,
  body.mobile-chat-header-collapsed .status-text,
  body.mobile-chat-header-collapsed .share-conversation-btn,
  body.mobile-chat-header-collapsed .lang-toggle,
  body.mobile-chat-header-collapsed .view-mode-btn {
    display: none !important;
  }

  body.mobile-chat-header-collapsed .header-actions {
    width: auto;
    display: grid;
    grid-template-columns: auto auto;
    gap: 6px;
  }

  body.mobile-chat-header-collapsed .haetsal-status {
    width: auto;
    max-width: 150px;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .login-gate-content, .update-news-content {
    border-radius: 20px !important;
    gap: 14px !important;
  }
  
  .lotus-icon-wrapper {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .header-actions {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-auto-rows: 34px;
    align-items: stretch;
  }

  .view-mode-btn {
    grid-column: 1 / span 2;
    width: 100%;
  }

}

/* Mobile drawer navigation */
.mobile-menu-btn,
.mobile-sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-light);
    color: var(--primary-darker);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    cursor: pointer;
  }

  .mobile-menu-btn span {
    width: 17px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  body.mobile-sidebar-open .mobile-menu-btn span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  body.mobile-sidebar-open .mobile-menu-btn span:nth-child(2) {
    opacity: 0;
  }

  body.mobile-sidebar-open .mobile-menu-btn span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .app-wrapper {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(26, 26, 46, 0.32);
    opacity: 0;
    pointer-events: none;
    z-index: 1200;
    transition: opacity 0.24s ease;
  }

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 340px);
    height: 100dvh;
    max-height: none;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0 22px 22px 0;
    box-shadow: 18px 0 45px rgba(37, 31, 51, 0.18);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-104%);
    z-index: 1300;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-logo {
    gap: 10px;
  }

  .logo-img {
    width: 38px;
    height: 38px;
  }

  .logo-text h1 {
    font-size: 18px;
  }

  .logo-text span {
    display: block;
    font-size: 10px;
  }

  .sidebar-nav,
  .sidebar-track-section {
    max-height: none;
    margin-bottom: 10px;
    opacity: 1;
    overflow: visible;
    transform: none;
    pointer-events: auto;
  }

  .sidebar-profile-section {
    margin: 0 0 12px;
    padding: 12px;
    border-width: 1px;
  }

  .profile-logged-in {
    grid-template-columns: minmax(112px, 1fr) auto;
  }

  .user-avatar {
    width: 34px;
    height: 34px;
  }

  .user-name {
    max-width: 120px;
    font-size: 13px;
  }

  .login-nudge-title {
    display: block;
    color: var(--text-primary);
  }

  .login-nudge-copy {
    white-space: normal;
  }

  .haetsal-badge-user {
    min-width: 124px;
  }

  .track-selector {
    flex-direction: column;
    overflow: visible;
    gap: 6px;
  }

  .track-btn,
  .track-btn-personality {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .sidebar-info {
    display: flex;
  }

  .chat-main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }

  .chat-header {
    flex-direction: row;
    align-items: center;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 8px;
  }

  .header-left {
    width: auto;
    flex: 1 1 auto;
    gap: 8px;
  }

  .header-left > div {
    display: block;
    min-width: 0;
  }

  .avatar-sm {
    width: 36px;
    height: 36px;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .status-text {
    display: inline-block;
    white-space: nowrap;
  }

  .header-actions {
    width: auto;
    margin-left: 0;
    display: flex;
    gap: 7px;
    flex-shrink: 0;
  }

  .haetsal-status {
    display: none !important;
  }

  .share-conversation-btn {
    display: none !important;
  }

  .lang-toggle,
  .view-mode-btn {
    min-height: 34px;
  }

  .view-mode-btn {
    padding: 0 10px;
  }

  .messages-area {
    padding: 16px 12px;
  }

  body.mobile-chat-header-collapsed .sidebar,
  body.mobile-chat-header-collapsed .sidebar-logo,
  body.mobile-chat-header-collapsed .sidebar-nav,
  body.mobile-chat-header-collapsed .sidebar-profile-section,
  body.mobile-chat-header-collapsed .sidebar-track-section,
  body.mobile-chat-header-collapsed .chat-header,
  body.mobile-chat-header-collapsed .header-left,
  body.mobile-chat-header-collapsed .header-left > div {
    transform: none;
  }
}

body.force-desktop-mode .mobile-menu-btn,
body.force-desktop-mode .mobile-sidebar-backdrop {
  display: none !important;
}
