/* ==========================================================================
   Core-03 · Learning Core — 分析頁樣式
   延續 dashboard 淺色科技風 + 藍紫色學習核心主調
   ========================================================================== */

/* ---------- 主色變數 ---------- */
:root {
  --c3-primary: #4F46E5;
  --c3-primary-hover: #4338CA;
  --c3-primary-soft: #EEF2FF;
  --c3-primary-light: #C7D2FE;
  --c3-indigo-400: #818CF8;
  --c3-indigo-300: #A5B4FC;
  --c3-ink-op: #0F172A;
}

/* ---------- Topbar 麵包屑補充 ---------- */
.dash-top .top-crumb {
  flex-wrap: nowrap;
  min-width: 0;
}
.dash-top .top-crumb .cur,
.dash-top .top-crumb .sub,
.dash-top .top-crumb .crumb-link,
.dash-top .top-crumb .crumb-sep {
  white-space: nowrap;
}
.crumb-link {
  color: var(--nx-ink-500);
  text-decoration: none;
  transition: color 0.15s;
  font-family: var(--nx-font-sans);
  font-size: 15px;
}
.crumb-link:hover { color: var(--nx-primary); }
.crumb-sep {
  color: var(--nx-ink-300);
  font-family: var(--nx-font-mono);
  font-size: 13px;
  padding: 0 2px;
}
@media (max-width: 900px) {
  .dash-top .top-crumb .crumb-link,
  .dash-top .top-crumb .crumb-sep { display: none; }
}

/* ---------- Content wrapper 覆寫 ---------- */
.c3-content { padding-top: 10px; padding-bottom: 12px; }
/* Hero 頂邊距吃緊 */
.c3-hero { margin-top: 0; }

/* ==========================================================================
   HERO 區(壓低更多 · 桌機一頁式)
   ========================================================================== */
.c3-hero {
  position: relative;
  height: clamp(92px, 11vh, 118px);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.14);
  box-shadow:
    0 12px 28px -18px rgba(79, 70, 229, 0.18),
    0 4px 10px rgba(15, 23, 42, 0.04);
  isolation: isolate;
}
.c3-hero-svg,
.c3-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.c3-hero-canvas { z-index: 2; pointer-events: none; }
.c3-hero-svg { z-index: 1; }

.c3-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 11px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  pointer-events: none;
}
.c3-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.c3-hero-tag {
  font-family: var(--nx-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff;
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.4);
}
.c3-hero-tag-sub {
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(124, 58, 237, 0.78);
  white-space: nowrap;
}
.c3-hero-headline {
  font-family: var(--nx-font-sans);
  font-size: 19px;
  font-weight: 800;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  line-height: 1.15;
  background: linear-gradient(135deg, #1E1B4B 0%, #4F46E5 55%, #818CF8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.c3-hero-subline {
  margin-top: 6px;
  font-family: var(--nx-font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(49, 46, 129, 0.72);
  letter-spacing: 0.02em;
  line-height: 1.5;
}
@media (max-width: 640px) {
  .c3-hero-subline { font-size: 11.5px; }
}

/* 節點微微呼吸 */
.c3-nodes circle {
  filter: drop-shadow(0 0 4px rgba(129, 140, 248, 0.55));
}
@keyframes c3-node-breath {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.c3-nodes circle:nth-child(3n) { animation: c3-node-breath 3.2s ease-in-out infinite; }
.c3-nodes circle:nth-child(4n) { animation: c3-node-breath 4.5s ease-in-out infinite; animation-delay: -1.2s; }

/* ==========================================================================
   Core-03 AI 工作區(整合卡:整張深色連貫)
   ========================================================================== */
.c3-workspace {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.20);
  box-shadow:
    0 20px 40px -18px rgba(79, 70, 229, 0.28),
    0 4px 12px rgba(15, 23, 42, 0.06);
  background:
    radial-gradient(1200px 320px at 15% -10%, rgba(99, 102, 241, 0.14), transparent 70%),
    radial-gradient(800px 240px at 90% 110%, rgba(59, 130, 246, 0.08), transparent 70%),
    linear-gradient(180deg, #0B1220 0%, #0F172A 100%);
  position: relative;
  isolation: isolate;
}

/* 頂部資訊條(深色玻璃) */
.c3-ws-header {
  padding: 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(129, 140, 248, 0.18);
  background: rgba(15, 23, 42, 0.4);
  position: relative;
  z-index: 1;
}
.c3-ws-ident {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.c3-ws-status {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* 舊 sys 保留避免斷 (未使用) */
.c3-sys { display: none; }
.c3-sys-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Core-03 大字 · 深色底 */
.c3-sys-key {
  font-family: var(--nx-font-mono);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #A5B4FC;
  line-height: 1;
  padding-right: 16px;
  border-right: 1px solid rgba(129, 140, 248, 0.24);
  white-space: nowrap;
}
.c3-sys-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* 英文說明降低存在感：縮小字體、降低對比、放到次要位置 */
.c3-sys-en {
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(199, 210, 254, 0.40);
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
  order: 2;
}
/* 中文為主要閱讀內容 */
.c3-sys-tw {
  font-family: var(--nx-font-sans);
  font-size: 15px;
  font-weight: 700;
  color: #EEF2FF;
  letter-spacing: var(--nx-ls-snug);
  line-height: 1.15;
  white-space: nowrap;
  order: 1;
}

/* Ready chip 深色底適配 */
.c3-workspace .status-chip.is-ready.c3-sys-chip {
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  border-color: rgba(52, 211, 153, 0.36);
  padding: 5px 12px;
  font-weight: 700;
}
.c3-workspace .status-chip.is-ready.c3-sys-chip .dot {
  background: #34D399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.30), 0 0 8px rgba(52, 211, 153, 0.55);
}

/* 時鐘 - 深色底 · 簡化為一行 */
.c3-sys-clock {
  padding-left: 14px;
  border-left: 1px solid rgba(129, 140, 248, 0.24);
}
.c3-clock-value {
  font-family: var(--nx-font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #EEF2FF;
  letter-spacing: 0.02em;
  display: flex;
  gap: 8px;
  align-items: baseline;
  white-space: nowrap;
}
.c3-clock-value #c3ClockTime {
  color: #A5B4FC;
  font-variant-numeric: tabular-nums;
}
.c3-clock-sep { color: rgba(199, 210, 254, 0.35); }

/* ==========================================================================
   AI Operation Stream(整合於 workspace 內)
   ========================================================================== */
.c3-workspace .c3-ops-head {
  position: relative;
  z-index: 1;
  padding: 4px 18px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(129, 140, 248, 0.14);
  margin-bottom: 0;
}
/* 舊 panel/舊 ops 相容 */
.c3-ops-panel, .c3-ops { display: contents; }

.c3-ops-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--nx-font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #C7D2FE;
  white-space: nowrap;
}
.c3-ops-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(129, 140, 248, 0.18);
  color: #A5B4FC;
}
.c3-ops-title-sub {
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(199, 210, 254, 0.5);
  text-transform: none;
}
.c3-ops-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.c3-ops-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--nx-font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #6EE7B7;
  padding: 2px 8px 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.36);
}
.c3-ops-live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.30), 0 0 8px rgba(52, 211, 153, 0.55);
  animation: c3-live-pulse 2s ease-in-out infinite;
}
@keyframes c3-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.c3-ops-meta {
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  color: rgba(199, 210, 254, 0.45);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ========== 2×2 等比例 grid (桌機一頁式,固定行高) ========== */
.c3-ops-grid {
  position: relative;
  z-index: 1;
  padding: 6px 18px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 66px 66px;
  gap: 7px;
  min-height: 0;
}
.c3-ops-col {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 66px;
}
.c3-ops-col-head {
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  font-family: var(--nx-font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  color: rgba(199, 210, 254, 0.65);
  background: rgba(11, 18, 32, 0.6);
  flex-shrink: 0;
  white-space: nowrap;
}
.c3-ops-col-head span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c3-ops-col-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  animation: c3-live-pulse 2.4s ease-in-out infinite;
}
.c3-ops-col-body {
  flex: 1;
  padding: 7px 11px 8px;
  overflow: hidden;
  position: relative;
  font-family: var(--nx-font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: rgba(199, 210, 254, 0.72);
  /* 讓新內容從底部推入,舊的自然被上面遮住 */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* 頂部漸淡 mask,讓舊內容優雅褪去 */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 100%);
}
/* body 的直接子元素(log/token 行)不要 shrink */
.c3-ops-col-body > * {
  flex-shrink: 0;
}

/* Log 樣式 */
.c3-log-line {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  animation: c3-line-in 0.6s ease-out forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0;
  font-size: 10px;
  line-height: 1.5;
}
.c3-log-line .l-time { color: rgba(148, 163, 184, 0.5); margin-right: 4px; }
.c3-log-line .l-key { color: #A5B4FC; }
.c3-log-line .l-val { color: #FDE68A; }
.c3-log-line .l-ok { color: #6EE7B7; }
.c3-log-line .l-err { color: #FCA5A5; }
@keyframes c3-line-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Matrix canvas · 降低存在感 */
.c3-ops-col-matrix .c3-ops-col-body {
  padding: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 15%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 15%, #000 100%);
  display: block;
  opacity: 0.55;
}
.c3-ops-col-matrix canvas { display: block; width: 100%; height: 100%; }

/* Token 樣式 */
.c3-tok-line {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  animation: c3-line-in 0.6s ease-out forwards;
  padding: 0;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c3-tok-id { color: rgba(199, 210, 254, 0.5); }
.c3-tok-name { color: #C7D2FE; }
.c3-tok-vec { color: #FDBA74; }
.c3-tok-w { color: #C4B5FD; }

/* ========== AI Status(新 · 壓縮) ========== */
.c3-ops-col-status .c3-ops-col-body {
  -webkit-mask-image: none;
  mask-image: none;
  display: block;
  justify-content: initial;
  padding: 6px 11px 7px;
}
.c3-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3px 12px;
  height: 100%;
  align-content: center;
}
.c3-stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.c3-stat-label {
  font-family: var(--nx-font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(199, 210, 254, 0.5);
  flex-shrink: 0;
}
.c3-stat-value {
  font-family: var(--nx-font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #E0E7FF;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.c3-stat-value.c3-stat-ok { color: #6EE7B7; }

/* ==========================================================================
   策略選擇(緊湊版)
   ========================================================================== */
.c3-strats {
  margin-top: 10px;
  padding: 10px 20px 12px;
  background: #fff;
  border: 1px solid var(--nx-line);
  border-radius: var(--nx-r-lg);
  box-shadow: var(--nx-shadow-sm);
}
.c3-strats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
}
.c3-strats-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.c3-strats-title h2 {
  margin: 0;
  font-family: var(--nx-font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  white-space: nowrap;
}
/* 即時時鐘 chip (取代 Energy) */
.c3-strats-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(165, 180, 252, 0.03));
  border: 1px solid rgba(99, 102, 241, 0.18);
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--c3-primary);
}
.c3-clock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c3-primary);
  opacity: 0.85;
}
.c3-strats-clock-value {
  font-family: var(--nx-font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--c3-primary);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.c3-strat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.c3-strat {
  all: unset;
  cursor: pointer;
  position: relative;
  padding: 11px 12px 11px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid var(--nx-line);
  display: block;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  isolation: isolate;
  min-height: 70px;
  text-align: left;
}
.c3-strat::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(165, 180, 252, 0.02) 50%, transparent 80%);
  opacity: 0;
  transition: opacity 0.22s;
  z-index: -1;
}
.c3-strat:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(79, 70, 229, 0.22);
}
.c3-strat:hover::before { opacity: 1; }

.c3-strat-idx {
  display: block;
  font-family: var(--nx-font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--nx-ink-300);
  margin-bottom: 4px;
  transition: color 0.22s;
}
.c3-strat-name {
  display: block;
  font-family: var(--nx-font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  line-height: 1.2;
  margin-bottom: 2px;
}
/* 英文說明降低存在感：更小字體、更淡顏色 */
.c3-strat-en {
  display: block;
  font-family: var(--nx-font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--nx-ink-300);
  opacity: 0.60;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c3-strat-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1.5px solid var(--nx-line-strong);
  color: transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s;
}
.c3-strat-check svg { width: 10px; height: 10px; }
.c3-strat.is-selected {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  border-color: #4338CA;
  color: #fff;
  box-shadow:
    0 16px 34px -14px rgba(79, 70, 229, 0.55),
    0 4px 10px rgba(79, 70, 229, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-3px);
}
.c3-strat.is-selected::before { opacity: 0; }
.c3-strat.is-selected .c3-strat-idx { color: rgba(255, 255, 255, 0.55); }
.c3-strat.is-selected .c3-strat-name { color: #fff; }
.c3-strat.is-selected .c3-strat-en { color: rgba(199, 210, 254, 0.55); opacity: 0.7; }
.c3-strat.is-selected .c3-strat-check {
  background: #fff;
  border-color: #fff;
  color: var(--c3-primary);
}
.c3-strat:focus-visible {
  outline: 2px solid var(--c3-primary);
  outline-offset: 2px;
}

/* 策略區底部 · 一列橫向排列 (桌機一頁式,不換行) */
.c3-strats-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--nx-line);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
.c3-strats-selected { flex: 0 1 auto; min-width: 0; }
.c3-strats-foot .c3-analyze-btn { flex-shrink: 0; }
.c3-strats-selected {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.c3-sel-label {
  font-family: var(--nx-font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nx-ink-400);
}
.c3-sel-value {
  font-family: var(--nx-font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
}
.c3-sel-value.is-empty {
  color: var(--nx-ink-300);
  font-weight: 500;
}

.c3-analyze-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 200px;
  padding: 9px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: #fff;
  font-family: var(--nx-font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: var(--nx-ls-snug);
  box-shadow: 0 14px 28px -10px rgba(79, 70, 229, 0.45);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.c3-analyze-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px -10px rgba(79, 70, 229, 0.55);
}
.c3-analyze-btn:active:not(:disabled) { transform: translateY(0); }
.c3-analyze-btn:disabled {
  cursor: not-allowed;
  background: #E5E7EB;
  color: var(--nx-ink-300);
  box-shadow: none;
}
.c3-analyze-btn .c3-btn-arrow {
  display: inline-flex;
  transition: transform 0.22s;
}
.c3-analyze-btn:hover:not(:disabled) .c3-btn-arrow { transform: translateX(3px); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.c3-modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.c3-modal-root[data-open="true"] { display: flex; }
.c3-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: c3-fade-in 0.24s ease-out;
}
@keyframes c3-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.c3-modal {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 22px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 40px 80px -20px rgba(15, 23, 42, 0.35),
    0 12px 30px rgba(15, 23, 42, 0.15);
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: c3-modal-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.c3-modal[data-active="true"] { display: flex; }
@keyframes c3-modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.c3-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.c3-modal-icon-info {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(129, 140, 248, 0.06));
  color: var(--c3-primary);
  border: 1px solid rgba(99, 102, 241, 0.22);
}
.c3-modal-title {
  font-family: var(--nx-font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  margin-bottom: 8px;
  white-space: nowrap;
  line-height: 1.3;
}
.c3-modal-body { width: 100%; }
.c3-modal-strategy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 4px auto 16px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: 10px;
  width: fit-content;
}
.c3-cs-label {
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nx-ink-400);
}
.c3-cs-name {
  font-family: var(--nx-font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--c3-primary);
}
.c3-modal-text {
  font-family: var(--nx-font-sans);
  font-size: 15px;
  color: var(--nx-ink-600);
  line-height: 1.65;
}
.c3-modal-text .c3-cost {
  font-family: var(--nx-font-mono);
  font-size: 17px;
  font-weight: 800;
  color: var(--c3-primary);
  padding: 0 4px;
}

.c3-modal-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  width: 100%;
}
.c3-btn {
  all: unset;
  cursor: pointer;
  flex: 1;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: var(--nx-font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: var(--nx-ls-snug);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s;
  text-align: center;
}
.c3-btn-ghost {
  background: transparent;
  border: 1px solid var(--nx-line-strong);
  color: var(--nx-ink-700);
}
.c3-btn-ghost:hover {
  background: var(--nx-bg-2);
  border-color: var(--nx-ink-300);
}
.c3-btn-primary {
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.4);
}
.c3-btn-primary:hover {
  box-shadow: 0 12px 26px -6px rgba(79, 70, 229, 0.55);
  transform: translateY(-1px);
}
.c3-btn-primary:active { transform: translateY(0); }

/* ---------- 分析中 modal ---------- */
.c3-modal-running { max-width: 500px; }
.c3-run-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.c3-run-orbit {
  width: 120px;
  height: 120px;
  position: relative;
  margin-bottom: 8px;
}
.c3-run-orbit-spin { transform-origin: 60px 60px; animation: c3-orbit-spin 4s linear infinite; }
@keyframes c3-orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.c3-run-title-main {
  font-family: var(--nx-font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  white-space: nowrap;
  line-height: 1.3;
}
.c3-run-title-sub {
  font-family: var(--nx-font-mono);
  font-size: 12px;
  color: var(--nx-ink-400);
  letter-spacing: 0.02em;
  margin-top: 4px;
}
.c3-run-progress {
  width: 100%;
  margin-top: 22px;
}
.c3-run-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.c3-run-progress-label {
  font-family: var(--nx-font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nx-ink-400);
}
.c3-run-progress-pct {
  font-family: var(--nx-font-mono);
  font-size: 16px;
  font-weight: 800;
  color: var(--c3-primary);
  font-variant-numeric: tabular-nums;
}
.c3-run-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.10);
  overflow: hidden;
  position: relative;
}
.c3-run-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366F1, #A5B4FC, #6366F1);
  background-size: 200% 100%;
  animation: c3-fill-shimmer 1.6s linear infinite;
  transition: width 0.2s linear;
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
}
@keyframes c3-fill-shimmer {
  from { background-position: 0 0; }
  to { background-position: -200% 0; }
}

.c3-run-log {
  margin-top: 18px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0B1220;
  border: 1px solid rgba(99, 102, 241, 0.16);
  font-family: var(--nx-font-mono);
  font-size: 11.5px;
  color: rgba(199, 210, 254, 0.75);
  line-height: 1.7;
  min-height: 84px;
  max-height: 84px;
  overflow: hidden;
  text-align: left;
}
.c3-run-log-line {
  opacity: 0;
  transform: translateY(4px);
  animation: c3-line-in 0.4s ease-out forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c3-run-log-line .lg-key { color: #A5B4FC; }
.c3-run-log-line .lg-val { color: #FDE68A; }
.c3-run-log-line .lg-ok { color: #6EE7B7; }

/* ---------- 結果 modal ---------- */
.c3-modal-result { padding-top: 28px; }
.c3-result-icon {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: c3-result-icon-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes c3-result-icon-in {
  0% { opacity: 0; transform: scale(0.5); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
.c3-result-icon-success {
  background: linear-gradient(135deg, #10B981, #34D399);
  color: #fff;
  box-shadow: 0 16px 30px -10px rgba(16, 185, 129, 0.4);
}
.c3-result-icon-failure {
  background: linear-gradient(135deg, #EF4444, #F87171);
  color: #fff;
  box-shadow: 0 16px 30px -10px rgba(239, 68, 68, 0.4);
}
.c3-result-title {
  font-family: var(--nx-font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: var(--nx-ls-snug);
  white-space: nowrap;
  line-height: 1.3;
}
.c3-result-sub {
  margin-top: 4px;
  font-family: var(--nx-font-sans);
  font-size: 13px;
  color: var(--nx-ink-500);
}
.c3-result-energy {
  margin-top: 18px;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 14px 24px;
  border-radius: 16px;
}
.c3-result-energy-plus {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(52, 211, 153, 0.04));
  border: 1px solid rgba(16, 185, 129, 0.20);
}
.c3-result-energy-minus {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(248, 113, 113, 0.04));
  border: 1px solid rgba(239, 68, 68, 0.20);
}
.c3-energy-sign {
  font-family: var(--nx-font-mono);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.c3-result-energy-plus .c3-energy-sign { color: #10B981; }
.c3-result-energy-minus .c3-energy-sign { color: #EF4444; }
.c3-energy-num {
  font-family: var(--nx-font-mono);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.c3-result-energy-plus .c3-energy-num { color: #10B981; }
.c3-result-energy-minus .c3-energy-num { color: #EF4444; }
.c3-energy-unit {
  font-family: var(--nx-font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 6px;
}
.c3-result-energy-plus .c3-energy-unit { color: rgba(16, 185, 129, 0.75); }
.c3-result-energy-minus .c3-energy-unit { color: rgba(239, 68, 68, 0.75); }
.c3-result-note {
  margin-top: 14px;
  font-family: var(--nx-font-sans);
  font-size: 13px;
  color: var(--nx-ink-500);
}
.c3-result-note span {
  color: var(--c3-primary);
  font-weight: 600;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* ---------- Tablet (900-1080) 6 欄改 3 欄 ---------- */
@media (max-width: 1080px) {
  .c3-strat-grid { grid-template-columns: repeat(3, 1fr); }
  .c3-strat { min-height: 78px; padding: 12px 14px; }
  .c3-strat-name { font-size: 14.5px; margin-bottom: 3px; }
  .c3-strat-en { font-size: 9.5px; }
  .c3-ws-header { gap: 14px; }
  .c3-sys-clock { padding-left: 12px; }
  .c3-clock-value { font-size: 13px; }
  .c3-ops-grid { grid-template-rows: 105px 105px; }
  .c3-ops-col { height: 105px; }
}

/* ---------- Small tablet ---------- */
@media (max-width: 900px) {
  .c3-strat-grid { grid-template-columns: repeat(2, 1fr); }
  .c3-ops-grid { min-height: 240px; }
  .c3-ops-col { min-height: 110px; height: auto; }
}

/* ==========================================================================
   Mobile 專屬版面(760px 以下,操作優先)
   ========================================================================== */
@media (max-width: 760px) {
  .c3-content {
    padding-top: 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  /* Hero:更短,只留品牌感 */
  .c3-hero {
    height: 116px;
    border-radius: 14px;
  }
  .c3-hero-overlay {
    padding: 14px 18px;
    gap: 4px;
  }
  .c3-hero-headline { font-size: 19px; }
  .c3-hero-eyebrow { gap: 8px; }
  .c3-hero-tag { font-size: 10px; padding: 3px 8px; }
  .c3-hero-tag-sub { display: none; }

  /* Workspace: 資訊條 + 精簡 AI 狀態 */
  .c3-workspace {
    margin-top: 12px;
    border-radius: 14px;
  }
  .c3-ws-header {
    padding: 12px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .c3-sys-key { font-size: 18px; padding-right: 12px; }
  .c3-sys-en { font-size: 9.5px; }
  .c3-sys-tw { font-size: 13.5px; }
  .c3-ws-status { width: 100%; justify-content: space-between; gap: 8px; }
  .c3-workspace .status-chip.is-ready.c3-sys-chip { padding: 4px 10px; font-size: 11px; }
  .c3-sys-clock { padding-left: 0; border-left: 0; }
  .c3-clock-value { font-size: 12.5px; gap: 6px; }

  /* AI Operation: mobile 縮成單卡精簡狀態 */
  .c3-ops-head {
    padding: 8px 12px 6px;
  }
  .c3-ops-title { font-size: 10px; gap: 6px; }
  .c3-ops-title-icon { width: 16px; height: 16px; }
  .c3-ops-title-sub { display: none; }
  .c3-ops-meta { display: none; }
  .c3-ops-live { font-size: 8px; padding: 2px 5px; }
  /* 手機 col-head 縮小字型 + 減 letter-spacing 讓標題完整顯示 */
  .c3-ops-col-head {
    font-size: 8px;
    letter-spacing: 0.1em;
    padding: 5px 8px;
  }

  .c3-ops-grid {
    padding: 8px 12px 12px;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 8px;
    min-height: 0;
  }
  /* mobile 只保留 Analysis Log + AI Status,節省空間 */
  .c3-ops-col { min-height: 0; }
  .c3-ops-col-log { grid-column: auto; min-height: 88px; }
  .c3-ops-col-log .c3-ops-col-body { max-height: 74px; overflow: hidden; padding: 4px 8px; }
  .c3-ops-col-status .c3-ops-col-body { padding: 6px 8px; }
  .c3-ops-col-matrix { display: none; } /* 手機隱藏亂碼 */
  .c3-ops-col-token { display: none; }  /* 手機隱藏 session */

  /* AI STATUS 改成 2 欄 3 列，讓 label / value 有充足空間 */
  .c3-stat-grid { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .c3-stat { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 6px; }
  .c3-stat-label { font-size: 8.5px; letter-spacing: 0.05em; }
  .c3-stat-value { font-size: 11.5px; }

  .c3-log-line { font-size: 9px; line-height: 1.55; }

  /* 策略區 */
  .c3-strats {
    margin-top: 12px;
    padding: 12px 12px 12px;
    border-radius: 14px;
  }
  .c3-strats-head {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }
  .c3-strats-title h2 { font-size: 15px; }
  .c3-strats-hint { font-size: 11px; }

  /* 6 張策略卡 · 2 欄 3 列 (壓縮高度) */
  .c3-strat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .c3-strat {
    padding: 9px 10px 8px;
    min-height: 58px;
    border-radius: 10px;
  }
  .c3-strat-idx { font-size: 8.5px; margin-bottom: 2px; letter-spacing: 0.12em; }
  .c3-strat-name { font-size: 13px; margin-bottom: 1px; }
  .c3-strat-en { font-size: 8.5px; }
  .c3-strat-check { top: 8px; right: 8px; width: 14px; height: 14px; }
  .c3-strat-check svg { width: 8px; height: 8px; }

  /* 手機底部按鈕列:改回靜態排版,隨內容自然出現在頁尾
     隱藏「已選擇 XXXX」文字 → 只留「立即分析」按鈕,置中呈現 */
  .c3-strats-foot {
    position: static;
    margin-top: 14px;
    padding: 14px 0 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 1px solid var(--nx-line);
    box-shadow: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
  }
  .c3-strats-selected { display: none; }
  .c3-analyze-btn {
    width: auto;
    min-width: 220px;
    padding: 11px 32px;
    font-size: 14.5px;
    flex-shrink: 0;
  }
}

/* 超小手機 */
@media (max-width: 380px) {
  .c3-hero { height: 96px; }
  .c3-hero-headline { font-size: 17px; }
  .c3-strat-name { font-size: 13px; }
  .c3-strat-en { font-size: 9px; }
}
