:root {
  color-scheme: dark;
  --bg: #000;
  --sidebar: rgba(1, 4, 15, 0.035);
  --sidebar-border: rgba(255, 255, 255, 0.12);
  --hover: rgba(255, 255, 255, 0.1);
  --active: rgba(255, 255, 255, 0.16);
  --composer: #2b2b2b;
  --composer-border: #3a3a3a;
  --text: #f4f4f4;
  --muted: #b4b4b4;
  --subtle: #7f7f7f;
  --line: #242424;
  --user-bubble: #303030;
  --learny-bubble: rgba(20, 20, 22, 0.86);
  --error: #ff6b6b;
  --ready: #d8d8d8;
  --accent: #5865ff;
  --accent-2: #6e75ff;
  --accent-3: #3d8bff;
  --radius: 8px;
  --sidebar-width: 292px;
  --sidebar-gutter: 14px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

body.sidebar-lock {
  overflow: hidden;
}

.page-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 9px 18px;
  border: 0;
  border-radius: 0;
  color: #130f00;
  background: #ffd83d;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-size: 0.95rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  opacity: 0;
  transform: translateY(-100%);
  animation: pageUpdateBannerIn 240ms ease forwards;
}

.page-update-banner:hover {
  background: #ffe066;
}

.page-update-banner:active {
  background: #f2c400;
}

.page-update-banner:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.86);
  outline-offset: -5px;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #d8d8d8;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
  transition: grid-template-columns 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.star-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
  pointer-events: none;
  contain: paint;
}

.star-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 0 42%, rgba(0, 0, 0, 0.42) 78%, rgba(0, 0, 0, 0.82) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.44), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.44));
}

.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: rgba(255, 255, 255, var(--opacity));
  box-shadow: 0 0 var(--glow) rgba(210, 224, 255, var(--glow-opacity));
  opacity: var(--opacity);
  transform: translate3d(0, 0, 0);
  animation: starDrift var(--duration) linear var(--delay) infinite alternate;
  backface-visibility: hidden;
  will-change: transform;
}

.sidebar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) max-content;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 12px var(--sidebar-gutter);
  border-right: 1px solid var(--sidebar-border);
  background:
    linear-gradient(180deg, rgba(3, 10, 31, 0.1), rgba(0, 0, 0, 0.04)),
    linear-gradient(115deg, rgba(6, 18, 52, 0.05), rgba(0, 0, 0, 0.02) 56%, rgba(0, 0, 0, 0.07)),
    var(--sidebar);
  box-shadow:
    inset -1px 0 rgb(24, 24, 24),
    inset 0 1px rgba(155, 155, 155, 0.08),
    18px 0 60px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  backdrop-filter: blur(2px) saturate(1.08);
  -webkit-backdrop-filter: blur(2px) saturate(1.08);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: -40% -26%;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 16%, rgba(8, 24, 72, 0.06), transparent 0 22%, transparent 38%),
    radial-gradient(circle at 82% 72%, rgba(1, 7, 22, 0.1), transparent 0 42%),
    linear-gradient(145deg, rgba(2, 11, 34, 0.07), transparent 48%, rgba(0, 0, 0, 0.14));
  filter: none;
  opacity: 0.16;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  animation: sidebarAura 13s ease-in-out infinite alternate;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-scrim {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 2px 2px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 70px;
  height: 70px;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  box-shadow: none;
}

.brand-name {
  color: rgba(255, 255, 255, 0.94);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.account-button {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(88, 101, 255, 0.18), rgba(255, 255, 255, 0.045) 52%, rgba(61, 139, 255, 0.13));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 14px 34px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.account-button::before {
  content: "";
  position: absolute;
  inset: -40% -55%;
  background: linear-gradient(110deg, transparent 16%, rgba(255, 255, 255, 0.16), transparent 48%);
  opacity: 0;
  transform: translateX(-72%);
  pointer-events: none;
  transition: opacity 220ms ease, transform 620ms ease;
}

.account-button:hover,
.account-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(88, 101, 255, 0.28), rgba(255, 255, 255, 0.06) 52%, rgba(61, 139, 255, 0.2));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.14),
    0 18px 40px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.account-button:hover::before,
.account-button:focus-visible::before {
  opacity: 1;
  transform: translateX(72%);
}

.account-button.signed-in {
  border-color: rgba(126, 220, 137, 0.2);
  background:
    radial-gradient(circle at 18% 12%, rgba(126, 220, 137, 0.17), transparent 34%),
    linear-gradient(135deg, rgba(88, 101, 255, 0.2), rgba(255, 255, 255, 0.045) 52%, rgba(126, 220, 137, 0.12));
}

.admin-nav-button {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-height: 46px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(118, 162, 255, 0.16);
  border-radius: 15px;
  background:
    radial-gradient(circle at 18% 18%, rgba(116, 171, 255, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(29, 49, 92, 0.64), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 14px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.admin-nav-button[hidden] {
  display: none;
}

.admin-nav-button::before {
  content: "";
  position: absolute;
  inset: -55% -70%;
  background: linear-gradient(105deg, transparent 24%, rgba(134, 180, 255, 0.22), transparent 58%);
  opacity: 0;
  transform: translateX(-62%);
  transition: opacity 220ms ease, transform 720ms ease;
  pointer-events: none;
}

.admin-nav-button:hover,
.admin-nav-button:focus-visible,
.admin-nav-button.active {
  border-color: rgba(142, 188, 255, 0.34);
  background:
    radial-gradient(circle at 18% 18%, rgba(116, 171, 255, 0.3), transparent 34%),
    linear-gradient(135deg, rgba(34, 59, 111, 0.82), rgba(255, 255, 255, 0.06));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.14),
    0 18px 38px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.admin-nav-button:hover::before,
.admin-nav-button:focus-visible::before,
.admin-nav-button.active::before {
  opacity: 1;
  transform: translateX(68%);
}

.admin-nav-button span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
  place-items: center;
  text-align: center;
}

.admin-nav-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-button strong {
  color: rgba(247, 250, 255, 0.96);
  font-size: 0.9rem;
  font-weight: 780;
}

.account-orb {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9efff;
  box-shadow:
    0 10px 24px rgba(68, 90, 255, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

.account-orb img,
.account-avatar-large img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

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

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

.account-copy strong {
  font-size: 0.84rem;
  font-weight: 650;
}

.account-copy small {
  color: var(--subtle);
  font-size: 0.72rem;
}

.rate-limit-open {
  overflow: hidden;
}

.attachment-auth-open {
  overflow: hidden;
}

.guest-access-open {
  overflow: hidden;
}

.app-shell.account-mode {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.account-mode .sidebar,
.app-shell.account-mode .sidebar-scrim {
  display: none;
}

.main-area.account-mode {
  grid-template-rows: minmax(0, 1fr);
}

.main-area.account-mode .top-bar,
.main-area.account-mode .chat-panel,
.main-area.account-mode .admin-portal {
  display: none;
}

.account-modal {
  position: relative;
  z-index: 4;
  display: grid;
  grid-row: 1 / -1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  place-items: stretch;
}

.account-modal[hidden],
.account-modal-view[hidden],
.account-danger-confirm[hidden],
.rate-limit-modal[hidden],
.guest-access-modal[hidden],
.attachment-limit-modal[hidden],
.attachment-auth-modal[hidden] {
  display: none;
}

.account-interface-scroll {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 80px 24px 40px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.account-interface-scroll::-webkit-scrollbar {
  display: none;
}

.account-back-button {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 7;
  display: inline-grid;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  place-items: center;
  color: rgba(248, 250, 255, 0.94);
  background: rgba(17, 18, 24, 0.88);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 18px 42px rgba(0, 0, 0, 0.34);
  font-size: 0.86rem;
  font-weight: 760;
  transition:
    border-color 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    transform 170ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.account-back-button:hover,
.account-back-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(28, 30, 39, 0.94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.14),
    0 22px 50px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
}

.account-modal-panel {
  position: relative;
  display: grid;
  gap: 18px;
  width: min(590px, 100%);
  max-height: min(780px, calc(100dvh - 124px));
  overflow: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 0, rgba(120, 150, 255, 0.16), transparent 34%),
    radial-gradient(circle at 100% 28%, rgba(255, 255, 255, 0.08), transparent 38%),
    rgba(17, 18, 24, 0.88);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 28px 86px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  animation: accountViewIn 260ms ease both;
}

.account-modal[data-active-account-view="myaccount"] .account-modal-panel {
  width: min(760px, 100%);
}

.account-modal-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.account-modal-panel::before {
  content: "";
  position: absolute;
  inset: -40% -26%;
  background:
    radial-gradient(circle at 18% 18%, rgba(126, 170, 255, 0.12), transparent 24%),
    linear-gradient(115deg, transparent 18%, rgba(255, 255, 255, 0.09), transparent 42%);
  opacity: 0.5;
  pointer-events: none;
  animation: accountModalSheen 9s ease-in-out infinite alternate;
}

.rate-limit-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 22px;
}

.rate-limit-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.055), transparent 30%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  animation: modalBackdropIn 220ms ease both;
}

.rate-limit-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(430px, 100%);
  padding: 26px 22px 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.09), transparent 44%),
    linear-gradient(180deg, rgba(22, 22, 27, 0.96), rgba(7, 7, 10, 0.94));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 30px 110px rgba(0, 0, 0, 0.68);
  overflow: hidden;
  animation: modalPanelIn 340ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.rate-limit-dialog::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 32%, rgba(255, 255, 255, 0.055));
  pointer-events: none;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

.rate-limit-dialog > * {
  position: relative;
  z-index: 1;
}

.rate-limit-close {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.075);
  transition: background 160ms ease, transform 160ms ease;
}

.rate-limit-close:hover,
.rate-limit-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}

.rate-limit-warning-icon {
  display: block;
  width: 54px;
  height: 54px;
  background: #c9cbd2;
  mask: url("../icon_library/warning.png") center / contain no-repeat;
  -webkit-mask: url("../icon_library/warning.png") center / contain no-repeat;
}

.guest-access-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
}

.guest-access-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(82, 111, 255, 0.12), transparent 34%),
    rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  animation: modalBackdropIn 220ms ease both;
}

.guest-access-dialog {
  position: relative;
  display: grid;
  gap: 18px;
  width: min(520px, calc(100vw - 30px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 28px;
  background:
    radial-gradient(circle at 14% 0, rgba(101, 128, 255, 0.24), transparent 34%),
    linear-gradient(180deg, rgba(27, 28, 36, 0.98), rgba(11, 12, 17, 0.96));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 34px 110px rgba(0, 0, 0, 0.68);
  color: #fff;
  overflow: hidden;
  animation: modalPanelIn 340ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.guest-access-dialog::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 30%, rgba(102, 138, 255, 0.16));
  pointer-events: none;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

.guest-access-dialog > * {
  position: relative;
  z-index: 1;
}

.guest-access-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  transition: background 160ms ease, transform 160ms ease;
}

.guest-access-close:hover,
.guest-access-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.04);
}

.guest-access-orb {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 18px 48px rgba(54, 92, 255, 0.18);
}

.guest-access-orb img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.guest-access-copy {
  display: grid;
  gap: 10px;
  padding-right: 22px;
}

.guest-access-copy h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  line-height: 1.02;
  font-weight: 820;
}

.guest-access-copy p {
  margin: 0;
  color: rgba(235, 237, 248, 0.78);
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 600;
}

.guest-access-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
}

.guest-access-primary,
.guest-access-secondary {
  min-width: 0;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 760;
  transition:
    border-color 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    transform 170ms ease,
    filter 170ms ease;
}

.guest-access-primary {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(135deg, rgba(88, 101, 255, 0.98), rgba(60, 144, 255, 0.98)),
    var(--accent);
  color: #fff;
  box-shadow:
    0 18px 48px rgba(59, 103, 255, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.3);
}

.guest-access-secondary {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.075);
  color: rgba(244, 246, 255, 0.9);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.guest-access-primary:hover,
.guest-access-primary:focus-visible,
.guest-access-secondary:hover,
.guest-access-secondary:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.guest-access-primary:focus-visible,
.guest-access-secondary:focus-visible,
.guest-access-close:focus-visible {
  outline: 2px solid rgba(126, 156, 255, 0.9);
  outline-offset: 3px;
}

@media (max-width: 540px) {
  .guest-access-dialog {
    padding: 24px;
  }

  .guest-access-copy {
    padding-right: 0;
  }

  .guest-access-actions {
    grid-template-columns: 1fr;
  }
}

.attachment-limit-modal {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 20px;
}

.attachment-limit-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(15px) saturate(1.08);
  -webkit-backdrop-filter: blur(15px) saturate(1.08);
  animation: modalBackdropIn 220ms ease both;
}

.attachment-limit-dialog {
  position: relative;
  display: grid;
  gap: 22px;
  width: min(500px, calc(100vw - 30px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 0, rgba(112, 142, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(30, 31, 39, 0.98), rgba(11, 12, 17, 0.97));
  color: #fff;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 34px 110px rgba(0, 0, 0, 0.68);
  overflow: hidden;
  animation: modalPanelIn 340ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.attachment-limit-dialog::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 30%, rgba(102, 138, 255, 0.16));
  pointer-events: none;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

.attachment-limit-dialog > * {
  position: relative;
  z-index: 1;
}

.attachment-limit-copy {
  display: grid;
  gap: 11px;
}

.attachment-limit-kicker {
  margin: 0;
  color: rgba(180, 194, 255, 0.86);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.attachment-limit-copy h2 {
  max-width: 10ch;
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 7vw, 3.1rem);
  font-weight: 850;
  line-height: 0.96;
}

.attachment-limit-copy p:not(.attachment-limit-kicker) {
  margin: 0;
  color: rgba(235, 237, 248, 0.78);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.55;
}

.attachment-limit-ok {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(88, 101, 255, 0.98), rgba(60, 144, 255, 0.98)),
    var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  box-shadow:
    0 18px 48px rgba(59, 103, 255, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.3);
  transition:
    filter 170ms ease,
    transform 170ms ease;
}

.attachment-limit-ok:hover,
.attachment-limit-ok:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-1px);
  outline: 2px solid rgba(126, 156, 255, 0.9);
  outline-offset: 3px;
}

.attachment-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 18px;
}

.attachment-auth-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  cursor: default;
  animation: modalBackdropIn 220ms ease both;
}

.attachment-auth-dialog {
  position: relative;
  display: grid;
  gap: 20px;
  width: min(460px, calc(100vw - 28px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  background: #343438;
  color: #fff;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 28px 90px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  animation: modalPanelIn 340ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.attachment-auth-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 14%, rgba(255, 255, 255, 0.11), transparent 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 52%);
  pointer-events: none;
}

.attachment-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  transition: background 160ms ease, transform 160ms ease;
}

.attachment-auth-close:hover,
.attachment-auth-close:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.04);
}

.attachment-auth-close img {
  width: 13px;
  height: 13px;
  filter: brightness(0) invert(1);
}

.attachment-auth-copy,
.attachment-auth-form,
.attachment-auth-ok {
  position: relative;
  z-index: 1;
}

.attachment-auth-copy {
  display: grid;
  gap: 10px;
}

.attachment-auth-copy h2 {
  margin: 0;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.08;
}

.attachment-auth-copy p {
  margin: 0;
  color: rgba(245, 245, 248, 0.82);
  font-size: 0.98rem;
  font-weight: 560;
  line-height: 1.5;
}

.attachment-auth-form {
  display: grid;
  gap: 14px;
}

.attachment-auth-form label {
  display: grid;
  gap: 8px;
}

.attachment-auth-form label span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
  font-weight: 720;
}

.attachment-auth-form input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  outline: 0;
  padding: 0 14px;
  color: #fff;
  background: rgba(8, 8, 10, 0.34);
  font: inherit;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.attachment-auth-form input:focus {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(255, 255, 255, 0.08);
}

.attachment-auth-message {
  min-height: 16px;
  margin: -3px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.attachment-auth-message.error {
  color: #ffd0d0;
}

.attachment-auth-ok {
  justify-self: end;
  min-width: 106px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 760;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.attachment-auth-ok:hover,
.attachment-auth-ok:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.attachment-auth-ok:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.captcha-slot {
  --captcha-edge-crop: 3px;
  --captcha-bottom-crop: 4px;
  position: relative;
  display: flex;
  width: calc(304px - (var(--captcha-edge-crop) * 2));
  max-width: 100%;
  height: calc(78px - var(--captcha-edge-crop) - var(--captcha-bottom-crop));
  min-height: calc(78px - var(--captcha-edge-crop) - var(--captcha-bottom-crop));
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #222;
  overflow: hidden;
  line-height: 0;
}

.captcha-slot[data-captcha-state="loading"],
.captcha-slot[data-captcha-state="error"] {
  display: grid;
  width: 100%;
  height: auto;
  min-height: 78px;
  justify-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
  line-height: normal;
}

.captcha-widget-clip {
  flex: 0 0 auto;
  width: 304px;
  height: 78px;
  overflow: visible;
  transform: translate(calc(var(--captcha-edge-crop) * -1), calc(var(--captcha-edge-crop) * -1));
  transform-origin: top left;
}

.captcha-widget-clip > div,
.captcha-widget-clip iframe {
  display: block;
  border: 0 !important;
}

.captcha-slot[data-captcha-state="loading"] .captcha-widget-clip,
.captcha-slot[data-captcha-state="error"] .captcha-widget-clip {
  display: none;
}

.captcha-slot[data-captcha-state="loading"]::before,
.captcha-slot[data-captcha-state="error"]::before {
  content: attr(data-captcha-message);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
  font-weight: 720;
  text-align: center;
}

.captcha-slot[data-captcha-state="loading"]::after {
  content: "";
  width: 17px;
  height: 17px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  animation: spinner-c7wet2 820ms linear infinite;
}

.captcha-slot[data-captcha-state="error"] {
  border-color: rgba(255, 126, 126, 0.28);
  background: rgba(255, 70, 70, 0.1);
}

.captcha-slot.danger[data-captcha-state="loading"],
.captcha-slot.danger[data-captcha-state="error"] {
  border-color: rgba(255, 118, 118, 0.18);
  background: rgba(30, 0, 0, 0.14);
}

.captcha-slot[hidden],
.captcha-slot.captcha-disabled {
  display: none;
}

.rate-limit-dialog-copy {
  display: grid;
  gap: 8px;
  max-width: 330px;
  text-align: center;
}

.rate-limit-kicker {
  margin: 0;
  color: rgba(217, 220, 255, 0.64);
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rate-limit-dialog h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.05;
}

.rate-limit-dialog-copy p:last-child {
  margin: 0;
  color: rgba(232, 232, 240, 0.72);
  line-height: 1.55;
  white-space: pre-line;
}

.rate-limit-countdown-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 150px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(0, 0, 0, 0.24);
}

.rate-limit-countdown-card span {
  color: #fff;
  font-size: 3.3rem;
  font-weight: 820;
  line-height: 0.96;
  letter-spacing: 0;
}

.rate-limit-countdown-card small {
  color: rgba(232, 232, 240, 0.58);
  font-size: 0.78rem;
  font-weight: 650;
}

.rate-limit-dialog-meter {
  width: min(290px, 100%);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rate-limit-dialog-meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.96));
  transform-origin: left center;
  transform: scaleX(var(--rate-popup-fill, 1));
  transition: transform 280ms linear;
}

.rate-limit-ok {
  min-width: 130px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-weight: 760;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
  transition: background 160ms ease, transform 160ms ease;
}

.rate-limit-ok:hover,
.rate-limit-ok:focus-visible {
  background: rgba(255, 255, 255, 0.17);
  transform: translateY(-1px);
}

.account-modal-panel > * {
  position: relative;
  z-index: 1;
}

.account-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.account-modal-kicker {
  margin: 0 0 6px;
  color: rgba(174, 184, 255, 0.86);
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.account-modal-header h2,
.account-profile-summary h3,
.account-settings-panel h3 {
  margin: 0;
  color: #fff;
  line-height: 1.12;
}

.account-modal-header h2 {
  font-size: 1.72rem;
}

.account-modal-header p,
.account-profile-summary p,
.account-settings-panel p,
.account-danger-confirm p,
.account-form-message {
  margin: 0;
  color: rgba(226, 226, 236, 0.72);
  line-height: 1.55;
}

.account-modal-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.82);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.account-modal-close:hover,
.account-modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: scale(1.05);
}

.account-modal-view {
  display: grid;
  gap: 13px;
  animation: accountViewIn 260ms ease both;
}

.account-modal-form {
  display: grid;
  gap: 12px;
}

.account-modal-form label {
  display: grid;
  gap: 7px;
}

.account-modal-form label span {
  color: rgba(232, 232, 240, 0.78);
  font-size: 0.78rem;
  font-weight: 650;
}

.account-modal-form label span small {
  color: rgba(232, 232, 240, 0.48);
  font-size: 0.68rem;
  font-weight: 650;
}

.account-modal-form input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(0, 0, 0, 0.24);
  color: #fff;
  outline: 0;
  padding: 0 13px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.account-modal-form input:focus {
  border-color: rgba(174, 184, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(88, 101, 255, 0.12);
  transform: translateY(-1px);
}

.account-primary-action,
.account-secondary-action,
.account-danger-action,
.account-link-button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 760;
  transition:
    border-color 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    color 170ms ease,
    transform 170ms cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 170ms ease;
}

.account-primary-action {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(135deg, #5865ff, #3d8bff);
  color: #fff;
  box-shadow: 0 16px 34px rgba(61, 139, 255, 0.24);
}

.account-primary-action:hover,
.account-primary-action:focus-visible {
  box-shadow: 0 20px 46px rgba(61, 139, 255, 0.32);
  transform: translateY(-2px);
}

.account-secondary-action,
.account-link-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
  color: #f3f3f3;
}

.account-link-button {
  justify-self: center;
  min-height: 34px;
  padding: 0 12px;
  color: rgba(217, 222, 255, 0.9);
  font-size: 0.82rem;
}

.account-secondary-action:hover,
.account-secondary-action:focus-visible,
.account-link-button:hover,
.account-link-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.account-danger-action {
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.08);
  color: #ffb0b0;
}

.account-danger-action:hover,
.account-danger-action:focus-visible,
.account-danger-action.solid {
  background: rgba(255, 107, 107, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

.account-form-message {
  min-height: 20px;
  font-size: 0.82rem;
}

.account-form-message.error {
  color: #ff9b9b;
}

.account-profile-summary {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
}

.account-avatar-large {
  display: block;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #e9efff;
  box-shadow:
    0 18px 46px rgba(61, 139, 255, 0.24),
    inset 0 1px rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

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

.account-stat-grid article {
  display: grid;
  gap: 6px;
  min-height: 92px;
  align-content: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.042);
}

.account-stat-grid span {
  color: var(--muted);
  font-size: 0.74rem;
}

.account-stat-grid strong {
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.account-settings-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.038);
}

.account-danger-confirm {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 107, 107, 0.18);
  border-radius: 18px;
  background: rgba(255, 107, 107, 0.075);
  animation: accountViewIn 180ms ease both;
}

.account-danger-confirm > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-primary-action:disabled,
.account-secondary-action:disabled,
.account-danger-action:disabled,
.account-modal-form input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.sidebar-toggle,
.add-chat-button,
.attach-button,
.send-button,
.mobile-sidebar-button,
.message-copy-button {
  display: inline-grid;
  place-items: center;
}

.ui-icon {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: brightness(0) invert(1);
}

.collapse-icon {
  width: 17px;
  height: 17px;
  opacity: 0.82;
}

.new-chat-icon {
  width: 14px;
  height: 14px;
}

.attach-icon {
  width: 14px;
  height: 14px;
}

.send-icon {
  width: 16px;
  height: 16px;
}

.file-input {
  display: none;
}

.x-icon {
  width: 12px;
  height: 12px;
  opacity: 1;
  filter: brightness(0) invert(1) !important;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.sidebar-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.06);
  cursor:col-resize
}

.sidebar-toggle:hover .collapse-icon {
  opacity: 1;
  cursor:col-resize
}

.chats-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  margin-top: 8px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 2px 2px;
}

.panel-heading p {
  margin: 0;
  color: rgba(217, 220, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.add-chat-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  gap: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(88, 101, 255, 0.95), rgba(61, 139, 255, 0.95)),
    var(--accent);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  box-shadow:
    0 9px 22px rgba(68, 90, 255, 0.24),
    inset 0 1px rgba(255, 255, 255, 0.28);
  overflow: hidden;
  transition:
    box-shadow 400ms ease,
    transform 400ms ease,
    filter 400ms ease;
}

.add-chat-button::after {
  content: none;
}

.add-chat-button:hover {
  filter: brightness(1.08);
  box-shadow:
    0 13px 30px rgba(68, 90, 255, 0.34),
    inset 0 1px rgba(255, 255, 255, 0.34);
  transform: translateY(-1px) scale(1.02);
}

.chat-search {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 34px;
  width: 100%;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045)),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.18);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.chat-search:focus-within {
  border-color: rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 12px 34px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.chat-search-icon {
  width: 14px;
  height: 14px;
  opacity: 0.68;
  transition: opacity 160ms ease, transform 160ms ease;
}

.chat-search:focus-within .chat-search-icon {
  opacity: 1;
  transform: scale(1.06);
}

.chat-search input {
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
}

.chat-search input::placeholder {
  color: rgba(180, 180, 180, 0.68);
}

.chat-search input::-webkit-search-cancel-button {
  appearance: none;
}

.chat-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding: 0;
}

.chat-list,
.chat-log {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.chat-list::-webkit-scrollbar,
.chat-log::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.rate-limit-panel {
  display: grid;
  align-self: end;
  grid-template-rows: auto auto auto;
  gap: 10px;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #151519;
  box-shadow: none;
  overflow: hidden;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.rate-limit-panel.limited {
  border-color: rgba(255, 88, 88, 0.42);
  background: #241013;
}

.rate-limit-copy {
  display: grid;
  gap: 4px;
  min-height: 0;
}

.rate-limit-copy span,
.rate-limit-panel p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
}

.rate-limit-copy span {
  color: rgba(236, 236, 242, 0.64);
}

.rate-limit-panel p {
  color: #fff;
  font-size: 0.84rem;
  line-height: 1.25;
}

.rate-limit-copy strong {
  color: #f7f7ff;
  font-size: 1.72rem;
  line-height: 1;
  white-space: nowrap;
}

.rate-limit-track {
  position: relative;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.rate-limit-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(235, 235, 245, 0.82), rgba(255, 255, 255, 0.96));
  box-shadow: none;
  transform-origin: left center;
  transform: scaleX(var(--rate-fill, 1));
  transition:
    transform 360ms cubic-bezier(0.2, 0.9, 0.2, 1),
    background 180ms ease;
}

.rate-limit-panel.limited .rate-limit-track span {
  background: linear-gradient(90deg, #ff6b6b, #ffb36b);
}

.rate-limit-panel.limited .rate-limit-track {
  background: rgba(255, 118, 118, 0.22);
}

.chat-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px 26px;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  padding: 5px 4px 5px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  transition:
    border-color 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    transform 170ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.chat-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0 50%, rgba(88, 101, 255, 0.2), transparent 46%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent);
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 170ms ease, transform 170ms ease;
  pointer-events: none;
}

.chat-item:hover,
.chat-item.active {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.2),
    inset 0 1px rgba(255, 255, 255, 0.08);
  transform: none;
}

.chat-item:hover::before,
.chat-item.active::before {
  opacity: 1;
  transform: translateX(0);
}

.chat-open-button {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  z-index: 1;
}

.chat-title {
  overflow: hidden;
  color: #e7e7e7;
  font-size: 0.79rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta {
  overflow: hidden;
  color: var(--subtle);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rename-chat-button,
.delete-chat-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  z-index: 1;
  border-radius: 50%;
  background: transparent;
  color: var(--subtle);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease, color 150ms ease;
}

.rename-chat-button img {
  width: 13px;
  height: 13px;
  filter: brightness(0) invert(1);
  opacity: 0.72;
}

.chat-item:hover .delete-chat-button,
.chat-item:hover .rename-chat-button,
.chat-item.renaming .delete-chat-button,
.chat-item.renaming .rename-chat-button,
.rename-chat-button:focus-visible,
.delete-chat-button:focus-visible {
  opacity: 1;
  transform: translateX(0);
}

.rename-chat-button:hover {
  background: rgba(126, 156, 255, 0.14);
  color: #dfe6ff;
}

.delete-chat-button:hover {
  background: rgba(255, 107, 107, 0.12);
  color: #ff8f8f;
}

.chat-rename-form {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.chat-rename-input {
  width: 100%;
  height: 30px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  outline: 0;
  padding: 0 9px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font: inherit;
  font-size: 0.79rem;
  font-weight: 650;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(88, 101, 255, 0.12);
}

.chat-rename-input:focus {
  border-color: rgba(170, 188, 255, 0.72);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 0 0 3px rgba(88, 101, 255, 0.18);
}

.empty-chat-list {
  padding: 8px;
  color: var(--subtle);
  font-size: 0.78rem;
}

.main-area {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
  isolation: isolate;
}

.top-bar,
.chat-panel {
  position: relative;
  z-index: 2;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
}

.mobile-sidebar-button {
  display: none;
}

.message-search {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: min(340px, 38vw);
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.18);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.message-search:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 12px 30px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.message-search-icon {
  width: 14px;
  height: 14px;
  opacity: 0.72;
  transition: opacity 160ms ease, transform 160ms ease;
}

.message-search:focus-within .message-search-icon {
  opacity: 1;
  transform: scale(1.06);
}

.message-search input {
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
}

.message-search input::placeholder {
  color: rgba(180, 180, 180, 0.68);
}

.message-search input::-webkit-search-cancel-button {
  appearance: none;
}

.message-search-count {
  min-width: 24px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.main-area.admin-mode .chat-panel,
.main-area.admin-mode .message-search {
  display: none;
}

.admin-portal {
  position: relative;
  z-index: 2;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.admin-portal[hidden] {
  display: none;
}

.admin-portal-scroll {
  display: grid;
  gap: 16px;
  width: min(1080px, calc(100vw - 320px));
  height: 100%;
  margin: 0 auto;
  padding: 28px 0 52px;
  overflow: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.admin-portal-scroll::-webkit-scrollbar {
  display: none;
}

.admin-panel,
.admin-action-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(17, 18, 24, 0.82);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.07),
    0 18px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.admin-panel-kicker {
  margin: 0;
  color: rgba(157, 184, 255, 0.78);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-panel h2 {
  margin: 4px 0 0;
  color: #f7f9ff;
  letter-spacing: 0;
}

.admin-action-card button,
.admin-mini-action {
  display: inline-grid;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: rgba(245, 248, 255, 0.92);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.78rem;
  font-weight: 750;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.admin-action-card button:hover,
.admin-mini-action:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.admin-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
}

.admin-availability-panel,
.admin-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-panel h2 {
  font-size: 1.05rem;
}

.admin-panel-heading > span {
  display: grid;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  place-items: center;
  color: rgba(245, 248, 255, 0.9);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-availability-panel > div > span {
  display: inline-block;
  margin-top: 6px;
  color: rgba(225, 231, 255, 0.64);
  font-size: 0.82rem;
}

.admin-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

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

.admin-switch span {
  position: relative;
  width: 58px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 87, 87, 0.16);
  transition: background 180ms ease, border-color 180ms ease;
}

.admin-switch span::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  transition: transform 180ms ease;
}

.admin-switch input:checked + span {
  border-color: rgba(94, 230, 132, 0.38);
  background: rgba(81, 211, 116, 0.22);
}

.admin-switch input:checked + span::before {
  transform: translateX(26px);
}

.admin-switch strong {
  min-width: 84px;
  color: #fff;
  font-size: 0.84rem;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: 16px;
  min-width: 0;
}

.admin-list,
.admin-ban-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.admin-account-row,
.admin-ban-row {
  display: grid;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-account-row {
  grid-template-columns: 40px minmax(0, 1fr) auto;
}

.admin-list.compact .admin-account-row {
  grid-template-columns: 36px minmax(0, 1fr);
}

.admin-avatar {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfe7ff;
}

.admin-account-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.admin-account-copy strong {
  color: #fff;
  font-size: 0.88rem;
}

.admin-account-copy span,
.admin-ban-row span {
  color: rgba(218, 225, 255, 0.62);
  font-size: 0.73rem;
}

.admin-badges,
.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-badge {
  display: inline-grid;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  place-items: center;
  color: rgba(241, 246, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.66rem;
  font-weight: 800;
}

.admin-badge.admin {
  color: #deecff;
  background: rgba(83, 144, 255, 0.18);
}

.admin-badge.rate-limit {
  color: #f3f6ff;
  background: rgba(255, 255, 255, 0.11);
}

.admin-badge.banned {
  color: #ffd8e2;
  background: rgba(255, 82, 112, 0.17);
}

.admin-mini-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.7rem;
}

.admin-mini-action.danger,
.admin-action-card.danger button {
  border-color: rgba(255, 108, 108, 0.26);
  color: #ffd9d9;
  background: rgba(255, 70, 70, 0.11);
}

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

.admin-action-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
}

.admin-action-card button {
  align-self: end;
  min-height: 38px;
  height: 38px;
}

.admin-action-card h3 {
  margin: 0;
  color: #fff;
  font-size: 0.92rem;
}

.admin-action-card input,
.admin-action-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  outline: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.24);
  font: inherit;
  font-size: 0.82rem;
}

.admin-action-card input {
  height: 38px;
  padding: 0 11px;
}

.admin-action-card textarea {
  resize: vertical;
  min-height: 76px;
  padding: 10px 11px;
}

.admin-action-card input:focus,
.admin-action-card textarea:focus {
  border-color: rgba(132, 183, 255, 0.46);
  box-shadow: 0 0 0 1px rgba(132, 183, 255, 0.14);
}

.admin-status-message {
  min-height: 18px;
  margin: 0;
  color: rgba(222, 230, 255, 0.72);
  font-size: 0.8rem;
}

.admin-status-message.error {
  color: #ffaaaa;
}

.empty-admin-list {
  margin: 0;
  padding: 8px 2px;
  color: rgba(218, 225, 255, 0.54);
  font-size: 0.8rem;
}

.chat-log {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(820px, calc(100vw - 320px));
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  padding: 42px 0 96px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-padding-bottom: 96px;
  scroll-behavior: smooth;
}

.empty-state {
  position: absolute;
  left: 50%;
  top: 40%;
  display: grid;
  width: min(680px, 100%);
  opacity: 1;
  transform: translate(-50%, -50%);
  place-items: center;
  pointer-events: none;
}

.empty-state.hidden {
  opacity: 0;
}

.empty-state h1 {
  margin: 0;
  color: #f1f1f1;
  font-size: 3.22rem;
  font-weight: 500;
  line-height: 1.2;
  opacity: 1;
  text-align: center;
  transform: translateY(0);
}

.welcome-word {
  display: inline-block;
  opacity: 1;
}

.message {
  display: grid;
  gap: 6px;
  width: 100%;
  animation: messageIn 160ms ease both;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 16px;
  color: var(--subtle);
  font-size: 0.68rem;
}

.source {
  display: none;
}

.message.user .message-meta {
  justify-content: flex-end;
  padding-right: 4px;
}

.message.learny .message-meta {
  padding-left: 4px;
}

.bubble {
  position: relative;
  max-width: min(680px, 76%);
  margin: 0;
  color: #f4f4f4;
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.bubble-text,
.thought-time {
  display: block;
}

.message-footer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--subtle);
}

.message.user .message-footer {
  justify-content: flex-end;
  width: 100%;
}

.message-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: rgba(236, 236, 236, 0.78);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.message-text-action:hover,
.message-text-action:focus-visible,
.message-text-action.copied {
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.message-action-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  opacity: 1;
  filter: brightness(0) invert(1);
}

.message-delete-button:hover,
.message-delete-button:focus-visible {
  border-color: rgba(255, 116, 116, 0.38);
  color: #ffd9d9;
  background: rgba(255, 84, 84, 0.12);
}

.message-edit-form {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: min(480px, 68vw);
  padding: 4px;
  border-radius: 18px;
  isolation: isolate;
  animation: editSurfaceIn 260ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.message-edit-form::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: 20px;
  background:
    linear-gradient(120deg, rgba(115, 234, 255, 0.72), rgba(107, 105, 255, 0.4), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.04);
  opacity: 0.62;
  filter: blur(0.5px);
  animation: editGlowDrift 2.8s ease-in-out infinite alternate;
}

.message-edit-input {
  width: 100%;
  min-height: 96px;
  max-height: 260px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 15px;
  outline: 0;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.045)),
    rgba(16, 17, 22, 0.94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.1),
    0 18px 44px rgba(0, 0, 0, 0.34);
  font: inherit;
  line-height: 1.45;
}

.message-edit-input:focus {
  border-color: rgba(130, 235, 255, 0.58);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(130, 235, 255, 0.16),
    0 22px 52px rgba(0, 0, 0, 0.38);
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.message-edit-actions button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  place-items: center;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.message-edit-action-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.message-edit-cancel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(245, 245, 245, 0.82);
  background: rgba(255, 255, 255, 0.06);
}

.message-edit-save {
  border: 1px solid rgba(135, 234, 255, 0.38);
  color: #fff;
  background: linear-gradient(135deg, rgba(74, 153, 255, 0.9), rgba(108, 101, 255, 0.86));
  box-shadow: 0 12px 26px rgba(58, 118, 255, 0.28);
}

.message-edit-actions button:hover,
.message-edit-actions button:focus-visible {
  transform: translateY(-1px);
}

.markdown-body {
  min-width: 0;
}

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

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

.markdown-body p {
  margin: 0 0 0.76em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0.08em 0 0.42em;
  color: #fff;
  font-weight: 720;
  line-height: 1.18;
}

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

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

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

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 0.98rem;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.42em 0 0.78em;
  padding-left: 1.24rem;
}

.markdown-body li {
  margin: 0.22em 0;
  padding-left: 0.08rem;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin: 0.28em 0 0.28em;
}

.markdown-body blockquote {
  margin: 0.62em 0 0.78em;
  padding: 0.18em 0 0.18em 0.82rem;
  border-left: 3px solid rgba(118, 132, 255, 0.66);
  color: rgba(242, 242, 255, 0.8);
}

.markdown-body blockquote p {
  margin-bottom: 0.48em;
}

.markdown-body a {
  color: #aeb8ff;
  font-weight: 650;
  text-decoration: none;
}

.markdown-body a:hover {
  color: #d6dcff;
  text-decoration: underline;
}

.markdown-body code {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.075);
  color: #f4f5ff;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
  padding: 0.12em 0.34em;
}

.markdown-body pre {
  max-width: 100%;
  margin: 0.58em 0 0.84em;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.42);
  overflow-x: auto;
}

.markdown-body pre code {
  display: block;
  border: 0;
  background: transparent;
  color: #f5f5f5;
  font-size: 0.82rem;
  line-height: 1.52;
  overflow-wrap: normal;
  padding: 0;
  white-space: pre;
}

.markdown-body .markdown-table-wrap {
  max-width: 100%;
  margin: 0.64em 0 0.84em;
  overflow-x: auto;
}

.markdown-body table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  color: #f4f4f4;
  font-size: 0.88rem;
}

.markdown-body th,
.markdown-body td {
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  vertical-align: top;
}

.markdown-body th {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 720;
}

.markdown-body tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.035);
}

.markdown-body hr {
  height: 1px;
  margin: 0.84em 0;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
}

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.58em 0;
  border-radius: 10px;
}

.task-list-item {
  display: inline-grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.task-list-entry {
  margin-left: -1.08rem;
  list-style: none;
}

.task-list-item input {
  width: 14px;
  height: 14px;
  margin: 0.34em 0 0;
  accent-color: var(--accent-2);
}

.message.user .bubble {
  justify-self: end;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--user-bubble);
}

.message.learny .bubble {
  justify-self: start;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: var(--learny-bubble);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(12px);
}

.message.learny .thought-time {
  max-height: none;
  margin-top: 0;
  color: var(--subtle);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 1;
  overflow: visible;
  transform: translateY(0);
}

.message-copy-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  opacity: 0.72;
  transition:
    background 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

.message-copy-button:hover,
.message-copy-button:focus-visible,
.message-copy-button.copied {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
  transform: scale(1.06);
}

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

.message-copy-button:disabled {
  cursor: default;
}

.message-copy-icon {
  width: 15px;
  height: 15px;
}

.message.learny.word-revealing .message-footer {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
}

.message.learny.word-revealing.reveal-complete .message-footer {
  display: inline-flex;
  pointer-events: auto;
  animation: footerFadeIn 420ms ease forwards;
}

.message.learny.word-revealing .markdown-body li::marker {
  color: transparent;
  transition: color 220ms ease;
}

.message.learny.word-revealing .markdown-body li.reveal-content-visible::marker {
  color: rgba(242, 242, 255, 0.84);
}

.message.learny.word-revealing .markdown-body .task-list-item input {
  opacity: 0;
  transition: opacity 220ms ease;
}

.message.learny.word-revealing .markdown-body .task-list-item.reveal-content-visible input {
  opacity: 1;
}

.message.learny.word-revealing .markdown-body code,
.message.learny.word-revealing .markdown-body pre,
.message.learny.word-revealing .markdown-body blockquote,
.message.learny.word-revealing .markdown-body .markdown-table-wrap {
  transition:
    opacity 260ms ease,
    border-color 260ms ease,
    background-color 260ms ease;
}

.message.learny.word-revealing .markdown-body code:not(.reveal-content-visible),
.message.learny.word-revealing .markdown-body pre:not(.reveal-content-visible),
.message.learny.word-revealing .markdown-body blockquote:not(.reveal-content-visible),
.message.learny.word-revealing .markdown-body .markdown-table-wrap:not(.reveal-content-visible) {
  opacity: 0;
}

.word-fade {
  display: none;
  opacity: 0;
}

.word-fade.word-visible {
  display: inline;
  animation-name: wordFadeIn;
  animation-timing-function: ease;
  animation-fill-mode: forwards;
}

.message-search-match .bubble {
  box-shadow:
    0 0 0 1px rgba(174, 184, 255, 0.44),
    0 10px 28px rgba(0, 0, 0, 0.26);
}

.message-search-current .bubble {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.66),
    0 0 24px rgba(88, 101, 255, 0.22),
    0 10px 28px rgba(0, 0, 0, 0.26);
}

.message-search-dim {
  opacity: 0.38;
}

.message.is-deleting {
  pointer-events: none;
  z-index: 3;
  animation: messageGlitchDelete 850ms steps(2, end) forwards;
}

.message.is-deleting .bubble {
  overflow: hidden;
  background-color: #1c1c1f;
  animation: bubbleGlitchDelete 850ms steps(8, end) forwards;
}

.message.is-deleting .bubble-text,
.message.is-deleting .message-footer {
  animation: glitchContentDelete 850ms steps(2, end) forwards;
}

.message.is-deleting .bubble::before,
.message.is-deleting .bubble::after {
  content: attr(data-glitch);
  position: absolute;
  inset: 10px 14px auto 14px;
  max-height: calc(100% - 20px);
  border-radius: inherit;
  color: #fff;
  background-color: #1c1c1f;
  font: inherit;
  font-weight: 760;
  line-height: 1.55;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.is-deleting .bubble::before {
  left: 11px;
  text-shadow: -2px 0 #00ffff, -6px 0 rgba(0, 255, 255, 0.22);
  animation: noiseBeforeDelete 520ms infinite linear alternate-reverse;
}

.message.is-deleting .bubble::after {
  left: 17px;
  text-shadow: 2px 0 #ff00ff, 7px 0 rgba(255, 0, 255, 0.22);
  animation: noiseAfterDelete 430ms infinite linear alternate-reverse;
}

.message.typing .bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 28px;
}

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

.typing-dot:nth-child(2) {
  animation-delay: 140ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 280ms;
}

.composer-zone {
  width: min(760px, calc(100vw - 332px));
  margin: 0 auto 36px;
  flex: 0 0 auto;
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
  margin: 0 0 8px;
  max-height: min(214px, 32vh);
  padding: 0 2px 2px;
  overflow-y: auto;
  scrollbar-width: none;
  animation: attachmentTrayIn 220ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.attachment-tray::-webkit-scrollbar {
  display: none;
}

.attachment-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  flex: 1 1 min(344px, 100%);
  width: min(420px, 100%);
  max-width: 100%;
  padding: 9px 9px 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: rgba(246, 246, 246, 0.94);
  background: rgba(25, 25, 27, 0.94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 16px 42px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.attachment-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.1), transparent 28%),
    linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  opacity: 0.68;
  pointer-events: none;
}

.attachment-file-icon {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.attachment-info {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attachment-name {
  overflow: hidden;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  color: rgba(213, 213, 213, 0.68);
  font-size: 0.72rem;
  line-height: 1.25;
}

.attachment-remove {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.attachment-remove:hover,
.attachment-remove:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}

.attachment-remove img {
  width: 11px;
  height: 11px;
}

.composer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: end;
  gap: 6px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid var(--composer-border);
  border-radius: 28px;
  background: var(--composer);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.composer.unavailable {
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.08);
  background: #252525;
  opacity: 0.78;
}

.composer.unavailable *,
.composer.unavailable textarea::placeholder {
  cursor: not-allowed;
}

.attach-button,
.send-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text);
  font-size: 1rem;
}

.attach-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.attach-button:hover,
.attach-button:focus-visible,
.composer.has-attachment .attach-button {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  transform: scale(1.03);
}

.composer textarea {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  max-height: min(240px, 34vh);
  padding: 9px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  outline: none;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  resize: none;
  scrollbar-width: none;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.composer textarea:disabled {
  cursor: not-allowed;
}

.composer textarea::placeholder {
  color: #a7a7a7;
}

.send-button {
  background: #676767;
  font-weight: 850;
  transition: background 120ms ease, transform 120ms ease;
}

.send-button:hover {
  background: #7a7a7a;
}

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

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

.message-attachment {
  display: inline-grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: min(260px, 100%);
  max-width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.052);
}

.message-attachment-icon {
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.56rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-attachment-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.message-attachment-name {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-meta {
  color: rgba(220, 220, 220, 0.58);
  font-size: 0.68rem;
  line-height: 1.2;
}

.ban-lock {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgb(0, 3, 7), transparent 0 34%),
    #000;
  cursor: not-allowed;
}

.ban-lock[hidden] {
  display: none;
}

body.ban-lock-active {
  overflow: hidden;
  cursor: not-allowed;
}

body.ban-lock-active .app-shell,
body.ban-lock-active .loading-screen {
  display: none !important;
}

.ban-lock-card {
  width: min(560px, 100%);
  padding: 32px;
  border-radius: 26px;
  color: #f5f8ff;
  background:
    radial-gradient(circle at 22% 0%, hsl(221, 100%, 3%), transparent 38%),
    linear-gradient(145deg, rgb(0, 0, 0), rgb(0, 9, 29));
  cursor: not-allowed;
}

.ban-lock-card * {
  cursor: not-allowed;
}

.ban-lock-kicker {
  margin: 0 0 10px;
  color: rgba(149, 186, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ban-lock-card h1 {
  margin: 0;
  max-width: 440px;
  color: #fff;
  font-size: clamp(1.7rem, 5vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.ban-lock-admin {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.ban-lock-admin img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  background: rgba(255, 255, 255, 0.12);
}

.ban-lock-admin div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ban-lock-admin span {
  color: rgba(180, 202, 255, 0.66);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ban-lock-admin strong {
  overflow: hidden;
  color: rgba(250, 252, 255, 0.96);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ban-lock-card dl {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
}

.ban-lock-card dl > div {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.ban-lock-card dt {
  color: rgba(180, 202, 255, 0.66);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ban-lock-card dd {
  margin: 0;
  color: rgba(250, 252, 255, 0.94);
  font-size: 0.9rem;
  line-height: 1.45;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

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

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

@keyframes sidebarAura {
  0% {
    opacity: 0.48;
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  50% {
    opacity: 0.74;
    transform: translate3d(3%, 2%, 0) scale(1.04);
  }
  100% {
    opacity: 0.56;
    transform: translate3d(-1%, 3%, 0) scale(1.02);
  }
}

@keyframes typingDot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

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

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

@keyframes editGlowDrift {
  from {
    opacity: 0.44;
    transform: translate3d(-2px, 0, 0);
  }
  to {
    opacity: 0.82;
    transform: translate3d(2px, 0, 0);
  }
}

@keyframes messageGlitchDelete {
  0%, 18% {
    opacity: 1;
    filter: contrast(1.1) saturate(1.4);
    transform: translate3d(0, 0, 0) skewX(0deg);
  }
  20% {
    opacity: 1;
    filter: contrast(2.1) saturate(2.4) hue-rotate(18deg);
    transform: translate3d(-9px, 2px, 0) skewX(18deg);
  }
  24% {
    transform: translate3d(10px, -2px, 0) skewX(-20deg);
  }
  39% {
    opacity: 0.88;
    filter: contrast(2.8) saturate(3) hue-rotate(-24deg);
    transform: translate3d(-14px, 5px, 0) skewX(36deg) skewY(8deg);
  }
  43% {
    transform: translate3d(16px, -4px, 0) skewX(-42deg) skewY(-8deg);
  }
  62% {
    opacity: 0.56;
    filter: blur(0.8px) contrast(3.2) saturate(3.5);
    transform: translate3d(-7px, 8px, 0) scale(1.025);
  }
  78% {
    opacity: 0.24;
    filter: blur(1.6px) contrast(4);
    transform: translate3d(6px, 16px, 0) scale(0.96);
  }
  100% {
    opacity: 0;
    filter: blur(5px) contrast(4.4);
    transform: translate3d(0, 30px, 0) scale(0.9);
  }
}

@keyframes bubbleGlitchDelete {
  0%, 8% {
    clip-path: inset(0 0 0 0);
  }
  10% {
    clip-path: inset(4% 0 72% 0);
  }
  14% {
    clip-path: inset(0 0 0 0);
  }
  19% {
    clip-path: inset(42% 0 18% 0);
  }
  25% {
    clip-path: inset(0 0 0 0);
  }
  35% {
    clip-path: inset(70% 0 3% 0);
  }
  43% {
    clip-path: inset(0 0 64% 0);
  }
  52% {
    clip-path: inset(18% 0 35% 0);
  }
  65% {
    clip-path: inset(58% 0 12% 0);
  }
  79%, 100% {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes glitchContentDelete {
  0%, 24% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  26% {
    opacity: 0.24;
    transform: translate3d(8px, -2px, 0);
  }
  31% {
    opacity: 1;
    transform: translate3d(-8px, 2px, 0);
  }
  57% {
    opacity: 0.18;
    transform: translate3d(13px, 0, 0);
  }
  72%, 100% {
    opacity: 0;
    transform: translate3d(-6px, 8px, 0);
  }
}

@keyframes noiseBeforeDelete {
  0% {
    clip-path: inset(62% 0 28% 0);
    opacity: 0.9;
  }
  8% {
    clip-path: inset(12% 0 76% 0);
    transform: translate3d(-10px, 0, 0);
  }
  16% {
    clip-path: inset(80% 0 4% 0);
    transform: translate3d(7px, -1px, 0);
  }
  28% {
    clip-path: inset(30% 0 48% 0);
    transform: translate3d(-16px, 2px, 0);
  }
  41% {
    clip-path: inset(4% 0 82% 0);
    transform: translate3d(14px, -2px, 0);
  }
  55% {
    clip-path: inset(52% 0 20% 0);
    transform: translate3d(-8px, 1px, 0);
  }
  72% {
    clip-path: inset(22% 0 62% 0);
    opacity: 0.98;
    transform: translate3d(18px, 0, 0);
  }
  100% {
    clip-path: inset(74% 0 10% 0);
    opacity: 0;
    transform: translate3d(-20px, 4px, 0);
  }
}

@keyframes noiseAfterDelete {
  0% {
    clip-path: inset(20% 0 66% 0);
    opacity: 0.86;
  }
  9% {
    clip-path: inset(76% 0 6% 0);
    transform: translate3d(14px, 1px, 0);
  }
  18% {
    clip-path: inset(6% 0 84% 0);
    transform: translate3d(-12px, -1px, 0);
  }
  31% {
    clip-path: inset(44% 0 30% 0);
    transform: translate3d(20px, 2px, 0);
  }
  47% {
    clip-path: inset(12% 0 70% 0);
    transform: translate3d(-18px, -2px, 0);
  }
  63% {
    clip-path: inset(68% 0 16% 0);
    opacity: 1;
    transform: translate3d(10px, 3px, 0);
  }
  81% {
    clip-path: inset(28% 0 46% 0);
    transform: translate3d(-22px, 0, 0);
  }
  100% {
    clip-path: inset(86% 0 0 0);
    opacity: 0;
    transform: translate3d(24px, -4px, 0);
  }
}

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

@keyframes modalPanelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes accountModalSheen {
  from {
    opacity: 0.42;
    transform: translate3d(-4%, -2%, 0) rotate(-2deg);
  }
  to {
    opacity: 0.74;
    transform: translate3d(4%, 2%, 0) rotate(2deg);
  }
}

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

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

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

@keyframes starDrift {
  from {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(var(--travel-x), var(--travel-y), 0);
  }
}

@media (min-width: 861px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border-right: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    pointer-events: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .app-shell.sidebar-collapsed .sidebar::before {
    display: none;
  }

  .app-shell.sidebar-collapsed .brand-lockup,
  .app-shell.sidebar-collapsed .account-button,
  .app-shell.sidebar-collapsed .admin-nav-button,
  .app-shell.sidebar-collapsed .chats-panel,
  .app-shell.sidebar-collapsed .rate-limit-panel {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-header {
    display: block;
    width: 0;
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    animation: none;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle {
    position: fixed;
    top: 4px;
    left: 12px;
    z-index: 8;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: auto;
    box-shadow:
      inset 0 1px rgba(255, 255, 255, 0.1),
      0 12px 28px rgba(0, 0, 0, 0.3);
    transform: none;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: scale(1.06);
  }

  .app-shell.sidebar-collapsed .top-bar {
    padding-left: 60px;
  }

  .app-shell.sidebar-collapsed .chat-log {
    width: min(820px, calc(100vw - 76px));
  }

  .app-shell.sidebar-collapsed .composer-zone {
    width: min(760px, calc(100vw - 76px));
  }

  .app-shell.sidebar-collapsed .admin-portal-scroll {
    width: min(1080px, calc(100vw - 76px));
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 6;
    display: grid;
    width: min(336px, 90vw);
    background: #01040f;
    transform: translateX(calc(-100% - 18px));
    visibility: hidden;
    transition:
      transform 300ms cubic-bezier(0.2, 0.9, 0.2, 1),
      visibility 0s linear 300ms;
    box-shadow:
      24px 0 70px rgba(0, 0, 0, 0.52),
      inset -1px 0 rgba(255, 255, 255, 0.1),
      inset 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar::before {
    display: none;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition:
      transform 300ms cubic-bezier(0.2, 0.9, 0.2, 1),
      visibility 0s linear 0s;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: block;
    background: rgba(0, 0, 0, 0.56);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms ease;
  }

  .app-shell.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sidebar-button {
    display: inline-grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    box-shadow:
      inset 0 1px rgba(255, 255, 255, 0.08),
      0 10px 24px rgba(0, 0, 0, 0.24);
    transition:
      background 160ms ease,
      transform 160ms ease,
      box-shadow 160ms ease;
  }

  .mobile-sidebar-button:hover,
  .mobile-sidebar-button:focus-visible {
    background: rgba(255, 255, 255, 0.13);
    box-shadow:
      inset 0 1px rgba(255, 255, 255, 0.1),
      0 12px 28px rgba(0, 0, 0, 0.3);
    transform: scale(1.04);
  }

  .mobile-sidebar-icon {
    width: 18px;
    height: 18px;
  }

  .chat-log,
  .composer-zone {
    width: min(760px, calc(100vw - 28px));
  }

  .admin-portal-scroll {
    width: min(100%, calc(100vw - 28px));
    padding: 20px 14px 120px;
  }

  .admin-availability-panel,
  .admin-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-dashboard-grid,
  .admin-actions-shell {
    grid-template-columns: 1fr;
  }

  .admin-account-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .admin-row-actions {
    grid-column: 1 / -1;
  }

  .top-bar {
    align-items: center;
    gap: 10px;
    padding: 0 14px;
  }

  .message-search {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 44px;
  }

}

@media (max-width: 560px) {
  .main-area {
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .empty-state {
    top: 36%;
  }

  .empty-state h1 {
    max-width: calc(100vw - 36px);
    font-size: clamp(2.04rem, 10vw, 3.05rem);
  }

  .composer-zone {
    margin-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .composer {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    min-height: 58px;
  }

  .attach-button,
  .send-button {
    width: 32px;
    height: 32px;
  }

  .bubble {
    max-width: 92%;
  }

  .message-edit-form {
    min-width: min(330px, 78vw);
  }

  .message-text-action {
    width: 34px;
    height: 34px;
  }

  .message-copy-button {
    width: 34px;
    height: 34px;
  }

  .top-bar {
    align-items: center;
    gap: 8px;
    padding: 0 10px;
  }

  .message-search {
    min-height: 44px;
    padding: 0 11px;
  }

  .message-search input {
    height: 40px;
  }

  .sidebar {
    width: min(330px, 92vw);
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .sidebar-toggle {
    width: 44px;
    height: 44px;
  }

  .add-chat-button {
    width: 42px;
    height: 42px;
  }

  .chat-search {
    min-height: 44px;
  }

  .chat-search input {
    height: 38px;
  }

  .account-interface-scroll {
    padding: 76px 10px 22px;
  }

  .account-modal-panel {
    max-height: calc(100dvh - 104px);
    padding: 16px;
    border-radius: 22px;
  }

  .account-back-button {
    left: max(10px, env(safe-area-inset-left));
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.78rem;
  }

  .account-modal-header {
    gap: 10px;
  }

  .account-profile-summary {
    grid-template-columns: 1fr;
  }

  .account-stat-grid {
    grid-template-columns: 1fr;
  }

  .message-search {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 7px;
    padding: 0 9px;
  }

  .message-search-count {
    display: none;
  }

}

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