:root {
  --bg: #ffffff;
  --text: #11141d;
  --line: #dfe3ea;
  --line-strong: #0f1115;
  --user: #141923;
  --bot: #f3f5f9;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.logo-defs { position: absolute; }

.intro-gate {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(74, 35, 183, 0.35), transparent 55%),
    radial-gradient(circle at 50% 75%, rgba(122, 76, 246, 0.45), transparent 45%),
    #07071a;
  display: grid;
  place-items: center;
  color: #f8f7ff;
}
.intro-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(32px);
  opacity: .6;
  animation: floatOrb 7s ease-in-out infinite alternate;
}
.orb-a { width: 280px; height: 280px; background: rgba(104, 63, 243, 0.6); top: 7%; left: 10%; }
.orb-b { width: 360px; height: 360px; background: rgba(71, 123, 255, 0.45); right: 8%; top: 14%; animation-delay: .8s; }
.orb-c { width: 300px; height: 300px; background: rgba(180, 103, 255, 0.45); left: 35%; bottom: -50px; animation-delay: 1.6s; }
@keyframes floatOrb { from { transform: translateY(0) scale(1); } to { transform: translateY(-16px) scale(1.06); } }

.intro-card {
  position: relative;
  z-index: 2;
  width: min(760px, 92vw);
  text-align: center;
  padding: 40px 24px 34px;
  border-radius: 26px;
  border: 1px solid rgba(199, 180, 255, 0.35);
  background: linear-gradient(180deg, rgba(20, 19, 56, 0.78), rgba(10, 10, 34, 0.86));
  box-shadow: 0 30px 80px rgba(58, 39, 139, 0.45);
}
.intro-fish { width: min(300px, 62vw); height: auto; color: #f7f5ff; margin: 0 auto 8px; }
.intro-card h1 { margin: 0; font-size: clamp(2.7rem, 8vw, 5rem); letter-spacing: -0.04em; font-weight: 700; }
.intro-kicker { margin: 8px 0 8px; font-weight: 700; color: #d9ccff; }
.intro-copy { margin: 0 auto 20px; max-width: 620px; line-height: 1.55; color: #efeaff; }
.intro-lightbar {
  margin: 0 auto 22px;
  width: min(620px, 84%);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(92, 74, 255, 0), #9f8cff, #5f9dff, rgba(92, 74, 255, 0));
  box-shadow: 0 0 26px rgba(140, 111, 255, 0.95), 0 0 44px rgba(95, 157, 255, 0.55);
  animation: pulseBeam 1.8s ease-in-out infinite alternate;
}
@keyframes pulseBeam { from { transform: scaleX(.94); opacity: .82; } to { transform: scaleX(1); opacity: 1; } }

.enter-app-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #6f3aff, #5f83ff);
  box-shadow: 0 14px 32px rgba(102, 74, 252, 0.45);
  cursor: pointer;
}
.enter-app-btn:hover { filter: brightness(1.06); }

.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.topbar,
.chat-area,
.thinking-toolbar,
.input-shell,
.model-menu,
.plus-menu {
  position: relative;
  z-index: 5;
}
.app > .topbar {
  z-index: 30;
}
.left-tools { position: relative; width: fit-content; }
.model-chip-wrap { display: flex; align-items: center; gap: 8px; }
.model-badge {
  font-size: .88rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
}
.icon-btn { border: none; background: transparent; padding: 0; cursor: pointer; }
.fish-logo { display: block; color: #0e1117; shape-rendering: geometricPrecision; }
.fish-logo.small { width: 75px; height: auto; }
.brand { justify-self: center; font-size: 1.95rem; font-weight: 650; letter-spacing: -0.03em; }
.brand-mode-switcher {
  position: relative;
  justify-self: center;
  width: 186px;
  height: 44px;
  display: grid;
  place-items: center;
  z-index: 42;
}
.brand-mode-trigger {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 0;
  border-radius: 12px;
  color: inherit;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transition: opacity .16s ease, transform .2s ease, color .2s ease;
}
.brand-mode-menu {
  position: relative;
  grid-area: 1 / 1;
  width: 186px;
  height: 38px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid rgba(124,58,237,.3);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 9px 24px rgba(15,23,42,.13), 0 0 20px rgba(124,58,237,.09);
  backdrop-filter: blur(16px) saturate(1.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.92);
  transition: opacity .16s ease, visibility .16s ease, transform .2s cubic-bezier(.2,.8,.2,1);
}
.brand-mode-menu::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(100,116,139,.35), transparent);
  pointer-events: none;
}
.brand-mode-switcher:not(.selection-closed):hover .brand-mode-menu,
.brand-mode-switcher.picker-open .brand-mode-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}
.brand-mode-switcher:not(.selection-closed):hover .brand-mode-trigger,
.brand-mode-switcher.picker-open .brand-mode-trigger {
  opacity: 0;
  pointer-events: none;
  transform: scale(.92);
}
.brand-mode-option {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  color: #27324a;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.brand-mode-option:hover:not(:disabled) { background: rgba(99,102,241,.08); }
.brand-mode-option.active {
  color: #312e81;
  background: rgba(238,242,255,.95);
  box-shadow: 0 3px 10px rgba(79,70,229,.12);
}
.brand-mode-option.math-option.active {
  color: #075985;
  background: rgba(224,242,254,.95);
  box-shadow: 0 3px 10px rgba(14,165,233,.14);
}
.brand-mode-option:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.35);
}
.brand-mode-option strong { font-size: .75rem; line-height: 1; }
.brand-mode-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #111827;
  background: rgba(255,255,255,.82);
}
.brand-mode-icon svg {
  width: 19px;
  height: 13px;
  fill: none;
  color: currentColor;
}
.brand-mode-icon.math-icon {
  position: relative;
  color: #0369a1;
  background: radial-gradient(circle at 35% 30%, #f0f9ff, #e0e7ff);
  box-shadow: inset 0 0 0 1px rgba(14,165,233,.2);
}
.brand-mode-icon.math-icon::before,
.brand-mode-icon.math-icon::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(14,165,233,.42);
  border-radius: 50%;
  transform: rotate(-24deg);
}
.brand-mode-icon.math-icon::before { width: 17px; height: 9px; }
.brand-mode-icon.math-icon::after { width: 9px; height: 17px; }
.brand-mode-icon.math-icon i {
  position: relative;
  z-index: 1;
  font-style: normal;
  font-size: .68rem;
  font-weight: 900;
}
.brand-mode-switcher.math-selected .brand-mode-trigger {
  color: #0369a1;
}
@media (hover: none), (pointer: coarse), (max-width: 1024px) {
  .brand-mode-switcher {
    width: 154px;
    height: 42px;
  }
  .brand-mode-trigger {
    padding: 3px 6px;
    font-size: 1.2rem;
  }
  .brand-mode-menu {
    width: 154px;
    height: 36px;
    padding: 3px;
  }
  .brand-mode-option {
    gap: 4px;
    padding: 3px 5px;
  }
  .brand-mode-option strong { font-size: .66rem; }
  .brand-mode-icon {
    width: 21px;
    height: 21px;
  }
  .brand-mode-icon svg { width: 18px; height: 12px; }
}
.right-tools {
  justify-self: end;
  display: flex;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}
.right-tools > * { flex-shrink: 1; }
.memory-btn,
.clear-btn {
  border: 1.7px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}
.ui-inline-icon {
  width: 1.02rem;
  height: 1.02rem;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.16em;
}
.model-menu {
  position: absolute;
  top: 56px;
  left: 0;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16,22,34,.14);
  padding: 6px;
  z-index: 20;
}
.model-option {
  width: 100%;
  border: 1px solid transparent;
  background: #f4f7fb;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  font-size: .95rem;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}
.model-option.active { border-color: #11151d; }
.thinking-mode-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.thinking-mode-picker {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #faf8ff);
  color: #5b21b6;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(109, 40, 217, .09);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.thinking-mode-picker:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(109, 40, 217, .16);
}
.thinking-mode-picker.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #6d28d9, #9333ea);
}
.thinking-mode-picker:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.thinking-mode-icon {
  width: 16px;
  min-width: 16px;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.thinking-mode-picker .css-gear-icon {
  --gear-hole: #fff;
  transform: scale(.68);
}
.thinking-mode-chevron {
  margin-left: 1px;
  font-size: .9rem;
  line-height: .8;
  transition: transform .18s ease;
}
.thinking-mode-picker[aria-expanded="true"] .thinking-mode-chevron { transform: rotate(180deg); }
.thinking-mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 218px;
  padding: 7px;
  border: 1px solid rgba(196, 181, 253, .8);
  border-radius: 15px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 44px rgba(76, 29, 149, .2);
  backdrop-filter: blur(16px);
  z-index: 35;
}
.thinking-mode-option {
  width: 100%;
  display: grid;
  grid-template-columns: 27px 1fr;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #312e81;
  text-align: left;
  cursor: pointer;
}
.thinking-mode-option:hover { background: #f5f3ff; }
.thinking-mode-option.active {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}
.thinking-mode-option > span:last-child { display: grid; gap: 2px; }
.thinking-mode-option strong { font-size: .86rem; }
.thinking-mode-option small { color: #6b7280; font-size: .7rem; }
.thinking-mode-option-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1rem;
}
.thinking-mode-option .css-gear-icon {
  --gear-core: #6d28d9;
  --gear-hole: #fff;
  transform: scale(.72);
}

/* Fast / Thinking lives in the composer as a quiet secondary control. */
@keyframes composerThinkingMenuIn {
  from { opacity: 0; transform: translate(-50%, 8px) scale(.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes composerThinkingChosen {
  0% { transform: scale(1); }
  42% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.input-shell > .composer-thinking-picker {
  grid-column: 1 / -1;
  justify-self: center;
  z-index: 42;
  margin: -2px 0 -1px;
}
.input-shell > .composer-thinking-picker.hidden { display: none !important; }
.composer-thinking-picker .thinking-mode-picker {
  min-height: 22px;
  gap: 4px;
  padding: 2px 8px;
  border-color: transparent;
  background: transparent;
  color: #6b7280;
  font-size: .68rem;
  font-weight: 750;
  opacity: .7;
  box-shadow: none;
  transition: opacity .2s ease, color .2s ease, background .2s ease, border-color .2s ease, box-shadow .22s ease, transform .22s cubic-bezier(.2,.85,.25,1);
}
.composer-thinking-picker .thinking-mode-picker:hover:not(:disabled),
.composer-thinking-picker .thinking-mode-picker:focus-visible {
  opacity: 1;
  color: #6d28d9;
  border-color: rgba(139,92,246,.16);
  background: rgba(245,243,255,.76);
  box-shadow: 0 5px 15px rgba(91,33,182,.1);
  transform: translateY(-1px);
}
.composer-thinking-picker .thinking-mode-picker.active {
  color: #7c3aed;
  border-color: transparent;
  background: transparent;
}
.composer-thinking-picker .thinking-mode-icon {
  width: 12px;
  min-width: 12px;
  font-size: .72rem;
}
.composer-thinking-picker .thinking-mode-chevron {
  display: inline-block;
  font-size: .72rem;
}
.composer-thinking-picker.is-open { z-index: 125; }
.composer-thinking-picker.is-open .thinking-mode-picker {
  opacity: 1;
  color: #fff;
  border-color: rgba(196,181,253,.82);
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  box-shadow: 0 9px 24px rgba(109,40,217,.27), 0 0 0 4px rgba(139,92,246,.09);
  transform: translateY(-1px) scale(1.045);
}
.composer-thinking-picker.mode-selected-pulse { animation: composerThinkingChosen .48s cubic-bezier(.2,.85,.25,1); }
.composer-thinking-picker .thinking-mode-menu {
  top: auto;
  bottom: calc(100% + 58px);
  left: 50%;
  width: min(238px, calc(100vw - 28px));
  transform-origin: bottom center;
}
.composer-thinking-picker .thinking-mode-menu:not(.hidden) {
  animation: composerThinkingMenuIn .22s cubic-bezier(.2,.85,.25,1) both;
}
body.ui-dark-mode .composer-thinking-picker .thinking-mode-picker,
body.ui-dark-mode .composer-thinking-picker .thinking-mode-picker.active {
  color: #a5b4fc;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
body.ui-dark-mode .composer-thinking-picker.is-open .thinking-mode-picker {
  color: #fff;
  border-color: rgba(196,181,253,.55);
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  box-shadow: 0 10px 28px rgba(0,0,0,.34), 0 0 0 4px rgba(139,92,246,.12);
}
@media (prefers-reduced-motion: reduce) {
  .composer-thinking-picker .thinking-mode-menu:not(.hidden),
  .composer-thinking-picker.mode-selected-pulse { animation: none; }
}


.memory-toast {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #f5f3ff;
  background: linear-gradient(90deg, #6d28d9, #7c3aed, #a855f7);
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.7),
    0 0 26px rgba(168, 85, 247, 0.75),
    0 0 46px rgba(124, 58, 237, 0.45);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .01em;
  animation: memoryGlow 1.2s ease-in-out infinite alternate;
}
.balos-notice {
  position: fixed;
  inset: 0;
  z-index: 340;
  display: grid;
  place-items: start center;
  padding-top: 92px;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(6px);
}
.balos-notice.hidden { display: none !important; }
.balos-notice-card {
  width: min(420px, calc(100vw - 28px));
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(167, 139, 250, 0.55);
  background: linear-gradient(180deg, rgba(18, 18, 40, 0.96), rgba(34, 20, 68, 0.96));
  color: #f5f3ff;
  box-shadow: 0 24px 70px rgba(76, 29, 149, 0.4), 0 0 0 1px rgba(196, 181, 253, 0.18) inset;
  animation: balosNoticeFloat .45s ease;
}
.balos-notice-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.balos-notice-card strong {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 6px;
}
.balos-notice-card p {
  margin: 0 0 14px;
  line-height: 1.55;
  color: #ddd6fe;
}
.balos-notice-card button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(90deg, #7c3aed, #8b5cf6, #6366f1);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.36);
  cursor: pointer;
}
@keyframes balosNoticeFloat {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-intro-notice {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, .58);
  backdrop-filter: blur(12px);
}
.agent-intro-notice.hidden { display: none !important; }
.agent-intro-card {
  width: min(620px, calc(100vw - 28px));
  border-radius: 20px;
  border: 1px solid rgba(125, 211, 252, .42);
  background: linear-gradient(145deg, rgba(15, 23, 42, .98), rgba(17, 24, 39, .98));
  color: #f8fafc;
  box-shadow: 0 32px 90px rgba(2, 6, 23, .52);
  overflow: hidden;
  animation: agentIntroIn .42s ease;
}
.agent-thumb {
  height: 190px;
  position: relative;
  background:
    linear-gradient(130deg, rgba(20, 184, 166, .24), transparent 38%),
    linear-gradient(230deg, rgba(124, 58, 237, .26), transparent 42%),
    #08111f;
  display: grid;
  place-items: center;
}
.agent-thumb-browser {
  width: min(420px, 78%);
  height: 128px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, .32);
  background: rgba(15, 23, 42, .82);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
  position: relative;
  overflow: hidden;
}
.agent-thumb-browser > span {
  position: absolute;
  top: 13px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38bdf8;
}
.agent-thumb-browser > span:nth-child(1) { left: 14px; background: #fb7185; }
.agent-thumb-browser > span:nth-child(2) { left: 30px; background: #facc15; }
.agent-thumb-browser > span:nth-child(3) { left: 46px; background: #34d399; }
.agent-thumb-url {
  position: absolute;
  left: 72px;
  right: 18px;
  top: 10px;
  height: 16px;
  border-radius: 999px;
  background: rgba(226, 232, 240, .12);
}
.agent-thumb-url::after {
  content: "https://";
  position: absolute;
  left: 12px;
  top: 2px;
  font-size: .58rem;
  color: rgba(226, 232, 240, .62);
}
.agent-thumb-scan {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 48px;
  bottom: 18px;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(20, 184, 166, .28) 0 18%, transparent 18% 24%, rgba(59, 130, 246, .22) 24% 55%, transparent 55% 62%, rgba(168, 85, 247, .2) 62% 100%),
    repeating-linear-gradient(180deg, rgba(248, 250, 252, .18), rgba(248, 250, 252, .18) 2px, transparent 2px, transparent 13px);
}
.agent-thumb-scan::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, .5), transparent);
  animation: agentScanThumb 1.8s ease-in-out infinite;
}
.agent-thumb-mark {
  position: absolute;
  right: 74px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #ccfbf1;
  background: rgba(15, 23, 42, .88);
  border: 1px solid rgba(94, 234, 212, .38);
  font-weight: 900;
  box-shadow: 0 18px 44px rgba(20, 184, 166, .22);
}
.agent-intro-copy {
  padding: 20px 22px 8px;
}
.agent-intro-copy span {
  color: #5eead4;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.agent-intro-copy strong {
  display: block;
  margin-top: 7px;
  font-size: 1.35rem;
}
.agent-intro-copy p {
  margin: 8px 0 0;
  color: #cbd5e1;
  line-height: 1.58;
}
.agent-intro-actions {
  display: flex;
  gap: 10px;
  padding: 14px 22px 22px;
}
.agent-intro-actions button {
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}
#agentTryNowBtn {
  color: #022c22;
  background: linear-gradient(90deg, #5eead4, #93c5fd);
  border-color: transparent;
}
#agentLaterBtn {
  color: #e2e8f0;
  background: rgba(15, 23, 42, .72);
}
@keyframes agentIntroIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes agentScanThumb {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.agent-virtual-desktop {
  position: fixed;
  inset: 86px 18px 96px;
  z-index: 280;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.agent-virtual-desktop.hidden { display: none !important; }
.agent-desktop-window {
  width: min(860px, 96vw);
  height: min(520px, calc(100vh - 170px));
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, .36);
  background: #08111f;
  box-shadow: 0 34px 90px rgba(2, 6, 23, .4);
  pointer-events: auto;
}
.agent-window-bar {
  height: 48px;
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, #111827, #0f172a);
  border-bottom: 1px solid rgba(148, 163, 184, .18);
}
.agent-window-dots {
  display: flex;
  gap: 6px;
}
.agent-window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fb7185;
}
.agent-window-dots span:nth-child(2) { background: #facc15; }
.agent-window-dots span:nth-child(3) { background: #34d399; }
.agent-address-bar {
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(248, 250, 252, .08);
  color: #cbd5e1;
  font-size: .82rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.agent-browser-body {
  position: relative;
  height: calc(100% - 86px);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(236, 253, 245, .96), rgba(240, 249, 255, .96)),
    #f8fafc;
}
.agent-search-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(20, 184, 166, .18), transparent 34%),
    linear-gradient(180deg, #f8fafc, #e0f2fe);
  transition: opacity .55s ease, transform .55s ease;
}
.agent-virtual-desktop[data-live="1"] .agent-search-stage {
  opacity: 0;
  transform: translateY(-18px) scale(.98);
  pointer-events: none;
}
.agent-search-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #0f766e;
  background: #ffffff;
  border: 1px solid rgba(20, 184, 166, .34);
  font-weight: 900;
  box-shadow: 0 18px 44px rgba(20, 184, 166, .2);
}
.agent-search-title {
  display: grid;
  place-items: center;
  gap: 3px;
  color: #0f172a;
  text-align: center;
}
.agent-search-title strong {
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
  letter-spacing: -.04em;
}
.agent-search-title span {
  color: #0f766e;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.agent-search-box {
  width: min(520px, 78%);
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 999px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid rgba(14, 165, 233, .42);
  box-shadow: 0 18px 45px rgba(14, 165, 233, .16);
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.agent-search-hint {
  color: #0f766e;
  font-weight: 900;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.agent-live-frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
  opacity: 0;
  transform: scale(.985);
  transition: opacity .55s ease, transform .55s ease;
}
.agent-live-frame.visible {
  opacity: .72;
  transform: scale(1);
}
.agent-page-skeleton {
  position: absolute;
  inset: 28px;
  z-index: 2;
  animation: agentPageScroll 7.2s ease-in-out infinite;
  transition: opacity .45s ease;
}
.agent-virtual-desktop[data-live="1"] .agent-page-skeleton {
  opacity: .62;
}
.agent-page-hero {
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(100deg, #0f766e, #2563eb);
  margin-bottom: 22px;
}
.agent-page-lines {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.agent-page-lines span {
  height: 12px;
  border-radius: 999px;
  background: #cbd5e1;
}
.agent-page-lines span:nth-child(1) { width: 72%; }
.agent-page-lines span:nth-child(2) { width: 90%; }
.agent-page-lines span:nth-child(3) { width: 64%; }
.agent-page-lines span:nth-child(4) { width: 82%; }
.agent-page-lines span:nth-child(5) { width: 52%; }
.agent-page-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.agent-page-grid span {
  height: 98px;
  border-radius: 14px;
  background: rgba(14, 165, 233, .16);
  border: 1px solid rgba(14, 165, 233, .22);
}
.agent-scan-beam {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.agent-scan-beam.run {
  opacity: 1;
}
.agent-scan-beam::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18%;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(20, 184, 166, .32), transparent);
  animation: agentBeamMove 1.9s ease-in-out infinite;
}
.agent-cursor {
  position: absolute;
  left: 22%;
  top: 18%;
  width: 18px;
  height: 24px;
  z-index: 4;
  filter: drop-shadow(0 8px 10px rgba(2, 6, 23, .28));
  transition: left 1.1s ease, top 1.1s ease, transform .5s ease;
}
.agent-cursor::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #0f172a;
  clip-path: polygon(0 0, 0 100%, 36% 74%, 56% 100%, 78% 89%, 58% 62%, 100% 62%);
}
.agent-cursor::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: rgba(20, 184, 166, .35);
}
.agent-cursor.pulse::after {
  animation: agentCursorPulse .7s ease-out;
}
.agent-virtual-desktop[data-phase="boot"] .agent-cursor { left: 18%; top: 22%; }
.agent-virtual-desktop[data-phase="newtab"] .agent-cursor { left: 32%; top: 12%; }
.agent-virtual-desktop[data-phase="search"] .agent-cursor { left: 50%; top: 47%; transform: scale(.96); }
.agent-virtual-desktop[data-phase="address"] .agent-cursor { left: 43%; top: 8%; transform: scale(.92); }
.agent-virtual-desktop[data-phase="enter"] .agent-cursor { left: 72%; top: 9%; }
.agent-virtual-desktop[data-phase="clickHero"] .agent-cursor { left: 50%; top: 28%; transform: scale(1); }
.agent-virtual-desktop[data-phase="clickText"] .agent-cursor { left: 34%; top: 52%; }
.agent-virtual-desktop[data-phase="scroll"] .agent-cursor { left: 82%; top: 64%; transform: rotate(8deg); }
.agent-virtual-desktop[data-phase="cards"] .agent-cursor { left: 58%; top: 74%; transform: rotate(-4deg); }
.agent-virtual-desktop[data-phase="done"] .agent-cursor { left: 88%; top: 18%; transform: scale(.96); }
.agent-desktop-status {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #ccfbf1;
  background: #0f172a;
  border-top: 1px solid rgba(148, 163, 184, .18);
  font-weight: 800;
}
@keyframes agentBeamMove {
  from { transform: translateY(0); }
  to { transform: translateY(720%); }
}
@keyframes agentPageScroll {
  0%, 22% { transform: translateY(0); }
  38%, 58% { transform: translateY(-64px); }
  76%, 100% { transform: translateY(-126px); }
}
@keyframes agentCursorPulse {
  0% { width: 0; height: 0; opacity: .85; transform: translate(-50%, -50%); }
  100% { width: 52px; height: 52px; opacity: 0; transform: translate(-50%, -50%); }
}

@media (max-width: 700px) {
  .agent-virtual-desktop {
    inset: 78px 8px 92px;
  }
  .agent-desktop-window {
    height: min(500px, calc(100vh - 160px));
  }
  .agent-intro-actions {
    flex-direction: column;
  }
}

/* Math keeps the same polished composer, but its interaction light is blue. */
@keyframes mathControlBreathe {
  0%, 100% { box-shadow: 0 8px 22px rgba(2,132,199,.14), inset 0 1px 0 rgba(255,255,255,.92); }
  50% { box-shadow: 0 11px 27px rgba(14,165,233,.23), 0 0 0 3px rgba(56,189,248,.07), inset 0 1px 0 rgba(255,255,255,.96); }
}
.app.math-mode #userInput {
  border-color: rgba(14,165,233,.25);
  box-shadow: 0 11px 30px rgba(14,116,144,.1), 0 3px 11px rgba(14,165,233,.08), inset 0 1px 0 rgba(255,255,255,.96);
}
.app.math-mode #userInput:hover {
  border-color: rgba(14,165,233,.48);
  box-shadow: 0 14px 34px rgba(14,116,144,.13), 0 0 0 2px rgba(56,189,248,.07), inset 0 1px 0 #fff;
}
.app.math-mode #userInput:focus {
  border-color: rgba(2,132,199,.72);
  box-shadow: 0 16px 38px rgba(14,116,144,.15), 0 0 0 5px rgba(56,189,248,.13), 0 7px 22px rgba(14,165,233,.16), inset 0 1px 0 #fff;
}
.app.math-mode .plus-btn,
.app.math-mode .input-shell button[type="submit"] {
  border-color: rgba(14,165,233,.36);
  color: #0369a1;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(224,242,254,.94));
  box-shadow: 0 8px 22px rgba(2,132,199,.14), inset 0 1px 0 rgba(255,255,255,.92);
  animation-name: mathControlBreathe;
}
.app.math-mode .plus-btn:hover,
.app.math-mode .input-shell button[type="submit"]:hover {
  border-color: rgba(2,132,199,.62);
  box-shadow: 0 13px 29px rgba(2,132,199,.22), 0 0 0 4px rgba(56,189,248,.1), inset 0 1px 0 #fff;
}
.app.math-mode #chatSubmitBtn.voice-launch {
  border-color: rgba(125,211,252,.78);
  background: linear-gradient(145deg, #38bdf8, #0284c7 58%, #0369a1);
  box-shadow: 0 10px 27px rgba(2,132,199,.31), 0 0 0 4px rgba(56,189,248,.1), inset 0 1px 0 rgba(255,255,255,.3);
}
body.ui-dark-mode .app.math-mode #userInput {
  border-color: rgba(56,189,248,.34);
  box-shadow: 0 13px 34px rgba(0,0,0,.3), 0 4px 16px rgba(2,132,199,.2), inset 0 1px 0 rgba(255,255,255,.055);
}

/* Auto-growing message composer: one line at rest, expands for longer prompts. */
#userInput {
  box-sizing: border-box;
  display: block;
  max-height: 144px;
  resize: none;
  overflow-y: hidden;
  font: inherit;
  line-height: 1.45;
  scrollbar-width: thin;
}
.input-web-wrap { align-self: end; }
.input-shell > .plus-area,
.input-shell > #chatSubmitBtn,
.input-shell > #balleGenerateBtn { align-self: end; }
@media (max-width: 700px) {
  #userInput { max-height: 116px; }
}
body.tv-mode #userInput { max-height: 184px; }

.math-ask-guide {
  display: none;
  width: min(790px, calc(100% - 82px));
  margin: -1px auto 3px;
  color: #075985;
  font-size: .72rem;
  position: relative;
  z-index: 25;
}
.app.math-mode .math-ask-guide { display: block; }
.math-ask-guide summary {
  width: fit-content;
  margin: 0 auto;
  padding: 5px 11px;
  border: 1px solid rgba(56,189,248,.34);
  border-radius: 999px;
  background: rgba(240,249,255,.82);
  color: #0369a1;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 5px 16px rgba(2,132,199,.08);
  transition: transform .18s ease, border-color .18s ease, box-shadow .2s ease;
}
.math-ask-guide summary::-webkit-details-marker { display: none; }
.math-ask-guide summary:hover {
  transform: translateY(-1px);
  border-color: rgba(2,132,199,.6);
  box-shadow: 0 8px 20px rgba(2,132,199,.15), 0 0 0 3px rgba(56,189,248,.07);
}
.math-ask-guide[open] summary { border-radius: 12px 12px 8px 8px; }
.math-ask-guide-panel {
  margin: 7px auto 0;
  max-width: 720px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  border: 1px solid rgba(125,211,252,.48);
  border-radius: 14px;
  background: rgba(240,249,255,.96);
  box-shadow: 0 13px 30px rgba(2,132,199,.12);
}
.math-ask-guide-panel p { margin: 0; line-height: 1.42; }
.math-ask-guide-panel code {
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(186,230,253,.65);
  color: #0c4a6e;
}
body.ui-dark-mode .math-ask-guide summary,
body.ui-dark-mode .math-ask-guide-panel {
  color: #bae6fd;
  background: rgba(8,47,73,.92);
  border-color: rgba(56,189,248,.38);
}
@media (max-width: 700px) {
  .math-ask-guide { width: calc(100% - 34px); margin-top: 0; font-size: .68rem; }
  .math-ask-guide-panel { grid-template-columns: 1fr; max-height: 38vh; overflow: auto; }
}

body.baluk23-tour-open { overflow: hidden; }
.math-launch-promo {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 360;
  width: min(680px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: 142px minmax(230px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  overflow: hidden;
  color: #f8fafc;
  border: 1px solid rgba(147, 197, 253, .34);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 50%, rgba(37, 99, 235, .28), transparent 34%),
    linear-gradient(135deg, rgba(8, 13, 35, .97), rgba(28, 13, 58, .97));
  box-shadow: 0 24px 70px rgba(15, 23, 42, .42), 0 0 34px rgba(99, 102, 241, .2);
  backdrop-filter: blur(18px);
  animation: mathLaunchRise .65s cubic-bezier(.18,.82,.2,1);
}
.math-launch-promo.hidden { display: none !important; }
.math-launch-promo.is-leaving { animation: mathLaunchLeave .28s ease forwards; }
.math-launch-promo::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 28%, rgba(255,255,255,.09) 46%, transparent 64%);
  transform: translateX(-110%);
  animation: mathLaunchSheen 3.2s ease-in-out infinite;
}
.math-launch-transition {
  position: relative;
  height: 66px;
  display: grid;
  grid-template-columns: 1fr 38px 1fr;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(147,197,253,.22);
  border-radius: 14px;
  background: rgba(2, 6, 23, .56);
}
.math-launch-baluk,
.math-launch-mode {
  position: relative;
  z-index: 2;
  font-size: .8rem;
  font-weight: 900;
  white-space: nowrap;
}
.math-launch-baluk {
  color: #bfdbfe;
  animation: mathBalukFade 3.4s ease-in-out infinite;
}
.math-launch-mode {
  color: #fff;
  text-shadow: 0 0 16px #8b5cf6;
  animation: mathModeReveal 3.6s ease-in-out infinite;
}
.math-launch-flow {
  display: flex;
  justify-content: center;
  gap: 3px;
}
.math-launch-flow i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 10px #60a5fa;
  animation: mathFlowDot 1.2s ease-in-out infinite;
}
.math-launch-flow i:nth-child(2) { animation-delay: .18s; }
.math-launch-flow i:nth-child(3) { animation-delay: .36s; }
.math-launch-cursor {
  position: absolute;
  left: 36%;
  top: 71%;
  z-index: 4;
  width: 18px;
  height: 24px;
  transform-origin: 45% 42%;
  animation: mathCursorFlipClick 3.6s cubic-bezier(.44,.03,.2,1) infinite;
}
.math-launch-cursor::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 68%, 57% 72%, 76% 100%, 61% 100%, 44% 75%, 15% 100%);
  background: #fff;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.55));
}
.math-launch-cursor i {
  position: absolute;
  left: 10px;
  top: 16px;
  width: 8px;
  height: 3px;
  border-radius: 2px;
  background: #60a5fa;
  transform: rotate(54deg);
}
.math-launch-click-ring {
  position: absolute;
  left: 82%;
  top: 50%;
  z-index: 3;
  width: 20px;
  height: 20px;
  border: 2px solid #c4b5fd;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.2);
  animation: mathClickRing 3.6s ease-in-out infinite;
}
.math-launch-copy { min-width: 0; }
.math-launch-copy > span {
  color: #93c5fd;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.math-launch-copy strong {
  display: block;
  margin-top: 2px;
  font-size: .96rem;
  line-height: 1.25;
}
.math-launch-copy p {
  margin: 4px 0 0;
  color: #cbd5e1;
  font-size: .75rem;
  line-height: 1.35;
}
.math-launch-try {
  position: relative;
  z-index: 2;
  padding: 10px 12px;
  color: #fff;
  border: 1px solid rgba(191, 219, 254, .42);
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .32);
  font: inherit;
  font-size: .76rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.math-launch-try:hover { transform: translateY(-1px); filter: brightness(1.08); }
.math-launch-close {
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 4;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  color: #cbd5e1;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
}
@keyframes mathLaunchRise {
  from { opacity: 0; transform: translateY(34px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mathLaunchLeave {
  to { opacity: 0; transform: translateY(22px) scale(.98); }
}
@keyframes mathLaunchSheen {
  0%, 24% { transform: translateX(-110%); }
  62%, 100% { transform: translateX(120%); }
}
@keyframes mathBalukFade {
  0%, 25% { opacity: 1; transform: translateX(0); }
  48%, 76% { opacity: .42; transform: translateX(4px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes mathModeReveal {
  0%, 39% { opacity: .55; transform: translateX(-3px) scale(1); }
  55%, 72% { opacity: 1; transform: translateX(0) scale(1.12); }
  100% { opacity: .55; transform: translateX(-3px) scale(1); }
}
@keyframes mathCursorFlipClick {
  0%, 12% { left: 34%; top: 72%; opacity: 0; transform: rotate(-30deg) scale(.75); }
  20% { opacity: 1; }
  42% { left: 61%; top: 20%; transform: rotate(330deg) scale(1.05); }
  58% { left: 79%; top: 48%; transform: rotate(720deg) scale(.9); }
  63% { left: 79%; top: 48%; transform: rotate(720deg) scale(.72); }
  70%, 82% { left: 79%; top: 48%; opacity: 1; transform: rotate(720deg) scale(1); }
  100% { left: 93%; top: 18%; opacity: 0; transform: rotate(900deg) scale(.7); }
}
@keyframes mathClickRing {
  0%, 57% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  63% { opacity: .9; transform: translate(-50%, -50%) scale(.35); }
  75% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
  100% { opacity: 0; }
}
@keyframes mathFlowDot {
  0%, 100% { opacity: .35; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1.25); }
}
.baluk23-intro-notice {
  position: fixed;
  inset: 0;
  z-index: 390;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(76, 29, 149, .38), transparent 34%),
    rgba(2, 4, 18, .76);
  backdrop-filter: blur(18px) saturate(1.2);
}
.baluk23-intro-notice.hidden,
.baluk23-tour.hidden { display: none !important; }
.baluk23-intro-card {
  width: min(760px, calc(100vw - 28px));
  overflow: hidden;
  color: #f8fafc;
  border: 1px solid rgba(167, 139, 250, .45);
  border-radius: 26px;
  background: linear-gradient(155deg, rgba(14, 8, 38, .98), rgba(24, 12, 64, .98));
  box-shadow: 0 42px 120px rgba(3, 1, 18, .72), 0 0 70px rgba(124, 58, 237, .2);
  animation: baluk23IntroIn .52s cubic-bezier(.2,.82,.22,1);
}
.baluk23-intro-art {
  position: relative;
  height: clamp(220px, 45vh, 410px);
  overflow: hidden;
  background: #07031d;
}
.baluk23-intro-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(transparent, rgba(14, 8, 38, .98));
}
.baluk23-intro-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  animation: baluk23HeroDrift 12s ease-in-out infinite alternate;
}
.baluk23-intro-sheen {
  position: absolute;
  inset: -30% auto -30% -25%;
  width: 36%;
  z-index: 2;
  transform: rotate(12deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  filter: blur(12px);
  animation: baluk23Sheen 4.8s ease-in-out infinite;
}
.baluk23-intro-copy { padding: 18px 26px 10px; }
.baluk23-intro-copy span,
.baluk23-page-heading > span {
  color: #a7f3d0;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.baluk23-intro-copy strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.7rem, 5vw, 2.55rem);
  letter-spacing: -.04em;
}
.baluk23-intro-copy p {
  margin: 8px 0 0;
  color: #ddd6fe;
  font-size: clamp(.95rem, 2vw, 1.08rem);
  line-height: 1.55;
}
.baluk23-intro-actions {
  display: flex;
  gap: 12px;
  padding: 14px 26px 26px;
}
.baluk23-intro-actions button,
.baluk23-primary-action,
.baluk23-secondary-action {
  border-radius: 14px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}
.baluk23-intro-actions button:hover,
.baluk23-primary-action:hover,
.baluk23-secondary-action:hover { transform: translateY(-2px); }
.baluk23-explore-btn,
.baluk23-primary-action {
  color: #fff;
  border: 1px solid rgba(196, 181, 253, .5);
  background: linear-gradient(100deg, rgba(37, 99, 235, .92), rgba(124, 58, 237, .96), rgba(168, 85, 247, .92));
  box-shadow: 0 14px 38px rgba(109, 40, 217, .38), 0 0 28px rgba(59, 130, 246, .2);
  backdrop-filter: blur(14px);
}
.baluk23-later-btn {
  color: #f8fafc;
  border: 1px solid rgba(255,255,255,.5);
  background: rgba(5, 5, 10, .82);
}
.baluk24-intro-card {
  width: min(680px, calc(100vw - 28px));
  border-color: rgba(96, 165, 250, .46);
  background: linear-gradient(155deg, rgba(5, 10, 42, .99), rgba(26, 11, 67, .98));
  box-shadow: 0 42px 120px rgba(2, 6, 35, .76), 0 0 64px rgba(79, 70, 229, .24);
}
.baluk24-intro-art { height: clamp(190px, 32vw, 320px); }
.baluk24-intro-art img { object-position: center; }
.baluk24-intro-card .baluk23-intro-actions { padding-top: 16px; }
.baluk24-understood-btn { width: 100%; min-height: 48px; }
.baluk23-tour {
  --tour-ink: #f8fafc;
  position: fixed;
  inset: 0;
  z-index: 420;
  overflow: hidden;
  color: var(--tour-ink);
  background:
    linear-gradient(rgba(5, 3, 20, .88), rgba(8, 4, 27, .96)),
    url("assets/baluk-2.3-launch.png") center / cover fixed;
}
.baluk23-tour::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 92, 246, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, .07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}
.baluk23-tour-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: .35;
}
.baluk23-tour-glow.glow-a { left: -160px; top: 18%; background: #2563eb; }
.baluk23-tour-glow.glow-b { right: -170px; bottom: 2%; background: #9333ea; }
.baluk23-tour-header {
  position: relative;
  z-index: 5;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid rgba(196, 181, 253, .18);
  background: rgba(5, 3, 20, .54);
  backdrop-filter: blur(20px);
}
.baluk23-tour-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.baluk23-brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #65ff8f;
  box-shadow: 0 0 0 5px rgba(101,255,143,.13), 0 0 22px #65ff8f;
}
.baluk23-tour-progress { display: flex; gap: 9px; }
.baluk23-tour-progress button {
  width: 30px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
  cursor: pointer;
  transition: width .25s ease, background .25s ease, box-shadow .25s ease;
}
.baluk23-tour-progress button.active {
  width: 54px;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  box-shadow: 0 0 18px rgba(139,92,246,.7);
}
.baluk23-tour-close {
  justify-self: end;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 10, 38, .64);
  font-size: 1.45rem;
  cursor: pointer;
}
.baluk23-tour-viewport {
  position: relative;
  height: calc(100vh - 72px);
  overflow: hidden auto;
}
.baluk23-tour-track {
  width: 200%;
  min-height: 100%;
  display: flex;
  align-items: stretch;
  transition: transform .72s cubic-bezier(.2,.8,.18,1);
  will-change: transform;
}
.baluk23-tour-page {
  width: 50%;
  flex: 0 0 50%;
  min-height: calc(100vh - 72px);
  padding: clamp(26px, 5vw, 62px) clamp(18px, 6vw, 82px) 52px;
}
.baluk23-page-heading {
  max-width: 850px;
  margin: 0 auto 30px;
  text-align: center;
}
.baluk23-page-heading h2 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -.055em;
  background: linear-gradient(90deg, #fff, #ddd6fe 48%, #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.baluk23-page-heading p { margin: 0; color: #c4b5fd; line-height: 1.55; }
.baluk23-network-grid {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.baluk23-network-card {
  --network-x: 50%;
  --network-y: 50%;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(167, 139, 250, .28);
  border-radius: 24px;
  background: rgba(9, 7, 29, .7);
  box-shadow: 0 24px 68px rgba(0,0,0,.25);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.baluk23-network-card.is-exploring,
.baluk23-network-card:hover {
  transform: translateY(-5px);
  border-color: rgba(101, 255, 143, .58);
  box-shadow: 0 28px 90px rgba(0,0,0,.4), 0 0 34px rgba(34,197,94,.13);
}
.baluk23-network-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
}
.baluk23-network-label span { font-size: 1.1rem; font-weight: 900; }
.baluk23-network-label small { color: #a7f3d0; }
.baluk23-network-visual {
  position: relative;
  height: clamp(190px, 28vw, 330px);
  overflow: hidden;
  background: #f8fafc;
}
.baluk23-network-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: filter .3s ease, opacity .3s ease, transform .5s ease;
}
.baluk23-network-card.legacy img {
  opacity: .68;
  filter: grayscale(.18) contrast(.98);
  transform: scale(.92);
}
.baluk23-network-card.current img {
  opacity: .96;
  filter: saturate(1.35) contrast(1.04);
  transform: scale(1.04);
}
.baluk23-network-mask {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 14%, rgba(248,250,252,.92) 14% 28%, transparent 28% 48%, rgba(248,250,252,.88) 48% 64%, transparent 64% 78%, rgba(248,250,252,.9) 78%);
  opacity: .68;
}
.baluk23-network-cursor {
  position: absolute;
  left: var(--network-x);
  top: var(--network-y);
  width: 18px;
  height: 18px;
  opacity: 0;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #65ff8f;
  box-shadow: 0 0 0 9px rgba(101,255,143,.16), 0 0 30px #65ff8f;
  pointer-events: none;
  transition: opacity .16s ease;
}
.baluk23-network-card.is-exploring .baluk23-network-cursor { opacity: 1; }
.baluk23-extra-links i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a7ff83;
  box-shadow: 0 0 14px #65ff8f;
  animation: baluk23NodePulse 1.8s ease-in-out infinite alternate;
}
.baluk23-extra-links i:nth-child(1) { left: 17%; top: 23%; }
.baluk23-extra-links i:nth-child(2) { left: 41%; top: 63%; animation-delay: .25s; }
.baluk23-extra-links i:nth-child(3) { left: 59%; top: 29%; animation-delay: .5s; }
.baluk23-extra-links i:nth-child(4) { left: 76%; top: 68%; animation-delay: .75s; }
.baluk23-extra-links i:nth-child(5) { left: 89%; top: 38%; animation-delay: 1s; }
.baluk23-network-tooltip {
  min-height: 82px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 13px 18px 16px;
}
.baluk23-network-tooltip strong { color: #bbf7d0; }
.baluk23-network-tooltip span { color: #cbd5e1; font-size: .9rem; line-height: 1.42; }
.baluk23-compare-table-wrap {
  max-width: 1160px;
  margin: 24px auto;
  overflow-x: auto;
  border: 1px solid rgba(167,139,250,.22);
  border-radius: 20px;
  background: rgba(10, 7, 31, .72);
  backdrop-filter: blur(16px);
}
.baluk23-compare-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.baluk23-compare-table th,
.baluk23-compare-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.baluk23-compare-table th { color: #ddd6fe; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.baluk23-compare-table td { color: #cbd5e1; }
.baluk23-compare-table td:first-child { color: #fff; font-weight: 800; }
.baluk23-compare-table b { color: #86efac; }
.baluk23-compare-table .metric-value {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .12);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}
.baluk23-compare-table b.metric-value {
  background: rgba(34, 197, 94, .14);
  box-shadow: inset 0 0 0 1px rgba(134, 239, 172, .2);
}
.baluk23-compare-page > .baluk23-primary-action { display: block; margin: 0 auto; }
.baluk23-primary-action { border: 1px solid rgba(196,181,253,.48); }
.baluk23-primary-action span { margin-left: 12px; }
.baluk23-features-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.baluk23-feature-rail {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  gap: 18px;
  padding: 16px 8px 30px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
}
.baluk23-feature-rail::-webkit-scrollbar { display: none; }
.baluk23-feature-rail.dragging { cursor: grabbing; scroll-snap-type: none; }
.baluk23-feature-card {
  position: relative;
  min-width: min(280px, 76vw);
  min-height: 320px;
  scroll-snap-align: center;
  overflow: hidden;
  text-align: left;
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(155deg, rgba(20,14,50,.96), rgba(8,7,25,.96));
  box-shadow: 0 22px 62px rgba(0,0,0,.28);
  cursor: pointer;
  transition: transform .32s ease, border-color .32s ease, box-shadow .32s ease;
}
.baluk23-feature-card:hover,
.baluk23-feature-card.active {
  transform: translateY(-10px) rotateX(2deg);
  border-color: var(--feature-color, #a78bfa);
  box-shadow: 0 30px 82px rgba(0,0,0,.42), 0 0 34px color-mix(in srgb, var(--feature-color, #a78bfa) 35%, transparent);
}
.baluk23-feature-card.math { --feature-color: #60a5fa; }
.baluk23-feature-card.agent { --feature-color: #34d399; }
.baluk23-feature-card.web { --feature-color: #a78bfa; }
.baluk23-feature-card.lens { --feature-color: #22d3ee; }
.baluk23-feature-card.thinking { --feature-color: #f0abfc; }
.feature-symbol {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 32px;
  border-radius: 22px;
  color: #fff;
  background: color-mix(in srgb, var(--feature-color) 22%, rgba(255,255,255,.04));
  border: 1px solid color-mix(in srgb, var(--feature-color) 62%, transparent);
  box-shadow: 0 0 32px color-mix(in srgb, var(--feature-color) 28%, transparent);
  font-size: 1.8rem;
  font-weight: 900;
}
.baluk23-feature-card small {
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--feature-color);
  font-weight: 900;
}
.baluk23-feature-card strong { display: block; font-size: 1.35rem; margin-bottom: 10px; }
.baluk23-feature-card p { margin: 0; color: #cbd5e1; line-height: 1.55; }
.baluk23-feature-card i {
  position: absolute;
  inset: auto -20% -45% 10%;
  height: 65%;
  border-radius: 50%;
  background: var(--feature-color);
  opacity: .12;
  filter: blur(42px);
  transition: transform .5s ease, opacity .5s ease;
}
.baluk23-feature-card:hover i,
.baluk23-feature-card.active i { opacity: .28; transform: translateY(-26px) scale(1.2); }
.baluk23-feature-detail {
  width: min(800px, 100%);
  min-height: 104px;
  margin: 0 auto 22px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 18px 22px;
  border: 1px solid rgba(167,139,250,.22);
  border-radius: 18px;
  background: rgba(10,7,31,.66);
  text-align: center;
}
.baluk23-feature-detail span { color: #86efac; font-size: .75rem; font-weight: 900; letter-spacing: .1em; }
.baluk23-feature-detail strong { font-size: 1.05rem; }
.baluk23-feature-detail p { margin: 3px 0 0; color: #cbd5e1; }
.baluk23-math-page .baluk23-feature-card {
  min-height: 300px;
}
.baluk23-math-page .baluk23-feature-card strong {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 1.2rem;
  letter-spacing: -.03em;
}
.baluk23-math-page .baluk23-feature-card.active {
  border-color: #60a5fa;
  box-shadow: 0 30px 82px rgba(0,0,0,.42), 0 0 38px rgba(59,130,246,.3);
}
.baluk23-math-page .baluk23-feature-detail {
  border-color: rgba(96,165,250,.38);
  background: linear-gradient(135deg, rgba(12,21,52,.8), rgba(25,10,54,.72));
}
.baluk23-tour-final-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.baluk23-secondary-action {
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(15,10,38,.7);
}
@keyframes baluk23IntroIn {
  from { opacity: 0; transform: translateY(18px) scale(.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes baluk23HeroDrift {
  from { transform: scale(1.02) translate3d(-.5%, -.5%, 0); }
  to { transform: scale(1.08) translate3d(.7%, .5%, 0); }
}
@keyframes baluk23Sheen {
  0%, 18% { left: -35%; opacity: 0; }
  42% { opacity: .7; }
  72%, 100% { left: 115%; opacity: 0; }
}
@keyframes baluk23NodePulse {
  from { transform: scale(.7); opacity: .55; }
  to { transform: scale(1.35); opacity: 1; }
}
@media (max-width: 760px) {
  .math-launch-promo {
    left: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    grid-template-columns: 118px 1fr;
    padding: 12px;
  }
  .math-launch-transition { height: 60px; padding: 0 7px; }
  .math-launch-copy p { padding-right: 18px; }
  .math-launch-try {
    grid-column: 1 / -1;
    width: 100%;
  }
  .baluk23-intro-art { height: 230px; }
  .baluk23-intro-actions,
  .baluk23-tour-final-actions { flex-direction: column; }
  .baluk23-intro-actions button,
  .baluk23-tour-final-actions button { width: 100%; }
  .baluk23-tour-header {
    height: 62px;
    padding: 0 14px;
  }
  .baluk23-tour-brand { font-size: .86rem; }
  .baluk23-tour-progress button { width: 20px; }
  .baluk23-tour-progress button.active { width: 34px; }
  .baluk23-tour-viewport { height: calc(100vh - 62px); }
  .baluk23-tour-page {
    min-height: calc(100vh - 62px);
    padding: 28px 14px 42px;
  }
  .baluk23-network-grid { grid-template-columns: 1fr; }
  .baluk23-network-visual { height: 210px; }
  .baluk23-feature-rail {
    width: calc(100vw - 12px);
    margin-left: -2px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .baluk23-feature-card { min-height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .math-launch-promo,
  .math-launch-promo::before,
  .math-launch-baluk,
  .math-launch-mode,
  .math-launch-flow i,
  .math-launch-cursor,
  .math-launch-click-ring {
    animation: none !important;
  }
  .baluk23-intro-art img,
  .baluk23-intro-sheen,
  .baluk23-extra-links i { animation: none !important; }
  .baluk23-tour-track { transition-duration: .01ms; }
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5d0fe;
  box-shadow: 0 0 12px rgba(245, 208, 254, 0.95);
}
@keyframes memoryGlow {
  from { box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.65), 0 0 20px rgba(168, 85, 247, 0.65), 0 0 36px rgba(124, 58, 237, 0.4); }
  to { box-shadow: 0 0 0 1px rgba(216, 180, 254, 0.85), 0 0 30px rgba(192, 132, 252, 0.9), 0 0 56px rgba(147, 51, 234, 0.55); }
}

.memory-panel {
  position: fixed;
  top: 82px;
  right: 16px;
  width: min(340px, 92vw);
  max-height: 62vh;
  overflow: auto;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 12px;
}
.memory-panel h3 { margin: 2px 0 8px; }
.memory-hint { margin: 0 0 10px; color: #475569; font-size: .9rem; }
#memoryList { margin: 0 0 10px; padding-left: 18px; }
#memoryList li { margin-bottom: 6px; }
#clearMemory {
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
}

.chat-area { flex: 1; overflow-y: auto; padding: 16px 18px; }
.splash {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-bottom: 8vh;
  transform: translateY(-22px);
}
.fish-logo.big { width: min(520px, 76vw); height: auto; }
.splash h1 { margin: 6px 0 0; font-size: clamp(2.5rem, 7vw, 5.2rem); font-weight: 650; letter-spacing: -0.04em; }
.splash-prompt {
  margin: 12px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 800;
  color: #c026d3;
  text-shadow: 0 0 10px rgba(217, 70, 239, .65), 0 0 20px rgba(168, 85, 247, .45);
  animation: neonPromptFlow 2.2s linear infinite;
  background: linear-gradient(90deg, #d946ef, #a855f7, #c026d3, #d946ef);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes neonPromptFlow {
  from { background-position: 0% 50%; filter: drop-shadow(0 0 5px rgba(192,38,211,.55)); }
  to { background-position: 220% 50%; filter: drop-shadow(0 0 10px rgba(217,70,239,.75)); }
}
.chat-log { display: flex; flex-direction: column; gap: 10px; max-width: 980px; margin: 0 auto; width: 100%; }
.msg {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: min(72%, 820px);
  white-space: pre-wrap;
  line-height: 1.45;
}
.msg.user { margin-left: auto; background: var(--user); color: #fff; }
.msg.bot { margin-right: auto; background: var(--bot); }

.input-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
#userInput {
  width: 100%;
  border: 1.8px solid var(--line-strong);
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 1rem;
}
#userInput:focus { outline: none; box-shadow: 0 0 0 3px rgba(17,21,29,.08); }
.thinking-image-preview {
  grid-column: 1 / -1;
  position: relative;
  justify-self: center;
  width: min(210px, 56vw);
  aspect-ratio: 16 / 10;
  margin: 0 0 3px;
  border: 1px solid rgba(124, 58, 237, .28);
  border-radius: 18px;
  padding: 0;
  overflow: visible;
  background: #111827;
  box-shadow: 0 13px 30px rgba(30, 24, 56, .18), 0 4px 14px rgba(124, 58, 237, .12);
  animation: balukComposerArrive .34s cubic-bezier(.2,.85,.25,1);
}
.thinking-image-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  overflow: hidden;
  background: transparent;
  cursor: zoom-in;
}
.thinking-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  border: 0;
  transition: transform .24s ease, filter .24s ease;
}
.thinking-image-open:hover img { transform: scale(1.025); filter: saturate(1.05); }
.thinking-image-remove {
  position: absolute;
  z-index: 2;
  top: -8px;
  right: -8px;
  width: 29px;
  height: 29px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: linear-gradient(145deg, #a855f7, #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: .78rem;
  cursor: pointer;
  box-shadow: 0 7px 17px rgba(109, 40, 217, .32);
  transition: transform .18s ease, box-shadow .18s ease;
}
.thinking-image-remove:hover { transform: scale(1.08); box-shadow: 0 9px 21px rgba(109,40,217,.4); }
.thinking-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 64px);
  background: rgba(7, 5, 15, .9);
  backdrop-filter: blur(18px) saturate(1.08);
  animation: imageLightboxIn .22s ease both;
}
.thinking-image-lightbox img {
  display: block;
  max-width: min(94vw, 1440px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(0,0,0,.48), 0 0 0 1px rgba(196,181,253,.24);
}
.thinking-image-lightbox-close {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px;
  background: linear-gradient(145deg, #a855f7, #6d28d9);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(109,40,217,.38);
}
body.thinking-image-lightbox-open { overflow: hidden; }
@keyframes imageLightboxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (max-width: 700px) {
  .thinking-image-preview { width: min(180px, 58vw); border-radius: 16px; }
  .thinking-image-lightbox { padding: 64px 12px 24px; }
  .thinking-image-lightbox img { max-width: 96vw; max-height: 82vh; border-radius: 15px; }
}
.input-shell button[type="submit"] {
  width: 48px;
  height: 48px;
  border: 1.8px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: #131821;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.input-shell button svg { width: 21px; height: 21px; }
.thinking-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 12px;
  position: relative;
}
.thinking-toggle-btn {
  border: 1px solid #c4b5fd;
  background: #fff;
  color: #6d28d9;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.css-gear-icon {
  --gear-core: currentColor;
  --gear-hole: #fff;
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gear-core);
  box-shadow:
    0 -9.5px 0 -5px var(--gear-core),
    0 9.5px 0 -5px var(--gear-core),
    9.5px 0 0 -5px var(--gear-core),
    -9.5px 0 0 -5px var(--gear-core),
    6.8px 6.8px 0 -5px var(--gear-core),
    -6.8px 6.8px 0 -5px var(--gear-core),
    6.8px -6.8px 0 -5px var(--gear-core),
    -6.8px -6.8px 0 -5px var(--gear-core);
}
.css-gear-icon::before {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: var(--gear-hole);
}
.css-gear-icon::after {
  content: "";
  position: absolute;
  inset: 6.5px;
  border-radius: 50%;
  background: var(--gear-core);
}
.thinking-button-gear {
  --gear-hole: #fff;
  transform: scale(.78);
}
.thinking-toggle-btn.active .thinking-button-gear {
  --gear-hole: #7c3aed;
}
.thinking-toggle-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(109, 40, 217, .12);
}
.thinking-toggle-btn.active {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(109, 40, 217, .28);
}
.thinking-toggle-btn.locked,
.thinking-toggle-btn:disabled {
  opacity: .58;
  cursor: not-allowed;
  box-shadow: none;
}
.thinking-quota-text {
  font-size: .88rem;
  color: #6b7280;
}
.voice-ui-promo-bubble {
  position: fixed;
  right: 16px;
  bottom: clamp(132px, 18vh, 170px);
  z-index: 82;
  width: min(360px, calc(100vw - 32px));
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border-radius: 18px;
  padding: 12px 38px 12px 14px;
  box-shadow: 0 14px 30px rgba(124, 58, 237, .32);
  border: 1px solid rgba(255,255,255,.25);
}
.voice-ui-promo-bubble::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 100%;
  border: 8px solid transparent;
  border-top-color: #a855f7;
}
.voice-ui-promo-bubble p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.35;
  font-weight: 600;
}
.voice-ui-promo-bubble p strong { font-weight: 900; }
.voice-ui-promo-bubble button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: #6d28d9;
  cursor: pointer;
  font-weight: 800;
}
.thinking-limit-banner {
  margin: 0 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(192, 132, 252, .45);
  background: linear-gradient(135deg, rgba(248, 250, 252, .98), rgba(250, 245, 255, .96));
  box-shadow: 0 16px 38px rgba(109, 40, 217, .12);
}
.thinking-limit-copy strong {
  display: block;
  color: #4c1d95;
  margin-bottom: 4px;
}
.thinking-limit-copy p {
  margin: 0;
  color: #6b7280;
  font-size: .92rem;
}
.thinking-limit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.thinking-unlock-btn,
.thinking-upgrade-btn {
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.thinking-unlock-btn {
  border: 1px solid #d8b4fe;
  background: #fff;
  color: #6d28d9;
}
.thinking-upgrade-btn {
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  box-shadow: 0 14px 30px rgba(124, 58, 237, .25);
}

.plus-area { position: relative; }
.plus-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1.8px solid #6d28d9;
  background: #f4efff; font-size: 1.45rem; font-weight: 700; cursor: pointer; color: #5b21b6;
}
.plus-menu {
  position: absolute; bottom: 52px; left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; min-width: 220px; box-shadow: 0 10px 25px rgba(16,22,34,.14);
  z-index: 35;
}
.image-mode-label { font-size: .92rem; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.model-option-2 {
  border-color: #d1d5db;
  color: #1f2937;
  background: #ffffff;
  animation: none;
}


.balle-mode-label {
  position: relative;
  overflow: hidden;
  border: 1px solid #f0abfc;
  border-radius: 12px;
  padding: 8px 10px;
  background: linear-gradient(125deg, rgba(250,245,255,.98), rgba(243,232,255,.92), rgba(254,242,242,.95));
  box-shadow: 0 10px 25px rgba(168,85,247,.18);
}
.balle-mode-label::after {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(circle at 20% 30%, rgba(34,197,94,.30) 0 8%, transparent 9%),
              radial-gradient(circle at 75% 30%, rgba(250,204,21,.34) 0 7%, transparent 8%),
              radial-gradient(circle at 32% 72%, rgba(239,68,68,.28) 0 7%, transparent 8%),
              radial-gradient(circle at 84% 72%, rgba(168,85,247,.34) 0 8%, transparent 9%);
  animation: balleBubbleDrift 7s linear infinite;
  pointer-events: none;
}


.balle-generate-btn {
  border: none;
  min-width: 232px;
  height: 48px;
  border-radius: 14px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .01em;
  cursor: pointer;
  background: linear-gradient(120deg, #22c55e, #facc15, #a855f7, #ef4444, #22c55e);
  background-size: 300% 100%;
  animation: balleBtnGlow 2.8s linear infinite;
  box-shadow: 0 10px 30px rgba(168,85,247,.28), 0 0 0 1px rgba(255,255,255,.35) inset;
}
.balle-generate-btn:disabled { opacity: .65; cursor: not-allowed; }

@keyframes balleBtnGlow {
  0% { background-position: 0% 50%; filter: saturate(1); }
  50% { filter: saturate(1.2); }
  100% { background-position: 220% 50%; filter: saturate(1); }
}

.balle-result-wrap {
  margin-top: 10px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #c4b5fd;
  position: relative;
  background: #f8fafc;
}
.balle-result-wrap img {
  width: 100%;
  display: block;
  max-height: min(56vh, 440px);
  object-fit: cover;
}
.balle-banner {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .92rem;
  color: #fff;
  background: rgba(15, 23, 42, .45);
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(3px);
}

@media (max-width: 700px) {
  .balle-generate-btn { min-width: 0; width: 100%; }
}



@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
  position: fixed; top: 82px; right: 16px; width: min(480px, 94vw); max-height: 72vh; overflow: auto;
  z-index: 55; background: #f8fbff; border: 1px solid #93c5fd; border-radius: 14px;
  box-shadow: 0 16px 36px rgba(30, 64, 175, .16); padding: 12px;
}
.math-studio-panel h3 { margin: 0 0 8px; color: #1e40af; }
.math-studio-panel p { margin: 0 0 10px; font-size: .9rem; color: #334155; }
.math-studio-input {
  min-height: 110px; border: 1.5px solid #93c5fd; border-radius: 10px; padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff;
  white-space: pre-wrap;
}
.math-studio-output { margin-top: 10px; display: grid; gap: 8px; }
.math-result {
  background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; border-radius: 10px; padding: 8px 10px;
  font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


.account-icon-btn {
  width: 40px;
  min-width: 40px;
  flex: 0 0 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.guest-login-btn {
  min-width: 122px;
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(120deg, #111827, #4f46e5 58%, #7c3aed);
  box-shadow: 0 10px 24px rgba(79,70,229,.26);
  font: 750 .92rem/1 inherit;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.guest-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(79,70,229,.34);
}

body.auth-portal-open { overflow: hidden; }
.auth-portal {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 15% 10%, rgba(99,102,241,.22), transparent 34%),
    rgba(4,7,17,.78);
  backdrop-filter: blur(18px);
}
.auth-portal-shell {
  width: min(1240px, 100%);
  height: min(760px, calc(100dvh - 44px));
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(370px, .72fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 35px 100px rgba(2,6,23,.48);
}
.auth-portal-media {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #080b1c;
}
.auth-portal-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}
.auth-media-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(2,6,23,.82));
  pointer-events: none;
}
.auth-media-copy {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 34px;
  display: grid;
  gap: 8px;
  color: #fff;
}
.auth-media-copy span {
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(15,23,42,.38);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  backdrop-filter: blur(10px);
}
.auth-media-copy strong {
  max-width: 480px;
  font-size: clamp(1.45rem, 2.6vw, 2.35rem);
  line-height: 1.08;
}
.auth-portal-form-side {
  position: relative;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 52px clamp(26px, 3.5vw, 52px);
  background:
    radial-gradient(circle at 100% 0, rgba(224,231,255,.9), transparent 42%),
    #fff;
}
.auth-portal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 1px solid #dbe3f0;
  border-radius: 50%;
  color: #334155;
  background: rgba(255,255,255,.82);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.auth-portal-form {
  width: min(420px, 100%);
  display: grid;
  gap: 17px;
}
.auth-portal-heading { display: grid; gap: 8px; margin-bottom: 4px; }
.auth-eyebrow {
  color: #6366f1;
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .16em;
}
.auth-portal-heading h2 {
  margin: 0;
  color: #111827;
  font-size: clamp(2rem, 4vw, 3.05rem);
  letter-spacing: -.055em;
}
.auth-portal-heading p {
  margin: 0;
  color: #64748b;
  font-size: .91rem;
  line-height: 1.55;
}
.auth-field { display: grid; gap: 7px; }
.auth-field span,
.auth-photo-field strong {
  color: #263148;
  font-size: .82rem;
  font-weight: 800;
}
.auth-field input {
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 13px;
  padding: 13px 14px;
  outline: 0;
  color: #111827;
  background: rgba(248,250,252,.9);
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-field input:focus {
  border-color: #818cf8;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.auth-photo-field {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  background: rgba(248,250,252,.72);
}
.auth-photo-preview {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 50%;
  background: #e2e8f0;
}
.auth-photo-preview img,
.auth-photo-preview svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.auth-photo-field p {
  margin: 3px 0 8px;
  color: #64748b;
  font-size: .73rem;
  line-height: 1.35;
}
.auth-photo-field button {
  border: 0;
  padding: 0;
  color: #4f46e5;
  background: transparent;
  font: 800 .76rem/1 inherit;
  cursor: pointer;
}
.auth-account-state {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #64748b;
  background: #f8fafc;
  font-size: .77rem;
  line-height: 1.4;
}
.auth-account-state.existing {
  color: #166534;
  border-color: #86efac;
  background: #f0fdf4;
}
.auth-account-state.new-account {
  color: #5b21b6;
  border-color: #c4b5fd;
  background: #f5f3ff;
}
.auth-submit-btn {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(115deg, #111827, #4f46e5 55%, #7c3aed);
  box-shadow: 0 14px 28px rgba(79,70,229,.25);
  font: 850 .93rem/1 inherit;
  cursor: pointer;
}
.auth-privacy-note {
  margin: -6px 0 0;
  color: #94a3b8;
  font-size: .68rem;
  line-height: 1.4;
  text-align: center;
}
@media (max-width: 820px) {
  .guest-login-btn {
    min-width: 96px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 11px;
    font-size: .78rem;
    box-shadow: 0 7px 18px rgba(79,70,229,.24);
  }
  .auth-portal { padding: 0; }
  .auth-portal-shell {
    width: 100%;
    height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: clamp(165px, 28vh, 230px) minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }
  .auth-portal-media video { object-position: center 42%; }
  .auth-media-copy { left: 22px; right: 22px; bottom: 20px; }
  .auth-media-copy strong { font-size: 1.35rem; }
  .auth-portal-form-side {
    place-items: start center;
    min-height: 0;
    padding: 38px 22px 28px;
  }
  .auth-portal-close { top: 12px; right: 12px; }
}
@media (max-width: 1024px) {
  .app.guest-session .topbar {
    grid-template-columns: minmax(84px, 1fr) auto minmax(84px, 1fr);
  }
  .app.guest-session .left-tools {
    width: auto;
    min-width: 112px;
    visibility: visible;
    pointer-events: auto;
  }
  .app.guest-session .model-chip-wrap {
    gap: 5px;
  }
  .app.guest-session .fish-logo.small {
    width: 44px;
  }
  .app.guest-session .model-badge {
    padding: 3px 7px;
    font-size: .68rem;
  }
  .app.guest-session .right-tools {
    justify-self: end;
  }
  .app.guest-session #memoryToggle,
  .app.guest-session #mathStudioToggle,
  .app.guest-session #clearChat,
  .app.guest-session #accountToggle {
    display: none !important;
  }
  .app.guest-session .guest-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
@media (max-width: 700px) {
  .guest-login-btn {
    min-width: 78px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 9px;
    font-size: .68rem;
  }
  .app.guest-session .topbar {
    grid-template-columns: minmax(112px, 1fr) auto minmax(78px, 1fr);
    gap: 4px;
    padding-inline: 8px;
  }
  .app.guest-session .left-tools {
    min-width: 112px;
  }
  .app.guest-session .fish-logo.small {
    width: 38px;
  }
  .app.guest-session .model-badge {
    padding: 2px 6px;
    font-size: .62rem;
  }
}

.account-panel {
  position: fixed;
  top: 82px;
  right: 16px;
  width: min(360px, 94vw);
  max-height: 74vh;
  overflow: auto;
  z-index: 56;
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(30, 64, 175, .15);
  padding: 12px;
}
.account-panel h3 { margin: 0 0 10px; color: #1e3a8a; }
.account-row { display: grid; gap: 6px; margin-bottom: 10px; }
.account-row label { font-size: .86rem; color: #334155; font-weight: 700; }
.account-row input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .92rem;
}
.account-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #dbeafe;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}
.account-preview img {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  object-fit: cover;
  background: #eef2ff;
}
.account-panel button {
  width: 100%;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  color: #1e3a8a;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
.account-panel button:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 8px 16px rgba(37, 99, 235, .12);
}
#saveAccount {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #e0f2fe, #bfdbfe);
}
#persistBrowserAccount {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4, #bbf7d0);
  color: #14532d;
}
#logoutAccount {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb, #fde68a);
  color: #713f12;
}
#deleteAccount {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff1f2, #fecdd3);
  color: #881337;
}
.account-settings { margin-top: 10px; }
.account-settings summary { cursor: pointer; font-weight: 700; color: #1e40af; }
.account-settings p { font-size: .86rem; color: #334155; }
.account-safety-info {
  margin-top: 12px;
  border-top: 1px solid rgba(100, 116, 139, .25);
  padding-top: 9px;
}
.account-safety-info summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  color: #64748b;
  font-size: .72rem;
  font-weight: 400;
  line-height: 1.4;
}
.account-safety-info summary::-webkit-details-marker { display: none; }
.account-disclosure-arrow::before {
  content: "<";
  display: inline-block;
  color: #64748b;
  font-size: .8rem;
}
.account-safety-info[open] .account-disclosure-arrow::before { content: ">"; }
.account-safety-details {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(226, 232, 240, .55);
}
.account-safety-details p {
  margin: 0 0 8px;
  color: #475569;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.5;
}
.account-safety-details p:last-child { margin-bottom: 0; }
.account-safety-details a { color: #2563eb; overflow-wrap: anywhere; }
.composer-safety-info {
  width: min(760px, calc(100% - 132px));
  margin: -2px auto 8px;
  padding: 0;
  border-top: 0;
  position: relative;
  z-index: 18;
}
.composer-safety-info summary {
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
  text-align: center;
  font-size: .68rem;
}
.context-usage-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #475569;
  background: rgba(148, 163, 184, .13);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease;
}
.context-usage-ring {
  --context-progress: 0deg;
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 14px;
  border-radius: 50%;
  background: conic-gradient(#7c3aed var(--context-progress), rgba(100, 116, 139, .2) 0);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .12);
  transition: background .25s ease;
}
.context-usage-ring i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}
.context-usage-summary.math-context {
  color: #1d4ed8;
  background: rgba(186, 230, 253, .48);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .2);
}
.context-usage-summary.math-context .context-usage-ring {
  background: conic-gradient(#38bdf8 var(--context-progress), rgba(125, 211, 252, .24) 0);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .2);
}
.context-usage-summary.math-context .context-usage-ring i {
  background: #e0f2fe;
}
.context-usage-summary.is-warning {
  color: #a16207;
  background: rgba(245, 158, 11, .13);
}
.context-usage-summary.is-warning .context-usage-ring {
  background: conic-gradient(#f59e0b var(--context-progress), rgba(245, 158, 11, .18) 0);
}
.context-usage-summary.is-critical {
  color: #b91c1c;
  background: rgba(239, 68, 68, .13);
}
.context-usage-summary.is-critical .context-usage-ring {
  background: conic-gradient(#ef4444 var(--context-progress), rgba(239, 68, 68, .18) 0);
}
.context-usage-warning {
  color: #b45309;
  font-size: .66rem;
  font-weight: 600;
  line-height: 1.3;
}
.context-usage-warning.is-critical {
  color: #dc2626;
}
.composer-safety-info .account-safety-details {
  max-height: min(42vh, 330px);
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}
@media (max-width: 720px) {
  .composer-safety-info {
    width: calc(100% - 32px);
    margin-bottom: 7px;
  }
}

.profanity-lock {
  position: fixed; inset: 0; z-index: 400; display: grid; place-content: center; text-align: center;
  gap: 10px; background: rgba(20, 0, 0, .7); backdrop-filter: blur(3px); color: #fff;
}
.profanity-lock h3 { margin: 0; color: #fecaca; font-size: 1.4rem; }
.profanity-lock input {
  width: min(260px, 80vw); margin: 0 auto; padding: 10px 12px; border-radius: 10px; border: 1px solid #ef4444;
}
.profanity-lock button {
  border: none; border-radius: 10px; padding: 10px 14px; background: #ef4444; color: #fff; font-weight: 700; cursor: pointer;
}

.app.math-mode .fish-logo,
.app.math-mode .brand { color: #1d4ed8; }
.app.math-mode .model-badge { border-color: #1d4ed8; color: #1d4ed8; }
.app.math-mode .memory-btn,
.app.math-mode .clear-btn,
.app.math-mode .plus-btn { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }

.hidden { display: none !important; pointer-events: none !important; }

.thinking-bubble {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  box-shadow: 0 14px 34px rgba(99, 102, 241, 0.12);
}
.baluk24-quota-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid #ef4444;
  border-radius: 14px;
  background: rgba(254, 226, 226, .96);
  color: #b91c1c;
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.35;
  box-shadow: 0 10px 22px rgba(185, 28, 28, .12);
}
.baluk24-quota-warning button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #dc2626;
  color: #fff;
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(185, 28, 28, .22);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.baluk24-quota-warning button:hover {
  transform: translateY(-1px);
  background: #b91c1c;
  box-shadow: 0 10px 20px rgba(185, 28, 28, .28);
}
.baluk24-quota-warning button:active { transform: translateY(0) scale(.98); }
.web-mode-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid rgba(139,92,246,.16);
  color: #64748b;
  font-size: .73rem;
}
.web-mode-suggestion button {
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: #7c3aed;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  opacity: .82;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity .18s ease, color .18s ease, transform .18s ease;
}
.test-mode-suggestion button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.web-mode-suggestion-icon,
.test-mode-suggestion-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.web-mode-suggestion button:hover,
.web-mode-suggestion button:focus-visible {
  color: #5b21b6;
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gemini-web-sources::before {
  content: "Kaynaklar";
  width: 100%;
  color: #64748b;
  font-size: .7rem;
  font-weight: 800;
}
body.ui-dark-mode .web-mode-suggestion {
  border-top-color: rgba(167,139,250,.22);
  color: #94a3b8;
}
body.ui-dark-mode .web-mode-suggestion button { color: #c4b5fd; }
.math-mode-suggestion {
  border-top-color: rgba(14,165,233,.2);
}
.math-mode-suggestion button { color: #0284c7; }
.math-mode-suggestion button:hover,
.math-mode-suggestion button:focus-visible { color: #0369a1; }
body.ui-dark-mode .math-mode-suggestion {
  border-top-color: rgba(56,189,248,.24);
}
body.ui-dark-mode .math-mode-suggestion button { color: #7dd3fc; }
@keyframes mathSettingHighlight {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 24px rgba(124,58,237,.1); }
  38% { transform: scale(1.018); box-shadow: 0 0 0 5px rgba(56,189,248,.16), 0 16px 34px rgba(2,132,199,.22); }
}
.math-switch-card.math-setting-highlight {
  animation: mathSettingHighlight 1.2s cubic-bezier(.2,.85,.25,1);
}
body.ui-dark-mode .gemini-web-sources::before { color: #94a3b8; }
body.ui-dark-mode .baluk24-quota-warning {
  background: rgba(69, 10, 10, .92);
  border-color: #f87171;
  color: #fecaca;
}
@media (max-width: 560px) {
  .baluk24-quota-warning { align-items: stretch; flex-direction: column; }
  .baluk24-quota-warning button { align-self: flex-start; }
}
.thinking-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #1e293b;
}
.thinking-head span {
  font-size: 1.08rem;
  letter-spacing: .01em;
}
.think-fish { width: 40px; height: auto; }
.thinking-head-deep { gap: 14px; }
.thinking-status-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 38px;
}
.think-fish-stage {
  position: relative;
  width: 84px;
  min-width: 84px;
  height: 38px;
}
.think-fish-static {
  position: absolute;
  left: 0;
  top: 2px;
  width: 48px;
}
.think-gear-bubble {
  position: absolute;
  left: 53px;
  top: 5px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}
.think-gear-bubble::after {
  display: none;
}
.thinking-cog-icon {
  --gear-core: #5b21b6;
  --gear-hole: #f7f7ff;
  animation: spinCogSmall 1.7s linear infinite;
}
.spin-fast { animation: spinFishFast 1s linear infinite; }
@keyframes spinFishFast { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes thinkGearLaunch {
  0% { transform: translate(0, 7px) scale(.82); opacity: 0; }
  16% { transform: translate(6px, 0) scale(1); opacity: 1; }
  58% { transform: translate(22px, -1px) scale(1); opacity: 1; }
  100% { transform: translate(34px, -6px) scale(.88); opacity: 0; }
}
@keyframes spinCog {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes spinCogSmall {
  from { transform: scale(.72) rotate(0deg); }
  to { transform: scale(.72) rotate(360deg); }
}
.thinking-answer { margin-top: 8px; white-space: pre-wrap; }
.thinking-live-note {
  margin-top: 8px;
  color: rgba(109, 40, 217, .72);
  font-size: 1rem;
  line-height: 1.72;
  min-height: 3.5em;
}
.thinking-live-sources,
.thinking-detail-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.thinking-source-chip {
  border: 1px solid rgba(167, 139, 250, .45);
  background: rgba(255, 255, 255, .92);
  color: #6d28d9;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}
.thinking-details {
  margin-top: 14px;
  border-top: 1px dashed rgba(167, 139, 250, .55);
  padding-top: 10px;
}
.thinking-details summary {
  cursor: pointer;
  color: #6d28d9;
  font-weight: 800;
}
.thinking-details ol {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #475569;
}
.thinking-details li + li { margin-top: 8px; }
.thinking-details p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: .96rem;
  line-height: 1.68;
}

@media (max-width: 700px) {
  .topbar {
    grid-template-columns: minmax(0, auto) minmax(86px, 1fr) auto;
    gap: 5px;
    padding: 8px 10px;
  }
  .brand-mode-switcher {
    justify-self: center;
    width: 128px;
    transform: translateX(6px);
  }
  .brand-mode-trigger { font-size: 1.08rem; }
  .brand-mode-menu { width: 128px; }
  .brand { font-size: 1.08rem; justify-self: start; }
  .model-chip-wrap { gap: 4px; }
  .fish-logo.small { width: 49px; }
  .model-badge { padding: 3px 6px; font-size: .68rem; }
  .thinking-mode-picker { min-height: 27px; padding: 4px 6px; gap: 4px; font-size: .66rem; white-space: nowrap; }
  .thinking-mode-chevron { display: none; }
  .thinking-mode-menu { width: 205px; }
  .right-tools { gap: 4px; }
  .memory-btn, .clear-btn { padding: 6px 7px; font-size: .72rem; }
  #clearChat { max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Bellek tek bir kısa kelime; mobilde üç noktayla kesilmesin. */
  #memoryToggle {
    min-width: 68px;
    max-width: none;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .thinking-toolbar,
  .thinking-limit-banner,
  .thinking-limit-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .thinking-limit-actions > * { width: 100%; }
  .account-icon-btn { width: 34px; min-width: 34px; height: 34px; }
  .account-panel {
    width: 96vw;
    right: 2vw;
    top: 76px;
    max-height: 78vh;
  }
  .memory-toast { width: calc(100vw - 20px); max-width: 420px; text-align: center; justify-content: center; }
  .msg { max-width: 90%; }
}


.plus-area { position: relative; }
.plus-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1.8px solid #6d28d9;
  background: #f4efff; font-size: 1.45rem; font-weight: 700; cursor: pointer; color: #5b21b6;
}
.plus-menu {
  position: absolute; bottom: 52px; left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; min-width: 220px; box-shadow: 0 10px 25px rgba(16,22,34,.14);
  z-index: 35;
}
.image-mode-label { font-size: .92rem; font-weight: 600; display: flex; gap: 8px; align-items: center; }



@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
  position: fixed; top: 82px; right: 16px; width: min(480px, 94vw); max-height: 72vh; overflow: auto;
  z-index: 55; background: #f8fbff; border: 1px solid #93c5fd; border-radius: 14px;
  box-shadow: 0 16px 36px rgba(30, 64, 175, .16); padding: 12px;
}
.math-studio-panel h3 { margin: 0 0 8px; color: #1e40af; }
.math-studio-panel p { margin: 0 0 10px; font-size: .9rem; color: #334155; }
.math-studio-input {
  min-height: 110px; border: 1.5px solid #93c5fd; border-radius: 10px; padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff;
  white-space: pre-wrap;
}
.math-studio-output { margin-top: 10px; display: grid; gap: 8px; }
.math-result {
  background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; border-radius: 10px; padding: 8px 10px;
  font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


.profanity-lock {
  position: fixed; inset: 0; z-index: 400; display: grid; place-content: center; text-align: center;
  gap: 10px; background: rgba(20, 0, 0, .7); backdrop-filter: blur(3px); color: #fff;
}
.profanity-lock h3 { margin: 0; color: #fecaca; font-size: 1.4rem; }
.profanity-lock input {
  width: min(260px, 80vw); margin: 0 auto; padding: 10px 12px; border-radius: 10px; border: 1px solid #ef4444;
}
.profanity-lock button {
  border: none; border-radius: 10px; padding: 10px 14px; background: #ef4444; color: #fff; font-weight: 700; cursor: pointer;
}

.app.math-mode .fish-logo,
.app.math-mode .brand { color: #1d4ed8; }
.app.math-mode .model-badge { border-color: #1d4ed8; color: #1d4ed8; }
.app.math-mode .memory-btn,
.app.math-mode .clear-btn,
.app.math-mode .plus-btn { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }

.hidden { display: none !important; pointer-events: none !important; }
.enter-transition.hidden { display: none !important; }
.enter-transition {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 44%, rgba(125, 94, 250, 0.26), rgba(10, 10, 31, 0.9) 58%), #07071a;
}
.transition-blur {
  position: absolute;
  inset: -40px;
  backdrop-filter: blur(6px);
  background: radial-gradient(circle at 50% 60%, rgba(114, 83, 246, 0.26), transparent 52%);
  animation: transitionFog 1.8s ease-out forwards;
}
@keyframes transitionFog {
  from { opacity: 0; filter: blur(2px); }
  to { opacity: 1; filter: blur(0px); }
}
.transition-logo-wrap {
  position: relative;
  text-align: center;
  color: #f7f5ff;
  opacity: 0;
  transform: translateY(14px) scale(.96);
  animation: logoReveal 2.4s ease-out .35s forwards;
}
@keyframes logoReveal {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.transition-fish { width: min(320px, 68vw); height: auto; color: #ffffff; margin: 0 auto 10px; }
.transition-logo-wrap h2 {
  margin: 0;
  font-size: clamp(2.8rem, 9vw, 6.2rem);
  letter-spacing: -0.04em;
  text-shadow: 0 0 18px rgba(188, 171, 255, 0.7), 0 0 40px rgba(122, 103, 255, 0.45);
}
.transition-drop {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f3edff, #a68cff 70%);
  box-shadow: 0 0 16px rgba(173, 143, 255, 0.95);
  transform: translateX(-50%);
  animation: dropFall 2.9s ease-in .65s forwards;
}
@keyframes dropFall {
  0% { opacity: 0; transform: translate(-50%, -28px) scale(.7); }
  16% { opacity: 1; }
  72% { opacity: 1; transform: translate(-50%, 170px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 210px) scale(.45); }
}
.transition-vapor {
  position: absolute;
  left: 50%;
  top: 170px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(205, 187, 255, .88), rgba(170, 138, 255, .35), transparent 70%);
  transform: translateX(-50%) scale(.3);
  filter: blur(1px);
  opacity: 0;
  animation: vaporRise 3.2s ease-out 1.65s forwards;
}
@keyframes vaporRise {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(.25); filter: blur(0px); }
  22% { opacity: .95; transform: translateX(-50%) translateY(-6px) scale(1.7); filter: blur(2px); }
  58% { opacity: .6; transform: translateX(-50%) translateY(-32px) scale(2.6); filter: blur(5px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-64px) scale(3.4); filter: blur(7px); }
}
.transition-beam {
  margin: 16px auto 0;
  width: min(640px, 84vw);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(102, 74, 255, 0), #a58bff, #6fa8ff, rgba(102, 74, 255, 0));
  box-shadow: 0 0 20px rgba(161, 132, 255, 0.95), 0 0 46px rgba(95, 157, 255, 0.55);
  animation: beamFlash 2.6s ease-out 1.4s forwards;
  opacity: 0;
}
@keyframes beamFlash {
  0% { opacity: 0; transform: scaleX(.72); }
  45% { opacity: 1; transform: scaleX(1.03); }
  100% { opacity: .95; transform: scaleX(1); }
}

/* math-mode refresh */
.math-mode-label {
  padding: 8px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
  font-size: 1.02rem;
  font-weight: 800;
}
.math-mode-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeafe, #bfdbfe);
  border: 1px solid #93c5fd;
}



@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
  width: min(52vw, 760px);
  height: calc(100vh - 102px);
  max-height: none;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fdff, #eef8ff);
  border: 1px solid #a5d8ff;
  box-shadow: 0 16px 38px rgba(56, 189, 248, .28), inset 0 0 0 1px rgba(147, 197, 253, .3);
}
.math-studio-panel p { font-size: .95rem; }
.math-studio-input {
  height: calc(100% - 86px);
  min-height: 260px;
  padding: 16px;
  font-size: 1.04rem;
  line-height: 1.75;
  color: #0f172a;
  border: 1.8px solid #7dd3fc;
  background:
    repeating-linear-gradient(180deg, rgba(59,130,246,0.06), rgba(59,130,246,0.06) 1px, transparent 1px, transparent 30px),
    #ffffff;
  caret-color: #2563eb;
}
.math-studio-input:focus { outline: none; box-shadow: 0 0 0 4px rgba(56, 189, 248, .28); }
.math-studio-input .calc-answer,
.math-studio-input { color: #0f172a; }

.math-mode-flash {
  position: fixed;
  inset: 0;
  z-index: 330;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(125, 211, 252, .3), rgba(14, 116, 255, .06) 45%, transparent 70%);
  animation: mathFlashFade 1.05s ease-out forwards;
}
.math-flash-ring {
  width: min(58vw, 520px);
  height: min(58vw, 520px);
  border-radius: 50%;
  border: 2px solid rgba(125, 211, 252, .95);
  box-shadow: 0 0 36px rgba(56, 189, 248, .95), 0 0 86px rgba(59, 130, 246, .62);
  animation: mathRingPulse 1.05s ease-out forwards;
}
.math-flash-text {
  position: absolute;
  color: #e0f2fe;
  font-size: clamp(1.3rem, 4vw, 2.6rem);
  font-weight: 800;
  text-shadow: 0 0 18px rgba(56, 189, 248, .95);
}
@keyframes mathRingPulse {
  from { transform: scale(.6); opacity: 0; }
  30% { opacity: 1; }
  to { transform: scale(1.28); opacity: 0; }
}
@keyframes mathFlashFade {
  from { opacity: 0; }
  12% { opacity: 1; }
  to { opacity: 0; }
}

.math-tutor-overlay {
  position: fixed;
  inset: 0;
  z-index: 340;
}
.math-tutor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .68);
}
.math-tutor-bubble {
  position: absolute;
  top: 88px;
  right: 20px;
  width: min(330px, 88vw);
  background: #fff;
  border: 1px solid #bae6fd;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(14, 116, 144, .26);
}
.math-tutor-bubble button {
  border: 1px solid #38bdf8;
  background: #e0f2fe;
  color: #0c4a6e;
  border-radius: 10px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}
.math-spotlight {
  position: relative;
  z-index: 360;
  box-shadow: 0 0 0 4px rgba(186, 230, 253, .8), 0 0 22px rgba(56, 189, 248, .95);
  animation: tutorBlink .9s ease-in-out infinite alternate;
}
@keyframes tutorBlink {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.app.math-mode {
  background: radial-gradient(circle at 50% 0%, #e0f2fe 0%, #f0f9ff 35%, #f8fdff 100%);
}
.app.math-mode .fish-logo,
.app.math-mode .brand { color: #0284c7; }
.app.math-mode .model-badge {
  border-color: #38bdf8;
  color: #0369a1;
  background: #ecfeff;
  box-shadow: 0 0 14px rgba(56, 189, 248, .35);
}
.app.math-mode .memory-btn,
.app.math-mode .clear-btn,
.app.math-mode .plus-btn,
.app.math-mode .input-shell button[type="submit"] {
  border-color: #38bdf8;
  color: #0c4a6e;
  background: linear-gradient(180deg, #f0f9ff, #dbeafe);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, .7), 0 0 14px rgba(56, 189, 248, .42);
}

@media (max-width: 900px) {
  

@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
    width: min(90vw, 640px);
    height: min(58vh, 560px);
  }
  .math-studio-input { height: calc(100% - 102px); }
  .math-tutor-bubble { right: 12px; top: 132px; }
}

/* geometry lab */
.geometry-lab {
  border: 1px solid #bae6fd;
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(180deg, #f0f9ff, #ecfeff);
  margin-bottom: 12px;
}
.geometry-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.geo-btn {
  border: 1px solid #7dd3fc;
  border-radius: 999px;
  background: #fff;
  color: #075985;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}
.geo-btn.active {
  background: linear-gradient(90deg, #dbeafe, #bae6fd);
  box-shadow: 0 0 14px rgba(56, 189, 248, .35);
}
.geometry-card { display: grid; gap: 10px; }
.geometry-sketch {
  background: #fff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 10px;
}
.geo-title { font-weight: 800; color: #0c4a6e; margin-bottom: 8px; }
.geo-edge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 8px;
}
.geo-edge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78rem;
  color: #155e75;
}
.geo-edge input, #geoGoalInput {
  border: 1.5px solid #7dd3fc;
  border-radius: 10px;
  padding: 7px 8px;
  font-weight: 700;
}
.geo-center-box { margin-top: 8px; }
#geoGoalInput { width: 100%; text-transform: lowercase; }
.geo-corners { margin-top: 6px; font-size: .8rem; color: #0369a1; font-weight: 700; }
.geometry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#solveGeometryBtn {
  border: 1.5px solid #38bdf8;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  color: #0c4a6e;
  background: linear-gradient(180deg, #e0f2fe, #bfdbfe);
  box-shadow: 0 0 14px rgba(14, 165, 233, .33);
  cursor: pointer;
}
.geometry-warn {
  color: #b91c1c;
  font-size: .85rem;
  font-weight: 700;
}

.thinking-bubble.thinking-math {
  border: 1px solid #7dd3fc;
  background: linear-gradient(90deg, #e0f2fe, #dbeafe, #e0f2fe);
  background-size: 220% 100%;
  animation: mathAnalyzeGlow 1.2s linear infinite;
}
.thinking-bubble.thinking-math .thinking-head {
  color: #0369a1;
  font-weight: 800;
}
@keyframes mathAnalyzeGlow {
  0% { background-position: 0% 0%; }
  100% { background-position: 220% 0%; }
}

@media (max-width: 900px) {
  .geometry-toolbar { max-height: 104px; overflow: auto; }
  .geo-edge-grid { grid-template-columns: 1fr; }
}



@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel { overflow: auto; }
.math-studio-input {
  height: 260px;
  min-height: 220px;
}
@media (max-width: 900px) {
  .math-studio-input { height: 180px; min-height: 150px; }
}

/* notebook geometry redesign */
.geometry-sketch {
  background: transparent;
  border: none;
  padding: 0;
}
.geo-notebook {
  position: relative;
  min-height: 360px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background:
    repeating-linear-gradient(180deg, rgba(59,130,246,0.08), rgba(59,130,246,0.08) 1px, transparent 1px, transparent 34px),
    #ffffff;
  box-shadow: inset 0 0 0 1px rgba(186, 230, 253, .45), 0 8px 18px rgba(14, 165, 233, .12);
}

.rational-notebook {
  display: grid;
  place-items: center;
}
.rational-zone {
  margin-top: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rational-box {
  width: 92px;
  display: grid;
  gap: 4px;
  justify-items: center;
}
.rational-box input {
  width: 74px;
  border: 1.4px solid #7dd3fc;
  border-radius: 8px;
  padding: 5px 6px;
  text-align: center;
  font-weight: 700;
}
.rat-line {
  width: 76px;
  height: 2px;
  background: #0284c7;
}
.rat-op {
  border: 1.5px solid #38bdf8;
  background: #f0f9ff;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 900;
  color: #0c4a6e;
}
.rational-btn {
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
}
.geo-shape-svg {
  position: relative;
  width: 188px;
  height: 188px;
  transform: translateY(-4%);
  fill: rgba(59,130,246,.10);
  stroke: #0284c7;
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, .35));
}
.geo-side-input {
  position: absolute;
  display: grid;
  gap: 2px;
  width: 44px;
  font-size: .64rem;
  color: #155e75;
  font-weight: 700;
  justify-items: center;
}
.geo-side-input input {
  width: 38px;
  box-sizing: border-box;
  border: 1.4px solid #7dd3fc;
  border-radius: 6px;
  padding: 2px 3px;
  font-weight: 700;
  font-size: .68rem;
  text-align: center;
  background: rgba(255,255,255,.96);
}
.geo-widget-wrap .pos-top { left: 50%; top: 4px; transform: translateX(-50%); }
.geo-widget-wrap .pos-bottom { left: 50%; bottom: 6px; transform: translateX(-50%); }
.geo-widget-wrap .pos-left { left: -18px; top: 50%; transform: translateY(-50%); }
.geo-widget-wrap .pos-right { right: -18px; top: 50%; transform: translateY(-50%); }
.geo-widget-wrap .pos-upper-left { left: -10px; top: 52px; }
.geo-widget-wrap .pos-upper-right { right: -10px; top: 52px; }
.geo-widget-wrap .pos-lower-left { left: -10px; bottom: 52px; }
.geo-widget-wrap .pos-lower-right { right: -10px; bottom: 52px; }

.geo-goal-input {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 86px;
  border: 1.6px solid #38bdf8;
  border-radius: 999px;
  padding: 4px 7px;
  text-align: center;
  font-weight: 800;
  font-size: .72rem;
  text-transform: lowercase;
  color: #0c4a6e;
  background: #f0f9ff;
}
.geo-result-pad {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  color: #0369a1;
  font-weight: 800;
  background: rgba(224, 242, 254, .92);
  border: 1px solid #7dd3fc;
  border-radius: 10px;
  padding: 5px 10px;
}
.geo-notebook.geo-hit {
  animation: geoHit 700ms ease-out;
}
@keyframes geoHit {
  0% { box-shadow: inset 0 0 0 1px rgba(186, 230, 253, .45), 0 0 0 rgba(14,165,233,0); }
  40% { box-shadow: inset 0 0 0 1px rgba(125, 211, 252, .8), 0 0 28px rgba(14,165,233,.65); }
  100% { box-shadow: inset 0 0 0 1px rgba(186, 230, 253, .45), 0 8px 18px rgba(14,165,233,.12); }
}


.unified-notebook {
  overflow: hidden;
}
.notebook-typing {
  position: absolute;
  inset: 12px;
  border: none;
  outline: none;
  background: transparent;
  color: #0f172a;
  font-size: 1rem;
  line-height: 1.9;
  z-index: 1;
  min-height: 260px;
  white-space: pre-wrap;
}
.geo-widget-wrap {
  position: absolute;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
.geo-widget-wrap.dragging { cursor: grabbing; }
.geo-delete-btn {
  position: absolute;
  right: -4px;
  top: -22px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #ef4444;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 900;
  cursor: pointer;
  display: none;
  z-index: 6;
  box-shadow: 0 6px 14px rgba(239, 68, 68, 0.22);
}
.geo-widget-wrap.selected .geo-delete-btn { display: inline-grid; place-items: center; }
.geo-widget-wrap .geo-side-input,
.geo-widget-wrap .geo-goal-input,
.geo-widget-wrap .rational-zone {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.geo-widget-wrap.selected .geo-side-input,
.geo-widget-wrap.selected .geo-goal-input,
.geo-widget-wrap.selected .rational-zone {
  opacity: 1;
  pointer-events: auto;
}
.geometry-widget .geo-shape-svg { pointer-events: none; }
.rational-widget {
  width: auto;
  height: auto;
}
.rational-widget .rational-zone {
  margin-top: 0;
  background: rgba(255,255,255,.92);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 8px;
}
.math-tutor-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.math-tutor-finale {
  position: fixed;
  inset: 0;
  z-index: 380;
  display: grid;
  place-items: center;
}
.math-tutor-finale-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .78);
}
.math-tutor-finale-card {
  position: relative;
  text-align: center;
  color: #e0f2fe;
  animation: tutorFinalePop 1.6s ease-out forwards;
}
.finale-fish {
  width: min(280px, 70vw);
  color: #f0f9ff;
  margin: 0 auto 8px;
  filter: drop-shadow(0 0 24px rgba(56, 189, 248, .8));
}
.math-tutor-finale-card h3 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  color: #7dd3fc;
  text-shadow: 0 0 20px rgba(56, 189, 248, .9);
}
@keyframes tutorFinalePop {
  0% { opacity: 0; transform: scale(.88); }
  18% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

@media (max-width: 900px) {
  .geo-notebook { min-height: 300px; }
   .geo-shape-svg { width: 164px; height: 164px; }
  .geo-widget-wrap { width: 196px; height: 196px; }
  .geo-side-input { width: 40px; font-size: .6rem; }
  .geo-side-input input { width: 34px; padding: 2px; font-size: .64rem; }
  .geo-goal-input { width: 78px; font-size: .68rem; }
  .rational-zone { margin-top: 54px; gap: 8px; }
  .rational-box { width: 76px; }
  .rational-box input, .rat-line { width: 62px; }
  .geo-result-pad { bottom: 44px; font-size: .82rem; }
}

.math-tutor-finale.hidden { display: none !important; }


.warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 390;
  display: grid;
  place-items: center;
  background: rgba(12, 10, 22, .62);
  backdrop-filter: blur(3px);
}
.warning-card {
  width: min(760px, 92vw);
  text-align: center;
  border-radius: 22px;
  border: 2px solid #f59e0b;
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  box-shadow: 0 0 40px rgba(245, 158, 11, .45);
  padding: 26px 20px;
}
.warning-card h3 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  color: #b45309;
}
.warning-card p {
  margin: 0;
  font-size: clamp(1.05rem, 2.8vw, 1.6rem);
  font-weight: 800;
  color: #9a3412;
}

.safety-survey {
  border: 1px solid #93c5fd;
  background: linear-gradient(180deg, #eff6ff, #f0f9ff);
}
.survey-title { font-weight: 800; color: #1e3a8a; margin-bottom: 8px; }
.survey-start-btn {
  border: 1.5px solid #3b82f6;
  border-radius: 10px;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}
.survey-panel {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  color: #1f2937;
}
.survey-panel label { display: flex; gap: 8px; align-items: center; }
.survey-note {
  margin-top: 6px;
  color: #1d4ed8;
  font-weight: 700;
}

.warning-overlay.hidden { display: none !important; }


.safety-survey-modal {
  position: fixed;
  inset: 0;
  z-index: 395;
  display: grid;
  place-items: center;
}
.safety-survey-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .74);
  backdrop-filter: blur(4px);
}
.safety-survey-card {
  position: relative;
  width: min(640px, 92vw);
  border-radius: 18px;
  border: 1px solid #93c5fd;
  background: linear-gradient(180deg, #f8fbff, #eaf4ff);
  box-shadow: 0 20px 44px rgba(30, 64, 175, .28);
  padding: 18px;
}
.safety-survey-card h3 { margin: 0 0 8px; color: #1e40af; }
.safety-survey-card p { margin: 0 0 12px; color: #334155; }
.safety-survey-options { display: grid; gap: 8px; }
.safety-survey-options button {
  border: 1.5px solid #60a5fa;
  border-radius: 11px;
  background: #fff;
  color: #1e3a8a;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}
.safety-survey-options button:hover { background: #eff6ff; }
.close-safety-survey {
  margin-top: 10px;
  border: 1px solid #94a3b8;
  background: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  font-weight: 700;
  cursor: pointer;
}
.safety-survey-modal.hidden { display: none !important; }

.web-mode-label {
  padding: 8px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2ff, #e0e7ff);
  border: 1px solid #a5b4fc;
  font-size: .98rem;
  font-weight: 800;
}

.input-web-wrap {
  position: relative;
  width: 100%;
}
.web-input-badge {
  position: absolute;
  top: -22px;
  left: 10px;
  font-size: .72rem;
  font-weight: 800;
  color: #6d28d9;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  padding: 2px 8px;
}
#userInput.web-search-input {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
  background: linear-gradient(180deg, #ffffff, #faf5ff);
}

.thinking-bubble.web-thinking,
.thinking-bubble.thinking-web {
  background: #ffffff;
  border: 1px solid #d8b4fe;
}
.thinking-bubble.thinking-web .thinking-head,
.thinking-bubble.web-thinking .thinking-head {
  color: #111;
  font-weight: 800;
  background: linear-gradient(120deg, #111 0%, #111 40%, #9333ea 50%, #111 60%, #111 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: webShimmer 2s linear infinite;
}
.thinking-bubble.thinking-complete.thinking-web .thinking-head,
.thinking-bubble.thinking-complete.web-thinking .thinking-head {
  color: #111;
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}
.thinking-bubble.thinking-complete .thinking-web-orb { display: none; }
@keyframes webShimmer { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.web-results {
  background: #fff;
  border: 1px solid #c4b5fd;
}
.web-results-head {
  font-weight: 900;
  color: #6d28d9;
  margin-bottom: 4px;
}
.web-query { color: #475569; font-size: .9rem; margin-bottom: 8px; }
.web-top3 { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.web-top3 li a { color: #4c1d95; font-weight: 800; text-decoration: none; }
.web-top3 li p { margin: 2px 0 0; color: #334155; font-size: .9rem; }
.web-results details { margin-top: 8px; }
.web-results summary { cursor: pointer; color: #6d28d9; font-weight: 700; }

/* mobile math studio size fix */
@media (max-width: 900px) {
  

@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
    width: 96vw;
    height: 78vh;
    right: 2vw;
    top: 78px;
  }
  .math-studio-input {
    height: 260px;
    min-height: 220px;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  #clearChat { display: none; }
  

@keyframes balleBubbleDrift { from { transform: translateX(-4%); } to { transform: translateX(6%); } }

.balle-model-badge {
  color: #4c1d95 !important;
  border-color: #d946ef !important;
  background: linear-gradient(120deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.14), rgba(168,85,247,.2));
  background-size: 240% 100%;
  animation: balleBadgeGlow 2.5s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 16px rgba(217,70,239,.28);
}
@keyframes balleBadgeGlow { from { background-position: 0% 50%; } to { background-position: 220% 50%; } }

.app.balle-bg-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 20%, rgba(34,197,94,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 26% 58%, rgba(250,204,21,.2) 0 6%, transparent 7%),
              radial-gradient(circle at 52% 22%, rgba(239,68,68,.18) 0 7%, transparent 8%),
              radial-gradient(circle at 77% 62%, rgba(168,85,247,.22) 0 7%, transparent 8%),
              radial-gradient(circle at 88% 18%, rgba(250,204,21,.14) 0 5%, transparent 6%);
  animation: balleBackdropFloat 8s ease-in-out infinite alternate;
  z-index: 0;
}
.app.balle-bg-active #chatArea,
.app.balle-bg-active .input-shell,
.app.balle-bg-active .topbar { position: relative; z-index: 1; }
@keyframes balleBackdropFloat { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.balle-stage-wrap { margin-top: 10px; }
.balle-stage-title { font-weight: 800; color: #6d28d9; margin-bottom: 8px; }
.balle-stage-canvas {
  height: min(44vh, 320px);
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 12px 28px rgba(15,23,42,.14);
}
.balle-stage-canvas::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(34,197,94,.16), rgba(250,204,21,.16), rgba(239,68,68,.16), rgba(168,85,247,.2), rgba(34,197,94,.16));
  animation: balleSweep 4.6s linear infinite;
}
@keyframes balleSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.balle-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  animation: orbFloat 4.8s ease-in-out infinite;
  box-shadow: 0 0 24px currentColor;
}
.balle-orb.orb-green { width: 110px; height: 110px; left: 8%; top: 18%; color: rgba(34,197,94,.65); background: rgba(34,197,94,.38); }
.balle-orb.orb-yellow { width: 90px; height: 90px; right: 14%; top: 16%; color: rgba(250,204,21,.7); background: rgba(250,204,21,.4); animation-delay: .5s; }
.balle-orb.orb-red { width: 120px; height: 120px; left: 22%; bottom: 10%; color: rgba(239,68,68,.64); background: rgba(239,68,68,.36); animation-delay: 1.1s; }
.balle-orb.orb-purple { width: 100px; height: 100px; right: 26%; bottom: 8%; color: rgba(168,85,247,.72); background: rgba(168,85,247,.42); animation-delay: 1.6s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-14px) scale(1.08); }
}
.balle-core-fish {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 14px rgba(255,255,255,.75));
}

.math-studio-panel {
    width: 98vw;
    right: 1vw;
    height: 80vh;
  }
  .math-studio-input {
    height: 230px;
    min-height: 200px;
  }
}

/* plus menu compact + glowing clickable mode options */
.plus-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 1.15rem;
  border: 1.4px solid #7c3aed;
  background: radial-gradient(circle at 28% 24%, #faf5ff 0%, #ede9fe 48%, #ddd6fe 100%);
  color: #5b21b6;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, .35), 0 0 14px rgba(124, 58, 237, .25);
  transition: transform .14s ease, box-shadow .2s ease, filter .2s ease;
}
.plus-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, .45), 0 0 20px rgba(124, 58, 237, .35), 0 0 28px rgba(59, 130, 246, .18);
}
.plus-btn:active { transform: translateY(0) scale(.98); }

.plus-menu {
  min-width: 188px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #ddd6fe;
  background: linear-gradient(180deg, #ffffff, #faf7ff);
}

.image-mode-label {
  position: relative;
  gap: 6px;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.image-mode-label:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, .22), 0 0 18px rgba(124, 58, 237, .16);
  filter: brightness(1.03);
}
.image-mode-label.mode-disabled {
  opacity: .48;
  cursor: not-allowed;
  filter: grayscale(.35);
}
.image-mode-label.mode-disabled:hover {
  transform: none;
  box-shadow: none;
  filter: grayscale(.35);
}
.image-mode-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #6d28d9;
  cursor: pointer;
}
.image-mode-label .mode-icon { font-size: .9rem; line-height: 1; }
.profanity-mode-label {
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding-inline: 8px;
}
.profanity-mode-label .mode-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  flex: 0 0 22px;
  font-size: 1.15rem;
}
.image-mode-label .mode-spark {
  font-size: .78rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(147, 51, 234, .45), 0 0 14px rgba(59, 130, 246, .25);
}

.math-mode-label,
.web-mode-label {
  padding: 6px 8px;
  border-radius: 10px;
  font-size: .78rem;
}
.baluk-engine-btn {
  width: 100%;
  border: 1px solid #99f6e4;
  background: linear-gradient(90deg, #ecfeff, #dcfce7);
  color: #134e4a;
  justify-content: flex-start;
  text-align: left;
  font: inherit;
}
.baluk-engine-btn:hover {
  box-shadow: 0 0 0 1px rgba(20, 184, 166, .22), 0 0 18px rgba(16, 185, 129, .16);
}
.baluk-engine-pill {
  background: linear-gradient(90deg, #ccfbf1, #dcfce7);
  border-color: #5eead4;
  color: #115e59;
}
.math-mode-pill {
  padding: 3px 8px;
  font-size: .76rem;
  border-radius: 999px;
}

@media (max-width: 700px) {
  .plus-btn {
    width: 34px;
    height: 34px;
    font-size: 1.02rem;
  }
  .plus-menu {
    min-width: 174px;
    padding: 7px;
  }
  .image-mode-label {
    padding: 5px 7px;
    font-size: .74rem;
  }
  .math-mode-pill {
    font-size: .7rem;
    padding: 2px 7px;
  }
}

.bmw-video-card {
  max-width: min(420px, 92vw);
  padding: 10px;
  border: 1px solid #c7d2fe;
  background: linear-gradient(180deg, #ffffff, #eef2ff);
}
.bmw-video-card iframe {
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 0;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 8px 18px rgba(30, 58, 138, .22);
}

/* drawer UI */
.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(360px, 92vw);
  z-index: 410;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-right: 1px solid #dbeafe;
  border-radius: 0;
  padding: 14px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.side-drawer.hidden {
  display: none !important;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer-head h3,
.drawer-tools-section h4,
.memory-panel h3,
.account-panel h3,
.math-studio-panel h3,
.account-settings summary,
#persistBrowserAccount {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-head h3 { margin: 0; color: #1e3a8a; font-size: 1rem; }
.drawer-head button { border: none; background: #eff6ff; border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.drawer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #0f172a;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 6px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.menu-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  position: relative;
  color: #334155;
}
.icon-user::before,
.icon-user::after {
  content: "";
  position: absolute;
  border: 1.7px solid currentColor;
}
.icon-user::before {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  top: 2px;
}
.icon-user::after {
  width: 10px;
  height: 6px;
  border-top-left-radius: 999px;
  border-top-right-radius: 999px;
  border-bottom: none;
  bottom: 2px;
}
.icon-newchat {
  border: 1.5px solid currentColor;
  border-radius: 4px;
  position: relative;
}
.icon-newchat::before,
.icon-newchat::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.icon-newchat::before { width: 9px; height: 1.5px; }
.icon-newchat::after { width: 1.5px; height: 9px; }
.icon-gear,
.icon-tools {
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.icon-gear::before,
.icon-tools::before {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.icon-gear::after,
.icon-tools::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  transform: rotate(45deg);
  opacity: .78;
}
.icon-bg {
  border-radius: 50%;
  border: 1.6px solid currentColor;
  box-shadow: inset 0 0 0 3px rgba(59,130,246,.18);
}
.icon-plus {
  border-radius: 50%;
  border: 1.6px solid #7c3aed;
  color: #7c3aed;
  font-size: 12px;
  font-weight: 900;
}
.icon-plus::before { content: "+"; line-height: 1; }
.icon-screatch {
  font-size: 15px;
  color: #7c3aed;
}
.drawer-chat-section {
  flex: 1;
  min-height: 220px;
  overflow: auto;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.chat-list { display: grid; gap: 6px; }
.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px;
  background: #f8fafc;
}
.chat-list-item.active { border-color: #93c5fd; background: #eff6ff; }
.chat-open-btn {
  flex: 1;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.chat-open-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-menu-wrap { position: relative; }
.chat-item-menu-btn {
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.05rem;
}
.chat-item-menu {
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 4;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15,23,42,.16);
  padding: 6px;
  display: grid;
  gap: 4px;
}
.chat-item-menu button {
  border: none;
  border-radius: 8px;
  background: #f8fafc;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
  font-weight: 600;
}
.drawer-tools-section {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.drawer-btn-soon {
  opacity: .72;
  cursor: not-allowed;
  justify-content: space-between;
}
.drawer-btn-soon small {
  color: #7c3aed;
  font-size: .72rem;
  font-weight: 800;
}
.drawer-btn-soon:disabled {
  filter: saturate(.9);
}
.drawer-tools-section h4 {
  margin: 0 0 8px;
  color: #1e3a8a;
  font-size: .9rem;
}
.math-drawer-content {
  display: none;
}
.side-drawer.math-drawer-mode #newChatBtn,
.side-drawer.math-drawer-mode .drawer-chat-section,
.side-drawer.math-drawer-mode .drawer-tools-section {
  display: none !important;
}
.side-drawer.math-drawer-mode .math-drawer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.side-drawer.math-drawer-mode {
  overflow: hidden;
}
.math-studio-panel .math-note-new-btn,
.math-studio-panel .math-notes-panel {
  display: none !important;
}
.math-drawer-notes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 3px 12px 0;
  scrollbar-width: thin;
  scrollbar-color: #bfdbfe transparent;
}
.math-drawer-notes h4 {
  margin: 0 0 10px;
  color: #1e40af;
  font-size: .92rem;
}
.math-drawer-notes-list {
  display: grid;
  gap: 6px;
  overflow: visible;
}
.math-drawer-settings {
  border-top: 1px solid rgba(191, 219, 254, 0.85);
  padding: 10px 2px 2px;
  display: grid;
  gap: 8px;
}
.math-drawer-settings h4 {
  margin: 0;
  color: #1e40af;
  font-size: .88rem;
}
.math-drawer-setting-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: rgba(239, 246, 255, .86);
  color: #0f172a;
  cursor: pointer;
}
.math-drawer-setting-row input {
  margin-top: 3px;
  accent-color: #0284c7;
}
.math-drawer-setting-row span {
  display: grid;
  gap: 3px;
}
.math-drawer-setting-row strong {
  font-size: .78rem;
  line-height: 1.25;
}
.math-drawer-setting-row small {
  color: #475569;
  font-size: .68rem;
  line-height: 1.25;
}
.math-drawer-notes-list .math-note-item {
  width: 100%;
  max-width: none;
  text-align: left;
  border-radius: 10px;
  justify-content: flex-start;
  padding: 9px 10px;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}
.math-drawer-hint {
  display: none;
}
.side-drawer.math-drawer-mode .math-drawer-new-note {
  width: fit-content;
  min-height: 32px;
  padding: 6px 10px;
  gap: 6px;
  border-radius: 9px;
  font-size: .82rem;
  align-self: flex-start;
  margin: 0 0 3px;
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.side-drawer.math-drawer-mode .math-drawer-new-note .menu-icon {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  overflow-x: hidden;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 10px 12px 10px 38px;
  position: relative;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item::before {
  content: "";
  position: absolute;
  left: 13px;
  width: 13px;
  height: 16px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  opacity: .72;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 17px;
  width: 7px;
  height: 1.5px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
  opacity: .62;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item.active {
  color: #fff;
  border-color: #4f46e5;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  box-shadow: 0 7px 18px rgba(79, 70, 229, .28), inset 4px 0 0 #a5f3fc;
  font-weight: 800;
}
@media (max-width: 700px) {
  .side-drawer { top: 0; left: 0; right: auto; width: min(96vw, 380px); height: 100dvh; }
}

.web-wiki-excerpt {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.web-wiki-excerpt h4 {
  margin: 0 0 8px;
  color: #1e293b;
  font-size: .95rem;
}
.web-wiki-excerpt p {
  margin: 0 0 8px;
  color: #334155;
  line-height: 1.55;
  max-height: 280px;
  overflow: auto;
  white-space: normal;
}
.web-wiki-excerpt a {
  color: #4c1d95;
  font-weight: 700;
  text-decoration: none;
}

.web-main-answer {
  margin-top: 4px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.web-main-answer h4 {
  margin: 0 0 8px;
  color: #1e293b;
  font-size: .95rem;
}
.web-answer-text {
  margin: 0;
  color: #334155;
  line-height: 1.55;
  white-space: pre-line;
}
.web-read-more {
  margin-top: 8px;
  border: 1px solid #a78bfa;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 8px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}
.web-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}
.web-sources h5 {
  margin: 0 0 8px;
  color: #475569;
  font-size: .88rem;
}
.web-source-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}
.web-source-list a,
.web-source-main {
  color: #4c1d95;
  font-weight: 700;
  text-decoration: none;
}
.web-source-main {
  display: inline-block;
  margin-top: 8px;
}

.math-studio-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}
.math-debug-btn,
.math-note-new-btn,
.math-debug-menu-btn {
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: linear-gradient(135deg, #fee2e2, #fff1f2);
  color: #991b1b;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
}
.math-note-new-btn {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  color: #1d4ed8;
}
.math-debug-btn.active,
.math-debug-menu-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 10px 24px rgba(220, 38, 38, .24);
}
.math-notes-panel {
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
}
.math-notes-panel strong {
  display: block;
  margin-bottom: 8px;
  color: #1e3a8a;
}
.math-notes-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.math-note-item {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #fff;
  color: #1e40af;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.math-note-item.active {
  color: #fff;
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}
.math-studio-output {
  white-space: pre-line;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  padding: 12px;
  line-height: 1.55;
}
.math-studio-output[data-kind="debug"] {
  border-color: #fecaca;
  background: #fff7f7;
  color: #7f1d1d;
}
.app:not(.math-mode) #mathChatDebugBtn {
  display: none !important;
}
.app.math-mode .plus-menu .web-mode-label,
.app.math-mode .plus-menu #balukEngineBtn,
.app.math-mode .plus-menu #thinkingImagePickerBtn {
  display: none !important;
}

.thinking-image-picker-btn {
  width: 100%;
  cursor: pointer;
}
.thinking-image-picker-btn.thinking-required {
  opacity: .68;
}
.plus-menu .thinking-suppressed {
  display: none !important;
}
.advanced-thinking-web-option {
  border-color: #8b5cf6 !important;
  background: linear-gradient(135deg, rgba(124, 58, 237, .14), rgba(37, 99, 235, .12)) !important;
  box-shadow: 0 8px 22px rgba(109, 40, 217, .16);
}
.thinking-mode-orb {
  position: absolute;
  right: -8px;
  bottom: -5px;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #6d28d9;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(109, 40, 217, .3);
  animation: thinkingOrbPulse 1.4s ease-in-out infinite;
}
.thinking-web-orb { background: #2563eb; }
@keyframes thinkingOrbPulse {
  50% { transform: translateY(-3px) scale(1.06); }
}
.app.math-mode #mathChatDebugBtn {
  display: flex;
  width: 100%;
  justify-content: flex-start;
}
body.ui-dark-mode .math-notes-panel,
body.ui-dark-mode .math-studio-output {
  background: rgba(15, 23, 42, .82);
  border-color: rgba(148, 163, 184, .28);
  color: #e5e7eb;
}
body.ui-dark-mode .math-note-item {
  background: rgba(255,255,255,.06);
  color: #dbeafe;
  border-color: rgba(147,197,253,.3);
}
body.ui-dark-mode .math-notes-panel strong { color: #bfdbfe; }
body.ui-dark-mode .math-drawer-notes {
  background: transparent;
  border-color: transparent;
}
body.ui-dark-mode .math-drawer-notes h4 {
  color: #bfdbfe;
}
body.ui-dark-mode .math-drawer-settings {
  border-top-color: rgba(56, 189, 248, .24);
}
body.ui-dark-mode .math-drawer-settings h4 {
  color: #dbeafe;
}
body.ui-dark-mode .math-drawer-setting-row {
  background: rgba(15, 23, 42, .72);
  border-color: rgba(125, 211, 252, .26);
  color: #e0f2fe;
}
body.ui-dark-mode .math-drawer-setting-row small {
  color: #93c5fd;
}
body.ui-dark-mode .math-drawer-hint {
  background: rgba(79, 70, 229, .16);
  color: #c7d2fe;
}
.brand-switch-hint {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 460;
  transform: translateX(-50%);
  width: min(292px, calc(100vw - 30px));
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 10px 10px 12px;
  border: 1px solid rgba(14, 165, 233, .34);
  border-radius: 16px;
  background: rgba(239, 246, 255, .98);
  color: #0f3f6e;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 18px 36px rgba(14, 116, 144, .22), 0 0 0 5px rgba(56, 189, 248, .10);
  backdrop-filter: blur(12px);
  text-align: left;
  pointer-events: auto;
}
.brand-switch-hint::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(239, 246, 255, .98);
  border-left: 1px solid rgba(14, 165, 233, .34);
  border-top: 1px solid rgba(14, 165, 233, .34);
}
.brand-switch-hint button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: #dbeafe;
  color: #075985;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}
body.ui-dark-mode .brand-switch-hint {
  background: rgba(15, 23, 42, .96);
  color: #bfdbfe;
  border-color: rgba(125, 211, 252, .32);
  box-shadow: 0 18px 36px rgba(2, 6, 23, .36), 0 0 0 5px rgba(56, 189, 248, .10);
}
body.ui-dark-mode .brand-switch-hint::before {
  background: rgba(15, 23, 42, .96);
  border-color: rgba(125, 211, 252, .32);
}
body.ui-dark-mode .brand-switch-hint button {
  background: rgba(30, 41, 59, .95);
  color: #bae6fd;
}
.brand-mode-switcher.brand-switch-highlight {
  border-radius: 18px;
  animation: brandSwitchPulse 1.05s ease-in-out 3;
}
.brand-mode-switcher.brand-switch-highlight::before {
  content: "";
  position: absolute;
  inset: -10px -14px;
  border: 2px solid rgba(14, 165, 233, .82);
  border-radius: 24px;
  box-shadow: 0 0 0 7px rgba(56, 189, 248, .16), 0 0 30px rgba(124, 58, 237, .28);
  pointer-events: none;
}
.brand-mode-switcher.brand-switch-highlight::after {
  content: "↙";
  position: absolute;
  right: -24px;
  top: -22px;
  color: #0284c7;
  font-size: 1.8rem;
  font-weight: 900;
  text-shadow: 0 0 16px rgba(56, 189, 248, .6);
  pointer-events: none;
  animation: brandArrowNudge .85s ease-in-out infinite;
}
@keyframes brandSwitchPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}
@keyframes brandArrowNudge {
  0%, 100% { transform: translate(0, 0); opacity: .62; }
  50% { transform: translate(-5px, 5px); opacity: 1; }
}


/* background settings */
.background-modal {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: grid;
  place-items: center;
}
.background-modal.hidden { display: none !important; }
.background-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .6); backdrop-filter: blur(2px); }
.background-card {
  position: relative;
  width: min(560px, 92vw);
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .26);
  display: grid;
  gap: 10px;
}
.background-title-row { display: flex; justify-content: space-between; align-items: center; }
.background-title-row h3 { margin: 0; color: #312e81; }
.background-title-row button { border: none; border-radius: 8px; background: #e2e8f0; padding: 5px 10px; cursor: pointer; }
.background-row { display: grid; gap: 6px; }
.background-row label { font-size: .88rem; color: #475569; font-weight: 700; }
.background-row select,
.background-row input[type="range"] { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px; }
.background-note { margin: 2px 0 0; font-size: .82rem; color: #64748b; }

body[class*="bg-theme-"] {
  position: relative;
  overflow-x: hidden;
}
body[class*="bg-theme-"]::before,
body[class*="bg-theme-"]::after {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: -1;
}
body.bg-theme-1 { background: radial-gradient(circle at 20% 20%, #111827, #0f172a 65%); }
body.bg-theme-1::before { background-image: radial-gradient(circle, rgba(255,255,255,.45) 1px, transparent 1px); background-size: 4px 4px; opacity: .22; animation: bgStarMove 3s linear infinite; }
body.bg-theme-1::after { background: radial-gradient(circle at 0% 50%, rgba(168,85,247,.24), transparent 55%), radial-gradient(circle at 100% 50%, rgba(99,102,241,.22), transparent 45%); }
body.bg-theme-2 { background: linear-gradient(120deg, #0f172a, #1e293b, #0b3b57); }
body.bg-theme-3 { background: linear-gradient(140deg, #1f2937, #312e81, #1f2937); }
body.bg-theme-4 { background: linear-gradient(120deg, #111827, #334155); }
body.bg-theme-5 { background: linear-gradient(120deg, #0f172a, #155e75); }
body.bg-theme-6 { background: linear-gradient(120deg, #1f2937, #7c3aed); }
body.bg-theme-7 { background: linear-gradient(120deg, #020617, #1d4ed8, #701a75); }
body.bg-theme-8 { background: linear-gradient(120deg, #052e16, #14532d, #0f172a); }
body.bg-theme-9 { background: linear-gradient(120deg, #0f172a, #334155, #1e1b4b); }
body.bg-theme-10 { background: linear-gradient(120deg, #111827, #1e3a8a, #0f172a); }

body.bg-theme-7,
body.bg-theme-9 {
  background-size: 170% 170%;
  animation: softGradientFlow 16s ease-in-out infinite;
}

body.bg-theme-7::before,
body.bg-theme-9::before {
  opacity: .2;
  filter: saturate(1.25) blur(.2px);
  animation: bgStarMove 5.8s linear infinite;
}

body.bg-theme-7::after,
body.bg-theme-9::after {
  background:
    radial-gradient(circle at 14% 35%, rgba(168,85,247,.26), transparent 48%),
    radial-gradient(circle at 82% 62%, rgba(96,165,250,.24), transparent 52%),
    radial-gradient(circle at 55% 20%, rgba(244,114,182,.14), transparent 46%);
  animation: neonGlowDrift 9.5s ease-in-out infinite alternate;
}
body.bg-theme-2::before,
body.bg-theme-3::before,
body.bg-theme-4::before,
body.bg-theme-5::before,
body.bg-theme-6::before,
body.bg-theme-7::before,
body.bg-theme-8::before,
body.bg-theme-9::before,
body.bg-theme-10::before {
  background-image: radial-gradient(circle, rgba(255,255,255,.25) 1px, transparent 1px);
  background-size: 5px 5px;
  opacity: .12;
  animation: bgStarMove 4s linear infinite;
}
body.bg-theme-2::after,
body.bg-theme-3::after,
body.bg-theme-4::after,
body.bg-theme-5::after,
body.bg-theme-6::after,
body.bg-theme-7::after,
body.bg-theme-8::after,
body.bg-theme-9::after,
body.bg-theme-10::after {
  background: radial-gradient(circle at 10% 30%, rgba(168,85,247,.14), transparent 45%), radial-gradient(circle at 85% 70%, rgba(59,130,246,.16), transparent 45%);
}
@keyframes bgStarMove {
  from { transform: translateX(-8px) translateY(0); }
  to { transform: translateX(8px) translateY(-8px); }
}

@keyframes softGradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes neonGlowDrift {
  0% { transform: translateY(0px) scale(1); opacity: .72; }
  100% { transform: translateY(-10px) scale(1.06); opacity: .95; }
}

/* Fotoğraf paneli */
.lens-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  width: min(660px, 96vw);
  max-height: 78vh;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 22px 48px rgba(15, 23, 42, .28);
  padding: 12px;
  z-index: 390;
}
.lens-panel.hidden { display: none !important; }

.lens-panel.lens-analyzing {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, .45), 0 0 28px rgba(99, 102, 241, .35), 0 22px 48px rgba(15, 23, 42, .28);
  animation: lensPulse 1.1s ease-in-out infinite alternate;
}
@keyframes lensPulse {
  from { transform: translateY(0); }
  to { transform: translateY(-1px); }
}

.lens-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lens-head h3 { margin: 0; color: #312e81; }
.lens-head button { border: none; background: #e2e8f0; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.lens-hint { margin: 8px 0; color: #475569; font-size: .86rem; }
.lens-drop-zone {
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  min-height: 92px;
  display: grid;
  place-content: center;
  gap: 7px;
  text-align: center;
  color: #475569;
  background: #fff;
}
.lens-drop-zone.dragging { border-color: #6366f1; background: #eef2ff; }
.lens-pick-btn {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  color: #fff;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
.lens-canvas-wrap { margin-top: 10px; border-radius: 12px; overflow: hidden; border: 1px solid #cbd5e1; background: conic-gradient(#f8fafc 0 25%, #e2e8f0 0 50%, #f8fafc 0 75%, #e2e8f0 0) 0 0/16px 16px; }
.lens-canvas-wrap.lens-canvas-live { box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .3), 0 0 18px rgba(129, 140, 248, .35); }
#lensCanvas { width: 100%; height: auto; display: block; cursor: crosshair; touch-action: none; }
.lens-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.lens-analyze-btn {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg,#111827,#312e81);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}
.lens-status {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  font-size: .86rem;
}
.lens-status-live {
  animation: lensStatusShimmer 1.2s linear infinite;
  background-image: linear-gradient(90deg, #eef2ff 0%, #ddd6fe 35%, #eef2ff 70%);
  background-size: 220% 100%;
}
@keyframes lensStatusShimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}
.lens-results {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}
.lens-results h4 { margin: 0 0 8px; color: #0f172a; }
.lens-results ol { margin: 0 0 8px 18px; padding: 0; }
.lens-results a { color: #1d4ed8; text-decoration: none; }
.lens-results a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  #lensCanvas { cursor: default; }
  .lens-panel {
    left: 8px;
    right: 8px;
    bottom: 74px;
    width: auto;
    max-height: 68vh;
  }
}


.typing-active::after {
  content: "▌";
  display: inline-block;
  margin-left: 2px;
  color: #6366f1;
  animation: typingCaretBlink 0.8s steps(1) infinite;
}

@keyframes typingCaretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* BALL.E visual refinement overrides */
.app.balle-bg-active::before {
  background:
    radial-gradient(circle at 10% 20%, rgba(34,197,94,.42) 0 8%, rgba(34,197,94,0) 9%),
    radial-gradient(circle at 25% 72%, rgba(250,204,21,.45) 0 8%, rgba(250,204,21,0) 9%),
    radial-gradient(circle at 45% 32%, rgba(239,68,68,.4) 0 8%, rgba(239,68,68,0) 9%),
    radial-gradient(circle at 72% 62%, rgba(168,85,247,.44) 0 8%, rgba(168,85,247,0) 9%),
    radial-gradient(circle at 87% 26%, rgba(250,204,21,.34) 0 7%, rgba(250,204,21,0) 8%),
    linear-gradient(120deg, rgba(16,185,129,.18), rgba(234,179,8,.18), rgba(239,68,68,.16), rgba(168,85,247,.22));
  background-size: 180% 180%;
  animation: balleBackdropFloat 10s ease-in-out infinite alternate, balleBgShift 7s linear infinite;
}
@keyframes balleBgShift { from { background-position: 0% 50%; } to { background-position: 160% 50%; } }

.balle-stage-canvas {
  border: 1px solid #d4d4d8;
  background: #e5e7eb;
}
.balle-stage-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, transparent 0%, rgba(255,255,255,.5) 48%, transparent 100%);
  transform: translateX(-120%);
  animation: balleCrossShine 2s linear infinite;
}
@keyframes balleCrossShine {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

.balle-core-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(120deg, #22c55e, #facc15, #ef4444, #a855f7, #22c55e);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(255,255,255,.35);
  animation: balleWordGlow 2.8s linear infinite;
  z-index: 3;
}
@keyframes balleWordGlow {
  from { background-position: 0% 50%; filter: drop-shadow(0 0 8px rgba(168,85,247,.45)); }
  to { background-position: 220% 50%; filter: drop-shadow(0 0 16px rgba(234,179,8,.55)); }
}
.balle-neon-scan {
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: 0 0 14px rgba(34,197,94,.35), 0 0 18px rgba(250,204,21,.28), 0 0 20px rgba(239,68,68,.24), 0 0 22px rgba(168,85,247,.32);
  animation: balleBorderPulse 2s ease-in-out infinite;
  z-index: 2;
}
@keyframes balleBorderPulse {
  0%,100% { opacity: .75; }
  50% { opacity: 1; }
}

.balle-orb { filter: blur(.4px); opacity: .92; }


.account-icon-btn.guest-default {
  border-radius: 999px;
  padding: 0;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
}
.account-icon-btn .account-toggle-avatar { width: 30px; height: 30px; display: block; }
.account-icon-btn .account-toggle-menu {
  width: 28px;
  height: 28px;
  color: #0f172a;
}
.account-icon-btn.has-photo {
  border-radius: 999px;
  overflow: hidden;
  padding: 0;
  border: 1.5px solid #cbd5e1;
}
.account-icon-btn.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.voice-mode-icon {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #111;
  display: grid;
  place-items: center;
}
.voice-mode-icon .vm-lines {
  width: 12px;
  height: 14px;
  border-left: 3px solid #111;
  border-right: 3px solid #111;
  opacity: .85;
}
.voice-mode-panel {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(167,139,250,.28), rgba(30,27,75,.88));
  z-index: 120;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.voice-mode-shell {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  background:
    radial-gradient(circle at 20% 15%, rgba(216,180,254,.22), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(147,51,234,.25), transparent 40%),
    linear-gradient(180deg, #2a0c48 0%, #17042b 100%);
  padding: 24px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  position: relative;
}
.voice-mode-core {
  z-index: 2;
  align-self: center;
  justify-self: center;
  width: min(230px, 62vw);
  aspect-ratio: 1/1;
  border-radius: 50%;
  border: 3px solid #111;
  display: grid;
  place-items: center;
  position: relative;
  background: radial-gradient(circle at 35% 35%, #f3e8ff, #c084fc 55%, #6b21a8);
}
.voice-logo {
  font-weight: 900;
  color: #334155;
  letter-spacing: .03em;
}
.voice-mode-status {
  color: #f5d0fe;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(216,180,254,.45);
}
.voice-mode-actions {
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.voice-mute-btn,
.voice-web-btn,
.voice-close-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #111;
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}
.voice-mute-btn {
  background: #ef4444;
  color: #fff;
}
.voice-mute-btn.muted { background: #9ca3af; }
.voice-web-btn {
  background: #dbeafe;
  color: #0f172a;
  border-color: #93c5fd;
  box-shadow: 0 8px 18px rgba(96,165,250,.35);
}
.voice-web-btn.active {
  background: linear-gradient(135deg, #60a5fa, #38bdf8);
  color: #fff;
  border-color: #38bdf8;
}




.voice-open-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.voice-drop {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #faf5ff, #d8b4fe 65%, #9333ea);
  box-shadow: 0 0 22px rgba(216,180,254,.95);
  transform: translateX(-50%);
  opacity: 0;
}
.voice-vapor {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  background: radial-gradient(circle, rgba(233,213,255,.9), rgba(168,85,247,.35), transparent 72%);
}
.voice-open-fx.play .voice-drop {
  animation: voiceDropFall 1.5s ease-in forwards;
}
.voice-open-fx.play .voice-vapor {
  animation: voiceVaporBurst 1.5s ease-out forwards;
}
@keyframes voiceDropFall {
  0% { opacity: 0; transform: translate(-50%, -26px) scale(.65); }
  14% { opacity: 1; }
  74% { opacity: 1; transform: translate(-50%, 52vh) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, 61vh) scale(.45); }
}
@keyframes voiceVaporBurst {
  0%, 58% { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
  72% { opacity: .95; transform: translate(-50%, -50%) scale(3.6); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(6); }
}
.voice-mode-panel.hidden { display: none !important; }
.voice-center-logo {
  width: min(150px, 45vw);
  color: #faf5ff;
  filter: drop-shadow(0 0 14px rgba(192,132,252,.65));
}
.voice-mode-core.speaking .voice-center-logo {
  color: #d946ef;
  animation: voiceLogoPulse .9s ease-in-out infinite;
}
@keyframes voiceLogoPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.voice-close-btn { z-index: 3; position: fixed; top: 16px; right: 16px; }

.voice-model-picker {
  position: fixed;
  left: 20px;
  top: 18px;
  z-index: 12;
}
.voice-model-toggle {
  min-width: 154px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(216,180,254,.42);
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, rgba(88,28,135,.78), rgba(30,10,64,.72));
  box-shadow: 0 8px 28px rgba(76,29,149,.28), inset 0 1px rgba(255,255,255,.13);
  backdrop-filter: blur(14px);
  cursor: pointer;
}
.voice-model-toggle svg { width: 30px; color: #e9d5ff; }
.voice-model-toggle > span { display: grid; gap: 1px; text-align: left; }
.voice-model-toggle small { color: #c4b5fd; font-size: .68rem; font-weight: 750; }
.voice-model-toggle strong { font-size: .9rem; letter-spacing: .01em; }
.voice-model-toggle > i { margin-left: auto; color: #d8b4fe; font-style: normal; transition: transform .2s ease; }
.voice-model-toggle[aria-expanded="true"] > i { transform: rotate(180deg); }
.voice-model-menu {
  width: min(310px, calc(100vw - 40px));
  max-height: min(68vh, 520px);
  overflow-y: auto;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid rgba(216,180,254,.34);
  border-radius: 20px;
  background: rgba(17,4,36,.93);
  box-shadow: 0 22px 60px rgba(0,0,0,.42), 0 0 26px rgba(139,92,246,.18);
  backdrop-filter: blur(22px);
}
.voice-model-menu > p { margin: 3px 5px 9px; color: #ddd6fe; font-size: .78rem; font-weight: 800; }
.voice-model-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 0;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #f5f3ff;
  background: rgba(255,255,255,.045);
  cursor: pointer;
}
.voice-model-option small { color: #a78bfa; font-size: .7rem; }
.voice-model-option:hover:not(:disabled) { background: rgba(139,92,246,.18); border-color: rgba(196,181,253,.25); }
.voice-model-option.active { border-color: #c084fc; background: linear-gradient(135deg, rgba(126,34,206,.56), rgba(91,33,182,.36)); box-shadow: 0 0 16px rgba(168,85,247,.22); }
.voice-model-option:disabled { opacity: .42; cursor: not-allowed; }

@media (max-width: 700px) {
  .voice-model-picker { left: 14px; top: 14px; }
  .voice-model-toggle { min-width: 136px; height: 48px; border-radius: 16px; padding: 6px 10px; }
  .voice-model-toggle svg { width: 26px; }
  .voice-model-menu { width: min(285px, calc(100vw - 28px)); max-height: 62vh; }
}


#chatSubmitBtn .voice-mode-icon {
  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}
#chatSubmitBtn .voice-mode-icon .vm-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: .88;
}
#chatSubmitBtn .voice-mode-icon .vm-wave::before,
#chatSubmitBtn .voice-mode-icon .vm-wave::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: .38;
}
#chatSubmitBtn .voice-mode-icon .vm-wave::after {
  inset: -10px;
  opacity: .2;
}
#chatSubmitBtn .voice-mode-icon .vm-bars {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  gap: 3px;
  height: 12px;
}
#chatSubmitBtn .voice-mode-icon .vm-bars span {
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  animation: vmBarsPulse 1.1s ease-in-out infinite;
}
#chatSubmitBtn .voice-mode-icon .vm-bars span:nth-child(1) { height: 6px; animation-delay: 0s; }
#chatSubmitBtn .voice-mode-icon .vm-bars span:nth-child(2) { height: 11px; animation-delay: .12s; }
#chatSubmitBtn .voice-mode-icon .vm-bars span:nth-child(3) { height: 8px; animation-delay: .24s; }
@keyframes vmBarsPulse {
  0%, 100% { transform: scaleY(.82); opacity: .72; }
  50% { transform: scaleY(1.08); opacity: 1; }
}


/* Voice/send unified button refinements */
#chatSubmitBtn {
  background: #fff;
  color: #111827;
  border-color: #111827;
}
#chatSubmitBtn.voice-launch {
  border-radius: 14px;
  border-color: #7c3aed;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  box-shadow: 0 8px 18px rgba(124,58,237,.32);
}
#chatSubmitBtn.voice-launch .voice-mode-icon {
  border-color: rgba(255,255,255,.95);
}
#chatSubmitBtn.voice-launch .voice-mode-icon .vm-wave,
#chatSubmitBtn.voice-launch .voice-mode-icon .vm-wave::before,
#chatSubmitBtn.voice-launch .voice-mode-icon .vm-wave::after,
#chatSubmitBtn.voice-launch .voice-mode-icon .vm-bars span {
  color: rgba(255,255,255,.95);
  border-color: rgba(255,255,255,.95);
  background: rgba(255,255,255,.95);
}
#chatSubmitBtn.stop-generating {
  border: 0;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 45%, #a78bfa 0%, #8b5cf6 48%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(139,92,246,.13), 0 0 24px rgba(124,58,237,.52), 0 12px 26px rgba(91,33,182,.28);
}
#chatSubmitBtn.stop-generating .stop-response-icon {
  width: 15px;
  height: 15px;
  display: block;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 12px rgba(255,255,255,.88);
}
#userInput[readonly] {
  color: #6b7280;
  background: #f8fafc;
  cursor: default;
}

.baluk-engine-btn {
  width: 100%;
  border: 1px solid #d1d5db;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: #111827;
  justify-content: flex-start;
  text-align: left;
  font: inherit;
  position: relative;
}
.baluk-engine-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.6px solid #111827;
  background: #fff;
  flex: 0 0 auto;
}
.baluk-engine-btn:hover {
  box-shadow: 0 0 0 1px rgba(17,24,39,.12), 0 10px 18px rgba(15,23,42,.08);
}
.baluk-engine-pill {
  background: linear-gradient(180deg, #ffffff, #eef2f7);
  border: 1px solid #d1d5db;
  color: #111827;
}

.app.engine-mode-active #chatArea,
.app.engine-mode-active #chatForm,
.app.engine-mode-active .thinking-toolbar,
.app.engine-mode-active #thinkingLimitBanner {
  display: none;
}

.engine-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background:
    radial-gradient(circle at 12% 8%, rgba(244, 114, 182, .14), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(59, 130, 246, .12), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(168, 85, 247, .10), transparent 30%),
    linear-gradient(180deg, #fdfdff 0%, #f4f7fb 52%, #eef3f8 100%);
}
.engine-workspace.hidden { display: none !important; }
.engine-workspace.engine-enter {
  animation: engineWorkspaceReveal .58s cubic-bezier(.2,.8,.2,1);
}
@keyframes engineWorkspaceReveal {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.engine-sidebar {
  border-right: 1px solid rgba(148, 163, 184, .26);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,249,255,.92));
  padding: 20px 18px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 16px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.6), 18px 0 40px rgba(15, 23, 42, .04);
  backdrop-filter: blur(16px);
}
.engine-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.engine-back-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.8px solid #111827;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
}
.engine-brand-diamond,
.engine-diamond-btn {
  width: 46px;
  height: 46px;
  transform: rotate(45deg);
  border: 2px solid #111827;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}
.engine-brand-diamond {
  flex: 0 0 auto;
  font-weight: 900;
  font-size: .95rem;
}
.engine-brand-diamond > *,
.engine-brand-diamond,
.engine-diamond-btn > *,
.engine-diamond-btn {
  color: #111827;
}
.engine-brand-diamond,
.engine-diamond-btn span {
  transform: rotate(-45deg);
}
.engine-brand-copy {
  display: grid;
  gap: 2px;
}
.engine-brand-copy strong {
  font-size: 1.1rem;
  color: #111827;
}
.engine-brand-copy span,
.engine-sidebar-label {
  color: #475569;
  font-size: .86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.engine-new-chat-btn {
  border: 1px solid rgba(99, 102, 241, .26);
  background: linear-gradient(135deg, #ffffff, #f4edff);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.engine-new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(124, 58, 237, .16);
}
.engine-chat-list {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
}
.engine-chat-item {
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.92));
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}
.engine-chat-item.active {
  border-color: rgba(139, 92, 246, .30);
  background: linear-gradient(180deg, #ffffff, #f4edff);
  box-shadow: 0 18px 32px rgba(124, 58, 237, .14);
}
.engine-chat-open {
  border: none;
  background: transparent;
  text-align: left;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  padding: 0;
}
.engine-chat-actions {
  display: flex;
  gap: 8px;
}
.engine-chat-actions button {
  flex: 1;
  border: 1px solid rgba(148, 163, 184, .36);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: 7px 8px;
  font-weight: 700;
  cursor: pointer;
}

.engine-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 22px 24px 24px;
  gap: 18px;
}
.engine-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.engine-thinking-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(99, 102, 241, .28);
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(244,237,255,.92));
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(124, 58, 237, .08);
}
.engine-panel-actions {
  display: flex;
  gap: 10px;
}
.engine-panel-btn {
  min-width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .34);
  background: linear-gradient(180deg, #fff, #f8fafc);
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.engine-panel-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(124, 58, 237, .12);
}
.engine-panel-btn-wide {
  padding: 0 18px;
  min-width: 88px;
}
.engine-panel-btn.active {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border-color: transparent;
}

.engine-canvas {
  min-height: 0;
  position: relative;
  border: 1px solid rgba(148, 163, 184, .26);
  border-radius: 36px;
  background:
    radial-gradient(circle at 92% 10%, rgba(96,165,250,.08), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,250,255,.96));
  padding: 30px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(15, 23, 42, .09);
}
.engine-canvas.pristine {
  background:
    radial-gradient(circle at 16% 18%, rgba(168, 85, 247, .06), transparent 24%),
    #ffffff;
}
.engine-status-card {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 2px solid #111827;
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  padding: 18px 20px;
  max-width: 560px;
  box-shadow: 0 18px 40px rgba(15,23,42,.08);
}
.engine-status-card.hidden { display: none !important; }
.engine-status-card.processing {
  box-shadow: 0 24px 44px rgba(124,58,237,.16);
}
.engine-status-visual {
  position: relative;
  width: 160px;
  height: 90px;
  flex: 0 0 auto;
}
.engine-fish {
  position: absolute;
  left: 0;
  top: 12px;
  width: 124px;
  color: #111827;
}
.engine-bubbles span {
  position: absolute;
  right: 6px;
  top: 16px;
  border-radius: 999px;
  border: 1.5px solid #111827;
  padding: 4px 8px;
  background: #fff;
  font-size: .78rem;
  font-weight: 800;
  opacity: 0;
}
.engine-status-card.processing .engine-bubbles span:nth-child(1) {
  animation: engineBubbleFloat 1.8s ease-in-out infinite;
}
.engine-status-card.processing .engine-bubbles span:nth-child(2) {
  animation: engineBubbleFloat 1.8s ease-in-out .45s infinite;
}
.engine-status-card.processing .engine-bubbles span:nth-child(3) {
  animation: engineBubbleFloat 1.8s ease-in-out .9s infinite;
}
.engine-thinking-card .engine-bubbles span:nth-child(1) {
  animation: engineBubbleFloat 1.8s ease-in-out infinite;
}
.engine-thinking-card .engine-bubbles span:nth-child(2) {
  animation: engineBubbleFloat 1.8s ease-in-out .45s infinite;
}
.engine-thinking-card .engine-bubbles span:nth-child(3) {
  animation: engineBubbleFloat 1.8s ease-in-out .9s infinite;
}
@keyframes engineBubbleFloat {
  0% { transform: translate(82px, 54px) scale(.55); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(148px, -4px) scale(1); opacity: 0; }
}
.engine-status-copy strong {
  display: block;
  color: #0f172a;
  font-size: 1.05rem;
}
.engine-status-copy p {
  margin: 6px 0 0;
  color: #475569;
  line-height: 1.5;
}

.engine-project-stage {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}
.engine-project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.engine-project-head strong {
  display: block;
  font-size: 1.15rem;
  color: #111827;
}
.engine-project-head p {
  margin: 6px 0 0;
  color: #64748b;
  max-width: 58ch;
}
.engine-project-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.engine-project-badge {
  border: 1px solid #d8b4fe;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .78rem;
  font-weight: 800;
  background: linear-gradient(180deg, #fff, #faf5ff);
  color: #6d28d9;
}
.engine-project-view {
  min-height: 360px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 32px;
  background:
    radial-gradient(circle at 90% 10%, rgba(96,165,250,.08), transparent 20%),
    linear-gradient(180deg, #ffffff, #fbfcff);
  overflow: hidden;
  position: relative;
}
.engine-thinking-scene {
  position: absolute;
  inset: 26px auto auto 26px;
  width: 390px;
  display: block;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}
.engine-thinking-actor {
  display: grid;
  gap: 16px;
  justify-items: start;
}

/* 2026 Engine Rebuild */
.ui-settings-btn { min-width: 82px; }

.ui-settings-modal,
.engine-settings-panel,
.engine-quota-panel {
  position: fixed;
  inset: 0;
  z-index: 420;
}
.ui-settings-modal.hidden,
.engine-settings-panel.hidden,
.engine-quota-panel.hidden { display: none !important; }
.ui-settings-backdrop,
.engine-quota-panel::before,
.engine-settings-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.56);
  backdrop-filter: blur(12px);
}
.ui-settings-card,
.engine-settings-card,
.engine-quota-card {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,247,252,0.98));
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}
.ui-settings-head,
.engine-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.ui-settings-head h3,
.engine-settings-head strong,
.engine-quota-card strong {
  margin: 0;
  font-size: 1.05rem;
  color: #0f172a;
}
.ui-settings-head button,
.engine-settings-head button,
.engine-dock-head button,
.engine-quota-actions button:last-child {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(255,255,255,0.82);
  color: #0f172a;
  cursor: pointer;
}
.ui-settings-block,
.engine-settings-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid rgba(226, 232, 240, 0.92);
}
.ui-settings-block:first-of-type,
.engine-settings-section:first-of-type { border-top: none; padding-top: 0; }
.ui-mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.06);
}
.ui-mode-switch button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #475569;
}
.ui-mode-switch button.active {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  box-shadow: 0 10px 22px rgba(124, 58, 237, 0.24);
}

body.ui-dark-mode {
  --bg: #090a13;
  --text: #eef2ff;
  --line: rgba(148, 163, 184, 0.24);
  --line-strong: #dbe3ff;
  --user: #181b2a;
  --bot: #101521;
  background: #090a13;
  color: #eef2ff;
}
body.ui-dark-mode .topbar,
body.ui-dark-mode .input-shell,
body.ui-dark-mode .chat-area,
body.ui-dark-mode .side-drawer,
body.ui-dark-mode .memory-panel,
body.ui-dark-mode .account-panel,
body.ui-dark-mode .math-studio-panel,
body.ui-dark-mode .plus-menu,
body.ui-dark-mode .background-card,
body.ui-dark-mode .ui-settings-card,
body.ui-dark-mode .lens-panel,
body.ui-dark-mode .test-question-card,
body.ui-dark-mode .geometry-card,
body.ui-dark-mode .drawer-tools-section,
body.ui-dark-mode .account-preview,
body.ui-dark-mode .web-results,
body.ui-dark-mode .web-wiki-excerpt {
  background: rgba(10, 14, 25, 0.94);
  color: #eef2ff;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
body.ui-dark-mode .brand,
body.ui-dark-mode .model-badge,
body.ui-dark-mode .drawer-head h3,
body.ui-dark-mode .drawer-tools-section h4,
body.ui-dark-mode .account-settings summary,
body.ui-dark-mode .memory-panel h3,
body.ui-dark-mode .account-panel h3,
body.ui-dark-mode .math-studio-panel h3 {
  color: #eef2ff;
}
body.ui-dark-mode .brand-mode-menu {
  border-color: rgba(139,92,246,.34);
  background: rgba(12, 16, 30, .94);
  box-shadow: 0 22px 54px rgba(0,0,0,.42), 0 0 28px rgba(124,58,237,.12);
}
body.ui-dark-mode .brand-mode-option {
  color: #e2e8f0;
  background: transparent;
}
body.ui-dark-mode .brand-mode-option.active {
  color: #e0e7ff;
  background: rgba(79,70,229,.3);
}
body.ui-dark-mode .brand-mode-option.math-option.active {
  color: #bae6fd;
  background: rgba(14,116,144,.32);
}
body.ui-dark-mode .brand-mode-option small { color: #94a3b8; }
body.ui-dark-mode .brand-mode-icon {
  color: #f8fafc;
  background: rgba(15,23,42,.92);
}
body.ui-dark-mode .fish-logo,
body.ui-dark-mode .voice-center-logo,
body.ui-dark-mode .transition-fish {
  color: #f8fafc;
}
body.ui-dark-mode .memory-btn,
body.ui-dark-mode .clear-btn,
body.ui-dark-mode .plus-btn,
body.ui-dark-mode #chatSubmitBtn,
body.ui-dark-mode .drawer-btn,
body.ui-dark-mode .engine-top-btn,
body.ui-dark-mode .model-option,
body.ui-dark-mode .test-option-btn,
body.ui-dark-mode .lens-pick-btn,
body.ui-dark-mode .lens-analyze-btn,
body.ui-dark-mode .geo-btn,
body.ui-dark-mode .ui-settings-head button {
  background: rgba(255,255,255,0.06);
  color: #eef2ff;
  border-color: rgba(148, 163, 184, 0.24);
}
body.ui-dark-mode input,
body.ui-dark-mode select,
body.ui-dark-mode textarea,
body.ui-dark-mode #userInput,
body.ui-dark-mode .agent-search-box {
  background: #111827;
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.34);
}
body.ui-dark-mode input::placeholder,
body.ui-dark-mode textarea::placeholder {
  color: #94a3b8;
}
body.ui-dark-mode #chatSubmitBtn.stop-generating {
  border: 0;
  background: radial-gradient(circle at 50% 45%, #a78bfa 0%, #8b5cf6 48%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(139,92,246,.13), 0 0 24px rgba(124,58,237,.52), 0 12px 26px rgba(91,33,182,.28);
}
body.ui-dark-mode #userInput[readonly] {
  background: #182033;
  color: #94a3b8;
}
body.ui-dark-mode .image-mode-label,
body.ui-dark-mode .lens-drop-zone,
body.ui-dark-mode .account-settings,
body.ui-dark-mode .account-safety-details,
body.ui-dark-mode .chat-list-item,
body.ui-dark-mode .chat-item-menu,
body.ui-dark-mode .thinking-details,
body.ui-dark-mode .thinking-live-note {
  background: rgba(255,255,255,0.045);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.24);
}
body.ui-dark-mode .plus-menu .math-mode-pill {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}
body.ui-dark-mode .plus-menu .web-mode-label .math-mode-pill {
  background: rgba(30, 41, 59, 0.96);
  color: #f8fafc;
}
body.ui-dark-mode .plus-menu .profanity-mode-label {
  background: rgba(255,255,255,0.045);
}
body.ui-dark-mode .memory-hint,
body.ui-dark-mode .lens-hint,
body.ui-dark-mode .background-note,
body.ui-dark-mode .account-preview p,
body.ui-dark-mode .thinking-live-note,
body.ui-dark-mode .thinking-details p {
  color: #b6c2d6;
}
body.ui-dark-mode .account-safety-info summary,
body.ui-dark-mode .account-safety-details p {
  color: #cbd5e1;
}
body.ui-dark-mode .context-usage-summary {
  color: #cbd5e1;
  background: rgba(148, 163, 184, .14);
}
body.ui-dark-mode .context-usage-summary.math-context {
  color: #bae6fd;
  background: rgba(14, 165, 233, .16);
}
body.ui-dark-mode .context-usage-summary.math-context .context-usage-ring i {
  background: #0c4a6e;
}
body.ui-dark-mode .context-usage-ring i { background: #111827; }
body.ui-dark-mode .context-usage-summary.is-warning,
body.ui-dark-mode .context-usage-warning { color: #fbbf24; }
body.ui-dark-mode .context-usage-summary.is-critical,
body.ui-dark-mode .context-usage-warning.is-critical { color: #f87171; }
body.ui-dark-mode .account-disclosure-arrow::before {
  color: #cbd5e1;
}
body.ui-dark-mode .account-safety-details a {
  color: #93c5fd;
}
body.ui-dark-mode .lens-results h4,
body.ui-dark-mode .web-wiki-excerpt h4,
body.ui-dark-mode .test-question,
body.ui-dark-mode .test-head,
body.ui-dark-mode label,
body.ui-dark-mode strong {
  color: #f8fafc;
}
body.ui-dark-mode .lens-results a,
body.ui-dark-mode .web-results a,
body.ui-dark-mode .thinking-source-chip {
  color: #93c5fd;
}
body.ui-dark-mode .msg.bot { background: rgba(255,255,255,0.06); color: #eef2ff; }
body.ui-dark-mode .msg.user { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; }
body.ui-dark-mode .model-menu,
body.ui-dark-mode .thinking-mode-menu,
body.ui-dark-mode .thinking-limit-banner { background: rgba(10, 14, 25, 0.96); color: #eef2ff; }
body.ui-dark-mode .thinking-mode-picker {
  background: rgba(255,255,255,.06);
  color: #ddd6fe;
  border-color: rgba(196,181,253,.35);
}
body.ui-dark-mode .thinking-mode-picker.active {
  color: #fff;
  background: linear-gradient(135deg, #6d28d9, #9333ea);
}
body.ui-dark-mode .thinking-mode-option { color: #eef2ff; }
body.ui-dark-mode .thinking-mode-option:hover,
body.ui-dark-mode .thinking-mode-option.active { background: rgba(139,92,246,.16); }
body.ui-dark-mode .thinking-mode-option small { color: #a5b4fc; }

/* Dark mode contrast polish for mobile drawer and top controls */
body.ui-dark-mode #currentModelBadge {
  background: rgba(255, 255, 255, .08);
  color: #f8fafc;
  border-color: rgba(226, 232, 240, .42);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

body.ui-dark-mode .account-icon-btn .account-toggle-menu,
body.ui-dark-mode #accountToggle .account-toggle-avatar {
  color: #f8fafc;
}

body.ui-dark-mode .drawer-chat-section {
  background: rgba(7, 11, 22, .92);
  border-color: rgba(148, 163, 184, .24);
}

body.ui-dark-mode .chat-list-item {
  background: rgba(255,255,255,.045);
}

body.ui-dark-mode .chat-list-item.active {
  background: rgba(59, 130, 246, .14);
  border-color: rgba(147, 197, 253, .42);
}

body.ui-dark-mode .chat-open-btn,
body.ui-dark-mode .chat-item-menu button {
  color: #eef2ff;
}

body.ui-dark-mode .chat-item-menu-btn {
  background: rgba(226, 232, 240, .12);
  color: #f8fafc;
}

body.ui-dark-mode .menu-icon,
body.ui-dark-mode .drawer-btn .menu-icon {
  color: #eaf1ff;
}

body.ui-dark-mode #chatSubmitBtn.voice-launch {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border-color: rgba(196, 181, 253, .55);
  box-shadow: 0 0 0 3px rgba(139,92,246,.15), 0 10px 24px rgba(124,58,237,.36);
}

body.ui-dark-mode .plus-btn {
  border-color: rgba(196, 181, 253, .45);
  box-shadow: 0 0 0 2px rgba(139,92,246,.10), 0 8px 18px rgba(88,28,135,.20);
}

@keyframes baluk67Shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-13px); }
  20%, 40%, 60%, 80% { transform: translateX(13px); }
}
.app.baluk-67-shake {
  animation: baluk67Shake 125ms linear 16;
}
@media (prefers-reduced-motion: reduce) {
  .app.baluk-67-shake { animation-duration: 240ms; animation-iteration-count: 2; }
}
.app.engine-mode-active .topbar,
.app.engine-mode-active #chatArea,
.app.engine-mode-active #chatForm,
.app.engine-mode-active .thinking-toolbar,
.app.engine-mode-active #thinkingLimitBanner,
.app.engine-mode-active #sideDrawer,
.app.engine-mode-active #memoryPanel,
.app.engine-mode-active #accountPanel,
.app.engine-mode-active #mathStudioPanel {
  display: none !important;
}

.engine-workspace {
  display: block;
  min-height: calc(100vh - 0px);
  background: radial-gradient(circle at top, rgba(129, 58, 255, 0.24), transparent 24%), linear-gradient(180deg, #090910 0%, #12101d 36%, #0a0912 100%);
  color: #eef2ff;
}
.engine-workspace.hidden { display: none !important; }
.engine-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px 28px 34px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
}
.engine-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.engine-top-btn {
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 14px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.04);
  color: #eef2ff;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.engine-top-btn:hover,
.engine-chip-btn:hover,
.engine-icon-btn:hover,
.engine-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(124, 58, 237, 0.2);
}
.engine-wordmark {
  display: flex;
  align-items: center;
  gap: 14px;
}
.engine-brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #e5e7eb;
  filter: drop-shadow(0 0 24px rgba(167,139,250,0.18));
}
.engine-brand-mark svg,
.engine-hero-logo svg {
  width: 100%;
  height: 100%;
}
.engine-wordmark-copy {
  display: grid;
  gap: 4px;
}
.engine-wordmark-copy strong {
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}
.engine-wordmark-copy span {
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.85rem;
}
.engine-main-layout {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  gap: 22px;
}
.engine-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
}
.engine-hero {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding-top: 6vh;
}
.engine-hero-logo {
  width: 88px;
  height: 88px;
  color: #f8fafc;
  filter: drop-shadow(0 0 28px rgba(192, 132, 252, 0.16));
}
.engine-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.04em;
  font-weight: 750;
}
.engine-project-view {
  width: min(1080px, 100%);
  margin: 0 auto;
  min-height: 380px;
  max-height: 50vh;
  overflow: auto;
  padding: 8px 6px 18px;
}
.engine-project-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: rgba(226, 232, 240, 0.52);
  text-align: center;
}
.engine-project-empty p {
  max-width: 48ch;
  line-height: 1.7;
}
.engine-conversation-feed {
  display: grid;
  gap: 14px;
}
.engine-conversation-bubble {
  max-width: min(720px, 86%);
  border-radius: 20px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(10px);
}
.engine-conversation-bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.88), rgba(79, 70, 229, 0.86));
  color: #fff;
}
.engine-conversation-bubble.assistant {
  background: rgba(255,255,255,0.05);
  color: #eef2ff;
}
.engine-conversation-bubble strong {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.engine-conversation-bubble p,
.engine-conversation-bubble span {
  margin: 0;
  line-height: 1.65;
}
.engine-bottom-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}
.engine-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.engine-picker-row,
.engine-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.engine-diamond-btn {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(192, 132, 252, 0.34);
  background: linear-gradient(180deg, rgba(22, 18, 36, 0.94), rgba(11, 11, 18, 0.96));
  color: #eef2ff;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.engine-diamond-btn-text {
  display: inline-grid;
  place-items: center;
  transform: rotate(-45deg);
  font-weight: 800;
  font-size: 1rem;
}
.engine-diamond-btn-text svg {
  width: 22px;
  height: 22px;
}
.engine-mini-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(10, 10, 18, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 8px;
  z-index: 20;
}
.engine-mini-menu button {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  color: #eef2ff;
  font-weight: 700;
  cursor: pointer;
}
.engine-picker-wrap { position: relative; }
.engine-quota-wrap {
  min-width: 210px;
  display: grid;
  gap: 8px;
}
.engine-quota-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.engine-quota-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.32);
}
.engine-quota-wrap strong {
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.84);
}
.engine-chip-btn,
.engine-icon-btn {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: #eef2ff;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.engine-chip-btn {
  padding: 11px 16px;
}
.engine-icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
}
.engine-icon-btn svg {
  width: 18px;
  height: 18px;
}
.engine-chip-btn.active,
.engine-icon-btn.active,
.engine-mini-menu button.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(79, 70, 229, 0.28));
  border-color: rgba(196, 181, 253, 0.44);
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.16);
}
.engine-composer-shell {
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255,255,255,0.04);
  padding: 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}
.engine-composer {
  display: grid;
  gap: 12px;
}
.engine-composer textarea {
  width: 100%;
  min-height: 116px;
  max-height: 190px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: #f8fafc;
  font: inherit;
  font-size: 1.04rem;
  line-height: 1.7;
}
.engine-composer textarea::placeholder {
  color: rgba(226, 232, 240, 0.5);
}
.engine-composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.engine-selection-meta {
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.88rem;
}
.engine-submit-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(124, 58, 237, 0.24);
}
.engine-dock {
  position: absolute;
  top: 88px;
  right: 28px;
  bottom: 34px;
  width: min(560px, calc(100vw - 56px));
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(8, 11, 20, 0.96);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.34);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  z-index: 40;
}
.engine-dock.hidden { display: none !important; }
.engine-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.engine-dock-head strong { color: #eef2ff; }
.engine-dock-body {
  padding: 18px 20px 22px;
  overflow: auto;
}
.engine-code-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.engine-code-tab {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  color: #e2e8f0;
  font-weight: 700;
  cursor: pointer;
}
.engine-code-tab.active {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-color: transparent;
}
.engine-code-section { display: none; gap: 12px; }
.engine-code-section.active { display: grid; }
.engine-code-actions {
  display: flex;
  justify-content: flex-end;
}
.engine-code-copy {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  color: #eef2ff;
  cursor: pointer;
}
.engine-code-block-highlight {
  margin: 0;
  padding: 18px;
  border-radius: 20px;
  background: #090c17;
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #eef2ff;
  overflow: auto;
}
.engine-preview-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 20px;
  background: #fff;
}
.engine-auth-gate {
  position: absolute;
  inset: 84px 28px 32px;
  display: grid;
  place-items: center;
}
.engine-auth-glow {
  position: absolute;
  inset: 12% 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.24), transparent 64%);
  filter: blur(22px);
}
.engine-auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  justify-items: start;
  padding: 32px 34px;
  width: min(560px, 100%);
  border-radius: 32px;
  border: 1px solid rgba(168, 85, 247, 0.24);
  background: rgba(255,255,255,0.04);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.24);
}
.engine-auth-logo {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: #f8fafc;
}
.engine-auth-phrase {
  margin: 0;
  color: rgba(226, 232, 240, 0.76);
  font-size: 1.08rem;
  min-height: 2.2em;
}
.engine-auth-btn,
.engine-quota-actions button:first-child {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(124, 58, 237, 0.24);
}
.engine-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.engine-switch input { display: none; }
.engine-switch-ui {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.34);
  position: relative;
  transition: background .18s ease;
}
.engine-switch-ui::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}
.engine-switch input:checked + .engine-switch-ui {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.engine-switch input:checked + .engine-switch-ui::after {
  transform: translateX(24px);
}

body.ui-light-mode .engine-workspace {
  background: radial-gradient(circle at top, rgba(124, 58, 237, 0.10), transparent 26%), linear-gradient(180deg, #f6f5ff 0%, #eceffd 40%, #eef4fb 100%);
  color: #0f172a;
}
body.ui-light-mode .engine-top-btn,
body.ui-light-mode .engine-chip-btn,
body.ui-light-mode .engine-icon-btn,
body.ui-light-mode .engine-composer-shell,
body.ui-light-mode .engine-dock,
body.ui-light-mode .engine-auth-card {
  background: rgba(255,255,255,0.84);
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
}
body.ui-light-mode .engine-wordmark-copy span,
body.ui-light-mode .engine-selection-meta,
body.ui-light-mode .engine-auth-phrase,
body.ui-light-mode .engine-project-empty,
body.ui-light-mode .engine-conversation-bubble.assistant,
body.ui-light-mode .engine-quota-wrap strong {
  color: rgba(15, 23, 42, 0.72);
}
body.ui-light-mode .engine-project-view {
  color: #0f172a;
}
body.ui-light-mode .engine-conversation-bubble.assistant {
  background: rgba(255,255,255,0.68);
}
body.ui-light-mode .engine-composer textarea {
  color: #0f172a;
}
body.ui-light-mode .engine-composer textarea::placeholder {
  color: rgba(15, 23, 42, 0.46);
}
body.ui-light-mode .engine-brand-mark,
body.ui-light-mode .engine-hero-logo {
  color: #0f172a;
}
body.ui-light-mode .engine-code-block-highlight {
  background: #ffffff;
  color: #0f172a;
}

.engine-quota-wrap.is-premium .engine-quota-fill {
  background: linear-gradient(90deg, #7c3aed, #2563eb, #06b6d4, #7c3aed);
  background-size: 200% 100%;
  animation: engineQuotaPremium 3s linear infinite;
}
@keyframes engineQuotaPremium {
  from { background-position: 0% 50%; }
  to { background-position: 200% 50%; }
}

@media (max-width: 900px) {
  .engine-shell {
    padding: 16px 16px 22px;
  }
  .engine-topbar,
  .engine-control-row,
  .engine-composer-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  .engine-wordmark {
    justify-content: center;
  }
  .engine-dock {
    inset: 84px 16px 16px;
    width: auto;
  }
  .engine-project-view {
    max-height: none;
    min-height: 300px;
  }
}
.engine-thinking-fish-wrap {
  position: relative;
  width: 260px;
  height: 126px;
}
.engine-thinking-fish-wrap .engine-fish {
  position: absolute;
  left: 0;
  top: 18px;
  width: 176px;
  color: #111827;
  filter: drop-shadow(0 12px 22px rgba(15,23,42,.12));
}
.engine-conversation-feed {
  display: grid;
  gap: 16px;
  padding: 28px;
}
.engine-conversation-bubble {
  max-width: min(76%, 620px);
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff, #f8f5ff);
  border: 1px solid rgba(148, 163, 184, .26);
  box-shadow: 0 16px 32px rgba(15, 23, 42, .06);
}
.engine-conversation-bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, #8b5cf6, #4f46e5);
  color: #ffffff;
}
.engine-conversation-bubble.thinking {
  border-style: dashed;
}
.engine-conversation-bubble strong {
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.engine-conversation-bubble p,
.engine-conversation-bubble span {
  margin: 0;
  line-height: 1.6;
}
.engine-bubbles {
  position: relative;
  width: 260px;
  height: 126px;
}
.engine-thinking-card {
  width: auto;
  display: grid;
  gap: 12px;
  text-align: left;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}
.engine-thinking-copy strong {
  display: block;
  font-size: 1.14rem;
  color: #111827;
  letter-spacing: -.02em;
}
.engine-thinking-copy p {
  margin: 8px 0 0;
  color: #64748b;
  max-width: 28ch;
}
.engine-project-view iframe {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: none;
  background: #fff;
}
.engine-project-empty,
.engine-project-python {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #94a3b8;
  text-align: center;
}
.engine-project-python pre {
  width: min(760px, 100%);
  margin: 0;
  text-align: left;
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 22px;
  padding: 18px;
}
.engine-example-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.engine-example-chip {
  border: 1px solid rgba(148, 163, 184, .34);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f8f5ff);
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.engine-example-chip:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, .36);
  box-shadow: 0 16px 28px rgba(124, 58, 237, .10);
}
.engine-log {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  max-width: min(760px, calc(100% - 40px));
  pointer-events: none;
}
.engine-log.hidden { display: none !important; }
.engine-log-entry {
  border: 2px solid #111827;
  border-radius: 22px;
  padding: 10px 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 24px rgba(15,23,42,.06);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.engine-log-entry.assistant {
  border-color: #d8b4fe;
  background: linear-gradient(180deg, #ffffff, #faf5ff);
}
.engine-log-entry.user {
  margin-left: auto;
  max-width: 75%;
  background: #111827;
  color: #fff;
}
.engine-log-entry.thinking {
  border-style: dashed;
  background: linear-gradient(180deg, #faf5ff, #ffffff);
}
.engine-log-entry.assistant strong,
.engine-log-entry.user strong {
  display: block;
  margin-bottom: 6px;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.engine-log-entry p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}
.engine-log-meta {
  margin-top: 8px;
  color: #64748b;
  font-size: .82rem;
}

.engine-dock {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,249,255,.98));
  box-shadow: 0 26px 56px rgba(15,23,42,.16), 0 0 0 1px rgba(168,85,247,.08) inset;
  overflow: hidden;
  z-index: 4;
}
.engine-dock.hidden { display: none !important; }
.engine-dock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fff, #f8f5ff);
}
.engine-dock-head button {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
.engine-dock-body {
  overflow: auto;
  padding: 22px;
}
.engine-code-block {
  margin: 0;
  border: 1px solid rgba(99, 102, 241, .18);
  border-radius: 22px;
  background: linear-gradient(180deg, #0b1020, #11182c);
  color: #e2e8f0;
  padding: 18px;
  font-size: .86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.engine-code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.engine-syntax-tag { color: #f472b6; }
.engine-syntax-attr { color: #f59e0b; }
.engine-syntax-string { color: #60a5fa; }
.engine-syntax-keyword { color: #c084fc; }
.engine-syntax-number { color: #fb7185; }
.engine-syntax-comment { color: #94a3b8; }
.engine-output-preview.clean iframe {
  width: 100%;
  min-height: 360px;
  border: none;
  border-radius: 26px;
  background: #ffffff;
}
.engine-dock-copy,
.engine-dock-run {
  margin-top: 12px;
  border: 2px solid #111827;
  background: linear-gradient(135deg, #ffffff, #f4edff);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.engine-output-preview {
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 20px;
  background: #ffffff;
  min-height: 100%;
}
.engine-output-preview.clean {
  padding: 0;
  border: none;
  background: #fff;
}
.engine-output-preview .blm-stage {
  display: grid;
  gap: 10px;
  min-height: 420px;
  align-content: start;
}
.engine-output-preview .blm-card,
.engine-output-preview .blm-calculator,
.engine-output-preview .blm-snake {
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.engine-output-preview .blm-inline-btn {
  border: 1.5px solid #111827;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
}
.engine-output-preview input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
}
.engine-study-card {
  display: grid;
  gap: 18px;
}
.engine-study-card h4,
.engine-study-card p { margin: 0; }
.engine-study-stepper {
  display: grid;
  gap: 12px;
}
.engine-study-step {
  border: 1.5px solid #d8b4fe;
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fff, #faf5ff);
}
.engine-study-step strong {
  display: block;
  margin-bottom: 6px;
  color: #6d28d9;
}
.engine-study-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.engine-study-grid button {
  border: 1.6px solid #111827;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f4edff);
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}
.engine-study-rule {
  border: 1px dashed #94a3b8;
  border-radius: 16px;
  padding: 12px 14px;
  color: #334155;
  line-height: 1.55;
  background: #fff;
}
.engine-notebook-area {
  width: 100%;
  min-height: 420px;
  border: 1.6px solid #111827;
  border-radius: 18px;
  padding: 14px;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.engine-composer-shell {
  display: flex;
  justify-content: center;
}
.engine-composer {
  width: min(920px, 100%);
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(251,250,255,.95));
  padding: 18px 20px;
  box-shadow: 0 28px 46px rgba(15,23,42,.09), 0 0 0 1px rgba(168,85,247,.08) inset;
  backdrop-filter: blur(14px);
}
.engine-composer textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 1rem;
  min-height: 96px;
  background: transparent;
}
.engine-composer-bottom {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.engine-picker-row {
  display: flex;
  gap: 16px;
}
.engine-picker-wrap {
  position: relative;
}
.engine-diamond-btn {
  cursor: pointer;
  font-weight: 900;
  font-size: 1rem;
}
.engine-diamond-btn {
  display: grid;
  place-items: center;
}
.engine-diamond-btn::before {
  content: attr(data-label);
}
.engine-diamond-btn {
  transform: rotate(45deg);
}
.engine-diamond-btn > span,
.engine-diamond-btn-text {
  transform: rotate(-45deg);
}
.engine-diamond-btn {
  line-height: 1;
}
.engine-mini-menu {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 10px);
  min-width: 220px;
  border: 2px solid #111827;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfaff);
  box-shadow: 0 20px 40px rgba(15,23,42,.12);
  padding: 8px;
  display: grid;
  gap: 8px;
  z-index: 40;
}
.engine-mini-menu.hidden { display: none !important; }
.engine-mini-menu button {
  border: 1px solid rgba(148, 163, 184, .34);
  background: linear-gradient(135deg, #ffffff, #f8f5ff);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}
.engine-mini-menu button:hover {
  border-color: rgba(139, 92, 246, .34);
  box-shadow: 0 12px 24px rgba(124, 58, 237, .10);
}
.engine-selection-meta {
  color: #475569;
  font-weight: 700;
}
.engine-submit-btn {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(124, 58, 237, .24);
}
.engine-submit-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 22px 34px rgba(124, 58, 237, .28);
}

@media (max-width: 980px) {
  .engine-workspace {
    grid-template-columns: 1fr;
  }
  .engine-sidebar {
    border-right: none;
    border-bottom: 2px solid #111827;
  }
}

@media (max-width: 760px) {
  .engine-stage {
    padding: 12px;
  }
  .engine-canvas {
    border-radius: 26px;
    padding: 16px;
  }
  .engine-toolbar,
  .engine-composer-bottom {
    grid-template-columns: 1fr;
    display: grid;
  }
  .engine-panel-actions,
  .engine-picker-row {
    flex-wrap: wrap;
  }
  .engine-status-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .engine-dock {
    inset: 0;
    max-height: none;
    height: auto;
  }
}

/* Baluk Engine reboot */
.engine-workspace {
  background:
    radial-gradient(circle at 10% 8%, rgba(168, 85, 247, .18), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(59, 130, 246, .14), transparent 24%),
    linear-gradient(180deg, #171322 0%, #1c1829 48%, #14111e 100%);
}
.engine-sidebar {
  background: linear-gradient(180deg, rgba(20, 17, 30, .92), rgba(17, 14, 26, .94));
  border-right: 1px solid rgba(167, 139, 250, .18);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.03), 20px 0 46px rgba(0,0,0,.24);
}
.engine-back-btn,
.engine-new-chat-btn,
.engine-chat-actions button {
  border-color: rgba(167, 139, 250, .26);
  background: linear-gradient(180deg, rgba(36, 30, 53, .94), rgba(26, 22, 40, .94));
  color: #f5f3ff;
}
.engine-brand-diamond,
.engine-diamond-btn {
  border: 1px solid rgba(192, 132, 252, .44);
  background: linear-gradient(180deg, rgba(36, 29, 53, .98), rgba(20, 17, 30, .98));
  box-shadow: 0 14px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.04);
}
.engine-brand-copy strong,
.engine-diamond-btn-text,
.engine-chat-open,
.engine-project-head strong,
.engine-thinking-copy strong,
.engine-thinking-meter,
.engine-panel-btn,
.engineSelectionMeta {
  color: #faf5ff;
}
.engine-brand-copy span,
.engine-sidebar-label,
.engine-project-head p,
.engine-thinking-copy p,
.engine-selection-meta {
  color: #b7afcf;
}
.engine-chat-item {
  background: linear-gradient(180deg, rgba(28, 24, 41, .96), rgba(20, 17, 30, .96));
  border-color: rgba(167, 139, 250, .16);
  box-shadow: 0 14px 26px rgba(0,0,0,.18);
}
.engine-chat-item.active {
  background: linear-gradient(180deg, rgba(46, 37, 72, .96), rgba(26, 22, 40, .96));
  border-color: rgba(192, 132, 252, .32);
  box-shadow: 0 18px 36px rgba(124, 58, 237, .22);
}
.engine-thinking-meter,
.engine-panel-btn,
.engine-composer,
.engine-dock,
.engine-project-view,
.engine-canvas {
  border-color: rgba(167, 139, 250, .18);
}
.engine-thinking-meter {
  background: linear-gradient(180deg, rgba(34, 28, 49, .94), rgba(24, 20, 35, .96));
  box-shadow: 0 16px 32px rgba(0,0,0,.24);
}
.engine-panel-btn {
  background: linear-gradient(180deg, rgba(34, 28, 49, .94), rgba(24, 20, 35, .96));
  color: #e9ddff;
}
.engine-panel-btn.active,
.engine-submit-btn {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  box-shadow: 0 18px 36px rgba(124, 58, 237, .28);
}
.engine-canvas {
  background:
    radial-gradient(circle at top right, rgba(139, 92, 246, .12), transparent 22%),
    linear-gradient(180deg, rgba(26, 22, 40, .98), rgba(19, 16, 30, .98));
  box-shadow: 0 30px 60px rgba(0,0,0,.26);
}
.engine-project-view {
  background:
    radial-gradient(circle at 88% 12%, rgba(96, 165, 250, .12), transparent 18%),
    linear-gradient(180deg, rgba(20, 17, 30, .98), rgba(16, 13, 25, .98));
}
.engine-project-badge {
  border-color: rgba(192, 132, 252, .26);
  background: linear-gradient(180deg, rgba(36, 29, 53, .94), rgba(20, 17, 30, .94));
  color: #e9d5ff;
}
.engine-project-empty {
  color: #8f87a7;
}
.engine-conversation-feed {
  padding: 30px;
}
.engine-conversation-bubble {
  background: linear-gradient(180deg, rgba(31, 27, 46, .96), rgba(20, 17, 30, .96));
  border-color: rgba(167, 139, 250, .16);
  box-shadow: 0 18px 36px rgba(0,0,0,.18);
  color: #f5f3ff;
}
.engine-conversation-bubble.user {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.engine-conversation-bubble span {
  color: #b7afcf;
}
.engine-thinking-scene {
  inset: 34px auto auto 34px;
  width: 420px;
}
.engine-thinking-actor {
  gap: 18px;
}
.engine-thinking-fish-wrap {
  width: 320px;
  height: 150px;
}
.engine-thinking-fish-wrap .engine-fish {
  width: 210px;
  top: 28px;
  color: #f5f3ff;
  filter: drop-shadow(0 0 24px rgba(139, 92, 246, .18));
}
.engine-bubbles {
  width: 320px;
  height: 150px;
}
.engine-bubbles span {
  border-color: rgba(216, 180, 254, .32);
  background: linear-gradient(180deg, rgba(36, 29, 53, .98), rgba(20, 17, 30, .98));
  color: #f5f3ff;
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
}
@keyframes engineBubbleFloat {
  0% { transform: translate(110px, 74px) scale(.55); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translate(228px, 6px) scale(1); opacity: 0; }
}
.engine-thinking-copy {
  padding-left: 10px;
}
.engine-thinking-copy strong {
  font-size: 1.2rem;
}
.engine-thinking-copy p {
  max-width: 30ch;
}
.engine-composer {
  background: linear-gradient(180deg, rgba(24, 20, 35, .98), rgba(16, 13, 25, .98));
  box-shadow: 0 26px 50px rgba(0,0,0,.26), 0 0 0 1px rgba(167, 139, 250, .08) inset;
}
.engine-composer textarea,
.engine-selection-meta {
  color: #f5f3ff;
}
.engine-composer textarea::placeholder {
  color: #847a9d;
}
.engine-mini-menu {
  border-color: rgba(167, 139, 250, .26);
  background: linear-gradient(180deg, rgba(26, 22, 40, .98), rgba(16, 13, 25, .98));
  box-shadow: 0 24px 44px rgba(0,0,0,.28);
}
.engine-mini-menu button {
  border-color: rgba(167, 139, 250, .18);
  background: linear-gradient(180deg, rgba(36, 29, 53, .96), rgba(20, 17, 30, .96));
  color: #f5f3ff;
}
.engine-dock {
  background: linear-gradient(180deg, rgba(26, 22, 40, .99), rgba(16, 13, 25, .99));
  box-shadow: 0 30px 60px rgba(0,0,0,.30), 0 0 0 1px rgba(167, 139, 250, .08) inset;
}
.engine-dock-head {
  background: linear-gradient(180deg, rgba(32, 27, 47, .98), rgba(21, 18, 32, .98));
  border-bottom-color: rgba(167, 139, 250, .16);
  color: #faf5ff;
}
.engine-dock-head button {
  border-color: rgba(167, 139, 250, .22);
  background: linear-gradient(180deg, rgba(36, 29, 53, .96), rgba(20, 17, 30, .96));
  color: #faf5ff;
}
.engine-output-preview.clean iframe {
  background: #ffffff;
}
.engine-code-block {
  border-color: rgba(139, 92, 246, .20);
  background: linear-gradient(180deg, #090b14, #111625);
}


.thinking-bubble.thinking-test {
  border: 1px solid rgba(168, 85, 247, .45);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(34, 211, 238, .18), transparent 52%),
    radial-gradient(110% 140% at 100% 0%, rgba(250, 204, 21, .16), transparent 58%),
    radial-gradient(130% 150% at 100% 100%, rgba(239, 68, 68, .14), transparent 60%),
    linear-gradient(120deg, #f5f3ff, #ede9fe, #ecfeff, #fef9c3, #ffe4e6, #f5f3ff);
  background-size: 100% 100%, 100% 100%, 100% 100%, 320% 100%;
  box-shadow: 0 14px 30px rgba(147, 51, 234, .2), inset 0 0 0 1px rgba(255,255,255,.4);
  animation: testPulseFlow 2.2s linear infinite;
  position: relative;
  overflow: hidden;
}
.thinking-bubble.thinking-test::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.62) 48%, transparent 100%);
  transform: translateX(-120%) skewX(-18deg);
  animation: testShineSweep 2s ease-in-out infinite;
  pointer-events: none;
}
.thinking-bubble.thinking-test .thinking-head {
  color: #6d28d9;
  font-weight: 800;
}
@keyframes testPulseFlow {
  from { background-position: 0% 50%; }
  to { background-position: 220% 50%; }
}
@keyframes testShineSweep {
  0%, 26% { transform: translateX(-125%) skewX(-18deg); opacity: .1; }
  48% { opacity: .95; }
  100% { transform: translateX(125%) skewX(-18deg); opacity: .1; }
}

.test-question-card {
  background: #ffffff;
  border: 1px solid #ddd6fe;
  box-shadow: 0 8px 24px rgba(109, 40, 217, .12);
}
.test-head {
  display: inline-block;
  font-size: .84rem;
  font-weight: 800;
  color: #5b21b6;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 8px;
}
.test-question {
  color: #1f2937;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 10px;
}
.test-options {
  display: grid;
  gap: 8px;
}
.test-option-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 600;
}
.test-option-btn:hover { border-color: #a78bfa; background: #f5f3ff; }
.test-option-btn:disabled { cursor: default; opacity: .96; }
.test-option-btn.correct { border-color: #22c55e; background: #ecfdf5; color: #14532d; }
.test-option-btn.wrong { border-color: #ef4444; background: #fef2f2; color: #7f1d1d; }
.test-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  font-size: .78rem;
  background: #fff;
  flex: 0 0 auto;
}
.test-feedback {
  margin-top: 10px;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  line-height: 1.45;
}
.test-feedback.correct { background: #ecfdf5; border: 1px solid #86efac; color: #166534; }
.test-feedback.wrong { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* 2026-04 geometry + settings fixes */
.ui-settings-card {
  pointer-events: auto;
}

.ui-settings-head button {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  min-width: 36px;
  min-height: 36px;
}

.math-studio-panel {
  display: flex;
  flex-direction: column;
}

.geometry-lab {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.geometry-card {
  display: grid;
  grid-template-rows: minmax(520px, 1fr) auto;
  min-height: calc(100vh - 300px);
  align-items: stretch;
  flex: 1 1 auto;
}

.geometry-sketch {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.geo-notebook {
  flex: 1 1 auto;
  min-height: calc(100vh - 390px);
  height: 100%;
}

@media (max-width: 900px) {
  .geometry-card {
    min-height: 520px;
    grid-template-rows: minmax(420px, 1fr) auto;
  }

  .geo-notebook {
    min-height: 420px;
  }
}

/* Restore visible Math Studio geometry controls on mobile */
@media (max-width: 700px) {
  .math-studio-panel .geometry-lab {
    display: block !important;
    overflow: visible !important;
  }

  .math-studio-panel .geometry-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    max-height: 112px !important;
    overflow: auto !important;
    margin: 8px 0 10px !important;
    padding-bottom: 2px;
  }

  .math-studio-panel .geo-btn {
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 28px;
    padding: 5px 8px;
    font-size: .72rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .math-studio-panel .geometry-card {
    display: grid !important;
    grid-template-rows: minmax(300px, 1fr) auto !important;
    gap: 8px !important;
    min-height: 0 !important;
  }

  .math-studio-panel .geometry-sketch {
    display: flex !important;
    min-height: 300px !important;
    overflow: visible !important;
  }

  .math-studio-panel .geo-notebook {
    min-height: 300px !important;
    height: auto !important;
  }

  .math-studio-panel .math-studio-input.notebook-typing {
    height: 210px !important;
    min-height: 180px !important;
  }

  .math-studio-panel .geometry-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    position: relative;
    z-index: 3;
  }

  .math-studio-panel #solveGeometryBtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: 100% !important;
    margin-top: 0 !important;
  }
}


/* Baluk Math drawer settings page */
.math-drawer-view {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.math-drawer-content.settings-open .math-drawer-main-view {
  display: none;
}
.math-drawer-settings-view.hidden {
  display: none !important;
}
.math-drawer-content.settings-open .math-drawer-settings-view {
  display: flex !important;
  animation: mathSettingsIn .18s ease both;
}
.math-drawer-settings-open {
  width: 100%;
  margin-top: 8px;
  justify-content: flex-start;
  gap: 9px;
  border: 1px solid rgba(124, 58, 237, .22);
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  color: #312e81;
  box-shadow: 0 12px 26px rgba(124, 58, 237, .10);
}
.math-drawer-settings-open small {
  margin-left: auto;
  color: #7c3aed;
  font-size: .68rem;
  font-weight: 900;
}
.math-settings-back {
  align-self: flex-start;
  border: 1px solid #dbeafe;
  background: #fff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 7px 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(59, 130, 246, .12);
}
.math-settings-hero {
  padding: 14px;
  border-radius: 18px;
  background: radial-gradient(circle at 15% 0%, rgba(168, 85, 247, .24), transparent 36%), linear-gradient(135deg, #eef2ff, #fdf4ff);
  border: 1px solid rgba(124, 58, 237, .20);
  box-shadow: 0 16px 34px rgba(99, 102, 241, .14);
}
.math-settings-chip {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(124, 58, 237, .12);
  color: #6d28d9;
  font-size: .68rem;
  font-weight: 900;
}
.math-settings-hero h4 {
  margin: 8px 0 4px;
  font-size: 1.05rem;
  color: #1e1b4b;
}
.math-settings-hero p {
  margin: 0;
  color: #475569;
  font-size: .78rem;
  line-height: 1.45;
}
.math-switch-card {
  position: relative;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, .88);
  border-radius: 18px;
}
.math-setting-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.math-switch-card input {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: auto;
  width: 48px;
  height: 28px;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.math-ios-switch {
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  padding: 3px;
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, .18);
  transition: background .2s ease, box-shadow .2s ease;
  pointer-events: none;
}
.thinking-bubble.thinking-complete.thinking-test {
  animation: none;
}
.thinking-bubble.thinking-complete.thinking-test::after {
  animation: none;
  opacity: .2;
}
.math-ios-switch span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, .25);
  transition: transform .2s ease;
}
.math-switch-card input:checked + .math-ios-switch {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .12), inset 0 1px 4px rgba(255, 255, 255, .18);
}
.math-switch-card input:checked + .math-ios-switch span {
  transform: translateX(20px);
}
body.ui-dark-mode .math-drawer-settings-open {
  background: linear-gradient(135deg, rgba(88, 28, 135, .72), rgba(30, 41, 59, .92));
  border-color: rgba(168, 85, 247, .36);
  color: #f5f3ff;
}
body.ui-dark-mode .math-drawer-settings-open small {
  color: #d8b4fe;
}
body.ui-dark-mode .math-settings-back {
  background: rgba(15, 23, 42, .82);
  border-color: rgba(147, 197, 253, .30);
  color: #dbeafe;
}
body.ui-dark-mode .math-settings-hero {
  background: radial-gradient(circle at 15% 0%, rgba(168, 85, 247, .25), transparent 38%), linear-gradient(135deg, rgba(30, 41, 59, .96), rgba(49, 46, 129, .72));
  border-color: rgba(168, 85, 247, .28);
}
body.ui-dark-mode .math-settings-chip {
  background: rgba(168, 85, 247, .18);
  color: #e9d5ff;
}
body.ui-dark-mode .math-settings-hero h4 {
  color: #f8fafc;
}
body.ui-dark-mode .math-settings-hero p {
  color: #bfdbfe;
}
body.ui-dark-mode .math-switch-card {
  background: rgba(15, 23, 42, .76);
  border-color: rgba(168, 85, 247, .28);
}
@keyframes mathSettingsIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}


/* Baluk Math confirm modal */
.math-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}
.math-confirm-card {
  width: min(420px, 94vw);
  border-radius: 24px;
  padding: 18px;
  border: 1px solid rgba(139, 92, 246, .28);
  background: radial-gradient(circle at 12% 0%, rgba(168, 85, 247, .24), transparent 34%), linear-gradient(180deg, #ffffff, #f5f3ff);
  box-shadow: 0 24px 70px rgba(76, 29, 149, .28);
  color: #1f1646;
}
.math-confirm-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(124, 58, 237, .12);
  color: #6d28d9;
  font-size: .72rem;
  font-weight: 950;
}
.math-confirm-card h3 {
  margin: 10px 0 7px;
  font-size: 1.15rem;
}
.math-confirm-card p {
  margin: 0;
  color: #475569;
  font-size: .9rem;
  line-height: 1.48;
}
.math-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.math-confirm-actions button {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 900;
  cursor: pointer;
}
.math-confirm-cancel {
  background: rgba(148, 163, 184, .18);
  color: #334155;
}
.menu-icon.baluk-ui-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.math-confirm-ok {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  box-shadow: 0 10px 24px rgba(109, 40, 217, .24);
}
body.ui-dark-mode .math-confirm-overlay {
  background: rgba(2, 6, 23, .62);
}
body.ui-dark-mode .math-confirm-card {
  background: radial-gradient(circle at 12% 0%, rgba(168, 85, 247, .22), transparent 36%), linear-gradient(180deg, #111827, #17112a);
  color: #f8fafc;
  border-color: rgba(168, 85, 247, .34);
}
body.ui-dark-mode .math-confirm-card p {
  color: #cbd5e1;
}
body.ui-dark-mode .math-confirm-cancel {
  background: rgba(148, 163, 184, .16);
  color: #e2e8f0;
}

/* Baluk unified SVG icon pass */
.baluk-line-icon {
  width: 1em;
  height: 1em;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-inline-icon.baluk-line-icon,
.menu-icon.baluk-line-icon {
  width: 18px;
  height: 18px;
}
.mode-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.mode-icon .mode-svg {
  width: 18px;
  height: 18px;
}
.thinking-mode-svg {
  width: 14px;
  height: 14px;
}
.thinking-option-svg {
  width: 20px;
  height: 20px;
}
.voice-action-svg {
  width: 24px;
  height: 24px;
  margin: auto;
}
.chat-list-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}
.drawer-chat-section {
  overflow-x: hidden;
  overflow-y: auto;
}
.chat-list {
  width: 100%;
  min-width: 0;
  overflow: visible;
}
.chat-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.chat-list-item:has(.chat-item-menu:not(.hidden)) {
  position: relative;
  z-index: 20;
}
.chat-open-btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.chat-open-btn span {
  min-width: 0;
  max-width: 20ch;
}
.chat-item-menu-wrap {
  min-width: 30px;
  position: relative;
  z-index: 2;
}
.chat-item-menu {
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 148px;
  max-width: min(210px, calc(100vw - 46px));
  z-index: 30;
  overflow: visible;
}
.chat-item-menu button {
  width: 100%;
  white-space: nowrap;
}
.math-note-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.math-note-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.math-note-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item {
  padding: 10px 12px;
  gap: 8px;
}
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item::before,
.side-drawer.math-drawer-mode .math-drawer-notes-list .math-note-item::after {
  display: none;
}
body.ui-dark-mode .baluk-line-icon {
  color: inherit;
}

/* Final SVG alignment and Math-mode header mark */
#modelToggle {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.math-model-emblem {
  display: none;
  position: relative;
  width: 75px;
  height: 48px;
  place-items: center;
  color: #0572ad;
  filter: drop-shadow(0 3px 6px rgba(2,112,173,.18));
  pointer-events: none;
}
.math-model-emblem svg {
  width: 75px;
  height: 33px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.app.math-mode .math-model-emblem {
  display: grid;
}
.app.math-mode #modelToggle {
  width: 75px;
  min-width: 75px;
  height: 48px;
  justify-content: center;
}
.app.math-mode #modelToggle .fish-logo.small {
  display: none;
}
body.ui-dark-mode .app.math-mode .math-model-emblem {
  color: #7dd3fc;
  filter: drop-shadow(0 3px 7px rgba(14,165,233,.3));
}
.thinking-cog-svg {
  width: 26px;
  height: 26px;
  color: #5b21b6;
  animation: spinCog 1.35s linear infinite;
}
.thinking-bubble.thinking-complete .thinking-cog-svg { animation: none; }
body.ui-dark-mode .thinking-cog-svg {
  color: #c4b5fd;
}
.composer-thinking-picker .thinking-mode-picker {
  gap: 6px;
}
.composer-thinking-picker .thinking-mode-icon {
  width: 16px;
  min-width: 16px;
  margin-right: 1px;
}
body.ui-dark-mode .side-drawer.math-drawer-mode .math-drawer-new-note {
  color: #e0f2fe;
  border-color: rgba(56,189,248,.62);
  background: linear-gradient(135deg, rgba(8,47,73,.96), rgba(12,74,110,.88));
  box-shadow: 0 6px 16px rgba(2,132,199,.2), inset 0 1px 0 rgba(255,255,255,.07);
}
body.ui-dark-mode .side-drawer.math-drawer-mode .math-drawer-new-note:hover,
body.ui-dark-mode .side-drawer.math-drawer-mode .math-drawer-new-note:focus-visible {
  color: #fff;
  border-color: #7dd3fc;
  background: linear-gradient(135deg, rgba(3,105,161,.98), rgba(14,116,144,.94));
}
@media (max-width: 700px) {
  .math-model-emblem {
    width: 49px;
    height: 44px;
  }
  .math-model-emblem svg {
    width: 49px;
    height: 22px;
  }
  .app.math-mode #modelToggle {
    width: 52px;
    min-width: 52px;
    height: 46px;
  }
}

/* Voice experience 2.0 — the original voice UI remains intact behind the appearance switch. */
.voice-setting-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-appearance-setting {
  align-items: flex-start;
  flex-wrap: wrap;
}
.voice-appearance-setting .voice-setting-heading { width: 100%; }
.voice-setting-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: #6d28d9;
  background: rgba(139, 92, 246, .12);
  border: 1px solid rgba(139, 92, 246, .22);
  font-size: .68rem;
  font-weight: 900;
}
.voice-appearance-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding-top: 12px;
  cursor: pointer;
}
.voice-appearance-toggle-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.voice-appearance-toggle-copy strong { font-size: .9rem; }
.voice-appearance-toggle-copy small {
  color: #64748b;
  font-size: .76rem;
  line-height: 1.35;
}
.voice-appearance-toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.voice-ios-switch {
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: inset 0 1px 4px rgba(15,23,42,.18);
  transition: background .2s ease, box-shadow .2s ease;
}
.voice-ios-switch span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(15,23,42,.24);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.voice-appearance-toggle-row input:checked + .voice-ios-switch {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 0 0 4px rgba(139,92,246,.12), inset 0 1px 4px rgba(255,255,255,.18);
}
.voice-appearance-toggle-row input:checked + .voice-ios-switch span { transform: translateX(20px); }
body.ui-dark-mode .voice-appearance-toggle-copy small { color: #94a3b8; }
body.ui-dark-mode .voice-setting-badge {
  color: #ddd6fe;
  background: rgba(139, 92, 246, .2);
  border-color: rgba(196, 181, 253, .2);
}

.voice-modern-stage { display: none; }
.voice-mode-panel.voice-appearance-modern {
  --voice-level: 0;
  --voice-blue: 0;
  --particle-reactive-boost: 1;
  --voice-center-y: 45%;
  background: #080014;
}
.voice-mode-panel.is-listening,
.voice-mode-panel.is-speaking {
  --particle-reactive-boost: 1.18;
}
.voice-mode-panel.voice-appearance-modern .voice-mode-shell {
  display: block;
  padding: 0;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 48%, rgba(91, 33, 182, .24), transparent 28%),
    radial-gradient(circle at 17% 55%, rgba(126, 34, 206, .18), transparent 32%),
    radial-gradient(circle at 86% 36%, rgba(49, 46, 129, .18), transparent 30%),
    linear-gradient(135deg, #080015 0%, #140025 46%, #080014 100%);
}
.voice-mode-panel.voice-appearance-modern .voice-mode-shell::before,
.voice-mode-panel.voice-appearance-modern .voice-mode-shell::after {
  content: "";
  position: absolute;
  width: 48vw;
  height: 48vw;
  min-width: 400px;
  min-height: 400px;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: .2;
}
.voice-mode-panel.voice-appearance-modern .voice-mode-shell::before {
  left: -20vw;
  top: 24%;
  background: #7c3aed;
}
.voice-mode-panel.voice-appearance-modern .voice-mode-shell::after {
  right: -24vw;
  top: 8%;
  background: color-mix(in srgb, #4f46e5 calc(100% - var(--voice-blue) * 35%), #0ea5e9);
}
.voice-mode-panel.voice-appearance-modern .voice-modern-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  padding: 0;
  color: #fff;
}
.voice-mode-panel.voice-appearance-modern .voice-mode-core,
.voice-mode-panel.voice-appearance-modern > .voice-mode-status,
.voice-mode-panel.voice-appearance-modern .voice-mode-shell > .voice-mode-status {
  display: none;
}
.voice-modern-core-wrap {
  position: absolute;
  left: 50%;
  top: var(--voice-center-y);
  z-index: 4;
  width: clamp(158px, 14vw, 204px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: drop-shadow(0 0 36px rgba(168, 85, 247, .5));
  transform: translate(-50%, -50%);
}
.voice-modern-core {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.5);
  background:
    radial-gradient(circle at 31% 24%, rgba(255,255,255,.95) 0 2%, rgba(255,255,255,.35) 9%, transparent 22%),
    radial-gradient(circle at 50% 62%, #a855f7 0%, #7c3aed 42%, #3b0764 100%);
  box-shadow:
    inset 0 0 28px rgba(255,255,255,.3),
    inset -20px -28px 38px rgba(49, 0, 85, .34),
    0 0 0 8px rgba(139,92,246,.08),
    0 0 42px rgba(168,85,247,.62);
  transform: scale(calc(1 + var(--voice-level) * .025));
  transition: transform 90ms linear, filter .35s ease;
}
.voice-core-shine {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(145deg, rgba(255,255,255,.14), transparent 42%);
  pointer-events: none;
}
.voice-modern-logo {
  width: 70%;
  color: rgba(255,255,255,.94);
  filter: drop-shadow(0 0 12px rgba(255,255,255,.38));
  transform: scale(calc(1 + var(--voice-level) * .045));
  transition: transform 90ms linear;
}
.voice-orbit-haze {
  position: absolute;
  left: 50%;
  top: var(--voice-center-y);
  width: min(54vw, 610px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(168,85,247,.12) 0%, rgba(124,58,237,.055) 25%, transparent 64%);
  box-shadow: none;
  pointer-events: none;
}
.voice-particle-field {
  position: absolute;
  left: 50%;
  top: var(--voice-center-y);
  width: min(54vw, 610px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}
.voice-particle {
  --particle-scale: calc(.92 + var(--voice-level) * .62 * var(--particle-reactive-boost));
  position: absolute;
  left: calc(var(--particle-x) * 1%);
  top: calc(var(--particle-y) * 1%);
  width: calc(var(--particle-size) * 1px);
  height: calc(var(--particle-size) * 1px);
  border-radius: 999px;
  background: hsl(calc(var(--particle-hue) + var(--voice-blue) * 35) 96% 62%);
  box-shadow: 0 0 calc(5px + var(--voice-level) * 12px * var(--particle-reactive-boost)) currentColor;
  color: hsl(calc(var(--particle-hue) + var(--voice-blue) * 35) 96% 62%);
  opacity: calc(.64 + var(--voice-level) * .34);
  transform:
    translate(
      calc(-50% + var(--particle-dir-x) * var(--particle-drift) * var(--voice-level) * .55px * var(--particle-reactive-boost)),
      calc(-50% + var(--particle-dir-y) * var(--particle-drift) * var(--voice-level) * .42px * var(--particle-reactive-boost))
    )
    scale(var(--particle-scale));
  transition: opacity .12s linear, background .6s ease, transform .11s linear;
}
.voice-mode-panel.is-thinking .voice-particle,
.voice-mode-panel.is-web-thinking .voice-particle {
  animation: voiceParticleThink calc(1.55s + var(--particle-delay) * .055s) cubic-bezier(.55,.05,.34,1) infinite;
  animation-delay: calc(var(--particle-delay) * -.09s);
}
.voice-mode-panel.is-speaking .voice-particle {
  animation: none;
}
@keyframes voiceParticleThink {
  0% { transform: translate(-50%, -50%) rotate(0) scale(.72); }
  34% { transform: translate(calc(-50% + var(--particle-drift) * 1px), calc(-50% - 13px)) rotate(95deg) scale(1.28); }
  67% { transform: translate(calc(-50% - var(--particle-drift) * .65px), calc(-50% + 8px)) rotate(220deg) scale(.9); }
  100% { transform: translate(-50%, -50%) rotate(360deg) scale(.72); }
}
.voice-modern-copy {
  position: absolute;
  left: 50%;
  top: calc(var(--voice-center-y) + clamp(148px, 20vh, 170px));
  z-index: 4;
  width: min(90vw, 620px);
  text-align: center;
  margin: 0;
  transform: translateX(-50%);
}
.voice-modern-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1.1;
  letter-spacing: -.025em;
  text-shadow: 0 0 20px rgba(196,181,253,.45);
}
.voice-modern-copy p {
  margin: 10px 0 0;
  color: #c4b5fd;
  font-size: clamp(.94rem, 1.4vw, 1.12rem);
  font-weight: 650;
  transition: color .35s ease;
}
.voice-waveform {
  position: absolute;
  left: 50%;
  bottom: clamp(45px, 8vh, 78px);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 126px;
  height: 54px;
  margin: 0;
  transform: translateX(-50%);
}
.voice-waveform > span {
  --bar-live: 0;
  width: 6px;
  height: calc(var(--bar-rest) * 1px + var(--bar-live) * 24px);
  border-radius: 999px;
  background: linear-gradient(180deg, #c084fc, #8b5cf6);
  box-shadow: 0 0 12px rgba(168,85,247,.7);
  transition: height 82ms linear, transform .48s cubic-bezier(.6,0,.2,1), opacity .28s ease;
}
.voice-waveform > span:nth-child(1) { --bar-rest: 4; --merge-x: 39px; --line-x: 21px; }
.voice-waveform > span:nth-child(2) { --bar-rest: 7; --merge-x: 26px; --line-x: 14px; }
.voice-waveform > span:nth-child(3) { --bar-rest: 12; --merge-x: 13px; --line-x: 7px; }
.voice-waveform > span:nth-child(4) { --bar-rest: 25; --merge-x: 0px; --line-x: 0px; }
.voice-waveform > span:nth-child(5) { --bar-rest: 12; --merge-x: -13px; --line-x: -7px; }
.voice-waveform > span:nth-child(6) { --bar-rest: 7; --merge-x: -26px; --line-x: -14px; }
.voice-waveform > span:nth-child(7) { --bar-rest: 4; --merge-x: -39px; --line-x: -21px; }
.voice-loader-orbit,
.voice-web-loader-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.voice-mode-panel.is-thinking .voice-waveform > span {
  animation: voiceBarsGather 1.06s cubic-bezier(.68,0,.22,1) forwards;
}
.voice-mode-panel.is-web-thinking .voice-waveform > span {
  animation: voiceBarsMerge .64s cubic-bezier(.7,0,.25,1) forwards;
}
@keyframes voiceBarsGather {
  0% { opacity: 1; height: calc(var(--bar-rest) * 1px); transform: translateX(0) scaleX(1) scaleY(1); }
  34% { opacity: 1; transform: translateX(calc(var(--line-x) * .62)) scaleX(1.18) scaleY(.56); }
  62%, 78% {
    opacity: 1;
    height: 4px;
    transform: translateX(var(--line-x)) scaleX(2.35) scaleY(1);
    box-shadow: 0 0 15px rgba(192,132,252,.92);
  }
  100% { opacity: 0; height: 4px; transform: translateX(var(--line-x)) scaleX(.18) scaleY(1); }
}
@keyframes voiceBarsMerge {
  0% { opacity: 1; transform: translateX(0) scaleY(1); }
  48% { opacity: 1; transform: translateX(var(--merge-x)) scaleY(.12); }
  68%, 100% { opacity: 0; transform: translateX(var(--merge-x)) scaleY(.08); }
}
.voice-mode-panel.is-thinking .voice-loader-orbit {
  width: 42px;
  height: 42px;
  opacity: 1;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 20px rgba(168,85,247,.55);
  animation: voiceLoaderMorph 1.12s cubic-bezier(.64,0,.2,1) both;
}
.voice-mode-panel.is-thinking .voice-loader-orbit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(196,181,253,.18);
  border-top-color: #f0abfc;
  border-right-color: #a855f7;
  border-bottom-color: #6d28d9;
  opacity: 0;
  box-shadow: inset 0 0 8px rgba(216,180,254,.18), 0 0 14px rgba(168,85,247,.56);
  animation: voiceLoaderSpin .82s linear 1.05s infinite;
}
@keyframes voiceLoaderMorph {
  0%, 43% { width: 8px; height: 4px; opacity: 0; border-radius: 999px; background: #c084fc; transform: translate(-50%, -50%) scaleX(.12); }
  58%, 68% { width: 50px; height: 4px; opacity: 1; border-radius: 999px; background: linear-gradient(90deg, #7c3aed, #e879f9, #7c3aed); transform: translate(-50%, -50%) scaleX(1); }
  80% { width: 48px; height: 17px; opacity: 1; border-radius: 48%; background: rgba(168,85,247,.72); transform: translate(-50%, -50%) scale(.96, 1.08); }
  92% { width: 39px; height: 45px; opacity: 1; border-radius: 50%; background: rgba(168,85,247,.12); transform: translate(-50%, -50%) scale(1.08, .94); }
  100% { width: 42px; height: 42px; opacity: 1; border-radius: 50%; background: transparent; transform: translate(-50%, -50%) scale(1); }
}
@keyframes voiceLoaderSpin {
  0% { opacity: 1; transform: rotate(0deg) scale(.96); }
  50% { opacity: 1; transform: rotate(180deg) scale(1.08); }
  100% { opacity: 1; transform: rotate(360deg) scale(.96); }
}
.voice-web-orbit-badge {
  position: absolute;
  right: -4%;
  bottom: 5%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(125,211,252,.75);
  background: rgba(8, 47, 73, .84);
  box-shadow: 0 0 18px rgba(56,189,248,.68);
  opacity: 0;
  transform: translateY(8px) scale(.75);
  transition: opacity .35s ease, transform .35s ease;
}
.voice-web-globe-lines,
.voice-web-loader-mark {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid #bae6fd;
}
.voice-web-globe-lines::before,
.voice-web-globe-lines::after,
.voice-web-loader-mark::before,
.voice-web-loader-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.voice-web-globe-lines::before,
.voice-web-loader-mark::before {
  width: 6px;
  height: 17px;
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
  border-radius: 50%;
}
.voice-web-globe-lines::after,
.voice-web-loader-mark::after {
  width: 17px;
  height: 6px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  border-radius: 50%;
}
.voice-mode-panel.is-web-active { --voice-blue: 1; }
.voice-mode-panel.is-web-active .voice-modern-copy p { color: #7dd3fc; }
.voice-mode-panel.is-web-active .voice-web-orbit-badge {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.voice-mode-panel.is-web-thinking .voice-web-loader-mark {
  display: block;
  opacity: 1;
  color: #7dd3fc;
  border-color: #38bdf8;
  box-shadow: 0 0 18px rgba(14,165,233,.65);
  animation: voiceWebLoaderArrive .7s ease .32s both, voiceWebLoaderSpin 1.8s linear 1s infinite;
}
@keyframes voiceWebLoaderArrive {
  from { opacity: 0; transform: translate(-50%, -50%) scaleX(2) scaleY(.08); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes voiceWebLoaderSpin {
  0% { transform: translate(-50%, -50%) rotate(0) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.12); }
  100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}
.voice-mode-panel.is-speaking .voice-modern-core {
  animation: voiceCoreSpeak .82s ease-in-out infinite;
}
@keyframes voiceCoreSpeak {
  0%,100% { transform: perspective(600px) translateZ(0) scale(.98); }
  48% { transform: perspective(600px) translateZ(34px) scale(1.065); }
}
.voice-mode-panel.voice-appearance-modern .voice-mode-actions {
  position: fixed;
  inset: auto 0 clamp(28px, 6vh, 58px);
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
}
.voice-mode-panel.voice-appearance-modern .voice-mute-btn,
.voice-mode-panel.voice-appearance-modern .voice-web-btn,
.voice-mode-panel.voice-appearance-modern .voice-close-btn {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255,255,255,.34);
  color: #fff;
  background: rgba(24, 8, 46, .62);
  backdrop-filter: blur(16px);
  box-shadow: 0 0 0 5px rgba(139,92,246,.08), 0 0 24px rgba(139,92,246,.35);
  transition: transform .2s ease, border-color .25s ease, box-shadow .25s ease;
}
.voice-mode-panel.voice-appearance-modern .voice-mute-btn { justify-self: start; margin-left: clamp(28px, 5vw, 72px); }
.voice-mode-panel.voice-appearance-modern .voice-web-btn { justify-self: end; margin-right: clamp(28px, 5vw, 72px); }
.voice-mode-panel.voice-appearance-modern .voice-close-btn {
  position: fixed;
  top: clamp(22px, 4vh, 38px);
  right: clamp(24px, 4vw, 48px);
  margin: 0;
}
.voice-mode-panel.voice-appearance-modern .voice-mode-actions button:hover { transform: scale(1.07); }
.voice-mode-panel.voice-appearance-modern .voice-mute-btn {
  border-color: rgba(251,113,133,.9);
  box-shadow: 0 0 0 5px rgba(244,63,94,.08), 0 0 24px rgba(244,63,94,.35);
}
.voice-mode-panel.voice-appearance-modern .voice-mute-btn.muted { background: rgba(100,116,139,.68); }
.voice-mode-panel.voice-appearance-modern .voice-web-btn.active {
  border-color: #38bdf8;
  background: rgba(7,89,133,.66);
  box-shadow: 0 0 0 5px rgba(14,165,233,.1), 0 0 28px rgba(14,165,233,.58);
}

@media (max-width: 700px) {
  .voice-mode-panel.voice-appearance-modern { --voice-center-y: 44%; }
  .voice-mode-panel.voice-appearance-modern .voice-modern-stage { padding: 0; }
  .voice-particle-field { width: min(108vw, 500px); }
  .voice-orbit-haze { width: min(102vw, 480px); }
  .voice-modern-core-wrap {
    width: clamp(142px, 42vw, 176px);
  }
  .voice-modern-copy {
    top: calc(var(--voice-center-y) + 116px);
    transform: translateX(-50%);
  }
  .voice-waveform { bottom: 74px; }
  .voice-mode-panel.voice-appearance-modern .voice-mode-actions { bottom: 24px; }
  .voice-mode-panel.voice-appearance-modern .voice-mute-btn,
  .voice-mode-panel.voice-appearance-modern .voice-web-btn,
  .voice-mode-panel.voice-appearance-modern .voice-close-btn { width: 54px; height: 54px; }
  .voice-mode-panel.voice-appearance-modern .voice-mute-btn { margin-left: 20px; }
  .voice-mode-panel.voice-appearance-modern .voice-web-btn { margin-right: 20px; }
  .voice-mode-panel.voice-appearance-modern .voice-close-btn { top: 18px; right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-mode-panel .voice-particle,
  .voice-mode-panel .voice-waveform > span,
  .voice-mode-panel .voice-modern-core-wrap,
  .voice-mode-panel .voice-modern-core,
  .voice-mode-panel .voice-loader-orbit,
  .voice-mode-panel .voice-web-loader-mark { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* TV mode: enabled by script only for genuinely large browser viewports. */
body.tv-mode {
  font-size: 18px;
  --tv-content-width: min(1380px, 88vw);
}
body.tv-mode .app { height: 100vh; }
body.tv-mode .topbar {
  height: 92px;
  padding: 14px clamp(28px, 3.2vw, 70px);
}
body.tv-mode .fish-logo.small { width: 96px; }
body.tv-mode .model-chip-wrap { gap: 12px; }
body.tv-mode .model-badge {
  padding: 7px 14px;
  font-size: 1rem;
}
body.tv-mode .brand-mode-switcher {
  width: 226px;
  height: 54px;
}
body.tv-mode .brand-mode-trigger { font-size: 2.3rem; }
body.tv-mode .brand-mode-menu {
  width: 226px;
  height: 48px;
}
body.tv-mode .brand-mode-option strong { font-size: .88rem; }
body.tv-mode .brand-mode-icon {
  width: 29px;
  height: 29px;
}
body.tv-mode .right-tools { gap: 12px; }
body.tv-mode .memory-btn,
body.tv-mode .clear-btn,
body.tv-mode .guest-login-btn {
  min-height: 48px;
  padding: 11px 16px;
  font-size: 1rem;
}
body.tv-mode .chat-area {
  padding: 28px clamp(54px, 5vw, 112px);
  scroll-padding-block: 32px;
}
body.tv-mode .splash {
  padding-bottom: 5vh;
  transform: translateY(-10px);
}
body.tv-mode .fish-logo.big { width: min(660px, 42vw); }
body.tv-mode .splash h1 { font-size: clamp(4.8rem, 5vw, 6.6rem); }
body.tv-mode .splash-prompt {
  margin-top: 18px;
  font-size: clamp(1.35rem, 1.45vw, 1.75rem);
}
body.tv-mode .chat-log {
  max-width: 1380px;
  gap: 18px;
}
body.tv-mode .msg {
  max-width: min(68%, 1040px);
  padding: 15px 20px;
  border-radius: 17px;
  font-size: 1.14rem;
  line-height: 1.6;
}
body.tv-mode .input-shell {
  grid-template-columns: auto minmax(520px, 1180px) auto;
  justify-content: center;
  gap: 16px;
  padding: 17px clamp(54px, 5vw, 112px) 14px;
}
body.tv-mode #userInput {
  min-height: 62px;
  border-radius: 20px;
  padding: 16px 19px;
  font-size: 1.18rem;
}
body.tv-mode .plus-btn,
body.tv-mode .input-shell button[type="submit"] {
  width: 60px;
  height: 60px;
}
body.tv-mode .input-shell button svg { width: 26px; height: 26px; }
body.tv-mode .plus-menu {
  min-width: 230px;
  font-size: 1rem;
}
body.tv-mode .model-menu {
  top: 68px;
  min-width: 220px;
  padding: 9px;
}
body.tv-mode .model-option {
  min-height: 48px;
  padding: 12px 14px;
  font-size: 1.05rem;
}
body.tv-mode .composer-safety-info {
  width: var(--tv-content-width);
  margin-inline: auto;
}
body.tv-mode .composer-safety-info summary { font-size: .86rem; }
body.tv-mode .side-drawer {
  top: 92px;
  width: min(460px, 30vw);
  height: calc(100vh - 92px);
  padding: 20px;
}
body.tv-mode .drawer-btn,
body.tv-mode .chat-list-item { min-height: 52px; font-size: 1rem; }
body.tv-mode .memory-panel {
  top: 106px;
  right: 34px;
  width: min(430px, 30vw);
  font-size: 1rem;
}
body.tv-mode .intro-card {
  width: min(940px, 72vw);
  padding: 54px 42px 46px;
  border-radius: 34px;
}
body.tv-mode .intro-fish { width: min(390px, 32vw); }
body.tv-mode .intro-card h1 { font-size: clamp(4.8rem, 5vw, 6.4rem); }
body.tv-mode .intro-kicker { font-size: 1.3rem; }
body.tv-mode .intro-copy { max-width: 760px; font-size: 1.08rem; }
body.tv-mode .enter-app-btn {
  min-height: 58px;
  padding: 15px 28px;
  font-size: 1.14rem;
}
body.tv-mode .voice-modern-core-wrap { width: clamp(230px, 18vw, 320px); }
body.tv-mode .voice-particle-field { width: min(70vw, 1040px); }
body.tv-mode .voice-orbit-haze { width: min(65vw, 960px); }
body.tv-mode .voice-modern-copy h2 { font-size: clamp(2rem, 2.3vw, 3rem); }
body.tv-mode .voice-modern-copy p { font-size: clamp(1.05rem, 1.15vw, 1.4rem); }
body.tv-mode .voice-waveform { transform: translateX(-50%) scale(1.18); }
body.tv-mode .voice-mode-panel.voice-appearance-modern .voice-mute-btn,
body.tv-mode .voice-mode-panel.voice-appearance-modern .voice-web-btn,
body.tv-mode .voice-mode-panel.voice-appearance-modern .voice-close-btn {
  width: 76px;
  height: 76px;
  font-size: 1.25rem;
}
body.tv-mode :is(button, a[href], input, textarea, summary, [tabindex]):focus-visible {
  outline: 4px solid #c084fc !important;
  outline-offset: 5px;
  box-shadow: 0 0 0 8px rgba(126, 34, 206, .22), 0 0 28px rgba(168, 85, 247, .58) !important;
  position: relative;
  z-index: 120;
}

@media (prefers-reduced-motion: reduce) {
  body.tv-mode :is(button, a[href], input, textarea, summary, [tabindex]) { scroll-behavior: auto; }
}

/* Polished desktop composer. Mobile (700px and below) deliberately keeps its layout. */
@keyframes balukComposerArrive {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes balukComposerLight {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes balukControlBreathe {
  0%, 100% { box-shadow: 0 8px 22px rgba(91,33,182,.13), inset 0 1px 0 rgba(255,255,255,.9); }
  50% { box-shadow: 0 10px 26px rgba(124,58,237,.2), 0 0 0 3px rgba(139,92,246,.055), inset 0 1px 0 rgba(255,255,255,.95); }
}

@media (min-width: 701px) {
  .input-shell {
    width: min(900px, calc(100% - 40px));
    margin: 0 auto 8px;
    grid-template-columns: 44px minmax(0, 1fr) 52px;
    gap: 10px;
    padding: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    animation: balukComposerArrive .55s cubic-bezier(.2,.85,.25,1);
    transition: none;
  }
  .input-shell:hover {
    border-color: transparent;
    box-shadow: none;
  }
  .input-shell:focus-within {
    transform: none;
    border-color: transparent;
    box-shadow: none;
  }
  .input-web-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
  }
  #userInput {
    min-height: 48px;
    padding: 12px 19px;
    border: 1px solid rgba(100,116,139,.2);
    border-radius: 999px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 11px 30px rgba(30,24,56,.1), 0 3px 10px rgba(124,58,237,.055), inset 0 1px 0 rgba(255,255,255,.96);
    backdrop-filter: blur(18px) saturate(1.15);
    transition: transform .22s ease, background .22s ease, border-color .22s ease, box-shadow .24s ease;
  }
  #userInput:hover {
    border-color: rgba(124,58,237,.3);
    background: rgba(255,255,255,.96);
    box-shadow: 0 14px 34px rgba(30,24,56,.12), 0 5px 15px rgba(124,58,237,.08), inset 0 1px 0 #fff;
  }
  #userInput:focus {
    transform: translateY(-1px);
    border-color: rgba(124,58,237,.5);
    background: rgba(255,255,255,.98);
    box-shadow: 0 16px 38px rgba(30,24,56,.14), 0 0 0 4px rgba(139,92,246,.085), 0 6px 19px rgba(124,58,237,.1), inset 0 1px 0 #fff;
  }
  .plus-btn,
  .input-shell button[type="submit"] {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(124,58,237,.28);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(239,233,255,.9));
    color: #6d28d9;
    box-shadow: 0 8px 22px rgba(91,33,182,.13), inset 0 1px 0 rgba(255,255,255,.9);
    animation: balukControlBreathe 4.8s ease-in-out infinite;
    transition: transform .2s cubic-bezier(.2,.8,.2,1), border-color .2s ease, box-shadow .24s ease, filter .2s ease;
  }
  .plus-btn:hover,
  .input-shell button[type="submit"]:hover {
    transform: translateY(-2px) scale(1.035);
    border-color: rgba(124,58,237,.5);
    box-shadow: 0 13px 28px rgba(91,33,182,.2), 0 0 0 4px rgba(139,92,246,.07), inset 0 1px 0 #fff;
    filter: saturate(1.08);
  }
  .plus-btn:active,
  .input-shell button[type="submit"]:active { transform: translateY(0) scale(.96); }
  .plus-btn { font-size: 1.12rem; }
  #chatSubmitBtn.voice-launch {
    border-radius: 15px;
    border-color: rgba(196,181,253,.7);
    background: linear-gradient(145deg, #8b5cf6, #7c3aed 55%, #6d28d9);
    box-shadow: 0 10px 26px rgba(109,40,217,.3), 0 0 0 4px rgba(139,92,246,.08), inset 0 1px 0 rgba(255,255,255,.3);
  }
  #chatSubmitBtn .voice-mode-icon { width: 26px; height: 26px; }
  .composer-safety-info {
    width: min(820px, calc(100% - 72px));
    margin-top: 0;
  }
  body.ui-dark-mode .input-shell {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  body.ui-dark-mode #userInput {
    background: rgba(15,23,42,.88);
    border-color: rgba(167,139,250,.24);
    box-shadow: 0 13px 34px rgba(0,0,0,.3), 0 4px 14px rgba(88,28,135,.15), inset 0 1px 0 rgba(255,255,255,.055);
  }
}

/* TV keeps the centered structure, with calmer controls and a premium top bar. */
body.tv-mode .input-shell {
  width: min(1180px, calc(100% - 120px));
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 13px;
  padding: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
body.tv-mode #userInput {
  min-height: 56px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 1.12rem;
}
body.tv-mode .plus-btn,
body.tv-mode .input-shell button[type="submit"] {
  width: 52px;
  height: 52px;
  border-radius: 18px;
}
body.tv-mode .input-shell button svg { width: 24px; height: 24px; }
body.tv-mode .topbar {
  height: 90px;
  margin: 10px clamp(24px, 2.4vw, 52px) 0;
  padding: 11px 16px;
  border: 1px solid rgba(139,92,246,.18);
  border-radius: 24px;
  background: linear-gradient(125deg, rgba(255,255,255,.9), rgba(250,247,255,.84));
  box-shadow: 0 18px 46px rgba(30,24,56,.11), inset 0 1px 0 rgba(255,255,255,.94);
  backdrop-filter: blur(24px) saturate(1.18);
}
body.tv-mode .model-chip-wrap {
  padding: 7px 10px;
  border: 1px solid rgba(124,58,237,.15);
  border-radius: 18px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 7px 20px rgba(30,24,56,.07);
}
body.tv-mode .model-badge,
body.tv-mode .memory-btn,
body.tv-mode .clear-btn,
body.tv-mode .guest-login-btn,
body.tv-mode .account-icon-btn {
  border-color: rgba(124,58,237,.22);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(245,241,255,.82));
  box-shadow: 0 8px 22px rgba(30,24,56,.08), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .2s ease, border-color .2s ease, box-shadow .24s ease;
}
body.tv-mode :is(.memory-btn, .clear-btn, .guest-login-btn, .account-icon-btn, .model-chip-wrap):hover {
  transform: translateY(-2px);
  border-color: rgba(124,58,237,.42);
  box-shadow: 0 13px 29px rgba(30,24,56,.12), 0 0 0 4px rgba(139,92,246,.06);
}
body.tv-mode .brand-mode-trigger {
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  text-shadow: 0 5px 18px rgba(91,33,182,.13);
}
body.ui-dark-mode.tv-mode .topbar {
  background: linear-gradient(125deg, rgba(15,23,42,.93), rgba(30,20,51,.9));
  border-color: rgba(167,139,250,.25);
  box-shadow: 0 20px 52px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.06);
}
body.ui-dark-mode.tv-mode .model-chip-wrap {
  background: rgba(15,23,42,.58);
  border-color: rgba(167,139,250,.2);
}

@media (prefers-reduced-motion: reduce) {
  .input-shell,
  .plus-btn,
  .input-shell button[type="submit"] { animation: none !important; }
}

/* Mobile receives the same soft composer language without losing typing room. */
@media (max-width: 700px) {
  .input-shell {
    width: calc(100% - 16px);
    margin: 0 8px 7px;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    gap: 7px;
    padding: 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    animation: balukComposerArrive .46s cubic-bezier(.2,.85,.25,1);
    transition: none;
  }
  .input-shell:focus-within {
    transform: none;
    border-color: transparent;
    box-shadow: none;
  }
  .input-web-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
  }
  #userInput {
    min-width: 0;
    min-height: 43px;
    padding: 10px 15px;
    border: 1px solid rgba(100,116,139,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 9px 24px rgba(30,24,56,.1), 0 3px 9px rgba(124,58,237,.05), inset 0 1px 0 rgba(255,255,255,.96);
    backdrop-filter: blur(15px) saturate(1.12);
    transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .22s ease;
  }
  #userInput:focus {
    transform: translateY(-1px);
    border-color: rgba(124,58,237,.44);
    background: rgba(255,255,255,.98);
    box-shadow: 0 12px 29px rgba(30,24,56,.13), 0 0 0 3px rgba(139,92,246,.075), inset 0 1px 0 #fff;
  }
  .plus-btn,
  .input-shell button[type="submit"] {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(124,58,237,.27);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(238,232,255,.9));
    color: #6d28d9;
    box-shadow: 0 7px 18px rgba(91,33,182,.13), inset 0 1px 0 rgba(255,255,255,.9);
    animation: balukControlBreathe 5.2s ease-in-out infinite;
    transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
  }
  .plus-btn:active,
  .input-shell button[type="submit"]:active { transform: scale(.95); }
  #chatSubmitBtn.voice-launch {
    border-radius: 14px;
    border-color: rgba(196,181,253,.68);
    background: linear-gradient(145deg, #8b5cf6, #7c3aed 58%, #6d28d9);
    box-shadow: 0 8px 21px rgba(109,40,217,.28), 0 0 0 3px rgba(139,92,246,.07), inset 0 1px 0 rgba(255,255,255,.28);
  }
  #chatSubmitBtn .voice-mode-icon { width: 24px; height: 24px; }
  body.ui-dark-mode .input-shell {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  body.ui-dark-mode #userInput {
    background: rgba(15,23,42,.9);
    border-color: rgba(167,139,250,.22);
    box-shadow: 0 11px 28px rgba(0,0,0,.3), 0 3px 12px rgba(88,28,135,.14), inset 0 1px 0 rgba(255,255,255,.05);
  }
}

/* Final Math composer override: Baluk stays purple; Math responds in blue. */
.app.math-mode #userInput {
  border-color: rgba(14,165,233,.26);
  box-shadow: 0 11px 30px rgba(14,116,144,.1), 0 3px 11px rgba(14,165,233,.08), inset 0 1px 0 rgba(255,255,255,.96);
}
.app.math-mode #userInput:hover {
  border-color: rgba(14,165,233,.5);
  box-shadow: 0 14px 34px rgba(14,116,144,.13), 0 0 0 2px rgba(56,189,248,.08), inset 0 1px 0 #fff;
}
.app.math-mode #userInput:focus {
  border-color: rgba(2,132,199,.74);
  box-shadow: 0 16px 38px rgba(14,116,144,.15), 0 0 0 5px rgba(56,189,248,.14), 0 7px 22px rgba(14,165,233,.17), inset 0 1px 0 #fff;
}
.app.math-mode .plus-btn,
.app.math-mode .input-shell button[type="submit"] {
  border-color: rgba(14,165,233,.38);
  color: #0369a1;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(224,242,254,.94));
  box-shadow: 0 8px 22px rgba(2,132,199,.15), inset 0 1px 0 rgba(255,255,255,.92);
  animation-name: mathControlBreathe;
}
.app.math-mode .plus-btn:hover,
.app.math-mode .input-shell button[type="submit"]:hover {
  border-color: rgba(2,132,199,.64);
  box-shadow: 0 13px 29px rgba(2,132,199,.23), 0 0 0 4px rgba(56,189,248,.11), inset 0 1px 0 #fff;
}
.app.math-mode #chatSubmitBtn.voice-launch {
  border-color: rgba(125,211,252,.8);
  background: linear-gradient(145deg, #38bdf8, #0284c7 58%, #0369a1);
  box-shadow: 0 10px 27px rgba(2,132,199,.32), 0 0 0 4px rgba(56,189,248,.11), inset 0 1px 0 rgba(255,255,255,.3);
}
.app.math-mode #chatSubmitBtn.stop-generating,
body.ui-dark-mode .app.math-mode #chatSubmitBtn.stop-generating {
  border: 0;
  background: radial-gradient(circle at 50% 45%, #7dd3fc 0%, #0ea5e9 48%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(14,165,233,.14), 0 0 24px rgba(2,132,199,.52), 0 12px 26px rgba(3,105,161,.3);
}
body.ui-dark-mode .app.math-mode #userInput {
  background: rgba(8,47,73,.9);
  border-color: rgba(56,189,248,.36);
  box-shadow: 0 13px 34px rgba(0,0,0,.3), 0 4px 16px rgba(2,132,199,.21), inset 0 1px 0 rgba(255,255,255,.055);
}

/* Linked rational-number workbench. */
.rational-widget {
  width: fit-content;
  max-width: min(780px, 86vw);
  min-width: 150px;
  height: auto;
}
.rational-widget .rational-zone,
.rational-widget.selected .rational-zone {
  margin-top: 0;
  min-width: 150px;
  max-width: min(780px, 86vw);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
  border: 1px solid rgba(125,211,252,.7);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 27px rgba(2,132,199,.11), inset 0 1px 0 #fff;
  transition: transform .22s cubic-bezier(.2,.85,.25,1), border-color .22s ease, box-shadow .24s ease, background .22s ease;
}
.rational-widget.selected .rational-zone {
  border-color: rgba(14,165,233,.82);
  box-shadow: 0 14px 34px rgba(2,132,199,.17), 0 0 0 4px rgba(56,189,248,.09), inset 0 1px 0 #fff;
}
.rational-chain {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #7dd3fc transparent;
}
.rational-card-unit {
  flex: 0 0 116px;
  padding: 7px 6px 6px;
  border: 1px solid rgba(186,230,253,.8);
  border-radius: 13px;
  background: linear-gradient(155deg, rgba(255,255,255,.98), rgba(240,249,255,.9));
}
.rational-card-unit .rational-box { width: 100%; gap: 4px; }
.rational-card-unit .rational-box input,
.rational-card-unit .rat-line { width: 78px; }
.rational-single-actions {
  display: none;
  margin-top: 7px;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.rational-widget.selected .rational-single-actions { display: flex; }
.rational-single-actions button,
.rational-group-actions button {
  border: 1px solid rgba(56,189,248,.5);
  border-radius: 999px;
  padding: 4px 7px;
  background: #f0f9ff;
  color: #075985;
  font-size: .62rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .18s ease, background .18s ease;
}
.rational-single-actions button:hover,
.rational-group-actions button:hover {
  transform: translateY(-1px);
  background: #e0f2fe;
  box-shadow: 0 5px 12px rgba(2,132,199,.16);
}
.rational-single-actions label,
.rational-group-actions label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #0369a1;
  font-size: .65rem;
  font-weight: 850;
}
.rat-item-scale,
.rat-group-scale {
  width: 35px !important;
  min-width: 35px;
  padding: 3px 2px !important;
  border: 1px solid #7dd3fc;
  border-radius: 7px;
  text-align: center;
  font-size: .65rem;
  font-weight: 800;
}
.rational-group-actions {
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(56,189,248,.42);
}
.rational-widget.selected .rational-group-actions { display: flex; }
.rational-linked-label {
  padding: 4px 8px;
  border-radius: 999px;
  color: #075985;
  background: rgba(186,230,253,.6);
  font-size: .65rem;
  font-weight: 900;
}
.rational-calculate-btn {
  color: #fff !important;
  border-color: #0284c7 !important;
  background: linear-gradient(135deg, #38bdf8, #0284c7) !important;
}
.rational-solo-hint {
  display: none;
  max-width: 240px;
  color: #0e7490;
  font-size: .66rem;
  line-height: 1.35;
  text-align: center;
}
.rational-widget.selected .rational-solo-hint { display: block; }
.rational-drop-hint {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 15;
  min-width: 178px;
  padding: 10px 13px;
  display: grid;
  gap: 2px;
  text-align: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14,165,233,.97), rgba(37,99,235,.96));
  box-shadow: 0 18px 40px rgba(2,132,199,.35), 0 0 0 7px rgba(56,189,248,.15);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -45%) scale(.82);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.9,.2,1);
}
.rational-drop-hint span { font-size: .67rem; opacity: .85; }
.rational-widget.merge-target { z-index: 12; }
.rational-widget.merge-target .rational-zone {
  transform: scale(1.045);
  border-color: #0ea5e9;
  background: rgba(224,242,254,.98);
  box-shadow: 0 20px 45px rgba(2,132,199,.28), 0 0 0 8px rgba(56,189,248,.15), inset 0 1px 0 #fff;
}
.rational-widget.merge-target .rational-drop-hint {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
body.ui-dark-mode .rational-widget .rational-zone {
  color: #e0f2fe;
  border-color: rgba(56,189,248,.42);
  background: rgba(8,47,73,.94);
  box-shadow: 0 13px 32px rgba(0,0,0,.3);
}
body.ui-dark-mode .rational-card-unit {
  border-color: rgba(56,189,248,.3);
  background: rgba(15,23,42,.72);
}
@media (max-width: 700px) {
  .rational-widget { max-width: 82vw; }
  .rational-widget .rational-zone,
  .rational-widget.selected .rational-zone { max-width: 82vw; padding: 8px; }
  .rational-card-unit { flex-basis: 104px; }
  .rational-card-unit .rational-box input,
  .rational-card-unit .rat-line { width: 68px; }
  .rational-group-actions { max-height: 92px; overflow-y: auto; }
}

/* Baluk-2.4 normal Fast: sohbet yüzeyine bağlı, katmanlı düşünme satırı. */
.msg.bot.thinking-bubble.thinking-fast-inline {
  position: relative;
  max-width: min(78%, 860px);
  min-height: 38px;
  margin-right: auto;
  padding: 5px 2px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
.thinking-fast-inline .thinking-head {
  position: relative;
  width: max-content;
  min-height: 30px;
  gap: 7px;
  transition: opacity .24s ease, transform .24s cubic-bezier(.2,.8,.2,1), filter .24s ease;
}
.thinking-fast-inline .think-fish {
  width: 31px;
  min-width: 31px;
  color: currentColor;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 2px 4px rgba(124,58,237,.18));
  transition: opacity .3s ease, transform .3s ease, filter .3s ease;
}
.thinking-fast-inline .fast-fish-gentle {
  animation: fastFishGentle 1.7s cubic-bezier(.45,.05,.55,.95) infinite;
}
.thinking-fast-inline .thinking-status-text {
  position: relative;
  font-size: .92rem;
  font-weight: 760;
  letter-spacing: .005em;
  color: transparent;
  background: linear-gradient(105deg, #1e293b 0%, #1e293b 34%, #a855f7 48%, #7c3aed 54%, #1e293b 68%, #1e293b 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: fastThinkingTextGlow 1.75s linear infinite;
  filter: drop-shadow(0 0 5px rgba(168,85,247,.24));
}
.thinking-fast-inline .thinking-head::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 5px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #c084fc;
  box-shadow: 10px 5px 0 rgba(168,85,247,.7), 18px -2px 0 rgba(216,180,254,.6), 28px 6px 0 rgba(124,58,237,.5);
  animation: fastThinkingSparkles 1.45s ease-in-out infinite;
  pointer-events: none;
}
.thinking-fast-inline.fast-answer-ready .think-fish {
  opacity: 0;
  transform: scale(.64) rotate(-8deg);
  filter: blur(2px) drop-shadow(0 0 7px rgba(168,85,247,.22));
}
.thinking-fast-inline.fast-answer-ready .thinking-status-text {
  background-size: 290% 100%;
  animation-duration: 2.25s;
}
.thinking-fast-inline.fast-head-leaving .thinking-head {
  opacity: 0;
  transform: translateY(-3px) scale(.985);
  filter: blur(2px);
}
.thinking-fast-inline.fast-answer-visible {
  min-height: 0;
  padding: 0;
}
.thinking-fast-inline.fast-answer-visible .thinking-head {
  display: none;
}
.thinking-fast-inline .thinking-answer {
  margin-top: 0;
  color: inherit;
  line-height: 1.55;
}
.thinking-fast-inline .thinking-answer.typing-active::after {
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  overflow: hidden;
  color: #3b82f6;
  background: #3b82f6;
  border-radius: 999px;
  vertical-align: -.12em;
  box-shadow: 0 0 7px rgba(59,130,246,.42);
}
body.ui-dark-mode .msg.bot.thinking-bubble.thinking-fast-inline {
  background: transparent;
  color: #eef2ff;
}
body.ui-dark-mode .thinking-fast-inline .thinking-status-text {
  background-image: linear-gradient(105deg, #e2e8f0 0%, #e2e8f0 34%, #d8b4fe 48%, #a78bfa 54%, #e2e8f0 68%, #e2e8f0 100%);
}
@keyframes fastFishGentle {
  0%, 100% { transform: translateY(0) rotate(-3deg) scale(1); }
  34% { transform: translateY(-1.5px) rotate(5deg) scale(.97); }
  68% { transform: translateY(1px) rotate(-6deg) scale(1.02); }
}
@keyframes fastThinkingTextGlow {
  from { background-position: 210% 50%; }
  to { background-position: -30% 50%; }
}
@keyframes fastThinkingSparkles {
  0%, 100% { opacity: .18; transform: translateY(4px) scale(.65); }
  45% { opacity: .9; transform: translateY(-4px) scale(1); }
  72% { opacity: .4; transform: translateY(-7px) scale(.78); }
}
@media (max-width: 700px) {
  .msg.bot.thinking-bubble.thinking-fast-inline { max-width: 90%; }
  .thinking-fast-inline .think-fish { width: 28px; min-width: 28px; }
  .thinking-fast-inline .thinking-status-text { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-fast-inline .fast-fish-gentle,
  .thinking-fast-inline .thinking-status-text,
  .thinking-fast-inline .thinking-head::after { animation: none !important; }
}
.msg.bot.restored-fast-inline {
  max-width: min(78%, 860px);
  margin-right: auto;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
body.ui-dark-mode .msg.bot.restored-fast-inline {
  background: transparent;
  color: #eef2ff;
}
@media (max-width: 700px) {
  .msg.bot.restored-fast-inline { max-width: 90%; }
}
.baluk24-rich-text {
  white-space: normal;
}

/* Baluk-2.4 normal Thinking: tek satırlı, aşamalı ve sohbet yüzeyine bağlı akış. */
.msg.bot.thinking-bubble.thinking-2-4-inline {
  position: relative;
  max-width: min(82%, 900px);
  min-height: 42px;
  margin-right: auto;
  padding: 6px 2px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
.thinking-2-4-inline .thinking-2-4-head {
  position: relative;
  width: max-content;
  min-height: 32px;
  gap: 9px;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1), filter .22s ease;
}
.thinking-2-4-inline .thinking-2-4-gear {
  width: 27px;
  min-width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  color: #7c3aed;
  filter: drop-shadow(0 0 6px rgba(124,58,237,.34));
  transition: opacity .2s ease, transform .2s ease, filter .2s ease;
}
.thinking-2-4-inline .thinking-2-4-gear .thinking-cog-svg,
.thinking-2-4-inline .thinking-2-4-gear svg {
  width: 25px;
  height: 25px;
  animation: baluk24ThinkingGearSpin 1.55s linear infinite;
}
.thinking-2-4-inline .thinking-status-text {
  position: relative;
  min-width: 126px;
  font-size: .95rem;
  font-weight: 760;
  letter-spacing: .005em;
  color: transparent;
  background: linear-gradient(105deg, #1e293b 0%, #1e293b 33%, #c084fc 46%, #7c3aed 54%, #1e293b 68%, #1e293b 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: baluk24ThinkingStatusGlow 1.8s linear infinite;
  filter: drop-shadow(0 0 5px rgba(168,85,247,.2));
  transition: opacity .18s ease, filter .18s ease;
}
.thinking-2-4-inline .thinking-status-text::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c084fc;
  box-shadow: 7px 7px 0 rgba(168,85,247,.58), 15px 1px 0 rgba(216,180,254,.5);
  animation: baluk24ThinkingStatusSpark 1.45s ease-in-out infinite;
}
.thinking-2-4-inline.thinking-2-4-final-check .thinking-2-4-gear {
  width: 0;
  min-width: 0;
  opacity: 0;
  transform: scale(.55) rotate(22deg);
  filter: blur(2px);
  overflow: hidden;
}
.thinking-2-4-inline.thinking-2-4-final-check .thinking-2-4-head {
  gap: 0;
}
.thinking-2-4-inline.thinking-2-4-head-leaving .thinking-2-4-head {
  opacity: 0;
  transform: translateY(-3px);
  filter: blur(2px);
}
.thinking-2-4-inline.fast-answer-visible {
  min-height: 0;
  padding: 0 2px;
}
.thinking-2-4-inline.fast-answer-visible .thinking-2-4-head {
  display: none;
}
.thinking-2-4-inline .thinking-answer {
  margin-top: 0;
  line-height: 1.58;
  color: inherit;
}
.thinking-2-4-inline .thinking-answer.typing-active::after {
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  color: #3b82f6;
  background: #3b82f6;
  border-radius: 999px;
  vertical-align: -.12em;
  box-shadow: 0 0 7px rgba(59,130,246,.42);
}
body.ui-dark-mode .msg.bot.thinking-bubble.thinking-2-4-inline {
  background: transparent;
  color: #eef2ff;
}
body.ui-dark-mode .thinking-2-4-inline .thinking-status-text {
  background-image: linear-gradient(105deg, #e2e8f0 0%, #e2e8f0 33%, #d8b4fe 46%, #a78bfa 54%, #e2e8f0 68%, #e2e8f0 100%);
}
body.ui-dark-mode .thinking-2-4-inline .thinking-2-4-gear {
  color: #a78bfa;
}
@keyframes baluk24ThinkingGearSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes baluk24ThinkingStatusGlow {
  from { background-position: 210% 50%; }
  to { background-position: -30% 50%; }
}
@keyframes baluk24ThinkingStatusSpark {
  0%, 100% { opacity: .18; transform: translateY(4px) scale(.65); }
  48% { opacity: .9; transform: translateY(-3px) scale(1); }
  75% { opacity: .38; transform: translateY(-6px) scale(.78); }
}
@media (max-width: 700px) {
  .msg.bot.thinking-bubble.thinking-2-4-inline { max-width: 94%; }
  .thinking-2-4-inline .thinking-2-4-gear { width: 25px; min-width: 25px; height: 25px; }
  .thinking-2-4-inline .thinking-status-text { min-width: 116px; font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-2-4-inline .thinking-2-4-gear svg,
  .thinking-2-4-inline .thinking-status-text,
  .thinking-2-4-inline .thinking-status-text::after {
    animation: none !important;
  }
}
.baluk24-rich-lines {
  white-space: pre-wrap;
}
.baluk24-rich-text strong {
  font-weight: 800;
}
.baluk24-rich-list {
  margin: .42em 0 .42em 1.25em;
  padding: 0;
}
.baluk24-rich-list li {
  margin: .18em 0;
  padding-left: .12em;
}
.baluk24-rich-gap { height: .48em; }
.baluk24-copy-block {
  margin: .8rem 0;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, .42);
  border-radius: 15px;
  background: #0b1020;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
  color: #e8efff;
}
.baluk24-copy-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  min-height: 42px;
  padding: .45rem .62rem .45rem .9rem;
  border-bottom: 1px solid rgba(148, 163, 184, .2);
  background: rgba(30, 41, 59, .78);
}
.baluk24-copy-language {
  color: #b9c7ff;
  font: 700 .78rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .025em;
}
.baluk24-copy-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 30px;
  border: 1px solid rgba(167, 139, 250, .58);
  border-radius: 9px;
  padding: 0;
  background: rgba(124, 58, 237, .18);
  color: #f1edff;
  font: 700 .76rem/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.baluk24-copy-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.baluk24-copy-button::after {
  content: attr(data-copy-label);
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 3;
  padding: .3rem .48rem;
  border-radius: 7px;
  background: #111827;
  color: #f8fafc;
  font: 700 .68rem/1 system-ui, sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .16s ease, transform .16s ease;
}
.baluk24-copy-button:hover::after,
.baluk24-copy-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
.baluk24-copy-button:hover {
  border-color: #c4b5fd;
  background: rgba(124, 58, 237, .38);
  transform: translateY(-1px);
}
.baluk24-code-body {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  color: #e6edf8;
  font: 500 .83rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  tab-size: 2;
}
.baluk24-code-keyword { color: #c084fc; font-weight: 700; }
.baluk24-code-literal { color: #fb923c; }
.baluk24-code-string { color: #86efac; }
.baluk24-code-comment { color: #8091a9; font-style: italic; }
.baluk24-copy-block-text {
  border-color: rgba(148, 163, 184, .34);
  background: rgba(241, 245, 249, .9);
  color: #182235;
  box-shadow: none;
}
.baluk24-copy-block-text .baluk24-copy-block-head {
  border-bottom-color: rgba(100, 116, 139, .22);
  background: rgba(226, 232, 240, .86);
}
.baluk24-copy-block-text .baluk24-copy-language { color: #475569; font-family: inherit; }
.baluk24-copy-block-text .baluk24-copy-button {
  border-color: rgba(100, 116, 139, .45);
  background: rgba(255, 255, 255, .72);
  color: #334155;
}
.baluk24-copy-text {
  padding: 1rem;
  color: inherit;
  line-height: 1.68;
  white-space: normal;
}
body.ui-dark-mode .baluk24-copy-block-text {
  border-color: rgba(148, 163, 184, .28);
  background: rgba(30, 41, 59, .88);
  color: #e2e8f0;
}
body.ui-dark-mode .baluk24-copy-block-text .baluk24-copy-block-head { background: rgba(15, 23, 42, .82); }
body.ui-dark-mode .baluk24-copy-block-text .baluk24-copy-language,
body.ui-dark-mode .baluk24-copy-block-text .baluk24-copy-button { color: #dbeafe; }
@media (max-width: 700px) {
  .baluk24-code-body { padding: .82rem; font-size: .77rem; }
  .baluk24-copy-block { border-radius: 13px; }
}
