/* UI styling for STCS AI Chat Client - Dark OLED Theme */
:root {
  --bg: #000000;
  --panel: #050508;
  --panel-2: #0b0b0f;
  --line: rgba(255, 255, 255, 0.05);
  --line-active: rgba(255, 255, 255, 0.12);
  --text: #f5f6f8;
  --muted: #8e919e;
  --accent: #ffffff;
  --violet: #ffffff;
  --gold: #efb65a;
  --sidebar: 260px;
  --glow-shadow: 0 0 30px rgba(255, 255, 255, 0.02);
  --motion-fast: 120ms;
  --motion-normal: 180ms;
  --motion-base: 190ms;
  --motion-slow: 260ms;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  transition:
    background-color var(--motion-base) var(--ease-out-quart),
    border-color var(--motion-base) var(--ease-out-quart),
    box-shadow var(--motion-base) var(--ease-out-quart),
    color var(--motion-fast) var(--ease-out-quart),
    transform var(--motion-base) var(--ease-out-quint),
    opacity var(--motion-base) var(--ease-out-quart);
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* Ambient glow system */
.ambient {
  display: none !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* App Layout */
.app-shell {
  height: 100%;
  display: flex;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  padding: 24px 18px 18px;
  border-right: 1px solid var(--line);
  background: rgba(4, 4, 6, 0.88);
  backdrop-filter: blur(25px);
  display: flex;
  flex-direction: column;
  z-index: 4;
  animation: stcs-sidebar-enter var(--motion-slow) var(--ease-out-expo) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: none;
  color: #fff;
  padding: 0 8px 26px;
  cursor: pointer;
}

.brand:hover .brand-mark,
.brand:focus-visible .brand-mark,
.mini-mark:hover,
.auth-logo:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.55), 0 0 5px rgba(255, 255, 255, 0.9);
}

.brand-mark,
.mini-mark,
.auth-logo {
  display: grid;
  place-items: center;
  background: #ffffff;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  color: #000000;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.45), 0 0 4px rgba(255, 255, 255, 0.85);
}

.brand-name {
  font: 700 22px 'Manrope', sans-serif;
  letter-spacing: -0.8px;
  background: linear-gradient(to right, #ffffff, #e1e3ec);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.new-chat {
  height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #eee;
  border-radius: 12px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.new-chat:hover {
  border-color: rgba(255, 107, 85, 0.35);
  background: #101014;
  box-shadow: 0 4px 15px rgba(255, 107, 85, 0.05);
}

.new-chat span {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.new-chat b {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.new-chat kbd {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-color: var(--line);
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(143, 120, 255, 0.08);
  border-color: rgba(143, 120, 255, 0.15);
  color: #fff;
}

.nav-item.active .icon {
  color: var(--violet);
}

.icon {
  font-size: 18px;
}

.history-block {
  margin-top: 28px;
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}

.history-block>p {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #585a66;
  padding: 0 14px;
  margin-bottom: 12px;
}

.history-item {
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  text-align: left;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}

.history-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  transform: translateX(2px);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.status-pill {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ba55d;
  box-shadow: 0 0 10px #3ba55d;
}

.profile-button {
  width: 100%;
  border: 0;
  background: none;
  color: #fff;
  padding: 12px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
}

.profile-button:hover {
  background: rgba(255, 255, 255, 0.03);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.45), 0 0 4px rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  position: relative;
  overflow: hidden;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.profile-copy b {
  font-size: 13px;
  font-weight: 600;
}

.profile-copy small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presence-line {
  display: flex !important;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted) !important;
}

.presence-line i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.presence-online i {
  background: #3ba55d;
  box-shadow: 0 0 8px #3ba55d;
}

.presence-idle i {
  background: #faa61a;
  box-shadow: 0 0 8px #faa61a;
}

.presence-dnd i {
  background: #ed4245;
  box-shadow: 0 0 8px #ed4245;
}

.presence-offline i,
.presence-unavailable i,
.presence-unknown i {
  background: #747f8d;
}

.main-panel {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% 0%, #08080c 0%, var(--bg) 100%);
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.mobile-menu {
  display: none;
}

.model-pill {
  height: 36px;
  padding: 0 14px 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(10px);
}

.mini-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 10px;
}

.route-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ba55d;
  box-shadow: 0 0 10px #3ba55d;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions button {
  height: 36px;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover {
  border-color: var(--line-active);
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

.auth-button {
  border: 0;
  background: #fff;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.auth-button:hover {
  background: #f1f2f6;
  transform: translateY(-1px);
}

.plan-badge {
  height: 25px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(143, 120, 255, 0.4);
  background: rgba(143, 120, 255, 0.1);
  color: #ad9cff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

.studio-nav small {
  margin-left: auto;
  font-size: 7px;
  letter-spacing: 0.7px;
  color: #ad9cff;
  border: 1px solid rgba(143, 120, 255, 0.3);
  border-radius: 4px;
  padding: 2px 4px;
}

.studio-locked {
  opacity: 0.62;
}

/* Chat Area */
.chat-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 40px 10% 180px;
}

#floatingScrollBtn {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, 8px);
  margin-bottom: 16px;
  padding: 8px 16px;
  background-color: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  color: #e3e3e6;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s ease, color 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
}

#floatingScrollBtn:hover {
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

#floatingScrollBtn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.welcome {
  max-width: 800px;
  margin: 6vh auto 0;
  text-align: center;
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-mark {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  padding: 1px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 10px 35px rgba(143, 120, 255, 0.25);
  display: grid;
  place-items: center;
}

.hero-mark span {
  width: 100%;
  height: 100%;
  border-radius: 19px;
  background: var(--panel);
  display: grid;
  place-items: center;
  font: 800 26px 'Manrope', sans-serif;
  color: var(--accent);
}

.eyebrow {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.welcome h1 {
  font: 800 clamp(36px, 4.5vw, 64px)/1.05 'Manrope', sans-serif;
  margin: 16px 0 22px;
  letter-spacing: -2px;
  background: linear-gradient(to bottom, #ffffff 35%, #9fa0a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome h1 em {
  font-style: normal;
  background: linear-gradient(to bottom, #ffffff 35%, #9fa0a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro {
  max-width: 500px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

/* Suggestion Buttons */
.suggestions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 48px;
}

.suggestions button {
  min-width: 0;
  height: 94px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 18px;
  gap: 14px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.suggestions button:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 255, 255, 0.02);
}

.suggestion-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

.coral {
  background: rgba(255, 107, 85, 0.1);
  color: var(--accent);
}

.violet {
  background: rgba(143, 120, 255, 0.1);
  color: #a895ff;
}

.gold {
  background: rgba(239, 182, 90, 0.1);
  color: var(--gold);
}

.suggestions button>span:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.suggestions b {
  font-size: 13px;
  font-weight: 600;
}

.suggestions small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestions i {
  font-style: normal;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.2);
  font-size: 14px;
}

/* Chat Messages */
.messages {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 20px;
}

.message,
.message-enter {
  display: flex;
  gap: 16px;
  margin: 0 0 32px;
  animation: stcs-message-in var(--motion-slow) var(--ease-out-expo) both;
}

.message.user,
.message-enter.user {
  justify-content: flex-end;
  animation-name: stcs-user-message-in;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #000000;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.45), 0 0 3px rgba(255, 255, 255, 0.85);
}

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

.message.user .message-content {
  max-width: 78%;
}

.message-body {
  line-height: 1.68;
  font-size: 14.5px;
  color: #e5e6eb;
}

.message.user .message-body {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px 18px 4px 18px;
  padding: 12px 18px;
  max-width: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.message-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, max-content));
  justify-content: end;
  gap: 8px;
  margin: 0 0 8px;
}

.message-attachment-thumb,
.message-attachment-card {
  width: min(240px, 62vw);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: #f4f4f5;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  animation: stcs-attachment-in var(--motion-slow) var(--ease-out-expo) both;
  transform-origin: right bottom;
}

.message-attachment-thumb {
  position: relative;
  display: block;
  padding: 0;
  cursor: zoom-in;
  isolation: isolate;
  transition:
    transform var(--motion-fast) var(--ease-out-quint),
    border-color var(--motion-fast) var(--ease-out-quart),
    background var(--motion-fast) var(--ease-out-quart),
    box-shadow var(--motion-fast) var(--ease-out-quart);
}

.message-attachment-thumb:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(168, 149, 255, 0.36);
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(168, 149, 255, 0.08);
}

.message-attachment-thumb:active {
  transform: translateY(0) scale(0.99);
}

.message-attachment-thumb img {
  display: block;
  width: 100%;
  height: 156px;
  object-fit: cover;
  background: #09090d;
  transition: transform var(--motion-slow) var(--ease-out-quint), filter var(--motion-slow) var(--ease-out-quart);
}

.message-attachment-thumb:hover img {
  transform: scale(1.025);
  filter: saturate(1.06);
}

.message-attachment-fallback {
  display: none;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(9, 9, 13, 0.82);
  color: #c4c8d4;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.message-attachment-thumb.preview-failed img {
  display: none;
}

.message-attachment-thumb.preview-failed .message-attachment-fallback {
  display: flex;
}

.message-attachment-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
}

.message-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.message-attachment-status {
  flex: 0 0 auto;
  color: #aeb3c2;
  font-size: 10.5px;
  font-weight: 600;
}

.message-attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 58px;
}

.message-attachment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(99, 102, 241, 0.14);
  color: #b7c4ff;
  font-size: 11px;
  font-weight: 800;
}

.message-attachment-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.message.assistant .message-body {
  padding-top: 2px;
  max-width: none;
}

.message-body p {
  margin: 0 0 12px;
}

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

.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  animation: stcs-overlay-in var(--motion-base) var(--ease-out-quart) both;
}

.attachment-preview-dialog {
  position: relative;
  display: grid;
  gap: 10px;
  max-width: min(920px, 94vw);
  max-height: 88vh;
  margin: 0;
  animation: stcs-preview-in var(--motion-slow) var(--ease-out-expo) both;
}

.attachment-preview-dialog img {
  max-width: min(920px, 94vw);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #06060a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.attachment-preview-dialog figcaption {
  justify-self: center;
  max-width: min(680px, 88vw);
  color: #d9dce5;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #111119;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.36);
}

.attachment-preview-close:hover {
  transform: scale(1.04);
  background: #171722;
}

.route-badge {
  width: max-content;
  max-width: 100%;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: capitalize;
}

.route-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
}

/* Typing effect */
.typing {
  display: inline-flex;
  gap: 10px;
  padding: 9px 12px;
  align-items: center;
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.026);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 24px rgba(0, 0, 0, 0.16);
}

.typing-label {
  color: #cfd3df;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.typing i {
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: stcs-typing-dot 1.05s var(--ease-out-quart) infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

/* Composer / Prompt Input */
.composer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px max(10%, 36px) 20px;
  background: linear-gradient(transparent 0%, #030305 60%);
  z-index: 3;
}

.composer {
  max-width: 800px;
  min-height: 58px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 9, 12, 0.82);
  backdrop-filter: blur(25px);
  border-radius: 18px;
  display: flex;
  align-items: flex-end;
  padding: 8px 10px;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateZ(0);
}

.composer:focus-within {
  border-color: rgba(143, 120, 255, 0.4);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), var(--glow-shadow);
  transform: translateY(-1px);
}

.composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  padding: 10px 4px;
  font-size: 14px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #5d5f6e;
}

.composer-tools {
  display: flex;
  align-items: center;
  padding-bottom: 6px;
  gap: 4px;
}

.tool-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.tool-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  transform: translateY(-1px);
}

.tool-button:active {
  transform: scale(0.94);
}

.composer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}

.model-select {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.model-select:hover {
  color: #fff;
}

.model-select small {
  margin-left: 3px;
  opacity: 0.7;
}

.send-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #ee4d46 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 85, 0.3);
  display: grid;
  place-items: center;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 107, 85, 0.4);
}

.send-button:active {
  transform: scale(0.94);
}

.send-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.disclaimer {
  text-align: center;
  color: #4a4b56;
  font-size: 10px;
  margin: 10px 0 0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 1, 2, 0.85);
  backdrop-filter: blur(15px);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-modal {
  width: min(440px, 100%);
  max-height: 94vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #09090b;
  border-radius: 24px;
  padding: 36px 40px 32px;
  position: relative;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 50px rgba(143, 120, 255, 0.05);
}

.close-modal {
  position: absolute;
  right: 20px;
  top: 18px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
}

.close-modal:hover {
  color: #fff;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin: 0 auto 20px;
  font-size: 18px;
}

.auth-modal>.eyebrow,
.auth-modal h2,
.auth-subtitle {
  text-align: center;
}

.auth-modal h2 {
  font: 700 26px 'Manrope', sans-serif;
  margin: 10px 0 6px;
  color: #fff;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
}

.auth-tabs {
  height: 40px;
  border-radius: 10px;
  background: #040406;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
  border: 1px solid var(--line);
}

.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.auth-tabs button.active {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.auth-modal form {
  display: grid;
  gap: 16px;
}

.auth-modal label {
  font-size: 11px;
  font-weight: 600;
  color: #a1a2aa;
  display: grid;
  gap: 8px;
}

.auth-modal input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #040406;
  color: #fff;
  padding: 0 14px;
  outline: 0;
}

.auth-modal input:focus {
  border-color: rgba(143, 120, 255, 0.5);
  box-shadow: 0 0 15px rgba(143, 120, 255, 0.1);
}

.form-error {
  color: #ff5b5b;
  font-size: 11px;
  margin: 0;
  min-height: 15px;
}

.primary-auth,
.discord-button {
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

.primary-auth {
  border: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #ee4d46 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 85, 0.25);
}

.primary-auth:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 107, 85, 0.35);
}

.divider {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555762;
  font-size: 10px;
  position: relative;
}

.divider:before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

.divider span {
  background: #09090b;
  padding: 0 12px;
  z-index: 1;
}

.discord-button {
  background: #5865f2;
  color: #fff;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.2);
}

.discord-button:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

.discord-button svg {
  width: 20px;
}

.terms {
  text-align: center;
  color: #50515b;
  font-size: 10px;
  margin: 20px 0 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(14, 14, 18, 0.9);
  color: #f3f4f6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 30;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  animation: stcs-toast-in var(--motion-slow) var(--ease-out-expo) both;
}

.toast.error {
  border-color: rgba(255, 91, 91, 0.3);
  background: rgba(255, 91, 91, 0.05);
}

.toast.success {
  border-color: rgba(59, 165, 93, 0.3);
  background: rgba(59, 165, 93, 0.05);
}

/* Animations */
@keyframes stcs-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes stcs-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes stcs-scale-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

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

@keyframes stcs-soft-pop {
  0% {
    opacity: 0;
    transform: scale(0.97);
  }

  70% {
    opacity: 1;
    transform: scale(1.012);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes stcs-shimmer {
  from {
    transform: translateX(-120%);
  }

  to {
    transform: translateX(120%);
  }
}

@keyframes stcs-pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }

  50% {
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.08);
  }
}

@keyframes stcs-message-in {
  from {
    opacity: 0;
    transform: translate3d(-8px, 10px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes stcs-user-message-in {
  from {
    opacity: 0;
    transform: translate3d(10px, 10px, 0) scale(0.985);
  }

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

@keyframes stcs-attachment-in {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.975);
    filter: blur(2px);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes stcs-preview-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

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

@keyframes stcs-overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes stcs-toast-in {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.98);
  }

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

@keyframes stcs-sidebar-enter {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes stcs-typing-dot {

  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  35% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* Rich Markdown Content Styling */
.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
  font-family: 'Manrope', sans-serif;
  color: #fff;
  line-height: 1.3;
  margin: 28px 0 12px;
  letter-spacing: -0.5px;
}

.message-body h1 {
  font-size: 24px;
}

.message-body h2 {
  font-size: 20px;
}

.message-body h3 {
  font-size: 17px;
}

.message-body h4 {
  font-size: 15px;
}

.message-body>h1:first-child,
.message-body>h2:first-child,
.message-body>h3:first-child {
  margin-top: 0;
}

.message-body strong {
  color: #fff;
  font-weight: 700;
}

.message-body em {
  color: #dfdfe6;
}

.message-body ul,
.message-body ol {
  margin: 10px 0 18px;
  padding-left: 24px;
}

.message-body li {
  margin: 6px 0;
  padding-left: 4px;
}

.message-body li::marker {
  color: var(--violet);
}

.message-body a {
  color: #a895ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 149, 255, 0.4);
}

.message-body a:hover {
  color: #c0b3ff;
  border-bottom-color: #c0b3ff;
}

.message-body blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--violet);
  background: rgba(143, 120, 255, 0.05);
  color: #c5c7d0;
  border-radius: 0 10px 10px 0;
}

.message-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}

/* Inline code formatting */
.message-body p code,
.message-body li code,
.message-body td code {
  font-family: Consolas, "JetBrains Mono", monospace;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffa38c;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.88em;
}

/* Monospace Math Matrices */
.math-matrix {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.45;
  color: #60a5fa;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  display: inline-block;
  white-space: pre;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Code Blocks */
.code-block {
  margin: 20px 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  overflow: hidden;
  background: #050508;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
}

.code-header {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
  background: #0c0c11;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font: 500 11px 'Manrope', sans-serif;
  text-transform: lowercase;
}

.code-header>div {
  display: flex;
  gap: 6px;
}

.copy-code,
.studio-code {
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: #b3b5c0;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}

.copy-code:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.studio-code {
  border-color: rgba(143, 120, 255, 0.3);
  background: rgba(143, 120, 255, 0.05);
  color: #ad9cff;
}

.studio-code:hover {
  border-color: rgba(143, 120, 255, 0.5);
  color: #fff;
  background: rgba(143, 120, 255, 0.1);
}

.message-body .code-block pre {
  margin: 0;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
  line-height: 1.6;
}

.message-body .code-block code {
  font-family: Consolas, "JetBrains Mono", monospace;
  font-size: 13px;
  color: #e2e4f0;
  white-space: pre;
  tab-size: 2;
}

/* Tables */
.table-wrap {
  margin: 18px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.message-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.message-body th,
.message-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.message-body th {
  background: #09090c;
  color: #fff;
  font-weight: 600;
}

.message-body tr:last-child td {
  border-bottom: 0;
}

.stream-caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--accent);
  border-radius: 1px;
  animation: blink 0.8s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.planning-box {
  position: relative;
  margin: 0 0 18px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(125, 145, 255, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(13, 15, 24, 0.88), rgba(7, 7, 11, 0.82));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  animation: stcs-slide-up var(--motion-slow) var(--ease-out-expo) both;
}

.planning-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.045) 42%, transparent 72%);
  transform: translateX(-120%);
  animation: stcs-shimmer 1.8s var(--ease-out-quart) infinite;
}

.plan-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.plan-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #eef2ff;
  font-size: 13px;
  font-weight: 800;
}

.plan-title-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(184, 191, 255, 0.8));
  box-shadow: 0 0 16px rgba(160, 174, 255, 0.18);
}

.plan-status {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.plan-steps,
.plan-checklist {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.plan-step {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 650;
  animation: stcs-plan-row-in var(--motion-slow) var(--ease-out-expo) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.plan-step-icon {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.plan-step.done {
  color: #e8fff4;
}

.plan-step.done .plan-step-icon {
  display: grid;
  place-items: center;
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.14);
  animation: stcs-soft-pop var(--motion-base) var(--ease-out-quint) both;
}

.plan-step.done .plan-step-icon::before {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid #86efac;
  border-bottom: 2px solid #86efac;
  transform: rotate(-45deg) translateY(-1px);
}

.plan-step.active {
  color: #dbeafe;
}

.plan-step.active .plan-step-icon {
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(96, 165, 250, 0.14);
  box-shadow: 0 0 18px rgba(96, 165, 250, 0.15);
  animation: stcs-pulse-glow 1.4s var(--ease-out-quart) infinite;
}

.plan-step.active .plan-step-icon::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 4px;
  border-radius: 999px;
  background: #93c5fd;
}

@keyframes stcs-plan-row-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

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

/* Responsive Overrides */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 998;
  will-change: opacity;
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

body.sidebar-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

.sidebar {
  will-change: transform;
  z-index: 999;
}

.app-shell {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

@media (max-width: 1024px) {
  html, body {
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 70px rgba(0, 0, 0, 0.8);
    z-index: 1000 !important;
    animation: none;
  }

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

  .mobile-menu {
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transition: background 0.2s;
  }
  .mobile-menu:active {
    background: rgba(255, 255, 255, 0.05);
  }

  .topbar {
    padding: 0 16px;
    height: 60px;
  }

  .ghost-button {
    display: none;
  }

  .chat-area {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 120px;
  }

  .welcome {
    margin-top: 4vh;
    padding: 0 8px;
  }

  .suggestions {
    grid-template-columns: 1fr;
    margin-top: 24px;
    gap: 10px;
  }

  .suggestions button {
    height: auto;
    min-height: 64px;
    padding: 12px 16px;
  }

  .composer-wrap {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 12px;
    background: #000000;
    z-index: 990;
    transition: bottom 0.1s ease-out;
  }

  .welcome h1 {
    letter-spacing: -1px;
    font-size: 32px !important;
  }

  .auth-modal {
    padding: 24px 20px;
    width: 90% !important;
    max-width: 400px;
  }

  .message-content,
  .message.user .message-content {
    max-width: 100% !important;
    font-size: 14px;
  }

  .message-body h1 {
    font-size: 18px;
  }

  .message-body h2 {
    font-size: 16px;
  }

  .code-block {
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
  }

  .message-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .message-attachments {
    grid-template-columns: 1fr;
    justify-items: end;
  }

  .message-attachment-thumb,
  .message-attachment-card {
    width: min(180px, 72vw);
  }

  .message-attachment-thumb img {
    height: 124px;
  }

  .attachment-preview-overlay {
    padding: 14px;
  }

  .attachment-preview-dialog img {
    border-radius: 12px;
  }

  .attachment-preview-close {
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 768px) {
  .composer-container {
    border-radius: 16px;
  }
  #promptInput {
    padding: 12px 16px 8px 16px;
    min-height: 56px;
    font-size: 14px;
  }
}

@media (max-height: 720px) and (min-width: 801px) {
  .welcome {
    margin-top: 0;
  }

  .hero-mark {
    margin-bottom: 14px;
  }

  .welcome h1 {
    font-size: 42px;
    margin: 8px 0 14px;
  }

  .suggestions {
    margin-top: 28px;
  }
}

/* Background floating paths animation styles */
.background-paths-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.background-paths-svg {
  width: 100%;
  height: 100%;
  opacity: 0.65;
  display: block;
}

.background-paths-svg path {
  stroke-linecap: round;
  animation: pathFlow var(--path-duration, 25s) linear infinite;
}

@keyframes pathFlow {
  0% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -1600;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Academic Onboarding & Profile Styles */
.academic-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.academic-card.selected {
  border-color: #3b82f6 !important;
  background-color: rgba(59, 130, 246, 0.08) !important;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.25), inset 0 1px rgba(255, 255, 255, 0.05);
}
.academic-badge-option {
  transition: all 0.20s ease;
}
.academic-badge-option.selected {
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  background-color: rgba(59, 130, 246, 0.15) !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

/* Math & KaTeX Rendering Layouts */
.katex-display-container {
  overflow: visible;
  width: fit-content;
  max-width: 100%;
  margin: 12px 0 !important;
  padding: 10px 14px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.018) !important;
  border-color: rgba(255, 255, 255, 0.055) !important;
  box-shadow: none;
}
.katex-display-container .katex-display {
  margin: 0 !important;
}
.katex-display-container .overflow-x-auto {
  padding-right: 0.35rem;
}
.math-final-answer {
  margin: 16px auto 14px !important;
  padding: 12px 18px !important;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.13), rgba(59, 130, 246, 0.075)) !important;
  border-color: rgba(167, 139, 250, 0.28) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.math-final-answer .overflow-x-auto {
  display: flex;
  justify-content: center;
}
.math-final-answer .katex {
  color: #ffffff !important;
}
.math-final-answer .katex .fbox {
  border-color: rgba(255, 255, 255, 0.72) !important;
  border-radius: 6px;
  padding: 0.22em 0.42em !important;
  background: rgba(255, 255, 255, 0.045);
}
.copy-math-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1e2030;
  color: #a5adba;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transform: translateY(1px) scale(0.96);
  transition:
    color var(--motion-fast) var(--ease-out-quart),
    border-color var(--motion-fast) var(--ease-out-quart),
    opacity var(--motion-fast) var(--ease-out-quart),
    transform var(--motion-fast) var(--ease-out-quint);
}
.katex-display-container:hover .copy-math-btn,
.katex-display-container:focus-within .copy-math-btn,
.copy-math-btn:focus-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.copy-math-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
}
.copy-math-btn:active {
  transform: scale(0.95);
}
.katex {
  font-size: 1.02em !important;
  color: #f3f4f6 !important;
}
@media (max-width: 768px) {
  .katex-display-container {
    width: 100%;
    margin: 10px 0 !important;
    padding: 9px 10px !important;
    border-radius: 9px !important;
  }
  .math-final-answer {
    width: fit-content;
    max-width: 100%;
    padding: 10px 14px !important;
  }
  .katex {
    font-size: 0.94em !important;
  }
  .copy-math-btn {
    width: 23px;
    height: 23px;
  }
}
.katex-error {
  color: #f87171 !important;
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 3px 6px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .message,
  .message.user,
  .message-attachment-thumb,
  .message-attachment-card,
  .attachment-preview-overlay,
  .attachment-preview-dialog,
  .toast,
  .sidebar {
    animation-name: none !important;
    filter: none !important;
    transform: none;
  }

}

@media (prefers-reduced-motion: reduce) and (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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