:root {
  --bg: #0a0a0a;
  --bg-sidebar: #000000;
  --bg-elevated: #181818;
  --bg-hover: #202020;
  --bg-input: #131313;
  --bg-code: #000000;
  --text: #ececec;
  --text-dim: #9b9b9b;
  --accent: #d97757;
  --accent-text: #ffffff;
  --border: #262626;
  --scrollbar-thumb: #2a2a2a;
  --scrollbar-thumb-hover: #383838;
  --auth-glow: #171310;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-sidebar: #f7f7f7;
  --bg-elevated: #ececec;
  --bg-hover: #e3e3e3;
  --bg-input: #ffffff;
  --bg-code: #f5f5f5;
  --text: #0d0d0d;
  --text-dim: #6e6e80;
  --border: #e2e2e2;
  --scrollbar-thumb: #d3d3d3;
  --scrollbar-thumb-hover: #bbbbbb;
  --auth-glow: #fdf0e6;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.app {
  display: flex;
  height: 100vh;
  animation: appIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes appIn {
  from { opacity: 0; transform: translateY(6px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.25s ease;
}
.page-loader.page-loader-hidden {
  opacity: 0;
  pointer-events: none;
}
.page-loader-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-hover);
  border-top-color: var(--accent);
  animation: pageLoaderSpin 0.7s linear infinite;
}
@keyframes pageLoaderSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Auth ---------- */

.auth-screen {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, var(--auth-glow) 0%, var(--bg) 55%);
  animation: appIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.auth-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.blob-1 {
  width: 480px;
  height: 480px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  animation: blobDrift1 16s ease-in-out infinite;
}
.blob-2 {
  width: 420px;
  height: 420px;
  bottom: -180px;
  right: -100px;
  background: radial-gradient(circle, #d97757 0%, transparent 70%);
  animation: blobDrift2 20s ease-in-out infinite;
}
.blob-3 {
  width: 320px;
  height: 320px;
  top: 40%;
  left: 60%;
  background: radial-gradient(circle, #ff9d6c 0%, transparent 70%);
  opacity: 0.35;
  animation: blobDrift3 24s ease-in-out infinite;
}

@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.15); }
}
@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.1); }
}
@keyframes blobDrift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(0.9); }
}

.auth-screen-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-height: 100vh;
  overflow-y: auto;
  padding: 24px 0;
}

.auth-announcement {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  min-height: 44px;
  animation: announcementIn 0.7s ease 0.1s both;
}

.typewriter-line {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.3em;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

#typewriterText {
  white-space: pre;
}

.typewriter-orb {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.18em;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(217, 119, 87, 0.55);
  animation: orbPulse 1.15s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

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

.auth-logo-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-icon-wrap .auth-logo-icon {
  position: relative;
  z-index: 1;
}

.auth-logo-glow {
  position: absolute;
  inset: -55%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), transparent 25%, transparent 55%, #ff9d6c, transparent 80%, var(--accent));
  filter: blur(16px);
  z-index: 0;
  animation: logoGlowSpin 7s linear infinite, logoGlowPulse 3.2s ease-in-out infinite;
}

@keyframes logoGlowSpin {
  to { transform: rotate(360deg); }
}

@keyframes logoGlowPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

@media (max-width: 560px) {
  .auth-announcement { padding: 0 16px; }
  .typewriter-line { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg-blob, .typewriter-orb, .auth-logo-glow { animation: none; opacity: 1; transform: none; }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 380px;
  max-width: calc(100vw - 40px);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 28px;
  letter-spacing: 0.2px;
}
.auth-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.auth-form {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  animation: formIn 0.3s ease;
}

@keyframes formIn {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-form h1 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.auth-sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 22px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.2);
}

.auth-error {
  color: #f37373;
  font-size: 13px;
  min-height: 0;
  margin-bottom: 4px;
  animation: shakeIn 0.25s ease;
}
.auth-error:empty { display: none; }
.auth-error.success { color: #6fcf97; }
@keyframes shakeIn {
  0% { opacity: 0; transform: translateX(-4px); }
  50% { transform: translateX(3px); }
  100% { opacity: 1; transform: translateX(0); }
}

.auth-btn {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 10px;
  padding: 11px 0;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s, transform 0.1s;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.6; cursor: default; }

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin: 18px 0 0;
}
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--text-dim);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.google-btn:hover { filter: brightness(0.96); }
.google-btn:active { transform: scale(0.98); }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: width 0.18s ease, padding 0.18s ease, opacity 0.15s ease;
}
.sidebar.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: none;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 2px 6px;
}
.sidebar-header #collapseSidebarBtn { margin-left: auto; }
.sidebar-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-header-brand img { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.new-chat-btn:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.new-chat-btn svg { flex-shrink: 0; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-dim);
  transition: background 0.15s;
}
.search-box:focus-within { background: var(--bg-elevated); }
.search-box svg { flex-shrink: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--text-dim); }

.conv-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 10px 12px;
}

.conv-item {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-elevated); }
.conv-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv-item .del {
  opacity: 0;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 5px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: opacity 0.15s, background 0.15s;
}
.conv-item:hover .del { opacity: 0.65; }
.conv-item .del:hover { opacity: 1; background: var(--bg-hover); }
.conv-item { animation: fadeIn 0.2s ease; }

/* ---------- Profile ---------- */

.profile-box {
  position: relative;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.profile-btn:hover { background: var(--bg-hover); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  animation: menuIn 0.15s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-menu-item:hover { background: var(--bg-hover); }
.profile-menu-item svg { flex-shrink: 0; color: var(--text-dim); }

.profile-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
}
.profile-menu-name { font-size: 13.5px; font-weight: 600; }
.profile-menu-username { font-size: 12px; color: var(--text-dim); }

.profile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ---------- Profil sayfası (tam ekran) ---------- */

.profile-page {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.profile-page-modal {
  position: relative;
  width: 100%;
  max-width: 1000px;
  height: 85vh;
  max-height: 720px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* The plan tab keeps the settings sidebar, but the modal widens so three pricing cards still
   get a comfortable column each next to it. */
.profile-page-modal.plan-view { max-width: 1150px; }
.profile-page-modal.plan-view .profile-page-content { padding: 40px 40px 32px; }

.profile-close-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.profile-close-btn:hover { background: var(--bg-hover); color: var(--text); }

.profile-page-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  width: 100%;
}

.profile-page-sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 56px 16px 24px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.profile-page-sidebar h1 {
  font-size: 17px;
  margin: 0 0 18px 10px;
  font-weight: 700;
}

.profile-page-tabs { display: flex; flex-direction: column; gap: 2px; }
.profile-page-tabs .modal-tab { font-size: 14px; padding: 10px 12px; }

.profile-page-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
}

@media (max-width: 760px) {
  .profile-page { padding: 0; }
  .profile-page-modal { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .profile-page-body { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  .profile-page-sidebar {
    width: 100%;
    flex-shrink: 0;
    padding: 56px 16px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }
  .profile-page-sidebar h1 { margin: 0 0 14px 6px; font-size: 17px; }
  .profile-page-tabs { flex-direction: row; overflow-x: auto; gap: 6px; }
  .profile-page-tabs .modal-tab { flex-shrink: 0; }
  .profile-page-content { padding: 24px 16px; }
  .modal-tab-panel { max-width: 100%; }
  .profile-header-card { flex-wrap: wrap; padding: 20px; }
  .settings-card { padding: 20px; }
}

.field textarea {
  width: 100%;
  min-height: 130px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.2);
}
.field-hint { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }

.modal-save-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: filter 0.15s;
}
.modal-save-btn:hover { filter: brightness(1.08); }
.modal-save-btn:disabled { opacity: 0.6; cursor: default; }

.modal-msg { font-size: 13px; margin-top: 10px; min-height: 0; }
.modal-msg.error { color: #f37373; }
.modal-msg.success { color: #6fce8f; }
.modal-msg:empty { display: none; }

.modal-guest-note {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.6;
}

.modal-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-tab svg { flex-shrink: 0; opacity: 0.85; }
.modal-tab:hover { background: var(--bg-hover); color: var(--text); }
.modal-tab.active { background: var(--bg-elevated); color: var(--text); }
.modal-tab.active svg { opacity: 1; color: var(--accent); }

.modal-tab-panel {
  max-width: 1200px;
  animation: fadeIn 0.15s ease;
}
.modal-tab-panel h2 { font-size: 17px; margin: 0 0 4px; font-weight: 600; }

.profile-header-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 24px;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 28px;
  flex-shrink: 0;
}
.profile-header-name { font-size: 20px; font-weight: 700; }
.profile-header-sub { font-size: 14px; color: var(--text-dim); margin-top: 5px; }

.settings-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 20px;
}
.settings-card .field { margin-bottom: 18px; }
.settings-card .field:last-child { margin-bottom: 0; }
.settings-card .field label { font-size: 13px; }
.settings-card .field input,
.settings-card .field textarea { padding: 12px 14px; font-size: 15px; }
.settings-card-desc { font-size: 13px; color: var(--text-dim); margin: 0 0 18px; }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.stat-row span { color: var(--text-dim); }
.stat-row strong { font-weight: 600; }

.theme-options {
  display: flex;
  gap: 12px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-option:hover { border-color: #444; }
.theme-option.active { border-color: var(--accent); }

.theme-preview {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
}
.theme-preview-dark { background: #0a0a0a; }
.theme-preview-dark::before { content: ""; width: 30%; height: 100%; background: #000; }
.theme-preview-light { background: #ffffff; }
.theme-preview-light::before { content: ""; width: 30%; height: 100%; background: #f0f0f0; border-right: 1px solid #e0e0e0; }

.theme-option span { font-size: 13px; font-weight: 500; }

.data-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.plan-view-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.plan-usage-inline { font-size: 13px; color: var(--text-dim); }
.plan-usage-inline strong { color: var(--text); font-weight: 600; }
.plan-view-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0 32px;
  letter-spacing: -0.01em;
}

.plan-grid {
  display: grid;
  /* auto-fit sizes columns off the grid's own available width, not the viewport — the plan tab
     now lives inside a fixed-width modal, so a viewport media query here would no longer track
     how much room the cards actually have. */
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.plan-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.plan-card:hover { transform: translateY(-2px); }
.plan-card-popular {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    linear-gradient(155deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #7c3aed)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 12px 32px rgba(217, 119, 87, 0.18);
}

.plan-badge {
  position: absolute;
  top: -11px;
  left: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}
.plan-badge-current { background: var(--bg-hover); color: var(--text-dim); border: 1px solid var(--border); }
.plan-badge-popular {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #7c3aed));
  color: #fff;
}

.plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.plan-card-name { font-size: 15px; font-weight: 700; }

.plan-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-hover);
}
.plan-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.plan-toggle-btn:hover { color: var(--text); }
.plan-toggle-btn.active { background: var(--accent); color: var(--accent-text); }
.plan-card-price { font-size: 34px; font-weight: 800; margin-top: 10px; letter-spacing: -0.02em; }
.plan-card-period { font-size: 13px; font-weight: 500; color: var(--text-dim); margin-left: 2px; }
.plan-card-desc { font-size: 12.5px; color: var(--text-dim); margin: 6px 0 0; min-height: 16px; }

.plan-card-features {
  list-style: none;
  margin: 18px 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
}
.plan-card-features li {
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-card-features li::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6 9 17l-5-5' stroke='%23d97757' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

.plan-btn {
  width: 100%;
  padding: 11px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-dim);
  transition: filter 0.15s, transform 0.1s;
}
.plan-btn:disabled { cursor: default; }
.plan-btn-upgrade {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.plan-card-popular .plan-btn-upgrade {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #7c3aed));
}
.plan-btn-upgrade:hover { filter: brightness(1.08); }
.plan-btn-upgrade:active { transform: scale(0.98); }

.plan-msg { text-align: center; }

.danger-zone {
  border-color: #4a2323;
  background: #1c1212;
}
.danger-zone h2 { color: #f0a0a0; }
.danger-btn {
  background: transparent;
  color: #f37373;
  border: 1px solid #5a2b2b;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.danger-btn:hover { background: #2a1616; }
.danger-btn:disabled { opacity: 0.5; cursor: default; }

.guest-box {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.guest-exit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.guest-exit-btn:hover { background: var(--bg-hover); }

/* ---------- Main ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  flex-shrink: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}
.topbar-icon { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.topbar-title { font-weight: 600; font-size: 14.5px; }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 4px 0;
}

.mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 3px;
}
.mode-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-toggle-btn:hover { color: var(--text); }
.mode-toggle-btn.active { background: var(--bg-hover); color: var(--accent); }

.model-select-box { position: relative; }
.model-select-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.model-select-btn:hover { background: var(--bg-hover); color: var(--text); }
.model-select-chevron { color: var(--text-dim); flex-shrink: 0; }

.model-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: -7px;
  min-width: 210px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  z-index: 20;
  animation: menuIn 0.15s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.model-menu.model-menu-up {
  top: auto;
  bottom: calc(100% + 6px);
  left: auto;
}

.model-menu-group {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 10px 4px;
}
.model-menu-group:first-child { padding-top: 4px; }

.model-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.model-menu-item:hover { background: var(--bg-hover); }
.model-menu-item-name { font-size: 13.5px; font-weight: 500; }
.model-menu-check { color: var(--accent); flex-shrink: 0; visibility: hidden; }
.model-menu-item.active .model-menu-check { visibility: visible; }
.model-menu-item.locked .model-menu-item-name { color: var(--text-dim); }
.model-menu-lock { color: var(--text-dim); flex-shrink: 0; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 12px;
}

.empty-state {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-align: center;
  padding: 0 24px;
  overflow: hidden;
}
.empty-state::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 900px;
  height: 520px;
  max-width: 150vw;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(217, 119, 87, 0.38) 0%, rgba(217, 119, 87, 0.2) 35%, rgba(217, 119, 87, 0.08) 58%, transparent 75%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  animation: heroGlowBreathe 6s ease-in-out infinite;
}
@keyframes heroGlowBreathe {
  0%, 100% { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}
.empty-state > * {
  position: relative;
  z-index: 1;
}
.empty-state-greeting {
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent) 50%, var(--text) 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: heroTextShine 5s ease-in-out infinite;
}
@keyframes heroTextShine {
  0% { background-position: 100% 0; }
  50% { background-position: 0 0; }
  100% { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .empty-state::before,
  .empty-state-greeting { animation: none; }
}
.empty-state .composer {
  margin: 0 auto;
  padding: 0;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 200px));
  gap: 10px;
  margin-top: 28px;
}

.suggestion-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  animation: fadeIn 0.3s ease;
}
.suggestion-chip:hover {
  background: var(--bg-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 6px 16px rgba(217, 119, 87, 0.12);
  transform: translateY(-2px);
}
.suggestion-chip:active { transform: scale(0.97); }

.msg-row {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  margin-bottom: 26px;
  animation: fadeIn 0.25s ease;
}

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

.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

.msg-row.user .msg-content {
  background: linear-gradient(155deg, var(--bg-elevated) 0%, color-mix(in srgb, var(--accent) 10%, var(--bg-elevated)) 100%);
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  max-width: 72%;
}

.msg-row.assistant .msg-content {
  max-width: 100%;
}

.msg-content {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 15px;
  word-wrap: break-word;
}

.msg-content p { margin: 0 0 12px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; }
.msg-content code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
.msg-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
}
.msg-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.typing-orb {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 6px 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(217, 119, 87, 0.55);
  animation: orbPulse 1.15s ease-in-out infinite;
}

.image-gen-card {
  position: relative;
  width: 280px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: var(--bg-elevated);
  padding: 16px;
  overflow: hidden;
  margin-top: 4px;
  box-sizing: border-box;
  isolation: isolate;
}
.image-gen-title {
  position: relative;
  z-index: 2;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  isolation: isolate;
  transform: translateZ(0);
}
.image-gen-dots {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: radial-gradient(circle, rgba(255,255,255,0.4) 1px, transparent 1.5px);
  background-size: 18px 18px;
  background-position: 20px 44px;
  -webkit-mask-image: linear-gradient(115deg, transparent 30%, rgba(0,0,0,0.9) 50%, transparent 70%);
  mask-image: linear-gradient(115deg, transparent 30%, rgba(0,0,0,0.9) 50%, transparent 70%);
  -webkit-mask-size: 260% 260%;
  mask-size: 260% 260%;
  animation: imageGenSweep 2.4s linear infinite;
  will-change: mask-position, -webkit-mask-position;
}
@keyframes imageGenSweep {
  0% { -webkit-mask-position: 130% 130%; mask-position: 130% 130%; }
  100% { -webkit-mask-position: -130% -130%; mask-position: -130% -130%; }
}
.image-gen-progress {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  background: rgba(255,255,255,0.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  isolation: isolate;
  transform: translateZ(0);
}

/* ---------- Composer ---------- */

.composer {
  max-width: 800px;
  width: 100%;
  margin: 0 auto 22px;
  padding: 0 24px;
}

.composer-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 8px 8px 8px 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(217, 119, 87, 0.2);
}

#input {
  flex: 1;
  min-width: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 8px 4px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 200px;
  display: block;
}
#input:focus { outline: none; }
#input::placeholder { color: var(--text-dim); }

.composer-icon-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.composer-icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.composer-icon-btn.recording {
  color: #fff;
  background: #e5484d;
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); }
}

.send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #1e1e1e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.5);
  transition: filter 0.15s, transform 0.1s, opacity 0.15s, box-shadow 0.2s;
}
.send-btn:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 2px 14px rgba(217, 119, 87, 0.45); }
.send-btn:active:not(:disabled) { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.3; cursor: default; box-shadow: none; }

/* ---------- Attachments ---------- */

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 12.5px;
  max-width: 220px;
}
.attachment-chip img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.attachment-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}
.attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  padding: 2px;
}
.attachment-chip-remove:hover { color: var(--text); }

.msg-image {
  max-width: 280px;
  max-height: 280px;
  border-radius: 12px;
  display: block;
  margin-bottom: 8px;
  cursor: zoom-in;
}

.msg-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
  margin-bottom: 8px;
}

.token-counter {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  opacity: 0.75;
}
.token-counter:empty { display: none; }

.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.msg-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.msg-action-btn.speaking { color: var(--accent); }
.msg-action-btn.loading { color: var(--accent); animation: msgActionPulse 0.9s ease-in-out infinite; }
@keyframes msgActionPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---------- Logout confirm modal ---------- */

.logout-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: appIn 0.15s ease;
}

.logout-modal {
  width: 320px;
  max-width: 90vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: menuIn 0.18s ease;
}

.logout-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.35;
}

.logout-modal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 20px;
}
.logout-modal-user-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.logout-modal-user-email { font-size: 12px; color: var(--text-dim); }

.logout-modal-btn {
  width: 100%;
  border-radius: 999px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.logout-modal-btn:hover { filter: brightness(1.08); }
.logout-modal-btn-primary {
  background: var(--text);
  color: var(--bg);
  border: none;
  margin-bottom: 10px;
}
.logout-modal-btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.code-intro-screen {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: appIn 0.25s ease;
}
.code-intro-screen.fade-out { animation: codeIntroFadeOut 0.35s ease forwards; }
@keyframes codeIntroFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.code-intro-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1000px;
  height: 600px;
  max-width: 180vw;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(217, 119, 87, 0.4) 0%, rgba(217, 119, 87, 0.2) 35%, rgba(217, 119, 87, 0.08) 58%, transparent 75%);
  filter: blur(40px);
  pointer-events: none;
}

.code-intro-teaser {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}
.code-intro-teaser.wipe-out {
  opacity: 0;
  transform: scale(0.85);
  filter: blur(6px);
}

.code-intro-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--accent);
  margin-bottom: 22px;
  opacity: 0;
  animation: codeIntroPop 0.5s ease 0.1s forwards;
}

.code-intro-badge {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  opacity: 0;
  animation: codeIntroRise 0.5s ease 0.3s forwards;
}

.code-intro-subtitle {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  opacity: 0;
  animation: codeIntroRise 0.55s ease 0.5s forwards;
}

.code-intro-title-finale {
  position: absolute;
  font-size: 52px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 0;
  padding: 0 24px;
  opacity: 0;
  transform: scale(0.75);
  pointer-events: none;
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.code-intro-title-finale.show {
  opacity: 1;
  transform: scale(1);
}

@keyframes codeIntroPop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes codeIntroRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.code-intro-skip {
  position: absolute;
  bottom: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
  opacity: 0;
  animation: codeIntroRise 0.5s ease 0.85s forwards;
}
.code-intro-skip:hover { background: var(--bg-hover); }

/* ---------- Voice call ---------- */

.voice-call-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  animation: appIn 0.25s ease;
}

.voice-orb-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-orb {
  position: relative;
  z-index: 1;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.25s ease;
}

.voice-orb-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  filter: blur(30px);
  opacity: 0.6;
}

.state-listening .voice-orb { animation: voiceListenPulse 1.8s ease-in-out infinite; }
.state-thinking .voice-orb { animation: voiceThinkPulse 0.85s ease-in-out infinite; }
.state-speaking .voice-orb { animation: voiceSpeakPulse 0.55s ease-in-out infinite; }
.state-muted .voice-orb { opacity: 0.35; animation: none; }

@keyframes voiceListenPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes voiceThinkPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.05); opacity: 1; }
}
@keyframes voiceSpeakPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.voice-status {
  font-size: 16px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.voice-caption {
  max-width: 640px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  min-height: 48px;
  padding: 0 28px;
}

.voice-call-controls {
  position: absolute;
  bottom: 64px;
  display: flex;
  gap: 22px;
}

.voice-control-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text);
  transition: background 0.15s, color 0.15s, filter 0.15s;
}
.voice-control-btn:hover { filter: brightness(1.1); }
.voice-control-btn.muted { background: var(--accent); color: #fff; }
.voice-control-end { background: #e5484d; color: #fff; }
