:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #101828;
  --text: #152033;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --green: #12b76a;
  --green-soft: #ecfdf3;
  --amber: #f79009;
  --amber-soft: #fffaeb;
  --red: #f04438;
  --red-soft: #fef3f2;
  --purple: #7c3aed;
  --purple-soft: #f4f3ff;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 10px 28px rgba(16, 24, 40, 0.06);
  --radius: 22px;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-soft: #182235;
  --surface-strong: #eff6ff;
  --text: #eef4ff;
  --muted: #a9b7cd;
  --faint: #718096;
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .18);
  --brand: #60a5fa;
  --brand-dark: #bfdbfe;
  --brand-soft: rgba(96, 165, 250, .13);
  --green-soft: rgba(18, 183, 106, .14);
  --amber-soft: rgba(247, 144, 9, .14);
  --red-soft: rgba(240, 68, 56, .14);
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, .22);
}

:root[data-density="compact"] {
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, .08), transparent 32rem),
    linear-gradient(180deg, #f7f9fd 0%, var(--bg) 45%, #eef2f7 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 0%, rgba(96, 165, 250, .14), transparent 32rem),
    linear-gradient(180deg, #0b1220 0%, #101827 55%, #0b1220 100%);
}

:root[data-density="compact"] .content {
  gap: 14px;
  padding: 16px;
}

:root[data-density="compact"] .card,
:root[data-density="compact"] .hero-card,
:root[data-density="compact"] .page-hero,
:root[data-density="compact"] .profile-hero,
:root[data-density="compact"] .metric-card,
:root[data-density="compact"] .item-card,
:root[data-density="compact"] .forum-post,
:root[data-density="compact"] .list-item {
  padding: 14px;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
  transition: .16s ease;
}

button:hover,
.link-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button:active,
.link-btn:active {
  transform: translateY(0) scale(.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: .6;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, .6);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

textarea {
  min-height: 120px;
  resize: vertical;
  padding: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.06;
  letter-spacing: -.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -.02em;
}

h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--surface-strong), #1d4ed8);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .24);
}

.brand b {
  display: block;
  font-size: 17px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  color: #475467;
  padding: 11px 12px;
  transition: .16s ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-item.active {
  font-weight: 800;
}

.nav-icon {
  width: 23px;
  text-align: center;
}

.side-card {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 15px;
}

.side-card b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.side-card p {
  margin: 0;
  font-size: 13px;
}

.danger-card {
  background: var(--red-soft);
  border-color: #fecdca;
}

.status-dot,
.live-dot:before {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 183, 106, .12);
}

.status-dot.danger {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(240, 68, 56, .12);
}

.page {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  border-bottom: 1px solid rgba(228, 231, 236, .82);
  background: rgba(244, 246, 251, .86);
  padding: 14px 24px;
  backdrop-filter: blur(18px);
}

.icon-btn {
  display: none;
  width: 42px;
  padding: 0;
}

.top-title {
  min-width: 180px;
}

.top-title b,
.top-title span {
  display: block;
}

.top-title span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 34vw);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 0 12px;
}

.search-box span {
  color: var(--faint);
  font-size: 13px;
}

.search-box input {
  min-height: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.search-box input:focus {
  box-shadow: none;
}

.top-stats {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.top-stats span,
.safe-badge,
.risk-banner,
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 11px;
  white-space: nowrap;
  font-size: 13px;
}

.top-stats b {
  color: var(--text);
}

.primary {
  border-color: transparent !important;
  background: var(--surface-strong) !important;
  color: #fff !important;
  font-weight: 800;
}

.primary:hover {
  background: #1d2939 !important;
  box-shadow: 0 14px 30px rgba(16, 24, 40, .18);
}

.content {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.right-panel {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, .56);
  padding: 22px 16px;
}

.card,
.hero-card,
.page-hero,
.profile-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 20px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(16, 24, 40, .92), rgba(29, 78, 216, .86)),
    radial-gradient(circle at 90% 0%, rgba(124, 58, 237, .55), transparent 28rem);
}

.hero-card:after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -140px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
}

.hero-card p,
.hero-card .kicker {
  color: rgba(255, 255, 255, .76);
}

.kicker,
.eyebrow {
  display: block;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero-result,
.draw-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 24px 0;
}

.balls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.balls span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 950;
  animation: ball-pop .42s ease both;
  animation-delay: calc(var(--ball-index, 0) * 70ms);
}

.hero-card .balls span {
  background: rgba(255, 255, 255, .13);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .18);
}

.balls.large span {
  width: 70px;
  height: 70px;
  border-radius: 22px;
  font-size: 32px;
}

[data-latest-sum] {
  display: block;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
  letter-spacing: -.04em;
}

.tag-row,
.action-row,
.segmented,
.chip-grid,
.table-tools,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag,
.chip,
.source-status,
.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.hero-card .tag {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.wide {
  width: 100%;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head.compact {
  margin-bottom: 14px;
}

.section-head.compact h2,
.section-head.compact h3 {
  margin: 0;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: -.03em;
}

.metric-card small {
  display: block;
  color: var(--faint);
  margin-top: 6px;
}

.work-grid,
.draw-layout,
.prediction-layout,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr);
  gap: 20px;
}

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

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

.item-card,
.forum-post,
.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 16px;
}

.interactive-card,
.clickable-row,
.bar,
.floating-snapshot button {
  cursor: pointer;
}

.interactive-card {
  transition: .18s ease;
}

.interactive-card:hover {
  border-color: rgba(37, 99, 235, .32);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.clickable-row {
  transition: .14s ease;
}

.clickable-row:hover {
  background: var(--brand-soft);
}

.item-card h3,
.forum-post h3,
.list-item h3 {
  margin-bottom: 8px;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
}

.list,
.feed-list,
.timeline,
.source-list,
.rule-list,
[data-room-tabs] {
  display: grid;
  gap: 10px;
}

.feed-list p,
.timeline p,
.rule-list p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 10px 12px;
}

.mini-profile {
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--surface-strong);
  color: #fff;
  font-weight: 900;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-row b,
.profile-row small {
  display: block;
}

.profile-row small {
  color: var(--muted);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.segmented {
  margin-bottom: 14px;
}

.segmented button,
.chip-grid button,
.table-tools button,
[data-room-tabs] button {
  background: var(--surface-soft);
}

.segmented button.active,
.chip-grid button.active,
.table-tools button.active,
[data-room-tabs] button.active {
  border-color: rgba(37, 99, 235, .42);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.form-note {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.smart-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 13px 14px;
}

.smart-panel b {
  display: block;
  margin-bottom: 6px;
}

.smart-panel p {
  margin: 0;
}

.smart-panel.warning {
  border-color: #fedf89;
  background: var(--amber-soft);
}

.post-compose-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.post-compose-tools button {
  background: var(--surface-soft);
}

.post-compose-tools span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.post-live-preview {
  margin-top: 12px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .08), transparent 42%),
    var(--surface-soft);
  padding: 15px;
  animation: reveal-up .18s ease both;
}

.community-workbench {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .1), transparent 30%),
    radial-gradient(circle at bottom right, rgba(18, 183, 106, .09), transparent 34%),
    var(--surface);
}

.community-desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 16px;
}

.hot-post-list,
.template-chip-list {
  display: grid;
  gap: 9px;
}

.hot-post-list button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  justify-items: start;
  gap: 2px 10px;
  min-height: 62px;
  text-align: left;
  background: rgba(255, 255, 255, .72);
}

:root[data-theme="dark"] .hot-post-list button {
  background: rgba(255, 255, 255, .04);
}

.hot-post-list span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.hot-post-list small,
.template-grid p,
.history-list small {
  color: var(--muted);
}

.template-chip-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-chip-list button {
  min-height: 48px;
  background: var(--surface-soft);
  font-weight: 900;
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.reaction-row button {
  min-height: 34px;
  border-radius: 999px;
  background: var(--surface);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.reaction-row button.active {
  border-color: rgba(18, 183, 106, .38);
  background: var(--green-soft);
  color: var(--green);
}

.reaction-row span {
  margin-right: 4px;
}

.reaction-row b {
  margin-left: 4px;
}

.assistant-hero,
.guide-progress {
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .1), transparent 46%),
    var(--surface-soft);
  padding: 16px;
}

.assistant-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0;
}

.assistant-hero span,
.guide-progress span {
  color: var(--muted);
  font-size: 13px;
}

.assistant-hero b,
.guide-progress b {
  display: block;
  font-size: 28px;
  letter-spacing: -.03em;
}

.assistant-hero p {
  margin: 0;
}

.assistant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.assistant-grid article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.assistant-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.assistant-grid b {
  display: block;
  margin: 5px 0;
}

.guide-progress {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.guide-step-list {
  display: grid;
  gap: 10px;
}

.guide-step-list article {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.guide-step-list article > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.guide-step-list article.done {
  border-color: rgba(18, 183, 106, .28);
  background: var(--green-soft);
}

.guide-step-list h3 {
  margin-bottom: 4px;
}

.guide-step-list p {
  margin-bottom: 10px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 6px;
}

.auth-tabs button {
  border-color: transparent;
  background: transparent;
  font-weight: 900;
}

.auth-tabs button.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: var(--shadow-soft);
}

.auth-form[hidden] {
  display: none;
}

.account-card {
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .1), transparent 42%),
    var(--surface-soft);
  padding: 16px;
  margin: 16px 0;
}

.backtest-controls {
  margin-top: 14px;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.mini-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.preview-meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(152, 162, 179, .18);
  overflow: hidden;
  margin-top: 10px;
}

.preview-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.wide-field {
  grid-column: span 2;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 13px;
}

.source-row strong,
.source-row small {
  display: block;
}

.source-row small {
  color: var(--muted);
  margin-top: 4px;
}

.mini-btn {
  min-height: 28px;
  border-radius: 999px;
  margin-left: 8px;
  padding: 4px 9px;
  font-size: 12px;
}

.compare-workbench,
.algorithm-workbench,
.algorithm-compare-workbench,
.author-watch-panel,
.community-workbench,
.draw-filter-panel {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .06), transparent 38%),
    var(--surface);
}

.compare-strip,
.algorithm-compare-strip,
.toolkit-grid,
.compare-detail,
.algorithm-compare-detail {
  display: grid;
  gap: 10px;
}

.compare-strip,
.algorithm-compare-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compare-strip button,
.algorithm-compare-strip button,
.toolkit-grid button {
  display: grid;
  justify-items: start;
  min-height: 82px;
  text-align: left;
  background: var(--surface-soft);
}

.compare-strip span,
.compare-strip small,
.algorithm-compare-strip span,
.algorithm-compare-strip small,
.toolkit-grid small {
  color: var(--muted);
}

.toolkit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compare-detail article,
.algorithm-compare-detail article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.compare-detail article strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: -.04em;
}

.algorithm-compare-detail {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.author-watch-grid,
.consensus-filter-row,
.consensus-row,
.reaction-row,
.topic-radar,
.topic-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.author-watch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .1), transparent 34%),
    var(--surface-soft);
  padding: 14px;
}

.author-watch-card > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}

.author-watch-card small {
  grid-column: 2;
  color: var(--muted);
}

.avatar.small {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.consensus-filter-row {
  margin: 12px 0 16px;
}

.consensus-filter-row button,
.consensus-row button,
.reaction-row button,
.topic-line button {
  min-height: 34px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.consensus-filter-row button.active,
.consensus-row button.active,
.reaction-row button.active,
.topic-line button.active {
  border-color: rgba(37, 99, 235, .45);
  background: rgba(37, 99, 235, .1);
  color: var(--brand);
}

.topic-radar {
  margin: 12px 0 16px;
}

.topic-radar button {
  display: grid;
  justify-items: start;
  min-width: 178px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, .12), transparent 40%),
    var(--surface-soft);
  text-align: left;
}

.topic-radar button.active {
  border-color: rgba(16, 185, 129, .42);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, .18), transparent 42%),
    var(--surface-soft);
}

.topic-radar small,
.topic-line {
  color: var(--muted);
}

.topic-line {
  align-items: center;
  margin: 10px 0;
}

.featured-strip {
  border: 1px solid rgba(245, 158, 11, .18);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, .1), transparent 40%),
    var(--surface-soft);
  margin-top: 16px;
  padding: 14px;
}

.consensus-row {
  margin: 12px 0;
}

.consensus-row b,
.reaction-row b {
  margin-left: 5px;
}

.rating-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  border: 1px solid rgba(245, 158, 11, .22);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, .12), rgba(37, 99, 235, .05));
  color: var(--text);
  margin: 12px 0;
  padding: 7px 11px;
}

.rating-summary small {
  color: var(--muted);
}

.stars {
  display: inline-flex;
  gap: 2px;
  color: rgba(148, 163, 184, .65);
  letter-spacing: -1px;
}

.stars .on {
  color: #f59e0b;
  text-shadow: 0 4px 14px rgba(245, 158, 11, .28);
}

.rating-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.rating-picker label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: #f59e0b;
  cursor: pointer;
  transition: .16s ease;
}

.rating-picker label:hover,
.rating-picker label.active {
  border-color: rgba(245, 158, 11, .45);
  background: rgba(245, 158, 11, .12);
  transform: translateY(-1px);
}

.rating-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.author-profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .16), transparent 36%),
    var(--surface-soft);
  margin-bottom: 14px;
  padding: 16px;
}

.avatar.large {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  font-size: 26px;
}

.author-profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.author-profile-metrics article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 12px;
}

.author-profile-metrics span,
.author-profile-metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.author-profile-metrics b {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  letter-spacing: -.04em;
}

.author-profile-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.author-profile-list button {
  display: grid;
  justify-items: start;
  min-height: 66px;
  background: var(--surface-soft);
  text-align: left;
}

.author-profile-list small,
.report-target-card small {
  color: var(--muted);
}

.report-target-card {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(239, 68, 68, .22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .08), transparent 45%),
    var(--surface-soft);
  margin: 12px 0;
  padding: 14px;
}

.template-chip-list.compact {
  margin-top: 14px;
}

.review-preview {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  padding: 16px;
}

.review-preview pre {
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text);
  font: inherit;
  line-height: 1.8;
  margin: 0;
}

.alert-strip,
.report-strip,
.alert-list,
.report-list {
  display: grid;
  gap: 10px;
}

.alert-strip,
.report-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.alert-card,
.report-card,
.report-strip button {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 13px;
}

.report-strip button {
  display: grid;
  justify-items: start;
  min-height: 72px;
  text-align: left;
}

.alert-card b,
.alert-card small,
.report-card b,
.report-card small,
.report-strip b,
.report-strip small {
  display: block;
}

.alert-card small,
.report-card small,
.report-strip small {
  color: var(--muted);
  margin-top: 5px;
}

.muted-card {
  opacity: .62;
  filter: grayscale(.35);
}

.source-ok,
.result-hit {
  background: var(--green-soft);
  color: #027a48;
}

.source-error,
.result-miss {
  background: var(--red-soft);
  color: #b42318;
}

.source-empty,
.source-idle {
  background: #f2f4f7;
  color: #475467;
}

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

.calc-panel p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 13px;
}

.keno-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.keno-grid span {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 8px 10px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 11px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trend-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(#eef2f6 1px, transparent 1px),
    var(--surface-soft);
  background-size: 100% 34px;
  padding: 16px;
}

.bar {
  flex: 1;
  min-width: 8px;
  border-radius: 999px 999px 5px 5px;
  background: linear-gradient(180deg, var(--brand), #93c5fd);
  position: relative;
  transition: .18s ease;
}

.bar:hover {
  filter: saturate(1.25);
  transform: translateY(-4px);
}

.bar:hover:after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

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

.heat-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 14px;
}

.heat-card strong {
  display: block;
  margin-bottom: 8px;
}

.insight-card {
  border-color: rgba(37, 99, 235, .18);
  background: linear-gradient(135deg, var(--surface), var(--brand-soft));
}

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

.insight-grid p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .46);
  padding: 14px;
}

:root[data-theme="dark"] .insight-grid p {
  background: rgba(255, 255, 255, .04);
}

.insight-grid b {
  display: block;
  color: var(--text);
  margin-bottom: 5px;
}

.sum-heatmap {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
}

.sum-heatmap button {
  display: grid;
  gap: 2px;
  min-height: 62px;
  border-color: rgba(37, 99, 235, calc(.1 + var(--heat) * .32));
  background: color-mix(in srgb, var(--brand) calc(var(--heat) * 42%), var(--surface));
}

.sum-heatmap b {
  font-size: 18px;
}

.sum-heatmap small {
  color: var(--muted);
}

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

.category-grid article {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  font-weight: 900;
}

.category-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}

.chat-box {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 520px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.chat-msg {
  max-width: 76%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 12px;
}

.chat-msg small {
  display: block;
  color: var(--faint);
  margin-top: 6px;
}

.risk-banner {
  border-color: #fedf89;
  background: var(--amber-soft);
  color: #b54708;
  font-weight: 800;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.empty {
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 24px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  max-width: 360px;
  border: 1px solid rgba(16, 24, 40, .12);
  border-radius: 16px;
  background: var(--surface-strong);
  color: #fff;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .24);
  padding: 14px 16px;
}

.toast.bad {
  background: #7a271a;
}

.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(16, 24, 40, .28);
  backdrop-filter: blur(5px);
}

.page-overlay[hidden],
.detail-drawer[hidden],
.command-palette[hidden] {
  display: none !important;
}

.detail-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 90;
  width: min(520px, calc(100vw - 28px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 28px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 28px 90px rgba(16, 24, 40, .24);
  padding: 26px;
  animation: drawer-in .2s ease both;
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  width: 38px;
  min-height: 38px;
  border-radius: 999px;
  padding: 0;
  font-size: 22px;
}

.drawer-hero {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.drawer-sum {
  display: block;
  font-size: 42px;
  letter-spacing: -.04em;
}

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.drawer-grid p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 14px;
}

.drawer-grid b {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.drawer-actions {
  margin-top: 18px;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding-top: min(9vh, 80px);
}

.command-card {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 26px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 28px 90px rgba(16, 24, 40, .22);
  padding: 18px;
  animation: command-in .18s ease both;
}

.command-card input {
  min-height: 54px;
  margin-bottom: 14px;
  font-size: 16px;
}

.command-close-btn {
  border-color: rgba(240, 68, 56, .18);
  background: var(--red-soft);
  color: #b42318;
  font-weight: 900;
}

.command-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.command-scopes button {
  min-height: 34px;
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 6px 12px;
  font-size: 13px;
}

.command-scopes button.active {
  border-color: rgba(37, 99, 235, .42);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.command-results {
  display: grid;
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
}

.command-results button {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas: "icon title" "icon desc";
  justify-content: stretch;
  text-align: left;
  gap: 2px 10px;
  min-height: 58px;
  padding: 10px 12px;
}

.command-results button span {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.command-results button b {
  grid-area: title;
}

.command-results button small {
  grid-area: desc;
  color: var(--muted);
}

.command-results button:after {
  content: attr(data-command-kind);
  grid-column: 2;
  justify-self: start;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--faint);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}

.search-result-list,
.draft-list,
.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-result-list button,
.history-list button {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  justify-items: start;
  gap: 4px 12px;
  min-height: 68px;
  text-align: left;
  background: var(--surface-soft);
}

.search-result-list button span,
.history-list button span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.search-result-list button small,
.history-list button small {
  color: var(--muted);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.template-grid article {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  padding: 16px;
}

.draft-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(124, 58, 237, .09), transparent 32%),
    var(--surface-soft);
  padding: 16px;
}

.draft-card p {
  margin-bottom: 10px;
}

.draft-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.draft-meta span {
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.snapshot-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .11), transparent 44%),
    var(--surface-soft);
  padding: 16px;
}

.snapshot-hero span {
  color: var(--muted);
  font-size: 13px;
}

.snapshot-hero b {
  display: block;
  margin: 3px 0;
  font-size: 26px;
  letter-spacing: -.03em;
}

.snapshot-hero p {
  margin: 0;
}

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

.snapshot-grid article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.snapshot-grid span,
.snapshot-grid small {
  display: block;
  color: var(--muted);
}

.snapshot-grid b {
  display: block;
  margin: 5px 0;
  font-size: 28px;
  letter-spacing: -.03em;
}

.snapshot-log {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.snapshot-log p {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px 12px;
}

.floating-actions {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 55;
  display: grid;
  gap: 8px;
}

.floating-actions button {
  min-width: 54px;
  min-height: 46px;
  border-color: rgba(16, 24, 40, .08);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.floating-snapshot {
  position: fixed;
  left: calc(260px + 24px);
  bottom: 18px;
  z-index: 54;
}

.floating-snapshot button {
  display: grid;
  justify-items: start;
  min-width: 230px;
  border-color: rgba(37, 99, 235, .18);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.floating-snapshot span,
.floating-snapshot small {
  color: var(--muted);
  font-size: 12px;
}

.floating-snapshot b {
  font-size: 16px;
}

.ticket {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  background: linear-gradient(135deg, #101828, #1d4ed8);
  color: #fff;
  padding: 24px;
}

.ticket:after {
  content: "";
  position: absolute;
  right: -48px;
  top: -48px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.ticket p,
.ticket .eyebrow {
  color: rgba(255, 255, 255, .75);
}

.ticket strong {
  display: block;
  font-size: 54px;
  margin: 16px 0 10px;
}

.ticket-points {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  padding: 8px 12px;
  font-weight: 900;
}

.ticket-hit {
  background: linear-gradient(135deg, #064e3b, #12b76a);
}

.ticket-miss {
  background: linear-gradient(135deg, #7a271a, #f04438);
}

.score-radar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.score-radar div {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, var(--surface) 68%, transparent 70% 100%),
    conic-gradient(var(--brand) calc(var(--score) * 1%), #eef2f6 0);
}

.score-radar span {
  color: var(--muted);
  font-size: 12px;
}

.score-radar b {
  font-size: 18px;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px;
}

.comment-head,
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.text-btn {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.comment-actions {
  justify-content: flex-start;
  margin-top: 8px;
}

.comment-actions button {
  min-height: 30px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
}

.comment-actions button.active {
  border-color: rgba(37, 99, 235, .45);
  background: rgba(37, 99, 235, .1);
  color: var(--brand);
}

.comment-item p {
  margin: 6px 0;
}

.comment-item small {
  color: var(--faint);
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.notice-stack button {
  display: grid;
  justify-items: start;
  text-align: left;
}

.notice-stack small {
  color: var(--muted);
}

.notice-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 13px;
}

.notice-item.warning {
  border-color: #fedf89;
  background: var(--amber-soft);
}

.bookmark-strip {
  margin-bottom: 14px;
}

.bookmark-strip button {
  display: grid;
  justify-items: start;
  min-height: 56px;
  text-align: left;
}

.bookmark-strip small {
  color: var(--muted);
}

.note-strip {
  margin-bottom: 14px;
}

.note-strip button,
.toolkit-strip button {
  display: grid;
  justify-items: start;
  text-align: left;
}

.note-strip p {
  margin: 4px 0 0;
}

.toolkit-strip {
  margin-bottom: 14px;
}

.toolkit-strip small {
  color: var(--muted);
}

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

.note-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.switch-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: flex-start;
  gap: 10px !important;
}

.switch-row input {
  width: auto;
  min-height: auto;
}

.note-content {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text);
  line-height: 1.8;
  padding: 16px;
}

.reveal-in {
  opacity: 0;
  animation: reveal-in .38s ease forwards;
}

@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ball-pop {
  from {
    opacity: .3;
    transform: translateY(8px) scale(.86);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes command-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }

  .search-box {
    width: min(340px, 32vw);
  }

  .floating-snapshot {
    left: 18px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 286px;
    transform: translateX(-105%);
    transition: .2s ease;
    box-shadow: var(--shadow);
  }

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

  .icon-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 12px;
  }

  .top-title span,
  .top-stats,
  .search-box {
    display: none;
  }

  .content {
    padding: 14px;
  }

  .hero-grid,
  .work-grid,
  .draw-layout,
  .prediction-layout,
  .admin-grid,
  .chat-layout,
  .ranking-grid,
  .compare-strip,
  .algorithm-compare-strip,
  .algorithm-compare-detail,
  .toolkit-grid,
  .alert-strip,
  .report-strip,
  .community-desk-grid,
  .template-grid,
  .assistant-grid {
    grid-template-columns: 1fr;
  }

  .assistant-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .card-grid,
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .floating-actions {
    grid-auto-flow: column;
    grid-auto-columns: min-content;
    right: 12px;
    left: 12px;
    bottom: 12px;
    justify-content: center;
  }

  .floating-snapshot {
    display: none;
  }

  .detail-drawer {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 86vh;
    border-radius: 26px 26px 0 0;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .mini-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .card-grid,
  .category-grid,
  .insight-grid,
  .calc-panel,
  .heat-grid,
  .compare-detail {
    grid-template-columns: 1fr;
  }

  .sum-heatmap {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-card,
  .page-hero,
  .card {
    padding: 17px;
    border-radius: 18px;
  }

  .hero-card {
    min-height: auto;
  }

  .balls.large span,
  .balls span {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    font-size: 22px;
  }

  .chip-grid {
    grid-template-columns: 1fr;
  }

  .template-chip-list {
    grid-template-columns: 1fr;
  }

  .drawer-grid,
  .score-radar,
  .snapshot-grid,
  .author-profile-metrics,
  .rating-picker {
    grid-template-columns: 1fr;
  }

  .snapshot-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .command-results button {
    grid-template-columns: 34px 1fr;
  }
}
