:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: #0d0d10;
  --panel-2: #111116;
  --panel-3: #17171d;
  --line: #282830;
  --line-soft: #1d1d24;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --white: #ffffff;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --pill: 999px;
  --sidebar: 264px;
  --sidebar-rail: 60px;
  --sidebar-content-width: calc(var(--sidebar) - 20px);
  --content-sidebar: var(--sidebar);
  --page-bottom-bg: var(--bg);
  --shadow: 0 24px 100px rgba(0, 0, 0, 0.42);
  --accent: #f5f5f5;
  --accent-strong: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.09);
  --accent-border: rgba(255, 255, 255, 0.28);
  --accent-contrast: #050506;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --panel-3: #e9eaee;
  --line: #d9dbe2;
  --line-soft: #e6e7ec;
  --text: #18181b;
  --muted: #5f636b;
  --faint: #7b8089;
  --white: #ffffff;
  --shadow: 0 24px 90px rgba(20, 24, 33, 0.18);
  --accent: #171717;
  --accent-strong: #050506;
  --accent-soft: rgba(24, 24, 27, 0.08);
  --accent-border: rgba(24, 24, 27, 0.24);
  --accent-contrast: #ffffff;
  --page-bottom-bg: var(--bg);
}

:root[data-accent="blue"] {
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --accent-border: rgba(59, 130, 246, 0.36);
  --accent-contrast: #ffffff;
}

:root[data-accent="purple"] {
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --accent-border: rgba(139, 92, 246, 0.36);
  --accent-contrast: #ffffff;
}

:root[data-accent="yellow"] {
  --accent: #eab308;
  --accent-strong: #ca8a04;
  --accent-soft: rgba(234, 179, 8, 0.18);
  --accent-border: rgba(234, 179, 8, 0.42);
  --accent-contrast: #111111;
}

:root[data-accent="green"] {
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.16);
  --accent-border: rgba(34, 197, 94, 0.36);
  --accent-contrast: #07130b;
}

:root[data-accent="red"] {
  --accent: #ef4444;
  --accent-strong: #dc2626;
  --accent-soft: rgba(239, 68, 68, 0.16);
  --accent-border: rgba(239, 68, 68, 0.36);
  --accent-contrast: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.055), transparent 34%),
    linear-gradient(180deg, #070708 0%, var(--bg) 52%, var(--page-bottom-bg) 100%);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at top, rgba(24, 24, 27, 0.06), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 58%, var(--page-bottom-bg) 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.boot-view {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  background: #030303;
  font-size: 0.9rem;
}

.boot-loader {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  animation: bootSpin 760ms linear infinite;
}

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

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 34%),
    #030303;
}

.login-view.login-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  background: rgba(3, 3, 4, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-card {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(13, 13, 16, 0.9);
  box-shadow: var(--shadow);
}

.login-close-button {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.login-close-button:hover {
  color: #ffffff;
  background: var(--panel-3);
}

.login-logo {
  display: block;
  width: min(250px, 78%);
  height: auto;
  margin: 0 auto 20px;
  border-radius: 16px;
}

.login-copy {
  text-align: center;
  margin-bottom: 22px;
}

.login-copy h1,
.login-copy p,
.welcome-panel h1,
.welcome-panel p,
.message p,
.section-title,
.account-meta strong,
.account-meta span,
.account-meta small {
  margin: 0;
}

.login-copy h1 {
  font-size: 1.5rem;
  font-weight: 680;
  letter-spacing: 0;
}

.login-copy p {
  margin-top: 8px;
  color: var(--muted);
}

.login-options,
.phone-panel {
  display: grid;
  gap: 10px;
}

.auth-button,
.solid-button,
.ghost-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.auth-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 14px;
}

.auth-button:hover,
.ghost-button:hover,
.sidebar-nav button:hover,
.recent-chat:hover,
.tool-button:hover,
.profile-chip:hover {
  background: var(--panel-3);
}

.primary-auth {
  border-color: #f4f4f5;
  color: #050506;
  background: #f4f4f5;
  font-weight: 760;
}

.primary-auth:hover {
  background: #ffffff;
}

.primary-auth .auth-icon {
  border-color: rgba(0, 0, 0, 0.16);
  color: #050506;
}

.guest-auth {
  color: #eeeeee;
}

.auth-icon {
  display: block;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  object-fit: cover;
}

.apple-icon::before {
  content: "";
  width: 12px;
  height: 15px;
  border-radius: 8px 8px 6px 6px;
  background: var(--white);
}

.phone-panel label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.phone-panel input,
.sidebar-search input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--text);
  background: #08080a;
  outline: none;
}

.phone-panel input:focus,
.sidebar-search input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.24);
  outline-offset: 2px;
}

.phone-panel small,
.login-message {
  color: var(--muted);
  font-size: 0.82rem;
}

.solid-button {
  border-color: var(--accent);
  color: var(--accent-contrast);
  background: var(--accent);
  font-weight: 750;
}

.ghost-button {
  color: var(--muted);
}

.login-message {
  min-height: 20px;
  margin: 14px 0 0;
  text-align: center;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  min-width: 0;
  padding: 14px 10px;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  background: rgba(11, 11, 14, 0.96);
  transition: transform 220ms ease;
}

.app.sidebar-closed {
  --content-sidebar: var(--sidebar-rail);
  grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
}

.app.sidebar-closed .sidebar {
  width: var(--sidebar-rail);
  padding: 14px 10px 10px;
  overflow: hidden;
  border-right-color: var(--line-soft);
}

.sidebar-top,
.sidebar-nav,
.sidebar-search,
.recent-section,
.account-shell,
.guest-promo-card {
  width: var(--sidebar-content-width);
  max-width: none;
}

.sidebar-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  margin-bottom: 10px;
}

.sidebar-toggle {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  top: 7px;
  justify-self: end;
}

.sidebar-logo {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  left: -23px;
  top: 10px;
  width: 150px;
  height: 40px;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
  opacity: 0.96;
}

.app.sidebar-closed .sidebar-top {
  grid-template-columns: 38px;
  justify-content: start;
  margin-bottom: 10px;
}

.app.sidebar-closed .sidebar-toggle {
  grid-column: 1;
  justify-self: start;
}

.app.sidebar-closed .sidebar-logo,
.app.sidebar-closed .sidebar-search,
.app.sidebar-closed .recent-section,
.app.sidebar-closed .guest-promo-card {
  display: none;
}

.app.sidebar-closed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.icon-button,
.tool-button,
.send-button,
.floating-open,
.profile-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button,
.tool-button,
.send-button,
.floating-open {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  color: #f2f2f4;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 520;
  text-align: left;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.app.sidebar-closed .sidebar-nav {
  gap: 6px;
  margin: 12px 0;
}

.app.sidebar-closed .sidebar-nav button {
  justify-content: flex-start;
  width: 40px;
  min-height: 40px;
  padding: 0 10px;
  gap: 0;
  border-radius: 50%;
  font-size: 0;
}

.app.sidebar-closed .sidebar-nav button svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav button:hover,
.sidebar-nav button:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-nav button.active {
  border-color: transparent;
  color: #ffffff;
  background: var(--accent-soft);
}

.sidebar-nav svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.sidebar-search {
  margin-bottom: 12px;
}

.recent-section {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding-top: 12px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 9px;
  color: #f2f2f4;
  font-size: 0.86rem;
  font-weight: 620;
  text-transform: none;
}

.section-title small {
  display: none;
}

.recent-list {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 1px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.recent-list::-webkit-scrollbar {
  display: none;
}

.recent-chat {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 7px 9px;
  color: #f1f1f3;
  background: transparent;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.recent-chat.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.recent-chat strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
}

.recent-chat small {
  display: none;
}

.empty-recent {
  flex: 0 0 auto;
  padding: 12px 10px;
  color: var(--faint);
  font-size: 0.9rem;
}

.account-card {
  display: grid;
  flex: 0 0 auto;
  width: 100%;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.account-card:hover,
.account-shell.menu-open .account-card {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.account-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.42);
  outline-offset: 2px;
}

.account-shell {
  position: relative;
  flex: 0 0 auto;
  margin-top: 12px;
}

.app.sidebar-closed .account-shell {
  display: none;
}

.sidebar-rail-profile {
  display: none;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  padding: 3px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.sidebar-rail-profile:hover,
.sidebar-rail-profile:focus-visible {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.065);
  outline: none;
  transform: translateY(-1px);
}

.sidebar-rail-profile .avatar {
  width: 100%;
  height: 100%;
}

.app.sidebar-closed .sidebar-rail-profile {
  display: grid;
  margin-top: auto;
}

.app.sidebar-closed .account-card {
  display: grid;
  width: 40px;
  height: 40px;
  min-height: 40px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 3px;
  border-radius: 50%;
}

.app.sidebar-closed .account-card .avatar {
  width: 32px;
  height: 32px;
}

.app.sidebar-closed .account-meta,
.app.sidebar-closed .account-card-chevron {
  display: none;
}

.app.sidebar-closed .account-menu {
  left: calc(100% + 10px);
  right: auto;
  bottom: 0;
  width: 260px;
  transform-origin: bottom left;
}

.account-menu {
  position: absolute;
  z-index: 55;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  display: grid;
  gap: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(18, 18, 23, 0.98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.42);
  transform-origin: bottom center;
  animation: accountMenuIn 150ms ease both;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.account-menu-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 5px 8px;
}

.account-menu-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.68rem;
}

.account-menu-header-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-menu-header-copy strong,
.account-menu-header-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header-copy strong {
  font-size: 0.88rem;
}

.account-menu-header-copy span {
  color: #d8d8dc;
  font-size: 0.76rem;
}

.account-menu-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 10px;
  color: #f3f3f4;
  background: transparent;
  text-align: left;
}

.account-menu-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.account-menu-icon {
  width: 18px;
  height: 18px;
  color: #f3f3f4;
  stroke-width: 1.9;
}

.account-card-chevron,
.account-menu-chevron {
  width: 17px;
  height: 17px;
  color: #f4f4f5;
  stroke-width: 2.15;
}

.account-card-chevron {
  justify-self: end;
  transition: transform 160ms ease;
}

.account-shell.menu-open .account-card-chevron {
  transform: rotate(-90deg);
}

.account-menu-separator {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.1);
}

@keyframes accountMenuIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.guest-promo-card {
  flex: 0 0 auto;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    var(--panel);
}

.guest-promo-card strong {
  display: block;
  color: #ffffff;
  font-size: 0.91rem;
  line-height: 1.28;
}

.guest-promo-card p {
  margin: 8px 0 11px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.38;
}

.guest-promo-card button {
  width: 100%;
  min-height: 36px;
  border: 1px solid #f1f1f2;
  border-radius: var(--radius);
  color: #08080a;
  background: #f1f1f2;
  font-size: 0.82rem;
  font-weight: 760;
}

.guest-promo-card button:hover {
  background: #ffffff;
}

.avatar,
.profile-chip span:first-child {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  color: #08080a;
  background: #f3f3f3;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  font-weight: 780;
  line-height: 1;
  flex: 0 0 auto;
}

.account-meta {
  min-width: 0;
}

.account-meta strong,
.account-meta span,
.account-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta strong {
  font-size: 0.9rem;
}

.account-meta span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-meta small {
  margin-top: 2px;
  color: #e7e7ea;
  font-size: 0.74rem;
}

.floating-open {
  position: fixed;
  z-index: 30;
  left: 16px;
  top: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.app.sidebar-closed .floating-open {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
}

.chat-shell {
  position: relative;
  min-width: 0;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
}

.chat-view {
  position: relative;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.chat-view[hidden],
.gallery-view[hidden] {
  display: none;
}

.chat-topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid transparent;
}

.topbar-title {
  grid-column: 2;
  display: grid;
  justify-items: center;
  min-width: 0;
  justify-self: center;
  transform: translateY(6px);
}

.chat-topbar strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.chat-topbar span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.mobile-menu-button {
  display: none;
  grid-column: 1;
  justify-self: start;
}

.profile-chip {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 94px;
  max-width: min(220px, 30vw);
  height: 38px;
  border-radius: var(--pill);
  padding: 0 10px 0 2px;
}

.profile-chip span:first-child {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.profile-chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 5px;
  padding: 2px 8px;
  border: 1px solid var(--accent-border);
  border-radius: var(--pill);
  color: var(--text) !important;
  background: var(--accent-soft);
  font-size: 0.72rem !important;
  font-weight: 700;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  scroll-padding-top: 18px;
  scroll-padding-bottom: 128px;
  padding: 18px max(18px, calc((100vw - var(--content-sidebar) - 820px) / 2)) 128px;
}

.conversation.has-messages + .welcome-panel {
  opacity: 0;
  pointer-events: none;
}

.welcome-panel {
  position: absolute;
  left: 50%;
  top: 45%;
  display: grid;
  width: min(720px, calc(100% - 32px));
  justify-items: center;
  text-align: center;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.welcome-logo-wrap {
  width: min(280px, 70vw);
  height: 82px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.welcome-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.welcome-panel h1 {
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: 620;
  letter-spacing: 0;
}

.welcome-panel p {
  max-width: 560px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.message {
  width: min(820px, 100%);
  min-width: 0;
  align-self: center;
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message-stack {
  min-width: 0;
}

.message.user .message-stack {
  width: min(620px, 100%);
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  font-size: 0.82rem;
  font-weight: 780;
}

.avatar.has-image,
.profile-chip span:first-child.has-image,
.message-avatar.has-image {
  color: transparent;
  background-color: var(--panel-2);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.message-content {
  min-width: 0;
  max-width: 100%;
}

.message.user .message-content {
  display: grid;
  gap: 10px;
}

.message.assistant .message-content {
  padding: 2px 4px 0;
}

.message.user .message-content {
  padding: 14px 16px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.message p {
  color: #e1e1e5;
  line-height: 1.58;
  white-space: pre-wrap;
}

.message.user .message-content > p {
  margin: 0;
}

.message .markdown-body {
  min-width: 0;
  max-width: 100%;
  color: #e1e1e5;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.message .markdown-body > :first-child {
  margin-top: 0;
}

.message .markdown-body > :last-child {
  margin-bottom: 0;
}

.message .markdown-body p {
  margin: 0 0 10px;
  white-space: normal;
}

.message .markdown-body h1,
.message .markdown-body h2,
.message .markdown-body h3 {
  margin: 14px 0 8px;
  color: #ffffff;
  line-height: 1.22;
  letter-spacing: 0;
}

.message .markdown-body h1 {
  font-size: 1.34rem;
}

.message .markdown-body h2 {
  font-size: 1.18rem;
}

.message .markdown-body h3 {
  font-size: 1.04rem;
}

.message .markdown-body ul,
.message .markdown-body ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.message .markdown-body li + li {
  margin-top: 4px;
}

.message .markdown-body blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.28);
  color: #cfcfd5;
  background: rgba(255, 255, 255, 0.04);
}

.message .markdown-body hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: var(--line);
}

.message .markdown-body a {
  color: #f5d28a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-citation {
  display: inline-flex;
  align-items: center;
  max-width: min(180px, 54vw);
  min-height: 21px;
  margin: 0 3px;
  padding: 2px 7px;
  overflow: hidden;
  vertical-align: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #d7d7dc;
  background: rgba(255, 255, 255, 0.075);
  font: inherit;
  font-size: 0.64rem;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.inline-citation:hover,
.inline-citation:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.message .markdown-body code {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: #f6d48f;
  background: rgba(255, 255, 255, 0.065);
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.9em;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  margin-top: 6px;
  padding: 0 2px;
}

.message.user .message-actions {
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.message.user:hover .message-actions,
.message.user:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message-action-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
}

.message-action-button:hover,
.message-action-button:focus-visible,
.message-action-button.copied {
  border-color: var(--line);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.065);
}

.message-action-button svg {
  width: 17px;
  height: 17px;
}

.message-delivery-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 22px;
  margin-top: 6px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.35;
}

.message-delivery-status small {
  max-width: min(360px, 72vw);
  overflow: hidden;
  color: #f1b8ad;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-delivery-status.is-responded {
  opacity: 0.64;
}

.sources-action-button {
  display: inline-flex;
  width: auto;
  padding: 0 8px;
  gap: 5px;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1;
}

.sources-action-button span {
  font-size: 0.72rem;
  font-weight: 650;
}

.code-block {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08080a;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.76rem;
}

.code-block-header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-copy-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #eeeeee;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
}

.code-copy-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.code-block pre {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  padding: 13px;
  -webkit-overflow-scrolling: touch;
}

.code-block pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #ececf0;
  background: transparent;
  line-height: 1.55;
  white-space: pre;
}

.text-block-body {
  min-width: 0;
  max-width: 100%;
  padding: 13px;
  overflow-x: hidden;
  color: #ececf0;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.text-block-line {
  display: block;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.text-block-line strong {
  color: #60f0d1;
  font-weight: 750;
}

.text-block-line em {
  color: #f6d48f;
  font-style: normal;
}

.text-block-line code {
  font-size: 0.94em;
}

.code-token.token-comment {
  color: #6a9955;
}

.code-token.token-string {
  color: #ce9178;
}

.code-token.token-keyword {
  color: #569cd6;
}

.code-token.token-import {
  color: #c586c0;
}

.code-token.token-function,
.code-token.token-method {
  color: #dcdcaa;
}

.code-token.token-variable {
  color: #9cdcfe;
}

.code-token.token-class,
.code-token.token-type {
  color: #4ec9b0;
}

.code-token.token-number {
  color: #b5cea8;
}

.code-token.token-operator {
  color: #d4d4d4;
}

.message-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 180px));
  gap: 8px;
  margin-top: 12px;
}

.message-content > .message-images:first-child,
.message-content > .message-files:first-child {
  margin-top: 0;
}

.message-images.generated-message-images {
  grid-template-columns: minmax(0, min(520px, 100%));
}

.message-images figure {
  min-width: 0;
  margin: 0;
}

.message-image-shell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
}

.message-image-shell:focus-visible {
  outline: 2px solid var(--accent-border);
  outline-offset: 3px;
}

.message-images img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  object-fit: cover;
  background: #030304;
}

.generated-image-figure {
  max-width: min(100%, 520px);
}

.generated-image-figure img {
  aspect-ratio: auto;
  max-height: 560px;
  object-fit: contain;
}

.message-image-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.message-image-shell:hover .message-image-actions,
.message-image-shell:focus-within .message-image-actions,
.message-image-shell.is-actions-open .message-image-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.message-image-action {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.66);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.message-image-action[data-image-action="share"] {
  order: 1;
  margin-right: auto;
}

.message-image-action[data-image-action="download"] {
  order: 2;
  margin-left: auto;
}

.message-image-action:hover {
  background: rgba(0, 0, 0, 0.82);
}

.message-images figcaption {
  margin-top: 5px;
  max-width: 520px;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.35;
}

.message.user .message-images {
  grid-template-columns: repeat(auto-fit, minmax(112px, 148px));
  margin: 0;
}

.message.user .message-images img {
  aspect-ratio: 1 / 1;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.message.user .message-images figcaption {
  display: none;
}

.message-files,
.message-voices {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.message-file,
.message-voice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 340px;
  min-height: 56px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.message-voice {
  grid-template-columns: 42px minmax(0, 1fr);
  max-width: min(360px, 100%);
  background: rgba(255, 255, 255, 0.06);
}

.message-voice:has(.message-voice-player) {
  grid-template-columns: 42px minmax(0, 1fr);
}

.message-file-icon,
.message-voice-icon,
.file-preview-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.28);
  line-height: 1;
}

.message-file-icon svg,
.message-voice-icon svg,
.file-preview-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.message-file-copy,
.message-voice-copy,
.image-preview-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.message-file-copy strong,
.message-file-copy small,
.message-voice-copy strong,
.message-voice-copy small,
.image-preview-copy strong,
.image-preview-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file-copy strong,
.message-voice-copy strong,
.image-preview-copy strong {
  font-size: 0.82rem;
  font-weight: 650;
}

.message-file-copy small,
.message-voice-copy small,
.image-preview-copy small {
  color: var(--faint);
  font-size: 0.7rem;
}

.message-voice-player {
  grid-column: 1 / -1;
  width: 100%;
  height: 34px;
  margin-top: 2px;
}

.thinking-copy {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 10px !important;
}

.thinking-plan {
  width: 100%;
  max-width: 100%;
  margin: 2px 0 12px;
  padding: 8px 0 8px 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.thinking-plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.thinking-plan-summary::-webkit-details-marker {
  display: none;
}

.thinking-plan-summary span {
  min-width: 0;
  color: var(--text);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.thinking-plan-summary small {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.72rem;
  white-space: nowrap;
}

.thinking-plan-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.thinking-plan-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.thinking-plan-item strong {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 650;
}

.thinking-plan-item span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .thinking-plan-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .thinking-plan-summary small {
    white-space: normal;
  }
}

.web-research-active .message-content {
  border-color: rgba(255, 255, 255, 0.14);
}

.web-research-active .typing span {
  background: var(--muted);
}

.file-analysis-active .message-content {
  border-color: rgba(103, 210, 160, 0.32);
}

.file-analysis-active .typing span {
  background: #70d8a7;
}

.typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 2px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 900ms infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.32;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes voicePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 95, 115, 0.42);
    transform: scale(0.92);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 95, 115, 0);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 95, 115, 0);
    transform: scale(0.92);
  }
}

@keyframes voiceBars {
  0%, 100% {
    transform: scaleY(0.34);
  }
  50% {
    transform: scaleY(0.96);
  }
}

.composer-zone {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 10px;
  display: grid;
  width: min(820px, calc(100% - 36px));
  gap: 5px;
  transform: translateX(-50%);
}

.composer-bottom-mask {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  height: 90px;
  pointer-events: none;
  background: var(--page-bottom-bg);
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
  grid-template-areas: "add input mic send";
  gap: 8px;
  align-items: end;
  min-height: 62px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(22, 22, 27, 0.94);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.composer.has-composer-tools {
  grid-template-columns: 42px auto minmax(0, 1fr) 42px 42px;
  grid-template-areas:
    "input input input input input"
    "add modes . mic send";
}

.composer.has-attachments {
  grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
  grid-template-areas:
    "attachments attachments attachments attachments"
    "input input input input"
    "add . mic send";
  align-items: end;
  padding-top: 8px;
}

.composer.has-composer-tools.has-attachments {
  grid-template-columns: 42px auto minmax(0, 1fr) 42px 42px;
  grid-template-areas:
    "attachments attachments attachments attachments attachments"
    "input input input input input"
    "add modes . mic send";
}

#addButton {
  grid-area: add;
}

#messageInput {
  grid-area: input;
}

#micButton {
  grid-area: mic;
}

#sendButton {
  grid-area: send;
}

#voiceRecorder {
  grid-area: voice;
}

.composer.is-recording,
.composer.is-transcribing {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "voice";
  align-items: center;
  min-height: 62px;
}

.composer.is-recording #addButton,
.composer.is-recording #messageInput,
.composer.is-recording #micButton,
.composer.is-recording #sendButton,
.composer.is-recording #attachmentPreviewPanel,
.composer.is-recording #composerModeBar,
.composer.is-recording #composerAspectShell,
.composer.is-transcribing #addButton,
.composer.is-transcribing #messageInput,
.composer.is-transcribing #micButton,
.composer.is-transcribing #sendButton,
.composer.is-transcribing #attachmentPreviewPanel,
.composer.is-transcribing #composerModeBar,
.composer.is-transcribing #composerAspectShell {
  display: none;
}

.voice-recorder {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.voice-recorder[hidden] {
  display: none;
}

.voice-capture {
  display: grid;
  grid-template-columns: 28px minmax(96px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 0 4px;
}

.voice-pulse {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  justify-self: center;
  border-radius: 50%;
  background: #ff5f73;
  box-shadow: 0 0 0 0 rgba(255, 95, 115, 0.42);
  animation: voicePulse 1150ms infinite ease-out;
}

.composer.is-transcribing .voice-pulse {
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 38%, transparent);
}

.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  height: 34px;
}

.voice-wave span {
  display: block;
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, var(--accent) 100%);
  opacity: 0.86;
  transform: scaleY(0.28);
  transform-origin: center;
  transition: transform 70ms linear;
}

.composer.is-transcribing .voice-wave span {
  animation: voiceBars 900ms infinite ease-in-out;
}

.composer.is-transcribing .voice-wave span:nth-child(2n) {
  animation-delay: 120ms;
}

.composer.is-transcribing .voice-wave span:nth-child(3n) {
  animation-delay: 240ms;
}

.voice-status,
.voice-timer {
  color: #f2f2f4;
  font-size: 0.86rem;
  font-weight: 620;
  white-space: nowrap;
}

.voice-timer {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.voice-action-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.055);
  transition: background 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.voice-action-button:hover,
.voice-action-button:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.voice-action-button:disabled {
  cursor: wait;
  opacity: 0.56;
  transform: none;
}

.voice-action-button svg {
  width: 19px;
  height: 19px;
}

.voice-delete-button {
  color: #ffb4bd;
}

.voice-send-button {
  color: var(--accent-contrast);
  background: var(--accent);
}

.voice-send-button:hover,
.voice-send-button:focus-visible {
  background: color-mix(in srgb, var(--accent) 86%, #ffffff);
}

.composer-mode-bar {
  grid-area: modes;
  position: relative;
  display: flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  min-width: 0;
}

.composer-mode-chip,
.composer-aspect-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--pill);
  color: #f4f4f5;
  background: transparent;
  white-space: nowrap;
}

.composer-mode-chip {
  padding: 0 10px;
  color: #f1f1f3;
  font-size: 0.86rem;
  font-weight: 560;
}

.composer-mode-chip:hover,
.composer-mode-chip:focus-visible,
.composer-aspect-button:hover,
.composer-aspect-button:focus-visible {
  border-color: transparent;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

.composer-mode-chip svg,
.composer-aspect-button svg,
.composer-tool-menu svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
}

.composer-chip-remove {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: -2px;
  border-radius: 50%;
  color: #f6f6f7;
  font-size: 0.8rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
}

.composer-mode-chip:hover .composer-chip-remove,
.composer-mode-chip:focus-visible .composer-chip-remove {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.composer-aspect-shell {
  position: relative;
}

.composer-aspect-button {
  padding: 0 10px;
  font-size: 0.84rem;
  font-weight: 620;
}

.composer-aspect-button svg:last-child {
  width: 14px;
  height: 14px;
}

.composer-aspect-menu,
.composer-tool-menu {
  position: absolute;
  z-index: 80;
  display: grid;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(45, 45, 48, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.composer-tool-menu {
  left: 10px;
  bottom: calc(100% + 8px);
  width: 278px;
  padding: 7px;
  gap: 2px;
}

.composer-tool-menu button,
.composer-aspect-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: #f1f1f3;
  background: transparent;
  font-size: 0.88rem;
  text-align: left;
}

.composer-tool-menu button {
  padding: 0 10px;
}

.composer-tool-menu button:hover,
.composer-tool-menu button:focus-visible,
.composer-aspect-menu button:hover,
.composer-aspect-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}

.composer-tool-menu button.is-selected {
  color: #9dcbff;
  background: rgba(157, 203, 255, 0.12);
}

.composer-aspect-menu {
  left: 0;
  bottom: calc(100% + 8px);
  width: 224px;
  padding: 10px;
  gap: 2px;
}

.composer-aspect-menu p {
  margin: 0 0 6px;
  padding: 0 6px;
  color: #b8b8bf;
  font-size: 0.78rem;
}

.composer-aspect-menu button {
  padding: 0 8px;
}

.composer-aspect-menu button[aria-checked="true"]::after {
  content: "✓";
  margin-left: auto;
  color: #f4f4f5;
}

.composer-aspect-menu small {
  color: var(--faint);
  font-size: 0.78rem;
}

.aspect-icon {
  flex: 0 0 auto;
  display: inline-block;
  border: 1.6px solid currentColor;
  border-radius: 4px;
  opacity: 0.92;
}

.aspect-icon.auto {
  width: 13px;
  height: 10px;
}

.aspect-icon.square {
  width: 14px;
  height: 14px;
}

.aspect-icon.portrait {
  width: 12px;
  height: 16px;
}

.aspect-icon.story {
  width: 10px;
  height: 18px;
}

.aspect-icon.landscape {
  width: 16px;
  height: 12px;
}

.aspect-icon.wide {
  width: 18px;
  height: 10px;
}

.token-notice {
  width: min(820px, 100%);
  margin: -2px auto 0;
  color: #f1d7a4;
  font-size: 0.84rem;
  line-height: 1.4;
  text-align: center;
}

.image-preview-panel {
  grid-area: attachments;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 8px;
  overflow: visible;
}

.image-preview-item {
  position: relative;
  display: grid;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.image-preview-item.is-image {
  width: 144px;
  height: 144px;
  overflow: hidden;
  padding: 0;
  background: #f4f4f5;
}

.image-preview-item.is-file {
  grid-template-columns: 40px minmax(0, 1fr);
  width: min(320px, calc(100vw - 72px));
  min-height: 56px;
  padding: 7px 36px 7px 7px;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  border-radius: 11px;
  object-fit: cover;
  background: #f4f4f5;
}

.image-preview-item .file-preview-icon {
  flex: 0 0 40px;
}

.image-preview-copy {
  min-width: 0;
  color: #dddddf;
}

.image-preview-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  color: #121214;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.image-preview-item button:hover,
.image-preview-item button:focus-visible {
  background: #ffffff;
  outline: none;
}

.image-preview-item > button svg {
  width: 13px;
  height: 13px;
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: min(820px, 100%);
  min-height: 18px;
  padding: 0 12px;
}

.composer-warning {
  min-width: 0;
  margin: 0;
  color: #ff9e9e;
  font-size: 0.74rem;
  line-height: 1.3;
}

.composer textarea {
  min-width: 0;
  max-height: 150px;
  min-height: 40px;
  height: 40px;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border: 0;
  padding: 10px 2px;
  color: var(--text);
  background: transparent;
  outline: none;
}

.composer textarea::-webkit-scrollbar {
  display: none;
}

.composer textarea::placeholder {
  color: #8b8b94;
}

.tool-button,
.send-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.composer .tool-button {
  border-color: transparent;
  color: #f1f1f3;
  background: transparent;
  box-shadow: none;
}

.composer .tool-button:hover,
.composer .tool-button:focus-visible,
.composer .tool-button.is-active {
  border-color: transparent;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

.send-button {
  position: relative;
  border-color: var(--accent);
  color: var(--accent-contrast);
  background: var(--accent);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.send-button .stop-icon {
  display: none;
}

.send-button.is-stopping .send-icon {
  display: none;
}

.send-button.is-stopping .stop-icon {
  display: block;
  fill: currentColor;
  stroke: none;
}

.send-button.is-stopping::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #f4f4f5;
  background: #17171c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.send-button.is-stopping:hover::after,
.send-button.is-stopping:focus-visible::after,
.send-button.is-stopping:active::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ai-disclaimer {
  width: 100%;
  justify-self: center;
  margin: 0;
  padding: 0 12px;
  color: #8a8a94;
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
}

.settings-overlay,
.confirm-overlay,
.profile-overlay,
.sources-overlay,
.gallery-preview-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 3, 4, 0.66);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: modalOverlayIn 160ms ease both;
}

.settings-card,
.confirm-card,
.profile-editor,
.sources-panel,
.gallery-preview-panel {
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  animation: modalCardIn 180ms ease both;
}

.profile-editor {
  display: grid;
  gap: 18px;
  width: min(470px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--radius-xl);
}

.profile-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-editor-header h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 720;
}

.profile-close-button {
  flex: 0 0 auto;
}

.profile-picture-editor {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 8px auto 12px;
}

.profile-picture-preview {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  overflow: hidden;
  border: 2px solid var(--accent-border);
  border-radius: 50%;
  color: var(--accent-contrast);
  background-color: var(--accent);
  background-position: center;
  background-size: cover;
  font-size: 2.8rem;
  font-weight: 520;
}

.profile-picture-preview.has-image {
  color: transparent;
}

.profile-picture-button {
  position: absolute;
  right: 0;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  color: var(--text);
  background: var(--panel-3);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.profile-picture-button:hover,
.profile-picture-button:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.profile-picture-button svg {
  width: 17px;
  height: 17px;
}

.profile-fields {
  display: grid;
  gap: 10px;
}

.profile-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.profile-field:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.profile-field > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
}

.profile-field input {
  width: 100%;
  min-width: 0;
  height: 25px;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  outline: none;
  font-size: 0.92rem;
}

.profile-username-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px;
}

.profile-username-input i {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: normal;
}

.profile-help,
.profile-error {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}

.profile-help {
  color: var(--muted);
  text-align: center;
}

.profile-error {
  min-height: 18px;
  color: #f87171;
  text-align: center;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.profile-actions .ghost-button,
.profile-save-button {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 15px;
}

.profile-save-button {
  border: 1px solid var(--accent);
  color: var(--accent-contrast);
  background: var(--accent);
  font-weight: 740;
}

.profile-save-button:hover,
.profile-save-button:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  outline: none;
}

.gallery-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 26px clamp(16px, 3vw, 38px) 30px;
  background: var(--bg);
}

.gallery-view-header {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 48px;
}

.gallery-view-header h1 {
  grid-column: 2;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(1.42rem, 2.2vw, 2rem);
  font-weight: 640;
  letter-spacing: 0;
  line-height: 1.12;
  text-align: center;
}

.gallery-mobile-menu-button {
  grid-column: 1;
  justify-self: start;
}

.gallery-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.gallery-preview-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.gallery-status {
  min-height: 22px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  align-content: start;
  gap: 18px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.gallery-grid::-webkit-scrollbar {
  width: 8px;
}

.gallery-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.gallery-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  align-content: start;
  background: transparent;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.gallery-card:hover,
.gallery-card:focus-within {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.gallery-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 16px;
  background: #030304;
  cursor: pointer;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img,
.gallery-thumb:focus-within img {
  transform: scale(1.025);
}

.gallery-image-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 160ms ease;
}

.gallery-thumb:hover .gallery-image-overlay,
.gallery-thumb:focus-visible .gallery-image-overlay,
.gallery-thumb:focus-within .gallery-image-overlay {
  opacity: 1;
}

.gallery-image-actions,
.gallery-preview-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gallery-action-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.gallery-action-button:hover,
.gallery-action-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
  outline: none;
}

.gallery-action-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.gallery-action-button.is-done {
  border-color: var(--accent-border);
  color: var(--accent-contrast);
  background: var(--accent-soft);
}

.gallery-action-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-card-info {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0 2px;
}

.gallery-card-info p,
.gallery-card-info small {
  margin: 0;
  line-height: 1.35;
}

.gallery-card-info p {
  display: -webkit-box;
  overflow: hidden;
  color: #e8e8eb;
  font-size: 0.83rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gallery-card-info small {
  color: var(--faint);
  font-size: 0.73rem;
}

.gallery-preview-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  padding: 14px;
  border-radius: 20px;
  background: rgba(12, 12, 15, 0.96);
}

.gallery-preview-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 190px);
  justify-self: center;
  border-radius: var(--radius);
  object-fit: contain;
  background: #030304;
}

.gallery-preview-close-button {
  flex: 0 0 auto;
}

.gallery-preview-actions {
  justify-self: center;
}

.gallery-preview-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.sources-panel {
  display: grid;
  gap: 14px;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: rgba(14, 14, 17, 0.96);
}

.sources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sources-header h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 720;
}

.sources-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: min(430px, calc(100dvh - 130px));
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.source-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
}

.source-item:hover,
.source-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
}

.source-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #f2f2f4;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 720;
}

.source-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.source-copy strong,
.source-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-copy strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.source-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.settings-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 32px));
  height: min(680px, calc(100dvh - 32px));
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-header h2,
.settings-header p,
.settings-section h3,
.settings-section p,
.confirm-card h2,
.confirm-card p {
  margin: 0;
}

.settings-header h2,
.confirm-card h2 {
  font-size: 1.08rem;
  font-weight: 720;
  letter-spacing: 0;
}

.settings-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.settings-close {
  flex: 0 0 auto;
}

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 0;
}

.settings-tabs {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
  border-right: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel-2) 58%, transparent);
}

.settings-tab {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: color 150ms ease, background 150ms ease;
}

.settings-tab svg {
  width: 18px;
  height: 18px;
}

.settings-tab:hover,
.settings-tab:focus-visible,
.settings-tab.is-active {
  color: var(--text);
  background: var(--accent-soft);
  outline: none;
}

.settings-content {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.settings-panel {
  display: grid;
  gap: 14px;
}

.settings-section {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--panel-2) 44%, transparent);
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 720;
}

.settings-section p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.48;
}

.settings-options {
  display: grid;
  gap: 10px;
}

.settings-options.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-choice {
  position: relative;
  min-width: 0;
}

.settings-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-choice span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  font-size: 0.88rem;
  font-weight: 680;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.settings-choice input:checked + span {
  border-color: var(--accent-border);
  color: var(--accent-contrast);
  background: var(--accent);
}

.accent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.accent-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px;
  color: var(--text);
  background: var(--panel);
  font-size: 0.86rem;
  font-weight: 650;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.accent-option:hover,
.accent-option:focus-visible,
.accent-option.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  outline: none;
}

.accent-option.is-active {
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.accent-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: #f5f5f5;
}

.accent-swatch.default { background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%); }
.accent-swatch.blue { background: #3b82f6; }
.accent-swatch.purple { background: #8b5cf6; }
.accent-swatch.yellow { background: #eab308; }
.accent-swatch.green { background: #22c55e; }
.accent-swatch.red { background: #ef4444; }

.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row i {
  position: relative;
  width: 44px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--panel-3);
  transition: background 150ms ease, border-color 150ms ease;
}

.switch-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 150ms ease;
}

.switch-row input:checked + i {
  border-color: var(--accent-border);
  background: var(--accent);
}

.switch-row input:checked + i::after {
  transform: translateX(18px);
}

.info-list {
  display: grid;
}

.info-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
  min-height: 52px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span {
  color: var(--muted);
  font-size: 0.85rem;
}

.info-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 680;
}

.danger-section {
  border-color: rgba(239, 68, 68, 0.32);
  background: var(--danger-soft);
}

.danger-button,
.secondary-action-button {
  min-height: 42px;
  width: fit-content;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 720;
}

.danger-button {
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ffffff;
  background: var(--danger);
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #dc2626;
  outline: none;
}

.secondary-action-button {
  border: 1px solid var(--accent-border);
  color: var(--text);
  background: var(--accent-soft);
}

.secondary-action-button:hover,
.secondary-action-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.session-list,
.memory-list {
  display: grid;
  gap: 8px;
}

.session-item,
.memory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.session-item:hover,
.session-item:focus-within,
.memory-item:hover,
.memory-item:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.session-item strong,
.memory-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.session-item span,
.memory-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.memory-item em {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 0.72rem;
  font-style: normal;
}

.session-copy,
.memory-copy {
  min-width: 0;
}

.session-actions,
.memory-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.session-end-button,
.memory-delete-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 720;
  cursor: pointer;
}

.session-end-button:hover,
.session-end-button:focus-visible,
.memory-delete-button:hover,
.memory-delete-button:focus-visible {
  border-color: rgba(239, 68, 68, 0.62);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  outline: none;
}

.session-end-button:disabled,
.memory-delete-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.memory-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.8rem;
}

.session-current {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--accent-border);
  border-radius: var(--pill);
  color: var(--text);
  background: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 720;
}

.confirm-card {
  display: grid;
  gap: 11px;
  width: min(470px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 20px;
}

.confirm-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.confirm-actions .ghost-button,
.confirm-actions .danger-button {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 14px;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalCardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 42px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  color: #eeeeee;
  background: rgba(16, 16, 20, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

:root[data-theme="light"] .login-view {
  background: #f7f7f8;
}

:root[data-theme="light"] .login-card,
:root[data-theme="light"] .sidebar,
:root[data-theme="light"] .composer,
:root[data-theme="light"] .account-menu,
:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
}

:root[data-theme="light"] .sidebar-nav button,
:root[data-theme="light"] .recent-chat,
:root[data-theme="light"] .account-menu-item,
:root[data-theme="light"] .account-menu-icon,
:root[data-theme="light"] .account-card-chevron,
:root[data-theme="light"] .account-menu-chevron {
  color: var(--text);
}

:root[data-theme="light"] .account-menu-header-copy span,
:root[data-theme="light"] .message p,
:root[data-theme="light"] .message .markdown-body,
:root[data-theme="light"] .code-block pre code,
:root[data-theme="light"] .text-block-body,
:root[data-theme="light"] .image-preview-item span,
:root[data-theme="light"] .clear-images-button,
:root[data-theme="light"] .image-preview-item button,
:root[data-theme="light"] .guest-auth {
  color: var(--text);
}

:root[data-theme="light"] .message .markdown-body h1,
:root[data-theme="light"] .message .markdown-body h2,
:root[data-theme="light"] .message .markdown-body h3 {
  color: #111111;
}

:root[data-theme="light"] .message .markdown-body a,
:root[data-theme="light"] .message .markdown-body code {
  color: var(--accent-strong);
}

:root[data-theme="light"] .text-block-line strong {
  color: #0f766e;
}

:root[data-theme="light"] .text-block-line em {
  color: #9a3412;
}

:root[data-theme="light"] .inline-citation {
  border-color: rgba(17, 17, 17, 0.14);
  color: #34363b;
  background: rgba(17, 17, 17, 0.065);
}

:root[data-theme="light"] .inline-citation:hover,
:root[data-theme="light"] .inline-citation:focus-visible {
  border-color: rgba(17, 17, 17, 0.28);
  color: #111111;
  background: rgba(17, 17, 17, 0.11);
}

:root[data-theme="light"] .code-block,
:root[data-theme="light"] .phone-panel input,
:root[data-theme="light"] .sidebar-search input,
:root[data-theme="light"] .message-images img {
  background: #ffffff;
}

:root[data-theme="light"] .composer textarea::placeholder {
  color: #767b84;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app,
  .app.sidebar-closed {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar));
    transform: translateX(-106%);
    box-shadow: var(--shadow);
  }

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

  .app.sidebar-closed .sidebar {
    width: min(86vw, var(--sidebar));
    padding: 14px;
    border-right: 1px solid var(--line-soft);
  }

  .floating-open {
    display: none;
  }

  .mobile-menu-button {
    display: grid;
  }

  .chat-topbar {
    padding: 0 12px;
  }

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

  .welcome-panel {
    top: 42%;
  }

  .settings-overlay,
  .confirm-overlay,
  .profile-overlay,
  .sources-overlay,
  .gallery-preview-overlay {
    align-items: stretch;
    padding: 10px;
  }

  .profile-overlay,
  .sources-overlay,
  .gallery-preview-overlay {
    place-items: center;
  }

  .settings-card {
    width: 100%;
    height: calc(100dvh - 20px);
  }

  .gallery-view {
    padding: 18px 12px 20px;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    scrollbar-width: none;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-tab {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 0 12px;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 22px;
  }

  .chat-view {
    grid-template-rows: 54px minmax(0, 1fr) auto;
  }

  .chat-topbar {
    min-height: 54px;
  }

  .conversation {
    gap: 14px;
    padding-top: 8px;
    padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
  }

  .profile-chip {
    min-width: 0;
    padding-right: 2px;
  }

  .profile-chip span:last-child {
    display: none;
  }

  .gallery-view {
    padding: 14px 10px 18px;
  }

  .gallery-view-header h1 {
    font-size: 1.35rem;
  }

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

  .gallery-card-info p {
    font-size: 0.78rem;
  }

  .gallery-action-button {
    width: 40px;
    height: 40px;
  }

  .welcome-logo-wrap {
    width: min(230px, 72vw);
    height: 68px;
  }

  .welcome-panel p {
    font-size: 0.94rem;
  }

  .message {
    width: 100%;
  }

  .message.user {
    display: flex;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
  }

  .message.user .message-content {
    padding: 12px;
  }

  .message-images {
    grid-template-columns: minmax(0, 1fr);
  }

  .message-file {
    max-width: 100%;
  }

  .composer-zone {
    bottom: max(7px, env(safe-area-inset-bottom, 0px));
    width: calc(100% - 28px);
  }

  .composer-bottom-mask {
    height: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .composer {
    grid-template-columns: 38px minmax(0, 1fr) 38px 38px;
    border-radius: 24px;
  }

  .composer.has-composer-tools {
    grid-template-columns: 38px auto minmax(0, 1fr) 38px 38px;
    grid-template-areas:
      "input input input input input"
      "add modes . mic send";
  }

  .composer.has-attachments {
    grid-template-columns: 38px minmax(0, 1fr) 38px 38px;
    grid-template-areas:
      "attachments attachments attachments attachments"
      "input input input input"
      "add . mic send";
  }

  .composer.has-composer-tools.has-attachments {
    grid-template-columns: 38px auto minmax(0, 1fr) 38px 38px;
    grid-template-areas:
      "attachments attachments attachments attachments attachments"
      "input input input input input"
      "add modes . mic send";
  }

  .composer.is-recording,
  .composer.is-transcribing {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "voice";
  }

  .voice-recorder {
    gap: 8px;
  }

  .voice-capture {
    grid-template-columns: 22px minmax(64px, 1fr) auto;
    gap: 8px;
  }

  .voice-status {
    display: none;
  }

  .voice-wave {
    gap: 3px;
  }

  .voice-wave span {
    width: 3px;
  }

  .tool-button,
  .send-button {
    width: 38px;
    height: 38px;
  }

  .image-preview-panel {
    align-items: flex-start;
  }

  .image-preview-item.is-image {
    width: 128px;
    height: 128px;
  }

  .image-preview-item.is-file {
    width: 100%;
  }

  .composer-meta {
    align-items: flex-end;
  }

  .composer-warning {
    font-size: 0.7rem;
  }

  .settings-header {
    min-height: 68px;
    padding: 14px;
  }

  .settings-header p {
    display: none;
  }

  .settings-content {
    padding: 12px;
  }

  .settings-section {
    padding: 13px;
  }

  .settings-options.three-cols,
  .accent-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .info-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 10px 0;
  }

  .session-item,
  .memory-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .profile-editor {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 15px;
  }

  .profile-picture-editor {
    width: 116px;
    height: 116px;
    margin-bottom: 6px;
  }

  .profile-picture-preview {
    width: 112px;
    height: 112px;
    font-size: 2.35rem;
  }

  .profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .confirm-actions .ghost-button,
  .confirm-actions .danger-button,
  .danger-button,
  .secondary-action-button {
    width: 100%;
  }
}

@media (hover: none), (max-width: 900px) {
  .message.user .message-actions {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .gallery-image-overlay {
    align-items: flex-end;
    justify-content: flex-end;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 46%, rgba(0, 0, 0, 0.52) 100%);
    opacity: 1;
  }

  .gallery-image-actions {
    gap: 8px;
  }
}
