.research-page {
  --surface: #142132;
  --surface-raised: #1b2b40;
  --line: #2b4057;
  --subtle: #9bb0c6;
  --accent: #92d6f5;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: radial-gradient(ellipse 620px 430px at 50% 36%, #17283c, transparent 100%), #0f1823;
}
.research-page [hidden] { display: none !important; }
.research-brand { display: flex; align-items: center; min-width: 0; gap: 8px; }
.research-workspace { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
.research-workspace.has-sidebar { grid-template-columns: clamp(230px, 20vw, 308px) minmax(0, 1fr); }
.history-sidebar {
  position: sticky; top: 63px; height: calc(100dvh - 63px); padding: 24px 14px 14px;
  display: flex; flex-direction: column; gap: 15px; min-width: 0; color: #d6e4f2;
  background: #111d2a; border-right: 1px solid #28394c;
}
.sidebar-heading { display: flex; gap: 8px; align-items: center; }
.sidebar-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid #31475c; border-radius: 8px; background: #172535; color: #c5d8e6; cursor: pointer;
}
.sidebar-heading .sidebar-toggle { height: 40px; background: transparent; }
.sidebar-toggle:hover { color: #eff8ff; background: #21354a; }
.sidebar-toggle > span { width: 16px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.sidebar-toggle > span::before { content: ""; position: absolute; left: 4px; inset-block: 0; border-left: 1.5px solid currentColor; }
.new-thread {
  display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 40px;
  border: 1px solid #39526a; border-radius: 9px; background: #203348; color: #deedf9; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.new-thread > span { color: #9dd7ef; font-size: 1.15rem; line-height: 1; }
.new-thread:hover:not(:disabled) { background: #294158; border-color: #54768c; }
.thread-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #374c5e transparent; }
.thread-group { margin: 0 0 14px; }
.thread-group h3 { font-size: .72rem; font-weight: 550; color: #9aafc2; margin: 4px 8px 5px; }
.thread-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin: 2px 0; border: 1px solid transparent; border-radius: 8px; }
.thread-row:hover, .thread-row:focus-within { background: #1b2a3b; }
.thread-row:has([aria-current="page"]) { background: #20354a; border-color: #38536b; }
.history-entry {
  display: grid; gap: 3px; min-width: 0; width: 100%; border: 0; border-radius: 6px; text-align: left;
  font: inherit; font-size: .83rem; line-height: 1.45; padding: 7px 2px 7px 9px; color: #c8d7e5; background: transparent; cursor: pointer;
}
.history-entry .thread-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.history-entry:is(:hover,[aria-current="page"]) { color: #e6f4ff; }
.thread-time { font-size: .7rem; font-variant-numeric: tabular-nums; color: #a0b6c8; }
.thread-more { display: grid; place-content: center; width: 30px; height: 32px; margin-right: 3px; border: 0; border-radius: 6px; color: #a5bed1; background: transparent; font-size: 1.1rem; cursor: pointer; }
.thread-more:hover, .thread-more[aria-expanded="true"] { background: #31475b; color: #edf6fe; }
.thread-menu {
  position: fixed; inset: auto; width: 122px; margin: 0; padding: 4px;
  border: 1px solid #405970; border-radius: 9px; background: #1a2b3d; color: #e5eff7; box-shadow: 0 8px 22px #070f1c88;
}
.thread-menu:popover-open { display: grid; gap: 2px; }
.thread-menu button { padding: 7px 10px; border-radius: 5px; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; font-size: .84rem; cursor: pointer; }
.thread-menu button:hover, .thread-menu button:focus-visible { background: #2a4053; }
.thread-menu .thread-danger { color: #ffaaa4; }
.thread-dialog h2 { margin: 0 0 5px; font-size: 1.15rem; }
.thread-dialog p { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.thread-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.thread-dialog .primary-button.thread-danger { background: #f4a9a5; color: #421b22; }
.thread-dialog .primary-button.thread-danger:hover { background: #ffc1bc; }
.research-page .thread-dialog form { margin-bottom: 0; }
.thread-draft { margin-right: 6px; font-size: .7rem; color: #9fd2e8; }
#history-status, #more-chats { font-size: .78rem; color: #a9bdcf; margin: 5px 8px; }
#more-chats { padding: 7px 0; }
.history-drawer { padding: 0; border: 0; }
.history-drawer::backdrop { background: #060d178c; }
.history-drawer[open] {
  position: fixed; inset: 0 auto 0 0; margin: 0; width: min(320px, 87vw); max-width: none;
  height: 100dvh; max-height: none; background: #111d2a; color: inherit; box-shadow: 10px 0 48px #040a135e;
}
.history-drawer .history-sidebar { position: static; height: 100%; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
body:has(.history-drawer[open]) { overflow: hidden; }
@media (max-width: 860px) {
  .research-workspace.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .thread-more { width: 40px; height: 44px; }
}
.research-topbar { grid-template-columns: 1fr auto 1fr; min-height: 62px; }
.research-topbar .brand { min-width: 0; }
.research-topbar .brand-mark { flex: none; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.account-area { justify-self: end; min-width: 0; max-width: min(100%, 190px); }
.account-menu { position: relative; }
.wallet-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.wallet .wallet-presets button { padding: 5px 12px; }
.wallet select { width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #142132; color: inherit; font: inherit; }
.account-trigger {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
  min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: #182638; cursor: pointer; list-style: none;
}
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger::marker { content: ""; }
.account-trigger:hover, .account-menu[open] .account-trigger { background: #21354a; }
.account-avatar {
  display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center;
  border-radius: 8px; background: #254867; color: #c4edff; font-size: .82rem; font-weight: 700;
}
.account-compact { display: grid; min-width: 0; gap: 2px; line-height: 1.1; }
.account-compact strong, .account-compact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-compact strong { font-size: .8rem; font-weight: 650; }
.account-compact span { color: #a9cade; font-size: .7rem; font-variant-numeric: tabular-nums; }
.account-chevron {
  flex: 0 0 6px; width: 6px; height: 6px; margin-left: 4px;
  border: solid var(--subtle); border-width: 0 1px 1px 0; transform: rotate(45deg) translateY(-2px);
}
.account-menu[open] .account-chevron { transform: rotate(225deg) translate(-1px, -1px); }
.account-popover {
  position: absolute; z-index: 2; top: calc(100% + 9px); right: 0;
  width: min(235px, calc(100vw - 26px)); padding: 14px;
  background: #182638; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 42px #070c14a8;
}
.account-popover > span { display: block; font-size: .78rem; color: var(--subtle); }
.account-popover > strong { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.account-popover .account-actions { justify-content: space-between; margin-top: 11px; }
.account-popover a, .signin > a, .message a { color: #a1dbf6; text-decoration: underline; text-underline-offset: .2em; }
.account-popover a { font-size: .82rem; }
.account-popover .balance-link { display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; border-radius: 5px; text-decoration: none; }
.balance-link:hover, .balance-link:focus-visible { background: #294158; }

.research {
  width: min(820px, calc(100% - 40px)); margin-inline: auto; flex: 1;
  display: flex; flex-direction: column; min-width: 0;
}
.research-stage { display: flex; flex: 1; flex-direction: column; justify-content: center; }
.welcome { padding: 28px 0 42px; text-align: center; }
.welcome-mark {
  width: 47px; height: 47px; padding-bottom: 12px; margin-inline: auto;
  border-radius: 15px; gap: 4px;
}
.welcome-mark i { width: 4px; }
.welcome h1 {
  margin: 20px 0 19px; font-size: clamp(1.6rem, 4vw, 2.44rem);
  font-weight: 640; letter-spacing: -.045em; line-height: 1.24;
}
.examples { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.research-page .quiet-button, .research-page .primary-button {
  border-radius: 10px; padding: 8px 11px; border: 1px solid transparent;
  font-size: .82rem; font-weight: 610; cursor: pointer;
}
.research-page .quiet-button { background: transparent; color: #c2d1e1; border-color: var(--line); }
.research-page .quiet-button:hover:not(:disabled) { background: #20354a; color: #f1f8ff; }
.research-page .primary-button { background: #93d7f5; color: #0f2839; }
.research-page .primary-button:hover:not(:disabled) { background: #baeaff; }
.research-page button:disabled { opacity: .55; cursor: default; }
.research-page :is(summary, input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.conversation { width: 100%; margin: auto 0 12px; padding-block: 28px 12px; display: grid; gap: 17px; }
.message { min-width: 0; padding: 9px 3px; scroll-margin-top: 90px; }
.message.user {
  width: fit-content; max-width: min(78%, 640px); justify-self: end; padding: 12px 15px;
  border: 1px solid var(--line); border-radius: 16px 16px 5px 16px; background: #1c2c3f;
}
.message strong { color: #b6cce1; font-size: .78rem; }
.answer-author { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 23px; }
.answer-mode {
  --mode-ink: #c5d1dc; --mode-line: #546372; --mode-bg: #24303c;
  display: inline-flex; position: relative; isolation: isolate; overflow: hidden;
  align-items: center; gap: 6px; padding: 2px 8px; min-height: 21px; box-sizing: border-box;
  border: 1px solid var(--mode-line); border-radius: 6px; background: var(--mode-bg);
  color: var(--mode-ink); font-size: .7rem; font-weight: 650; line-height: 1.25; white-space: nowrap;
}
.answer-mode[data-mode="medium"] { --mode-ink: #b7e8fb; --mode-line: #3c7690; --mode-bg: #153849; }
.answer-mode[data-mode="high"] { --mode-ink: #a5f3e1; --mode-line: #408a7d; --mode-bg: linear-gradient(115deg,#16383c,#184638); }
.answer-mode[data-mode="xhigh"] {
  --mode-ink: #e5d6ff; --mode-line: #9676c0; --mode-bg: linear-gradient(110deg,#302747,#4a365e);
  box-shadow: inset 0 1px 0 #cfb4ff30;
}
.answer-mode[data-mode="deep"] {
  --mode-ink: #fff1c5; --mode-line: #c49863; --mode-bg: linear-gradient(115deg,#4a3431,#4f3350 60%,#423750);
  box-shadow: inset 0 1px 0 #ffe5b749, 0 0 10px #d4a36920;
}
.answer-mode[data-mode="unknown"] { --mode-ink: #a6b5c0; --mode-line: #405161; --mode-bg: transparent; font-weight: 500; }
.answer-mode-bars { display: inline-flex; align-items: end; gap: 1px; height: 11px; }
.answer-mode-bars i { display: block; width: 2px; height: 4px; border-radius: 1px; background: currentColor; }
.answer-mode-bars i:nth-child(2) { height: 5px; }
.answer-mode-bars i:nth-child(3) { height: 7px; }
.answer-mode-bars i:nth-child(4) { height: 9px; }
.answer-mode-bars i:nth-child(5) { height: 11px; }
@media (prefers-reduced-motion: no-preference) {
  .answer-mode[data-mode="xhigh"] .answer-mode-bars { animation: mode-glow 5s ease-in-out infinite; }
  .answer-mode[data-mode="deep"]::after {
    content: ""; pointer-events: none; position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 32%, #ffe6b633 50%, transparent 68%);
    animation: mode-sheen 6s ease-in-out infinite;
  }
  @keyframes mode-glow { 0%, 60%, 100% { opacity: 1; } 80% { opacity: .62; } }
  @keyframes mode-sheen { 0%, 65% { transform: translateX(-110%); } 95%, 100% { transform: translateX(110%); } }
}
.message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 5px 0 0; line-height: 1.72; }
.research-report {
  margin-top: 9px; padding: clamp(16px, 3.5vw, 29px); background: #162333;
  border: 1px solid #2b4055; border-radius: 16px; color: #d7e2ed; overflow-wrap: anywhere;
}
.research-report :is(h3,h4,h5) { line-height: 1.42; letter-spacing: -.015em; color: #f1f7fc; }
.report-body > :is(h3,h4,h5) { margin: 22px 0 7px; }
.report-body > h3:not(:first-child) { border-top: 1px solid #2b4055; padding-top: 18px; }
.report-body > :first-child { margin-top: 0; }
.report-body h3 { font-size: 1.12rem; }
.report-body h4, .report-body h5 { font-size: 1rem; }
.research-report p { margin: 7px 0; white-space: normal; line-height: 1.75; }
.research-report :is(ul,ol) { padding-inline-start: 1.45em; margin: 8px 0 12px; }
.research-report li { margin: 5px 0; line-height: 1.65; }
.research-report li::marker { color: #91bed8; }
.research-report strong { font-size: inherit; color: #f0f6fc; }
.research-report .report-conclusion { display: block; margin-bottom: .45em; font-size: 1.12em; line-height: 1.5; }
.research-report blockquote { margin: 12px 0; padding: 2px 14px; border-left: 3px solid #70b5cd; color: #c7dae6; }
.research-report code { font: .94em ui-monospace, monospace; color: #c6e4ef; }
.research-report pre { overflow: auto; padding: 10px; background: #101b29; }
.research-report a { text-decoration-thickness: 1px; }
.report-table { max-width: 100%; overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 9px; }
.report-table table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.55; }
.report-table :is(th,td) { padding: 9px 12px; text-align: left; vertical-align: top; min-width: 6em; }
.report-table th { background: #203248; color: #dceaf3; }
.report-table tbody tr + tr { border-top: 1px solid #2b4055; }
.report-chart {
  min-width: 0; margin: 17px 0 22px; padding: clamp(11px, 2.5vw, 18px);
  border: 1px solid #344e63; border-radius: 12px; background: #101e2d;
}
.report-chart figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; }
.chart-kind { color: #8bd7e7; font-size: .74rem; font-weight: 650; }
.report-chart figcaption h4 { margin: 0; grid-column: 1; font-size: 1.02rem; }
.chart-toggle { grid-column: 2; grid-row: 1 / 3; display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.chart-toggle button { padding: 5px 8px; border: 0; border-radius: 5px; color: #b7cadd; background: transparent; font: inherit; font-size: .75rem; cursor: pointer; }
.chart-toggle button[aria-pressed="true"] { color: #def5ff; background: #28455a; }
.chart-plot { position: relative; display: block; min-width: 0; margin-top: 14px; }
.chart-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--subtle); font-size: .76rem; }
.chart-foot span { margin-inline-start: auto; }
@media (max-width: 560px) {
  .report-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .report-table :is(table,tbody,tr) { display: block; }
  .report-table tbody tr { padding: 7px 11px; }
  .report-table td { display: grid; grid-template-columns: minmax(4em, 24%) 1fr; gap: 9px; padding: 4px 0; }
  .report-table td::before { content: attr(data-label); color: var(--subtle); font-size: .83rem; }
}
.report-games { display: grid; gap: 7px; }
.research-report .report-game { min-height: 1px; display: flex; align-items: center; gap: 14px; text-decoration: none; }
.report-game.ready { padding-bottom: 13px; margin-bottom: 12px; border-bottom: 1px solid #32485b; }
.report-game img { width: clamp(86px, 21vw, 145px); aspect-ratio: 460/215; object-fit: cover; border-radius: 6px; }
.report-game-copy { display: grid; gap: 4px; }
.report-game-copy small { color: var(--subtle); }
.game-snapshots { margin: -12px 0 11px; padding-block: 4px 8px; font-size: .92rem; }
.game-snapshots summary { width: fit-content; cursor: pointer; color: var(--accent); font-size: .81rem; }
.report-audit { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 22px; color: #b6c9da; font-size: .9rem; }
.report-audit summary { cursor: pointer; color: #aad5eb; font-weight: 600; }
.composer-dock { position: sticky; bottom: 0; z-index: 3; padding-top: 12px; background: linear-gradient(0deg, #0f1823 78%, #0f182300); }
#ask-form {
  display: grid; gap: 9px; padding: 13px 14px 11px; border: 1px solid #344c65;
  border-radius: 20px; background: #182638; box-shadow: 0 14px 40px #070e1766;
}
#ask-form:focus-within { border-color: #527397; }
#question {
  width: 100%; min-width: 0; min-height: 52px; max-height: 34dvh; padding: 1px 2px;
  border: 0; color: #f0f6ff; background: transparent; font: inherit; line-height: 1.52; resize: vertical;
}
#question::placeholder { color: #91a6bd; }
#question:focus-visible { outline: 0; }
.composer-tools { display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.composer-actions { display: flex; align-items: center; margin-left: auto; gap: 8px; }
.composer-actions button { white-space: nowrap; }
.composer-actions { flex-wrap: wrap; justify-content: flex-end; }
#older-turns { align-self: center; }
.send-arrow { margin-left: 5px; font-size: 1rem; line-height: 1; }
.mode-cost { margin: 0; color: #b4bedb; font-size: .71rem; }
.research-footer {
  padding: 9px 0 max(10px, env(safe-area-inset-bottom)); text-align: center;
  color: #8297ac; font-size: .7rem;
}
.research-footer a:hover { color: #c1daf0; }
.feedback {
  margin: 0 0 8px; padding: 8px 11px; border-radius: 9px; color: #d7e9f8; background: #22384e;
  font-size: .84rem; overflow-wrap: anywhere;
}
.research-progress {
  display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 10px 12px;
  color: #d7e9f8; background: #1e3347; border: 1px solid #304c63; border-radius: 10px; font-size: .84rem;
}
.progress-dots { display: flex; gap: 3px; align-items: center; }
.progress-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: #93d7f5;
  animation: research-bounce 1.2s ease-in-out infinite;
}
.progress-dots i:nth-child(2) { animation-delay: .15s; }
.progress-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes research-bounce { 0%, 65%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
#progress-time { margin-left: auto; white-space: nowrap; color: #a9cade; font-variant-numeric: tabular-nums; }
.message .retry-edit { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .progress-dots i { animation: none; } }

.research-activity {
  margin: 8px 0 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #142130; font-size: .84rem; line-height: 1.45;
}
.activity-summary {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 14px;
  border-radius: inherit; list-style: none; cursor: pointer; color: #d6e6f4;
}
.activity-summary::-webkit-details-marker { display: none; }
.activity-summary::marker { content: ""; }
.activity-summary:hover { background: #1a2c3e; }
.activity-title { font-weight: 630; }
.activity-meta, .activity-time { font-variant-numeric: tabular-nums; color: var(--subtle); font-size: .75rem; }
.activity-meta { margin-left: auto; }
.activity-chevron {
  width: 7px; height: 7px; margin: 0 1px 3px 4px; border: solid currentColor;
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); color: #9cb9ce;
}
.research-activity[open] .activity-chevron { margin-bottom: -3px; transform: rotate(225deg); }
.activity-indicator, .activity-point {
  display: grid; place-content: center; width: 12px; height: 12px; flex: none;
  border: 1.5px solid currentColor; border-radius: 50%; color: #87bba9; box-sizing: border-box;
}
.activity-indicator::after, .activity-point::after {
  content: ""; width: 5px; height: 3px; transform: translateY(-1px) rotate(-45deg);
  border: solid currentColor; border-width: 0 0 1.5px 1.5px;
}
.activity-row[data-state="running"] > .activity-point,
.research-activity[data-state="running"] .activity-indicator {
  border-color: #3b5a72; border-top-color: var(--accent); border-right-color: var(--accent);
  animation: activity-turn .95s linear infinite;
}
.activity-row[data-state="running"] > .activity-point::after,
.research-activity[data-state="running"] .activity-indicator::after { display: none; }
.activity-list {
  max-height: min(34dvh, 310px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-color: #405b70 transparent; list-style: none; margin: 0 12px 8px; padding: 1px 1px 3px;
}
.activity-row {
  position: relative; display: grid; grid-template-columns: 14px minmax(0,1fr) auto 32px;
  gap: 8px; align-items: start; padding: 6px 3px; color: #d0deea;
}
.activity-row:not(:last-child)::before {
  content: ""; position: absolute; left: 8px; width: 1px; top: 21px; bottom: -8px; background: #34485a;
}
.activity-point { margin-top: 4px; width: 11px; height: 11px; }
.activity-body { min-width: 0; overflow-wrap: anywhere; }
.activity-kind { color: #9fb2c5; font-size: .7rem; margin-right: 7px; white-space: nowrap; }
.activity-context { display: block; margin-top: 1px; color: var(--subtle); font-size: .78rem; }
.activity-time { text-align: right; }
.activity-status { font-size: .74rem; color: var(--subtle); }
.activity-row[data-state="running"] :is(.activity-label,.activity-status) { color: #ade3f9; }
.activity-row:is([data-state="failed"],[data-state="interrupted"],[data-state="unknown"]) :is(.activity-point,.activity-status),
.research-activity[data-state="interrupted"] .activity-indicator { color: #e1bb92; }
.activity-row:is([data-state="failed"],[data-state="interrupted"],[data-state="unknown"]) .activity-point::after,
.research-activity[data-state="interrupted"] .activity-indicator::after {
  width: 4px; height: 0; border-width: 0 0 1px; transform: none;
}
@keyframes activity-turn { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .research-activity[data-state="running"] .activity-indicator, .activity-row[data-state="running"] > .activity-point { animation: none; }
}
@media (max-width: 540px) {
  .activity-row { column-gap: 5px; grid-template-columns: 13px minmax(0,1fr) auto 31px; }
  .activity-list { margin-inline: 9px; }
  .activity-context { font-size: .75rem; }
}

.mode-control {
  --level: 25%; --mode-ink: #a9dcfa; --mode-base: #3a77ad;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  column-gap: 9px; flex: 0 1 335px; min-width: 0;
}
.mode-control[data-level="1"] { --level: 0%; --mode-ink: #9be2d3; --mode-base: #427f84; }
.mode-control[data-level="3"] { --level: 50%; --mode-ink: #b8c5ff; --mode-base: #5b6fbd; }
.mode-control[data-level="4"] { --level: 75%; --mode-ink: #dbc2ff; --mode-base: #7b61be; }
.mode-control[data-level="5"] { --level: 100%; --mode-ink: #ecd1ff; --mode-base: #7965e0; }
.mode-label { grid-row: 1 / 3; color: var(--subtle); font-size: .75rem; white-space: nowrap; }
.mode-meter { display: grid; align-items: center; min-width: 0; height: 28px; margin-inline: 7px; }
.mode-track, #mode { grid-area: 1 / 1; width: 100%; min-width: 0; }
.mode-track { height: 12px; position: relative; isolation: isolate; overflow: hidden; border-radius: 999px; background: #2b3c52; }
.mode-track::before {
  content: ""; display: block; height: 100%; width: max(14px, var(--level)); border-radius: inherit;
  background: linear-gradient(92deg, var(--mode-base), var(--mode-ink)); transition: width .24s ease-out;
}
.mode-track span { position: absolute; inset: 0; border-radius: inherit; opacity: .95; }
.mode-control[data-level="5"] .mode-track::before {
  background: linear-gradient(100deg, #3973d0, #6760e0 39%, #a870d9 72%, #88d2ed);
}
.mode-control[data-level="5"] .mode-track span::before {
  content: ""; position: absolute; inset: -9px -32%;
  background: radial-gradient(ellipse 29% 62% at 52% 50%, #f4d9ffdd, #a0dcff80 53%, transparent);
  animation: mode-travel 2.6s ease-in-out infinite alternate;
}
.mode-control[data-level="5"] .mode-track span::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 13% 60%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 29% 28%, #e5ecff 0 1px, transparent 1.6px),
    radial-gradient(circle at 52% 65%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 72% 37%, #fbe1ff 0 1px, transparent 1.6px),
    radial-gradient(circle at 87% 71%, #e5ecff 0 1px, transparent 1.6px);
  animation: mode-spark 3.2s ease-in-out infinite alternate;
}
@keyframes mode-travel { from { transform: translateX(-28%); } to { transform: translateX(28%); } }
@keyframes mode-spark { from { transform: translateX(-4px); opacity: .4; } to { transform: translateX(5px); opacity: 1; } }
#mode { appearance: none; position: relative; margin: 0; height: 28px; background: transparent; cursor: pointer; }
#mode::-webkit-slider-thumb {
  appearance: none; width: 15px; height: 15px; border: 2px solid #e4f5ff; border-radius: 50%;
  background: var(--mode-ink); box-shadow: 0 0 0 2px #121e30a1;
}
#mode::-moz-range-thumb {
  width: 12px; height: 12px; border: 2px solid #e4f5ff; border-radius: 50%;
  background: var(--mode-ink); box-shadow: 0 0 0 2px #121e30a1;
}
.mode-stops { display: grid; grid-template-columns: repeat(4, 1fr) 1.3fr; gap: 2px; }
.mode-stops button {
  padding: 2px 0 3px; border: 0; border-radius: 5px; background: transparent; color: #a7bad0;
  font-size: .7rem; white-space: nowrap; cursor: pointer;
}
.mode-stops button:hover:not(:disabled) { background: #25384e; color: #eaf4ff; }
.mode-stops button[aria-pressed="true"] { color: var(--mode-ink); font-weight: 730; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.signin {
  width: min(420px, calc(100% - 30px)); max-height: calc(100dvh - 30px); color: #f0f6ff;
  padding: 20px; border: 1px solid #405973; border-radius: 17px; background: #182638;
  box-shadow: 0 22px 60px #0008;
}
.signin::backdrop { background: #07101bc4; backdrop-filter: blur(5px); }
.signin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.signin-heading h2 { margin: 0; font-size: 1.19rem; }
.signin-heading button { font-size: 1rem; line-height: 1; }
.signin > p { margin: 9px 0 14px; color: #afc3d7; font-size: .85rem; }
.signin form, .signin label { display: grid; gap: 7px; }
.signin form { gap: 12px; margin-bottom: 14px; }
.signin label { font-size: .85rem; }
.signin input {
  width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #415975;
  border-radius: 9px; background: #101c2b; color: #eff7ff; font: inherit;
}
.signin > a { font-size: .83rem; }

.bank-link, .bank-question {
  border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer;
}
.bank-link { margin-top: 12px; padding: 8px; font-size: .84rem; }
.bank-link:hover, .bank-question:hover { text-decoration: underline; text-underline-offset: .2em; }
.question-bank[open] {
  display: flex; flex-direction: column; width: min(620px, calc(100% - 24px));
  max-height: min(78dvh, 760px); overflow: hidden;
}
.bank-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 15px; margin-top: 16px; }
.bank-filters input[type="search"] { flex: 1 1 200px; }
.bank-filters label { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: #bfccdb; }
.bank-filters input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.bank-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.bank-list details { border-top: 1px solid var(--line); }
.bank-list summary { cursor: pointer; padding: 12px 4px; font-size: .94rem; color: #dceaf7; }
.bank-list details > div { padding-inline: 16px 6px; }
.bank-question { width: 100%; padding: 10px 2px; text-align: left; font-size: .9rem; }
.bank-check { margin: 0 0 8px; color: var(--subtle); font-size: .8rem; line-height: 1.5; }
.question-bank:not(:has(#show-checks:checked)) .bank-check { display: none; }
.research-page button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 700px) {
  .research-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .account-compact { max-width: clamp(56px, 21vw, 100px); }
  .research { width: calc(100% - 28px); }
  .welcome { padding-block: 26px 34px; }
  .conversation { padding-top: 16px; }
  .message { scroll-margin-top: 130px; }
}
@media (max-width: 540px) {
  #ask-form { border-radius: 16px; padding: 11px; }
  .composer-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .mode-control { flex: auto; }
  .mode-stops button { padding-block: 5px; }
  .composer-actions { justify-content: end; }
  .message.user { max-width: 87%; }
}
@media (prefers-reduced-motion: reduce) {
  .mode-control[data-level="5"] .mode-track span::before,
  .mode-control[data-level="5"] .mode-track span::after { animation: none; }
}

.mode-picker { position: relative; min-width: 0; }
.mode-picker summary {
  display: flex; align-items: center; gap: 7px; list-style: none; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  color: #c2d1e1; font-size: .82rem; white-space: nowrap;
}
.mode-picker summary::-webkit-details-marker { display: none; }
.mode-picker summary::marker { content: ""; }
.mode-picker summary strong { color: var(--accent); }
.mode-picker summary:hover, .mode-picker[open] summary { background: #20354a; }
.mode-picker[open] .account-chevron { transform: rotate(225deg) translate(-1px, -1px); }
.mode-picker .mode-control {
  position: absolute; z-index: 4; left: 0; bottom: calc(100% + 10px);
  width: min(356px, calc(100vw - 56px)); padding: 12px;
  background: #182638; border: 1px solid #405973; border-radius: 14px;
  box-shadow: 0 14px 36px #070c14a8;
}
.mode-picker .mode-cost { grid-column: 1 / -1; margin-top: 5px; }
@media (max-width: 540px) {
  .composer-tools { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
