/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 2px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: #f7e7c5;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  background:
    linear-gradient(145deg, rgba(200, 163, 90, 0.35), rgba(179, 58, 58, 0.28)),
    #102436;
  border: 1px solid rgba(200, 163, 90, 0.60);
  box-shadow: inset 0 0 20px rgba(200, 163, 90, 0.12), 0 8px 22px rgba(0, 0, 0, 0.25);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--paper);
}

.brand-copy small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 13, 22, 0.32);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  transition: 0.2s ease;
}

.nav-btn:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  color: #1d2730;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 18px rgba(200, 163, 90, 0.22);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
}

.nav-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.select-wrap {
  position: relative;
}

.select {
  appearance: none;
  min-width: 84px;
  padding: 7px 26px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  background-color: rgba(255, 255, 255, 0.025);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.select:hover {
  border-color: rgba(200, 163, 90, 0.45);
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Layout / views
   -------------------------------------------------------------------------- */
.main {
  flex: 1;
  padding-top: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeUp 0.35s ease both;
}

.hero-grid {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 306px;
  gap: 14px;
  align-items: stretch;
}

.compass-panel,
.chat-panel,
.insight-panel {
  padding: 16px;
  min-width: 0;
}

.compass-panel {
  display: flex;
  flex-direction: column;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  height: clamp(620px, calc(100vh - 255px), 790px);
  min-height: 560px;
}

.insight-panel {
  display: flex;
  flex-direction: column;
  max-height: clamp(620px, calc(100vh - 255px), 790px);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
}

.panel-hint {
  color: var(--muted-2);
  font-size: 10px;
  text-align: right;
}

.section-divider {
  margin: 16px 0;
}

/* --------------------------------------------------------------------------
   Compass
   -------------------------------------------------------------------------- */
.compass-wrap {
  position: relative;
  width: min(100%, 264px);
  aspect-ratio: 1;
  margin: 18px auto 8px;
  flex: 0 0 auto;
}

.compass-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--line);
  pointer-events: none;
}

.ring-1 {
  inset: 0;
  border-style: dashed;
  border-color: rgba(200, 163, 90, 0.25);
  animation: spin 120s linear infinite;
}

.ring-2 {
  inset: 12%;
  border-color: rgba(111, 168, 160, 0.22);
  animation: spin 90s linear infinite reverse;
}

.ring-3 {
  inset: 25%;
  border-color: rgba(200, 163, 90, 0.28);
}

.compass-tick {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(200, 163, 90, 0.35) 0deg 0.5deg, transparent 0.5deg 15deg);
  mask-image: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%);
  opacity: 0.7;
}

.compass-cross {
  position: absolute;
  inset: 12%;
  pointer-events: none;
  opacity: 0.28;
}

.compass-cross::before,
.compass-cross::after {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.compass-cross::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.compass-cross::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(0deg, transparent, var(--gold), transparent);
}

.compass-core {
  position: absolute;
  inset: 33%;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  border: 1px solid rgba(200, 163, 90, 0.45);
  background:
    radial-gradient(circle at 35% 25%, rgba(200, 163, 90, 0.20), transparent 55%),
    rgba(8, 22, 35, 0.92);
  box-shadow: inset 0 0 30px rgba(200, 163, 90, 0.10), 0 0 40px rgba(0, 0, 0, 0.28);
}

.compass-core .core-label {
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: 0.16em;
  line-height: 1.15;
}

.compass-core .core-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.10em;
}

.compass-era {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  transition: 0.2s ease;
}

.compass-era:hover {
  color: var(--paper);
  background: rgba(200, 163, 90, 0.12);
}

.compass-era.active {
  color: #1d2730;
  background: var(--gold-soft);
  box-shadow: 0 4px 14px rgba(200, 163, 90, 0.22);
}

.compass-caption {
  margin: 8px 2px 0;
}

.context-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.context-label {
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.context-line strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.06em;
}

#context-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.quick-block {
  margin-top: 18px;
  flex: 1;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.quick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: left;
  transition: 0.2s ease;
}

.quick-item::before {
  content: "问";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 6px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 10px;
  background: rgba(200, 163, 90, 0.08);
  border: 1px solid rgba(200, 163, 90, 0.18);
}

.quick-item:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.compass-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.compass-foot .mini-seal {
  width: 22px;
  height: 22px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Chat
   -------------------------------------------------------------------------- */
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.chat-title strong {
  display: block;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-title small {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 10px;
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.seg-btn {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  transition: 0.2s ease;
}

.seg-btn.active {
  color: #17222d;
  background: var(--paper-2);
}

.seg-btn:hover {
  color: var(--paper);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 6px 10px 2px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar,
.timeline-scroll::-webkit-scrollbar,
.insight-panel::-webkit-scrollbar,
.case-content::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.chat-messages::-webkit-scrollbar-thumb,
.timeline-scroll::-webkit-scrollbar-thumb,
.insight-panel::-webkit-scrollbar-thumb,
.case-content::-webkit-scrollbar-thumb {
  background: rgba(200, 163, 90, 0.28);
  border-radius: 999px;
}

.chat-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 12px 30px;
}

.welcome-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.welcome-mark::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold);
}

.chat-empty h2 {
  margin: 0;
  max-width: 480px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.chat-empty p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.welcome-tip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.welcome-tip span {
  color: var(--gold);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  animation: fadeUp 0.25s ease both;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-top: 2px;
  border-radius: 8px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 13px;
  background: rgba(200, 163, 90, 0.09);
  border: 1px solid rgba(200, 163, 90, 0.24);
}

.message.user .message-avatar {
  color: #d8e7e4;
  background: rgba(111, 168, 160, 0.10);
  border-color: rgba(111, 168, 160, 0.25);
}

.message-body {
  max-width: min(86%, 740px);
  min-width: 0;
}

.message.user .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 4px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.message.user .message-meta {
  justify-content: flex-end;
}

.message-bubble {
  padding: 12px 14px;
  border-radius: 2px 14px 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 13px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.message.user .message-bubble {
  border-radius: 14px 2px 14px 14px;
  color: #1c2731;
  background: linear-gradient(135deg, #efe1c4, #d9c49b);
  border-color: rgba(200, 163, 90, 0.35);
}

.message-bubble > :first-child {
  margin-top: 0;
}

.message-bubble > :last-child {
  margin-bottom: 0;
}

.message-bubble h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 15px 0 7px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.message-bubble h3::before {
  content: "";
  width: 4px;
  height: 13px;
  border-radius: 2px;
  background: var(--gold);
  opacity: 0.8;
}

.message-bubble p {
  margin: 0 0 8px;
}

.message-bubble ul,
.message-bubble ol {
  margin: 6px 0 10px;
  padding-left: 1.3em;
}

.message-bubble li {
  margin: 3px 0;
}

.message-bubble strong {
  color: #f7e7c8;
  font-weight: 700;
}

.message.user .message-bubble strong {
  color: #14222e;
}

.message-bubble blockquote {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--gold);
  background: rgba(200, 163, 90, 0.07);
  color: var(--muted);
  font-size: 12px;
}

.message-bubble code {
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--teal-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(111, 168, 160, 0.09);
}

.message-bubble .cite {
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: 4px;
  color: var(--gold-soft);
  font-size: 10px;
  vertical-align: 1px;
  border: 1px solid rgba(200, 163, 90, 0.25);
  background: rgba(200, 163, 90, 0.08);
}

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

.typing-cursor::after {
  content: "▍";
  margin-left: 2px;
  color: var(--gold);
  animation: pulseInk 0.9s ease-in-out infinite;
}

.message-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.message-foot .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 2px 8px;
}

.suggestion-chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.02);
  transition: 0.2s ease;
}

.suggestion-chip:hover {
  color: var(--paper);
  border-color: rgba(200, 163, 90, 0.50);
  background: rgba(200, 163, 90, 0.08);
}

.composer {
  padding-top: 6px;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(3, 13, 22, 0.36);
  transition: 0.2s ease;
}

.composer-box:focus-within {
  border-color: rgba(200, 163, 90, 0.50);
  box-shadow: 0 0 0 3px rgba(200, 163, 90, 0.07);
}

.composer-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-bottom: 1px;
  border-radius: 8px;
  color: var(--muted-2);
  transition: 0.2s ease;
}

.composer-tool svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.composer-tool:hover,
.composer-tool.recording {
  color: var(--gold-soft);
  background: rgba(200, 163, 90, 0.08);
}

.composer-tool.recording {
  animation: pulseInk 1.2s ease-in-out infinite;
}

#chat-input {
  flex: 1;
  min-height: 30px;
  max-height: 150px;
  padding: 5px 3px;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.65;
  background: transparent;
}

#chat-input::placeholder {
  color: var(--muted-2);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  color: #1b2631;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  transition: 0.2s ease;
}

.send-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.send-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 3px 0;
  color: var(--muted-2);
  font-size: 9.5px;
}

.composer-mode {
  color: var(--gold-soft);
}

/* --------------------------------------------------------------------------
   Insight panel
   -------------------------------------------------------------------------- */
.insight-panel {
  overflow-y: auto;
}

.reference-list {
  margin-top: 10px;
}

.ref-card {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.ref-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ref-title {
  color: var(--paper);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
}

.ref-score {
  flex-shrink: 0;
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.ref-meta {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.ref-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.source-card {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line-cool);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(111, 168, 160, 0.055), rgba(255, 255, 255, 0.018));
}

.source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.source-title {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

.source-type {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--teal-soft);
  font-size: 8.5px;
  border: 1px solid rgba(111, 168, 160, 0.25);
  background: rgba(111, 168, 160, 0.07);
}

.source-quote {
  margin: 7px 0 0;
  padding-left: 8px;
  border-left: 1px solid rgba(200, 163, 90, 0.55);
  color: #d8d2c3;
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.7;
}

.source-translation {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.source-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 9px;
}

.reliability {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.rel-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.rel-dot.on {
  background: var(--gold);
}

.radar-wrap {
  min-height: 158px;
  display: grid;
  place-items: center;
}

.radar-svg {
  width: 170px;
  height: 150px;
  overflow: visible;
}

.radar-grid {
  fill: none;
  stroke: rgba(200, 163, 90, 0.18);
  stroke-width: 0.8;
}

.radar-axis {
  stroke: rgba(200, 163, 90, 0.18);
  stroke-width: 0.8;
}

.radar-poly {
  fill: rgba(111, 168, 160, 0.22);
  stroke: var(--teal);
  stroke-width: 1.2;
}

.radar-dot {
  fill: var(--gold-soft);
}

.radar-label {
  fill: var(--muted);
  font-size: 8px;
  font-family: var(--sans);
}

.competency-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--teal-soft);
  font-size: 9px;
  border: 1px solid rgba(111, 168, 160, 0.22);
  background: rgba(111, 168, 160, 0.06);
}

.note-teaser {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding-top: 2px;
}

.note-teaser strong {
  display: block;
  color: var(--paper);
  font-size: 11.5px;
}

.note-teaser p {
  margin: 3px 0 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */
.timeline-panel {
  margin-top: 14px;
  padding: 18px 18px 14px;
}

.timeline-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-head h2 {
  margin: 4px 0 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.06em;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted-2);
  font-size: 10px;
}

.timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.china { background: var(--gold); }
.legend-dot.world { background: var(--teal); }
.legend-dot.local { background: var(--red-soft); }

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}

.timeline-board {
  position: relative;
  min-width: 1080px;
  height: 250px;
  margin-top: 4px;
}

.timeline-axis {
  position: absolute;
  left: 72px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 163, 90, 0.36), transparent);
}

.timeline-axis.china-axis { top: 82px; }
.timeline-axis.world-axis { top: 164px; }

.track-label {
  position: absolute;
  left: 0;
  width: 62px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.track-label.china-label { top: 73px; }
.track-label.world-label { top: 155px; }
.track-label.local-label { top: 219px; }

.track-label small {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.event-node {
  position: absolute;
  transform: translateX(-50%);
  width: 112px;
  padding: 3px 2px;
  text-align: center;
  color: var(--muted);
  z-index: 2;
  transition: 0.2s ease;
}

.event-node.china { top: 38px; }
.event-node.china.lower { top: 92px; }
.event-node.world { top: 120px; }
.event-node.world.lower { top: 174px; }

.event-dot {
  width: 9px;
  height: 9px;
  margin: 0 auto 5px;
  border-radius: 50%;
  background: var(--navy-2);
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 163, 90, 0.06);
}

.event-node.world .event-dot {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(111, 168, 160, 0.06);
}

.event-node:hover .event-dot,
.event-node.active .event-dot {
  background: var(--gold);
  transform: scale(1.2);
}

.event-node.world:hover .event-dot,
.event-node.world.active .event-dot {
  background: var(--teal);
}

.event-date {
  display: block;
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
  white-space: nowrap;
}

.event-node.world .event-date {
  color: var(--teal-soft);
}

.event-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.event-node:hover .event-label {
  color: var(--paper);
}

.local-pins {
  position: absolute;
  left: 72px;
  right: 20px;
  top: 216px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.local-pin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid rgba(179, 58, 58, 0.28);
  border-radius: 999px;
  color: #d9a69b;
  font-size: 9px;
  background: rgba(179, 58, 58, 0.06);
  transition: 0.2s ease;
}

.local-pin::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red-soft);
}

.local-pin:hover {
  color: #f0c6bb;
  border-color: rgba(179, 58, 58, 0.55);
  background: rgba(179, 58, 58, 0.12);
}

.comparison-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.comparison-chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.02);
  transition: 0.2s ease;
}

.comparison-chip::before {
  content: "⇄";
  margin-right: 4px;
  color: var(--gold);
}

.comparison-chip:hover {
  color: var(--paper);
  border-color: rgba(200, 163, 90, 0.50);
  background: rgba(200, 163, 90, 0.08);
}

/* --------------------------------------------------------------------------
   Shared view header
   -------------------------------------------------------------------------- */
.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 4px 18px;
}

.view-head h1 {
  margin: 5px 0 4px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.view-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.view-head-seal {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid rgba(200, 163, 90, 0.45);
  border-radius: 12px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 29px;
  background: rgba(200, 163, 90, 0.06);
  transform: rotate(-3deg);
}

.view-head-seal.teal {
  color: var(--teal-soft);
  border-color: rgba(111, 168, 160, 0.42);
  background: rgba(111, 168, 160, 0.06);
}

.view-head-seal.red {
  color: #e7b1a6;
  border-color: rgba(179, 58, 58, 0.48);
  background: rgba(179, 58, 58, 0.08);
}

/* --------------------------------------------------------------------------
   Case
   -------------------------------------------------------------------------- */
.case-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.case-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.02);
  transition: 0.2s ease;
}

.case-tab .num {
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.case-tab:hover,
.case-tab.active {
  color: var(--paper);
  border-color: rgba(200, 163, 90, 0.48);
  background: rgba(200, 163, 90, 0.08);
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 14px;
  align-items: start;
}

.case-file,
.case-workspace {
  padding: 18px;
}

.case-file {
  position: sticky;
  top: 16px;
}

.case-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-soft);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.case-kicker .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.case-file h2 {
  margin: 8px 0 4px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.03em;
}

.case-meta {
  display: flex;
  gap: 12px;
  color: var(--muted-2);
  font-size: 10px;
}

.case-background {
  margin: 16px 0 12px;
  padding: 12px;
  border-left: 1px solid rgba(200, 163, 90, 0.5);
  background: rgba(200, 163, 90, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.case-question {
  color: #eadfc8;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
}

.case-hint {
  display: flex;
  gap: 7px;
  margin-top: 13px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
  background: rgba(111, 168, 160, 0.055);
  border: 1px solid var(--line-cool);
}

.case-hint::before {
  content: "引";
  color: var(--teal-soft);
  font-family: var(--serif);
}

.case-sources {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case-source {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
}

.case-source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.case-source-title {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
}

.case-source-meta {
  color: var(--muted-2);
  font-size: 9px;
}

.case-source-quote {
  margin: 8px 0 0;
  padding-left: 9px;
  border-left: 2px solid rgba(200, 163, 90, 0.42);
  color: #d8d2c3;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.75;
}

.case-source-translation {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.rating-label {
  flex: 0 0 68px;
  color: var(--muted);
  font-size: 9.5px;
}

.rating-slider {
  flex: 1;
  height: 3px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-soft), var(--gold), var(--teal));
  outline: none;
}

.rating-slider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 163, 90, 0.12);
  cursor: pointer;
}

.rating-value {
  width: 26px;
  text-align: right;
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.case-reasoning-wrap {
  margin-top: 14px;
}

.case-reasoning-wrap label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.case-reasoning-wrap label span {
  color: var(--muted-2);
  font-size: 9px;
}

.case-reasoning {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.7;
  background: rgba(3, 13, 22, 0.32);
  outline: none;
}

.case-reasoning:focus {
  border-color: rgba(200, 163, 90, 0.55);
}

.case-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  color: #1a2631;
  font-size: 11.5px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  transition: 0.2s ease;
}

.primary-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  transition: 0.2s ease;
}

.secondary-btn:hover {
  color: var(--paper);
  border-color: rgba(200, 163, 90, 0.48);
}

.case-result {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(200, 163, 90, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(200, 163, 90, 0.06), transparent 40%),
    rgba(255, 255, 255, 0.02);
  animation: fadeUp 0.35s ease both;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
}

.result-seal {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(179, 58, 58, 0.5);
  border-radius: 8px;
  color: #e4b3a9;
  font-family: var(--serif);
  font-size: 15px;
  background: rgba(179, 58, 58, 0.1);
  transform: rotate(-4deg);
}

.score-ring {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--score) * 1%), rgba(255, 255, 255, 0.07) 0);
  position: relative;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--navy);
}

.score-ring strong {
  position: relative;
  z-index: 1;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
}

.score-ring small {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
}

.dimension-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.dimension-row {
  display: grid;
  grid-template-columns: 62px 1fr 42px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 9.5px;
}

.dimension-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.dimension-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.dimension-row em {
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  text-align: right;
}

.feedback-box {
  margin-top: 12px;
  padding: 10px 11px;
  border-left: 2px solid var(--red-soft);
  border-radius: 0 8px 8px 0;
  background: rgba(179, 58, 58, 0.055);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.feedback-box strong {
  color: #e8b7ad;
  font-family: var(--serif);
  font-size: 12px;
}

.feedback-box ul {
  margin: 5px 0 0;
  padding-left: 1.15em;
}

.feedback-box li {
  margin: 2px 0;
}

.follow-up {
  margin-top: 9px;
  color: var(--teal-soft);
  font-size: 10.5px;
  line-height: 1.65;
}

.sample-answer {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.sample-answer summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
}

.sample-answer p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.75;
}

/* --------------------------------------------------------------------------
   Persona
   -------------------------------------------------------------------------- */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.persona-card {
  position: relative;
  padding: 16px 12px 13px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 163, 90, 0.10), transparent 56%),
    rgba(255, 255, 255, 0.022);
  transition: 0.25s ease;
  overflow: hidden;
}

.persona-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.55;
}

.persona-card:hover,
.persona-card.active {
  transform: translateY(-3px);
  border-color: rgba(200, 163, 90, 0.48);
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 163, 90, 0.18), transparent 58%),
    rgba(255, 255, 255, 0.04);
}

.persona-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 9px;
  border-radius: 50%;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 26px;
  border: 1px solid rgba(200, 163, 90, 0.40);
  background:
    radial-gradient(circle at 35% 25%, rgba(200, 163, 90, 0.28), transparent 60%),
    #102436;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.25);
}

.persona-name {
  display: block;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.08em;
}

.persona-era {
  display: block;
  margin-top: 2px;
  color: var(--gold-soft);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.persona-keywords {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 7px;
}

.persona-keywords span {
  padding: 1px 5px;
  border-radius: 999px;
  color: var(--muted-2);
  font-size: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.persona-room {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  animation: fadeUp 0.3s ease both;
}

.persona-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.persona-room-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.persona-room-title strong {
  display: block;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
}

.persona-room-title small {
  display: block;
  color: var(--muted-2);
  font-size: 9.5px;
}

.persona-chat {
  max-height: 430px;
  overflow-y: auto;
  padding: 14px 4px 8px;
}

.persona-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 0;
}

.persona-composer {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(3, 13, 22, 0.32);
}

.persona-composer textarea {
  flex: 1;
  min-height: 32px;
  max-height: 120px;
  padding: 5px;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 12px;
  background: transparent;
}

.persona-disclaimer {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Note
   -------------------------------------------------------------------------- */
.note-content {
  max-width: 1000px;
  margin: 0 auto;
}

.note-empty {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}

.note-empty .empty-seal {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border: 1px solid rgba(200, 163, 90, 0.36);
  border-radius: 14px;
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 34px;
  background: rgba(200, 163, 90, 0.06);
  transform: rotate(-4deg);
}

.note-empty h2 {
  margin: 0 0 5px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
}

.note-empty p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11.5px;
}

.note-paper {
  position: relative;
  padding: clamp(24px, 4vw, 48px);
  border-radius: 4px;
  color: #2b2a25;
  background:
    linear-gradient(90deg, rgba(120, 95, 50, 0.05) 1px, transparent 1px) 0 0 / 28px 100%,
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.55), transparent 45%),
    #f2ead9;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
}

.note-paper::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(120, 95, 50, 0.18);
  pointer-events: none;
}

.note-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(90, 70, 35, 0.22);
}

.note-head .note-kicker {
  color: #7d6a4a;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.note-head h1 {
  margin: 4px 0 2px;
  color: #2a2a22;
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: 0.08em;
}

.note-head p {
  margin: 0;
  color: #71664f;
  font-size: 10.5px;
}

.note-seal {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  border: 2px solid rgba(150, 45, 40, 0.7);
  border-radius: 10px;
  color: #96302b;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.1;
  text-align: center;
  transform: rotate(4deg);
  background: rgba(150, 45, 40, 0.045);
}

.note-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  margin-top: 18px;
}

.note-section {
  margin-bottom: 16px;
}

.note-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  color: #6d4d31;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.note-section h3::before {
  content: "";
  width: 12px;
  height: 1px;
  background: #9b6b45;
}

.note-section p {
  margin: 0;
  color: #3d3a31;
  font-size: 12px;
  line-height: 1.8;
}

.note-section ul {
  margin: 3px 0 0;
  padding-left: 1.2em;
  color: #3d3a31;
  font-size: 11.5px;
  line-height: 1.75;
}

.note-section li {
  margin: 2px 0;
}

.note-evidence {
  padding: 9px 10px;
  margin-bottom: 7px;
  border-left: 2px solid #a9784f;
  background: rgba(150, 110, 60, 0.055);
}

.note-evidence strong {
  display: block;
  color: #4d3a27;
  font-family: var(--serif);
  font-size: 11.5px;
}

.note-evidence p {
  margin: 3px 0 0;
  color: #5b5243;
  font-size: 10.5px;
  line-height: 1.65;
}

.note-myview textarea {
  width: 100%;
  min-height: 110px;
  padding: 9px;
  border: 1px solid rgba(120, 95, 50, 0.22);
  border-radius: 4px;
  color: #302d25;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.8;
  background: rgba(255, 255, 255, 0.30);
  outline: none;
}

.note-myview textarea:focus {
  border-color: rgba(120, 95, 50, 0.55);
}

.note-radar {
  display: grid;
  place-items: center;
  padding: 6px 0;
}

.note-radar .radar-svg {
  width: 210px;
  height: 180px;
}

.note-radar .radar-label {
  fill: #6f6048;
}

.note-radar .radar-grid,
.note-radar .radar-axis {
  stroke: rgba(90, 70, 35, 0.20);
}

.note-radar .radar-poly {
  fill: rgba(111, 168, 160, 0.20);
  stroke: #4f837c;
}

.note-radar .radar-dot {
  fill: #9b6b45;
}

.note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(90, 70, 35, 0.18);
}

.note-actions .primary-btn {
  color: #f5ecd9;
  background: #1f3b45;
}

.note-actions .secondary-btn {
  color: #5b4a35;
  border-color: rgba(90, 70, 35, 0.22);
}

.note-actions .secondary-btn:hover {
  color: #2d2519;
  border-color: rgba(90, 70, 35, 0.45);
}

.note-date {
  color: #8d7b5e;
  font-family: var(--mono);
  font-size: 9px;
}

/* --------------------------------------------------------------------------
   Toast / modal
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.6;
  background: rgba(12, 28, 43, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
  animation: fadeUp 0.25s ease both;
}

.toast.warning {
  border-color: rgba(200, 163, 90, 0.48);
  color: #ead9b7;
}

.toast.error {
  border-color: rgba(179, 58, 58, 0.52);
  color: #ecc3bb;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 9, 15, 0.72);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--navy-2);
  box-shadow: var(--shadow);
  animation: fadeUp 0.25s ease both;
}

.modal h3 {
  margin: 0 0 6px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 20px;
}

.modal p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.modal input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-align: center;
  background: rgba(3, 13, 22, 0.38);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 2px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.footer-dot {
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1320px) {
  .hero-grid {
    grid-template-columns: 268px minmax(0, 1fr) 284px;
  }

  .chat-panel {
    height: clamp(590px, calc(100vh - 250px), 750px);
  }

  .insight-panel {
    max-height: clamp(590px, calc(100vh - 250px), 750px);
  }

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

@media (max-width: 1140px) {
  .topbar {
    flex-wrap: wrap;
  }

  .brand {
    min-width: 190px;
  }

  .topbar-actions {
    margin-left: 0;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .hero-grid {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .insight-panel {
    grid-column: 1 / -1;
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 18px;
    align-items: start;
  }

  .insight-panel > .panel-heading {
    grid-column: 1 / -1;
  }

  .insight-panel .section-divider {
    display: none;
  }

  .insight-panel .note-teaser {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

  .chat-panel {
    height: clamp(580px, calc(100vh - 290px), 740px);
  }

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

@media (max-width: 860px) {
  .app-shell {
    padding: 12px 12px 22px;
  }

  .topbar {
    gap: 10px;
    padding-bottom: 12px;
  }

  .brand-copy small {
    display: none;
  }

  .brand-copy strong {
    font-size: 19px;
  }

  .brand-seal {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .select {
    min-width: 70px;
    padding: 6px 22px 6px 8px;
  }

  .status-pill {
    display: none;
  }

  .main {
    padding-top: 12px;
  }

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

  .compass-panel {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }

  .compass-panel > .panel-heading {
    grid-column: 1 / -1;
  }

  .compass-wrap {
    width: 210px;
    margin: 6px auto;
    grid-row: span 3;
  }

  .compass-caption {
    align-self: end;
  }

  .quick-block {
    margin-top: 4px;
  }

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

  .compass-foot {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .chat-panel {
    height: 70vh;
    min-height: 520px;
  }

  .insight-panel {
    display: block;
    max-height: none;
  }

  .insight-panel .section-divider {
    display: block;
  }

  .timeline-board {
    min-width: 980px;
  }

  .case-layout {
    grid-template-columns: 1fr;
  }

  .case-file {
    position: static;
  }

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

  .note-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .note-paper {
    padding: 24px 18px;
  }

  .note-head h1 {
    font-size: 23px;
  }

  .view-head h1 {
    font-size: 26px;
  }

  .view-head-seal {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    font-size: 23px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand {
    min-width: 0;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-actions .ghost-btn {
    display: none;
  }

  .select-wrap:nth-of-type(2) {
    display: none;
  }

  .main-nav {
    justify-content: space-between;
    gap: 2px;
    padding: 3px;
  }

  .nav-btn {
    flex: 1;
    justify-content: center;
    padding: 7px 4px;
    font-size: 11px;
  }

  .nav-btn .nav-icon {
    display: none;
  }

  .compass-panel {
    display: block;
  }

  .compass-wrap {
    width: 220px;
  }

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

  .chat-panel {
    height: 76vh;
    min-height: 500px;
    padding: 12px;
  }

  .chat-tools .segmented {
    display: none;
  }

  .message-body {
    max-width: 92%;
  }

  .message-bubble {
    font-size: 12.5px;
  }

  .timeline-head {
    display: block;
  }

  .timeline-legend {
    margin-top: 8px;
  }

  .timeline-board {
    min-width: 900px;
  }

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

  .persona-card {
    padding: 12px 8px;
  }

  .persona-icon {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }

  .case-file,
  .case-workspace {
    padding: 14px;
  }

  .case-file h2 {
    font-size: 21px;
  }

  .dimension-row {
    grid-template-columns: 56px 1fr 38px;
  }

  .result-head {
    align-items: center;
  }

  .score-ring {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  .score-ring strong {
    font-size: 19px;
  }

  .note-paper {
    padding: 20px 14px;
  }

  .note-head {
    display: block;
  }

  .note-seal {
    width: 48px;
    height: 48px;
    font-size: 17px;
    margin-top: 10px;
  }

  .note-actions {
    flex-wrap: wrap;
  }

  .toast-stack {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

@media print {
  body {
    background: #fff;
    color: #222;
  }

  .starfield,
  .topbar,
  .footer,
  .view:not(#view-note),
  .note-actions,
  .toast-stack,
  .modal-backdrop {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .main {
    padding: 0;
  }

  #view-note {
    display: block !important;
  }

  .note-content {
    max-width: none;
  }

  .note-paper {
    box-shadow: none;
    border-radius: 0;
    padding: 12mm;
    background: #fff;
  }

  .note-paper::before {
    border-color: rgba(0, 0, 0, 0.12);
  }

  .note-myview textarea {
    border: 0;
    background: transparent;
    resize: none;
    min-height: 70px;
  }

  .note-section p,
  .note-section li,
  .note-evidence p {
    color: #333;
  }
}

/* --------------------------------------------------------------------------
   Period-column timeline (readable dual track)
   -------------------------------------------------------------------------- */
.timeline-columns {
  display: flex;
  gap: 10px;
  min-width: max-content;
  padding: 6px 2px 8px;
}

.period-column {
  flex: 0 0 208px;
  width: 208px;
  padding: 10px 11px 12px;
  border-left: 1px solid rgba(200, 163, 90, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 70%);
  border-radius: 0 8px 8px 0;
}

.period-column:first-child {
  border-left-color: rgba(200, 163, 90, 0.42);
}

.period-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.period-num {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  opacity: 0.75;
}

.period-head strong {
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.period-head small {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 8.5px;
}

.track-block {
  margin-top: 9px;
}

.track-cap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.track-cap::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

.track-block.world .track-cap::before {
  background: var(--teal);
}

.tl-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tl-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 5px;
  text-align: left;
  transition: 0.18s ease;
}

.tl-item:hover {
  border-color: rgba(200, 163, 90, 0.28);
  background: rgba(200, 163, 90, 0.055);
  transform: translateX(1px);
}

.tl-date {
  color: var(--gold-soft);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
}

.track-block.world .tl-date {
  color: var(--teal-soft);
}

.tl-label {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.tl-item:hover .tl-label {
  color: var(--paper);
}

.local-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px dashed rgba(179, 58, 58, 0.18);
}

.local-item {
  padding: 3px 6px;
  border: 1px solid rgba(179, 58, 58, 0.25);
  border-radius: 999px;
  color: #d9a69b;
  font-size: 8.5px;
  background: rgba(179, 58, 58, 0.05);
  transition: 0.18s ease;
}

.local-item:hover {
  color: #f0c6bb;
  border-color: rgba(179, 58, 58, 0.5);
  background: rgba(179, 58, 58, 0.11);
}

@media (max-width: 560px) {
  .period-column {
    flex-basis: 184px;
    width: 184px;
  }
}

.thinking-text {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  animation: pulseInk 1.4s ease-in-out infinite;
}

.timeline-empty {
  display: block;
  padding: 2px 4px;
  color: var(--muted-2);
  font-size: 9px;
  opacity: 0.6;
}

.message-foot .icon-btn {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.message-foot .icon-btn svg {
  width: 13px;
  height: 13px;
}

/* Keep the note action visible; only the reference list scrolls. */
.insight-panel {
  overflow: hidden;
}

#reference-list {
  flex: 1 1 auto;
  min-height: 110px;
  overflow-y: auto;
  padding-right: 3px;
}

@media (max-width: 1140px) {
  .insight-panel {
    overflow: visible;
  }

  #reference-list {
    max-height: 360px;
  }
}

@media (max-width: 860px) {
  .chat-panel {
    order: -1;
  }
}

@media (max-width: 860px) {
  .chat-panel { order: -1; }
  .insight-panel { order: 0; }
  .compass-panel { order: 1; }
}

@page {
  size: A4;
  margin: 10mm;
}
