/* ============================================================
   投資冒險者 — 設計系統 v2「八方旅人 HD-2D 點陣風」
   深色夜幕 + 暖金輝光 + 像素字 + 像素框 + vignette
   ============================================================ */

/* 像素中文字 Zpix（最像素）+ 拉丁像素字 Pixelify Sans */
@font-face {
  font-family: "Zpix";
  src: url("https://cdn.jsdelivr.net/gh/SolidZORO/zpix-pixel-font/dist/Zpix.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* 夜幕底色 */
  --bg-0:     #0a0d18;
  --bg-1:     #10142a;
  --paper:    #10142a;          /* app 底 */
  --paper-2:  #1a2040;          /* chip / tag 底 */
  --paper-3:  #242b50;          /* 進度條軌道 */
  --surface:  #161b34;          /* 面板 */
  --surface-2:#1b2240;

  /* 文字（暖白） */
  --ink:      #efe9d8;
  --ink-soft: #aeb4cf;
  --ink-faint:#737a9a;

  /* 線 / 框（金調） */
  --line:      rgba(231,198,107,.22);
  --line-soft: rgba(255,255,255,.07);

  /* 強調色 */
  --gold:      #e7c66b;
  --gold-soft: #f3dd96;
  --gold-deep: #b9912f;
  --emerald:   #6fcf97;   --emerald-bg: rgba(111,207,151,.15);  /* 跌/陰線/空 */
  --crimson:   #e86a52;   --crimson-bg: rgba(232,106,82,.16);   /* 漲/陽線/多 */
  --indigo:    #8fb8ff;   --indigo-bg:  rgba(143,184,255,.15);  /* 冷靜/連結 */
  --teal:      #6fe0d0;
  --sky:       var(--teal);
  --violet:    #c98bff;
  --panel:     var(--surface);
  --sage:      var(--emerald);
  --muted:     var(--ink-soft);
  --coral:     var(--crimson);

  /* 稀有度 */
  --rar-common: #97a0b8;
  --rar-rare:   #5aa9ff;
  --rar-epic:   #c98bff;
  --rar-legend: #f3c14e;

  --r-sm: 4px; --r: 6px; --r-md: var(--r); --r-lg: 8px;
  --glow-gold: 0 0 12px rgba(231,198,107,.45);
  --shadow:    0 4px 0 rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 0 rgba(0,0,0,.3);

  --pixel: "Pixelify Sans", "Zpix", "Noto Sans TC", monospace;
  --sans:  "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --serif: "Noto Serif TC", serif;
  --font-num: "DSEG7 Classic", "Oxanium", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(231,198,107,.10), transparent 60%),
    radial-gradient(700px 500px at 12% 8%, rgba(111,224,208,.07), transparent 60%),
    linear-gradient(180deg, #0c1024 0%, var(--bg-0) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* vignette + 微噪點氛圍 */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(0,0,0,.45) 100%);
  mix-blend-mode: multiply;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--gold-soft); }

h1,h2,h3,h4 { font-family: var(--pixel); font-weight: 700; color: var(--gold-soft); margin: 0; letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 14px rgba(231,198,107,.25); }

.pixel { font-family: var(--pixel); }

/* ============================================================ 版面 */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 2; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, #0c1024, #0a0d18);
  border-right: 1px solid var(--line);
  color: #d8d0b8; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .logo { display: inline-flex; align-items: center; filter: drop-shadow(0 0 8px rgba(231,198,107,.5)); }
.brand .title { font-family: var(--pixel); font-size: 17px; color: var(--gold-soft); line-height: 1.15; text-shadow: var(--glow-gold); }
.brand .sub { font-family: var(--pixel); font-size: 9px; color: #6f7aa0; letter-spacing: 1.5px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-section { font-family: var(--pixel); font-size: 10px; color: #646e96; letter-spacing: 2px; padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  color: #c3c8e2; font-size: 14px; border: 1px solid transparent; transition: .12s;
}
.nav a .ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(0,0,0,.55)); }
.nav a.active .ico .rpg-icon { filter: drop-shadow(0 0 10px rgba(231,198,107,.5)); }
.nav a:hover { background: rgba(231,198,107,.08); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(231,198,107,.22), rgba(231,198,107,.04));
  color: var(--gold-soft); border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-foot { font-family: var(--pixel); margin-top: 20px; padding: 12px 10px; border-top: 1px solid var(--line-soft); font-size: 10px; line-height: 1.8; color: #5f688c; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 頂部 HUD */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 26px;
  background: rgba(12,16,36,.92); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(4px);
}
.hero-chip { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 46px; height: 46px; border-radius: var(--r-sm);
  background: linear-gradient(160deg, #2a325c, #1a2042);
  display: grid; place-items: center;
  border: none; box-shadow: none;
  overflow: visible;
}
.hero-meta .name { font-family: var(--pixel); color: var(--gold-soft); }
.hero-meta .lvl { font-size: 12px; color: var(--ink-soft); }
.xp-wrap { flex: 1; max-width: 300px; }
.xp-label { font-family: var(--pixel); display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-soft); margin-bottom: 4px; letter-spacing: 1px; }

/* 像素進度條（分段刻度 + 輝光） */
.bar { height: 12px; background: var(--paper-3); border: 1px solid rgba(0,0,0,.5); border-radius: 2px; overflow: hidden; box-shadow: inset 0 2px 3px rgba(0,0,0,.5); position: relative; }
.bar > span { display: block; height: 100%; background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep)); box-shadow: 0 0 8px rgba(231,198,107,.6); position: relative; }
.bar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(90deg, transparent 0, transparent 9px, rgba(0,0,0,.4) 9px, rgba(0,0,0,.4) 11px); }

.topbar-right { margin-left: auto; }
.coin { font-family: var(--pixel); display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gold-soft); background: var(--paper-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--r-sm); text-decoration: none; }
.coin:hover { border-color: var(--gold); color: var(--gold); }
.topbar-assets-col { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.topbar-assets-label { font-size: 9px; color: var(--ink-soft); letter-spacing: 1px; }
.topbar-assets-val { font-size: 13px; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.topbar-assets:hover .topbar-assets-val { color: var(--gold); }

.content { padding: 26px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 22px; }
.page-head .eyebrow { font-family: var(--pixel); font-size: 11px; letter-spacing: 3px; color: var(--teal); text-transform: uppercase; }
.page-head h1 { font-size: 30px; margin: 8px 0 8px; }
.page-title-row, .page-section-title, .group-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-section-title { font-size: inherit; }
.page-head p { margin: 0; color: var(--ink-soft); max-width: 62ch; }

/* ============================================================ 面板（像素框） */
.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), transparent 40%),
    var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(0,0,0,.4);
  padding: 18px; position: relative;
}
/* 四角金色鉚釘 */
.card::before, .card::after { content:""; position:absolute; width:5px; height:5px; background: var(--gold); opacity:.6; }
.card::before { top:5px; left:5px; box-shadow: 0 0 6px rgba(231,198,107,.7); }
.card::after  { top:5px; right:5px; box-shadow: 0 0 6px rgba(231,198,107,.7); }
.card.pad-lg { padding: 22px; }
.card-title { font-family: var(--pixel); display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--gold-soft); margin-bottom: 14px; letter-spacing: .5px; }
.card-title .ico { font-size: 18px; }
.card-title-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-refresh { font-size: 12px; padding: 3px 10px; white-space: nowrap; }
.card-title .ai {
  font-family: var(--sans); margin-left: 0; font-size: 12px; color: var(--teal);
  background: rgba(111,224,208,.12); border: 1px solid var(--line); padding: 3px 10px;
  border-radius: var(--r-sm); cursor: pointer;
}
.card-title .ai:hover { background: rgba(111,224,208,.22); }

/* AI 導覽員 — 金幣貓頭鷹 */
.guide-dock { position: fixed; right: 16px; bottom: 72px; z-index: 180; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.guide-fab {
  position: relative; border: none; border-radius: 0;
  width: 78px; height: 82px; padding: 0; cursor: pointer;
  background: transparent;
  box-shadow: none; transition: .15s;
  animation: mascotFloat 3.2s ease-in-out infinite;
}
.guide-fab:hover { transform: translateY(-4px) scale(1.03); animation-play-state: paused; }
.guide-fab:hover .guide-portrait-frame { filter: drop-shadow(0 0 10px rgba(231,198,107,.55)); }
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.guide-portrait { position: relative; display: grid; place-items: center; }
.guide-portrait-fallback { display: none; }
.guide-portrait-img { image-rendering: auto; }
.guide-portrait--fab .guide-portrait-frame { filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)) drop-shadow(0 0 6px rgba(231,198,107,.25)); }
.guide-portrait--chat .guide-portrait-frame { filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.guide-sparkle { opacity: .85; }
.guide-sparkle-a { animation: sparklePulse 2.4s ease-in-out infinite; }
.guide-sparkle-b { animation: sparklePulse 2.4s ease-in-out .8s infinite; }
@keyframes sparklePulse {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.guide-portrait.blink .guide-portrait-img { animation: portraitBlink 5s step-end infinite; }
@keyframes portraitBlink {
  0%, 92%, 100% { opacity: 1; }
  93%, 95% { opacity: .15; }
}
.guide-fab-label {
  position: absolute; right: 0; bottom: 2px;
  font-family: var(--pixel); font-size: 11px; color: #1a1228;
  background: var(--gold); border: 2px solid #f8e6a8; border-radius: 6px;
  padding: 1px 6px; box-shadow: 0 2px 0 #8a6420;
  pointer-events: none; z-index: 2;
}
.guide-panel {
  width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 2px solid var(--gold);
  border-radius: var(--r-lg); box-shadow: var(--shadow), var(--glow-gold);
  overflow: hidden; animation: eraSlide .2s ease-out;
}
.guide-panel-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft); background: rgba(231,198,107,.06);
}
.guide-name { font-family: var(--pixel); color: var(--gold-soft); font-size: 14px; }
.guide-ctx { font-size: 11px; }
.guide-close {
  margin-left: auto; width: 32px; height: 32px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--paper-2); color: var(--gold-soft);
  font-size: 20px; cursor: pointer;
}
.guide-setup { padding: 10px 14px; background: rgba(232,106,82,.08); border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.guide-setup-link { color: var(--teal); font-family: var(--pixel); font-size: 12px; }
.guide-toolbar { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); align-items: end; }
.guide-field { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--ink-soft); }
.guide-field select { background: var(--paper-2); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r-sm); padding: 6px 8px; }
.guide-clear { font-family: var(--pixel); font-size: 10px; padding: 6px 10px; border: 1px solid var(--line-soft); background: transparent; color: var(--ink-soft); border-radius: var(--r-sm); cursor: pointer; }
.guide-chat { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 160px; }
.guide-msg { display: flex; gap: 8px; align-items: flex-start; }
.guide-msg.user { flex-direction: row-reverse; }
.guide-msg.user .guide-bubble { background: rgba(143,184,255,.15); border-color: rgba(143,184,255,.35); }
.guide-msg.system .guide-bubble { background: rgba(232,106,82,.1); border-color: rgba(232,106,82,.3); font-size: 12px; }
.guide-bubble-wrap { max-width: 85%; }
.guide-bubble {
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); font-size: 13px; line-height: 1.55;
}
.markdown-message > :first-child { margin-top: 0; }
.markdown-message > :last-child { margin-bottom: 0; }
.markdown-message p { margin: 0 0 8px; }
.markdown-message h1,
.markdown-message h2,
.markdown-message h3,
.markdown-message h4 {
  margin: 12px 0 6px; color: var(--gold-soft); line-height: 1.35;
}
.markdown-message h1 { font-size: 1.3em; }
.markdown-message h2 { font-size: 1.2em; }
.markdown-message h3,
.markdown-message h4 { font-size: 1.08em; }
.markdown-message ul,
.markdown-message ol { margin: 6px 0 10px; padding-left: 22px; }
.markdown-message li + li { margin-top: 4px; }
.markdown-message blockquote {
  margin: 8px 0; padding: 5px 10px; border-left: 3px solid var(--gold);
  background: rgba(231,198,107,.07); color: var(--ink-soft);
}
.markdown-message a { color: var(--teal); text-decoration: underline; overflow-wrap: anywhere; }
.markdown-message code {
  padding: 1px 4px; border: 1px solid var(--line-soft); border-radius: 4px;
  background: rgba(0,0,0,.35); color: var(--gold-soft); font-size: .92em;
}
.markdown-message pre {
  margin: 8px 0; padding: 10px; overflow-x: auto; border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); background: rgba(0,0,0,.45); white-space: pre;
}
.markdown-message pre code { padding: 0; border: 0; background: transparent; color: var(--ink); }
.markdown-message table { display: block; max-width: 100%; margin: 8px 0; overflow-x: auto; border-collapse: collapse; }
.markdown-message th,
.markdown-message td { padding: 5px 7px; border: 1px solid var(--line-soft); text-align: left; }
.markdown-message th { color: var(--gold-soft); background: rgba(231,198,107,.08); }
.markdown-message hr { margin: 10px 0; border: 0; border-top: 1px solid var(--line-soft); }
.guide-meta { margin-top: 4px; }
.guide-skills { padding: 8px 12px; border-top: 1px solid var(--line-soft); }
.guide-skills-k { font-family: var(--pixel); font-size: 10px; color: var(--teal); margin-bottom: 6px; }
.guide-skill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-skill {
  font-family: var(--pixel); font-size: 10px; padding: 5px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2);
  color: var(--gold-soft); cursor: pointer;
}
.guide-skill:hover { border-color: var(--gold); }
.guide-compose {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-soft);
  background: rgba(0,0,0,.15);
}
.guide-compose textarea {
  flex: 1; resize: none; min-height: 36px; max-height: 100px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); padding: 8px 10px; font-family: var(--sans); font-size: 14px;
}
.guide-send {
  width: 40px; height: 40px; border: 2px solid var(--gold); border-radius: var(--r-sm);
  background: rgba(231,198,107,.15); color: var(--gold-soft); font-size: 18px; cursor: pointer;
}
.guide-send:disabled { opacity: .5; cursor: not-allowed; }
.guide-msg .guide-portrait { flex: 0 0 auto; }
.guide-panel-head .guide-portrait { flex: 0 0 auto; }

/* AI 真視觀測鏡：完整 API Prompt / Context 偵錯 */
.ai-debug-orb {
  position: fixed; z-index: 179; right: 31px; bottom: 164px; width: 42px; height: 42px;
  display: grid; place-items: center; border: 1px solid rgba(201,139,255,.5); border-radius: 50%;
  color: var(--rar-epic); background: radial-gradient(circle, #242044, #0b1020 72%);
  box-shadow: 0 0 14px rgba(201,139,255,.22), inset 0 0 10px rgba(111,224,208,.08);
  cursor: pointer; transition: .15s;
}
.ai-debug-orb:hover { transform: scale(1.08); border-color: var(--rar-epic); box-shadow: 0 0 20px rgba(201,139,255,.4); }
.ai-debug-orb.active { color: var(--teal); border-color: var(--teal); animation: debug-eye-pulse 2.4s ease-in-out infinite; }
.ai-debug-orb i {
  position: absolute; top: 1px; right: 1px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 8px var(--teal);
}
.ai-debug-modal {
  position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 18px;
}
.ai-debug-backdrop { position: absolute; inset: 0; border: 0; background: rgba(3,5,14,.84); backdrop-filter: blur(6px); }
.ai-debug-panel {
  position: relative; width: min(1120px, 100%); height: min(860px, calc(100dvh - 36px));
  display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--rar-epic) 70%, var(--teal));
  border-radius: 14px; color: var(--ink);
  background:
    linear-gradient(rgba(111,224,208,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111,224,208,.025) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, rgba(201,139,255,.19), transparent 42%),
    #0a0e1d;
  background-size: 24px 24px, 24px 24px, auto, auto;
  box-shadow: 0 0 45px rgba(201,139,255,.25), var(--shadow);
}
.ai-debug-panel::after {
  position: absolute; inset: 6px; border: 1px solid rgba(111,224,208,.1); border-radius: 9px;
  pointer-events: none; content: "";
}
.ai-debug-head {
  position: relative; z-index: 2; min-height: 82px; display: grid;
  grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid rgba(201,139,255,.28); background: rgba(15,16,38,.9);
}
.ai-debug-eye {
  width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(201,139,255,.55);
  border-radius: 50% 8px; color: var(--teal); background: rgba(201,139,255,.08);
  box-shadow: inset 0 0 13px rgba(111,224,208,.13), 0 0 15px rgba(201,139,255,.15);
}
.ai-debug-head > div { min-width: 0; display: grid; gap: 2px; }
.ai-debug-head span { font-family: var(--pixel); font-size: 8px; letter-spacing: .15em; color: var(--rar-epic); }
.ai-debug-head strong { font-family: var(--pixel); font-size: 14px; color: var(--gold-soft); }
.ai-debug-head small { color: var(--ink-soft); font-size: 10px; }
.ai-debug-close {
  position: relative; z-index: 4; width: 34px; height: 34px; border: 1px solid var(--line);
  border-radius: 50%; color: var(--ink-soft); background: rgba(0,0,0,.25); cursor: pointer; font-size: 20px;
}
.ai-debug-controls {
  position: relative; z-index: 2; display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(150px, auto) auto;
  align-items: center; gap: 9px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  background: rgba(8,12,26,.92);
}
.ai-debug-switch-copy { min-width: 0; display: grid; gap: 2px; }
.ai-debug-switch-copy strong { font-family: var(--pixel); font-size: 10px; color: var(--teal); }
.ai-debug-switch-copy span { font-size: 10px; color: var(--ink-soft); }
.ai-debug-switch {
  min-width: 72px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft);
  background: rgba(0,0,0,.25); font-family: var(--pixel); font-size: 9px; cursor: pointer;
}
.ai-debug-switch i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); }
.ai-debug-switch.active { border-color: var(--teal); color: var(--teal); background: rgba(111,224,208,.08); }
.ai-debug-switch.active i { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.ai-debug-controls select,
.ai-debug-clear {
  height: 32px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); background: var(--paper-2); font-size: 10px;
}
.ai-debug-clear { color: var(--crimson); cursor: pointer; }
.ai-debug-clear:disabled { opacity: .4; cursor: not-allowed; }
.ai-debug-summary {
  position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 7px; padding: 7px 16px;
  border-bottom: 1px solid var(--line-soft); background: rgba(201,139,255,.025);
}
.ai-debug-summary span {
  padding: 2px 7px; border: 1px solid rgba(201,139,255,.18); border-radius: 999px;
  font-family: var(--pixel); font-size: 8px; color: var(--ink-soft);
}
.ai-debug-summary strong {
  padding: 3px 8px; border: 1px solid rgba(111,224,208,.35); border-radius: 999px;
  background: rgba(111,224,208,.07); font-family: var(--pixel); font-size: 8px; color: var(--teal);
}
.ai-debug-view-tabs { display: flex; gap: 6px; padding: 8px 14px 0; border-top: 1px solid var(--line-soft); }
.ai-debug-view-tabs button { border: 1px solid var(--line-soft); border-radius: 5px 5px 0 0; padding: 8px 12px; background: rgba(0,0,0,.2); color: var(--ink-soft); font-family: var(--pixel); font-size: 8px; cursor: pointer; }
.ai-debug-view-tabs button.active { border-color: var(--rar-epic); color: var(--gold-soft); background: rgba(201,139,255,.1); }
.ai-debug-log {
  position: relative; z-index: 2; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding: 12px 15px 18px; scrollbar-color: rgba(201,139,255,.45) transparent;
}
.ai-debug-empty { margin: auto; max-width: 480px; text-align: center; color: var(--ink-soft); }
.ai-debug-empty strong { display: block; font-family: var(--pixel); font-size: 11px; color: var(--gold-soft); }
.ai-debug-empty p { font-size: 12px; line-height: 1.6; }
.ai-debug-entry {
  flex: 0 0 auto; border: 1px solid rgba(201,139,255,.25); border-radius: 7px; overflow: hidden;
  background: rgba(10,14,30,.88);
}
.ai-debug-entry.error { border-color: rgba(232,106,82,.42); }
.ai-debug-entry.warning { border-color: rgba(238,185,74,.45); }
.ai-debug-entry.skipped { opacity: .78; border-style: dashed; }
.ai-debug-event .ai-debug-source { color: var(--teal); }
.ai-debug-entry > summary {
  display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(120px, .9fr) auto auto;
  align-items: center; gap: 10px; padding: 9px 11px; cursor: pointer; list-style: none;
  background: linear-gradient(90deg, rgba(201,139,255,.07), rgba(111,224,208,.025));
}
.ai-debug-entry > summary::-webkit-details-marker { display: none; }
.ai-debug-source { font-family: var(--pixel); font-size: 9px; color: var(--gold-soft); }
.ai-debug-model, .ai-debug-entry time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; color: var(--ink-soft); }
.ai-debug-entry summary b { font-family: var(--pixel); font-size: 8px; color: var(--teal); }
.ai-debug-entry.error summary b { color: var(--crimson); }
.ai-debug-entry-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 11px; border-top: 1px solid var(--line-soft); font-size: 9px; color: var(--ink-soft); }
.ai-debug-entry-meta .bad { color: var(--crimson); }
.ai-debug-payload { display: grid; gap: 6px; padding: 0 11px 11px; }
.ai-debug-payload details { border: 1px solid var(--line-soft); border-radius: 5px; overflow: hidden; background: rgba(0,0,0,.2); }
.ai-debug-payload summary { padding: 7px 9px; cursor: pointer; font-family: var(--pixel); font-size: 8px; color: var(--teal); }
.ai-debug-payload pre {
  max-height: 420px; margin: 0; padding: 10px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  border-top: 1px solid var(--line-soft); color: #dbe5ff; background: rgba(0,0,0,.3);
  font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}
@keyframes debug-eye-pulse { 50% { box-shadow: 0 0 24px rgba(111,224,208,.46), inset 0 0 12px rgba(111,224,208,.13); } }

@media (max-width: 720px) {
  .ai-debug-orb { right: 22px; bottom: 154px; }
  .ai-debug-modal { padding: 0; }
  .ai-debug-panel { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .ai-debug-head { padding: 12px; }
  .ai-debug-controls { grid-template-columns: 1fr auto; padding: 9px 11px; }
  .ai-debug-controls select, .ai-debug-clear { width: 100%; }
  .ai-debug-summary { padding: 6px 11px; }
  .ai-debug-log { padding: 9px 10px 14px; }
  .ai-debug-entry > summary { grid-template-columns: 1fr auto; gap: 4px 8px; }
  .ai-debug-model { display: none; }
  .ai-debug-entry time { grid-column: 1; }
}

/* 設定頁 */
.settings-field { margin-bottom: 14px; }
.settings-field label { display: block; font-family: var(--pixel); font-size: 11px; color: var(--ink-soft); margin-bottom: 6px; }
.settings-field input {
  width: 100%; padding: 10px 12px; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--ink); font-size: 14px;
}
.settings-providers { display: flex; flex-direction: column; gap: 14px; }
.settings-provider-card { padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: rgba(0,0,0,.15); }
.settings-provider-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.settings-provider-head b { display: block; color: var(--gold-soft); }
.settings-radio { font-family: var(--pixel); font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.settings-model-row { display: flex; gap: 8px; align-items: center; }
.settings-model-row input,
.settings-model-row select { flex: 1; min-width: 0; }
.btn-ghost, .btn-primary {
  font-family: var(--pixel); font-size: 12px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
  background: var(--paper-2); color: var(--gold-soft);
}
.btn-primary { background: rgba(231,198,107,.15); border-color: var(--gold); }
.settings-msg { margin-top: 10px; color: var(--teal); }
.settings-code {
  width: 100%; min-height: 120px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.5;
  background: rgba(0,0,0,.25); color: var(--ink);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 12px;
}
.settings-mcp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
}
.settings-mcp-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.12); cursor: pointer; font-size: 13px;
}
.settings-mcp-item b { display: block; color: var(--gold-soft); font-size: 12px; }
.settings-mcp-item input { margin-top: 3px; accent-color: var(--gold); }
.settings-skill-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
  max-height: 280px; overflow-y: auto;
}
.settings-skill-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.12); cursor: pointer; font-size: 13px;
}
.settings-skill-item b { display: block; color: var(--gold-soft); font-size: 12px; }
.settings-skill-item input { margin-top: 3px; accent-color: var(--gold); flex-shrink: 0; }
.settings-skill-tag {
  font-family: var(--pixel); font-size: 8px; margin-left: 6px; padding: 1px 4px;
  border-radius: 3px; background: rgba(111,224,208,.15); color: var(--teal); vertical-align: middle;
}
.settings-skill-del {
  display: inline-block; margin-top: 4px; padding: 0; border: none; background: none;
  color: var(--coral); font-size: 11px; cursor: pointer; text-decoration: underline;
}
.settings-skill-preview {
  margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px dashed var(--line-soft); background: rgba(0,0,0,.1);
}
.settings-skill-actions { margin-bottom: 8px; }
.guide-skill-row { max-height: 88px; overflow-y: auto; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mcp-badge {
  font-family: var(--pixel); font-size: 9px; padding: 1px 5px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
  background: rgba(255,255,255,.08); color: var(--ink-soft);
}
.mcp-badge.ok { background: rgba(111,224,208,.2); color: var(--teal); }
.mcp-badge.warn { background: rgba(231,198,107,.2); color: var(--gold-soft); }
.mcp-badge.err { background: rgba(232,106,82,.2); color: var(--coral); }
.settings-required {
  font-family: var(--pixel); font-size: 9px; color: var(--coral);
  margin-left: 8px; padding: 1px 5px; border-radius: 4px;
  background: rgba(232,106,82,.15);
}
.settings-set {
  font-family: var(--pixel); font-size: 9px; color: var(--teal);
  margin-left: 8px;
}
.settings-source-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
}
.settings-source-item {
  padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(111,224,208,.06);
}
.settings-source-item b { display: block; color: var(--gold-soft); font-size: 12px; margin-bottom: 4px; }
.settings-source-via { color: var(--teal); font-family: var(--pixel); font-size: 9px; display: block; margin-top: 4px; }

@media (max-width: 920px) {
  .guide-dock { bottom: 64px; right: 10px; }
  .guide-panel { width: calc(100vw - 20px); }
}

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

/* 手機導覽：漢堡 + 抽屜側欄 + 底部捷徑 */
.nav-toggle,
.nav-backdrop,
.nav-close,
.bottom-nav { display: none; }

/* ── RWD 斷點 ── */
@media (max-width: 1100px){
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px){
  body.nav-open { overflow: hidden; }

  .nav-toggle {
    display: inline-grid; place-items: center; gap: 4px;
    width: 40px; height: 40px; flex: 0 0 40px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--paper-2); cursor: pointer; padding: 0;
  }
  .nav-toggle span {
    display: block; width: 18px; height: 2px; background: var(--gold-soft);
    border-radius: 1px; transition: .15s;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    border: none; padding: 0; margin: 0;
    background: rgba(5,7,16,.62); opacity: 0; pointer-events: none;
    transition: opacity .2s; cursor: pointer;
  }
  .nav-backdrop.open { opacity: 1; pointer-events: auto; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: min(280px, 86vw); max-width: 280px;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,.45);
  }
  .sidebar.open { transform: translateX(0); }

  .brand { position: relative; padding-right: 36px; }
  .nav-close {
    display: grid; place-items: center;
    position: absolute; top: 4px; right: 0;
    width: 32px; height: 32px; border-radius: var(--r-sm);
    border: 1px solid var(--line-soft); background: var(--paper-2);
    color: var(--ink-soft); cursor: pointer; font-size: 14px;
  }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(12,16,36,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(6px); padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a,
  .bottom-nav-more {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 52px; padding: 4px 2px;
    border: none; background: transparent; color: var(--ink-soft);
    font-size: 10px; font-family: var(--pixel); cursor: pointer;
    border-radius: var(--r-sm); text-decoration: none;
  }
  .bottom-nav a .ic,
  .bottom-nav-more .ic { display: flex; align-items: center; justify-content: center; line-height: 0; }
  .bottom-nav a.active { color: var(--gold-soft); background: rgba(231,198,107,.1); }

  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: nowrap; }
  .content { padding: 18px 14px 24px; }
}
@media (max-width: 768px){
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .weather, .compass { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
  .weather .big { font-size: 17px; line-height: 1.35; }
  .weather .desc { font-size: 12px; line-height: 1.55; }
  .compass .era { font-size: 15px; line-height: 1.35; }
  .compass .editorial { margin-top: 8px; padding: 10px 12px; font-size: 13px; }
  .weather-score-num { font-size: 30px; }
  .weather-summary { -webkit-line-clamp: 3; }
  .dl .row {
    flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 10px 2px;
  }
  .dl .row .k { max-width: 100%; }
  .dl .row .v, .rangebar-val { align-self: flex-start; }
  .card-title { flex-wrap: wrap; row-gap: 8px; }
  .card-title .ai { margin-left: 0; }
  .stat-head { flex-wrap: wrap; row-gap: 6px; }
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; }
  .editorial { padding: 12px 14px; font-size: 14px; }
}
@media (max-width: 680px){
  .xp-wrap { display: none; }
  .page-head h1 { font-size: 23px; }
  .page-head p { font-size: 13px; max-width: none; }
  .stat-value { font-size: 20px; }
  .card { padding: 14px; }
  .map-tile { padding: 14px; }
}
@media (max-width: 420px){
  .content { padding: 14px 11px 20px; }
  .hero-meta .lvl { display: none; }
  .coin { font-size: 11px; padding: 5px 9px; }
  .avatar { width: 36px; height: 36px; font-size: 18px; }
  .evt-head { flex-wrap: wrap; gap: 6px; }
  .evt-title { flex: 1 1 100%; }
  .bottom-nav a .lb,
  .bottom-nav-more .lb { font-size: 9px; }
}

/* 標籤 */
.tag { font-family: var(--pixel); display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 3px 9px; border-radius: var(--r-sm); background: var(--paper-2); border: 1px solid var(--line-soft); color: var(--ink-soft); letter-spacing: .5px; }
.tag.up { background: var(--crimson-bg); color: var(--crimson); border-color: rgba(232,106,82,.4); }
.tag.down { background: var(--emerald-bg); color: var(--emerald); border-color: rgba(111,207,151,.4); }
.tag.cool { background: var(--indigo-bg); color: var(--indigo); border-color: rgba(143,184,255,.4); }
.tag.gold { background: rgba(231,198,107,.14); color: var(--gold-soft); border-color: var(--line); }

.pill-rar {
  display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap;
  font-family: var(--pixel); font-size: 10px; padding: 2px 7px;
  border-radius: 3px; color: #0a0d18; letter-spacing: .5px;
}
.rar-common{background:var(--rar-common);} .rar-rare{background:var(--rar-rare);} .rar-epic{background:var(--rar-epic);} .rar-legend{background:var(--rar-legend);}

/* 天氣 */
.weather {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, rgba(111,224,208,.08), rgba(143,184,255,.06));
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
}
.weather.fair { background: linear-gradient(135deg, rgba(111,207,151,.1), rgba(231,198,107,.06)); }
.weather.storm{ background: linear-gradient(135deg, rgba(232,106,82,.12), rgba(40,30,60,.2)); }
.weather .ic { font-size: 54px; filter: drop-shadow(0 0 12px rgba(231,198,107,.4)); }
.weather-body { flex: 1; min-width: 0; }
.weather-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.weather-scoreline {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 4px;
}
.weather-score-num {
  font-family: var(--font-num); font-size: 36px; font-weight: 800; line-height: 1;
  color: var(--gold-soft); text-shadow: var(--glow-gold);
}
.weather-score-unit { font-family: var(--pixel); font-size: 14px; color: var(--ink-soft); margin-right: 2px; }
.weather-regime { font-family: var(--pixel); font-size: 14px; color: var(--gold-soft); line-height: 1.35; }
.weather-summary {
  margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.weather-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.weather-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: rgba(0,0,0,.22);
  font-size: 11px; cursor: help; transition: .12s;
}
.weather-pill:hover { border-color: var(--gold); background: rgba(231,198,107,.08); }
.weather-pill.up { border-color: rgba(232,106,82,.35); }
.weather-pill.down { border-color: rgba(111,207,151,.35); }
.weather-pill.gold { border-color: rgba(231,198,107,.35); }
.weather-pill-k { color: var(--ink-faint); font-family: var(--pixel); }
.weather-pill-v { color: var(--ink); font-weight: 600; }

.explain-trigger { display: inline-flex; cursor: help; outline: none; }
.explain.explain-wide { max-width: min(360px, 92vw); }
.explain dd { white-space: pre-line; }

/* 指標解讀區塊 */
.indicator-block { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.indicator-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.indicator-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.indicator-head .k { color: var(--ink-soft); font-size: 13px; flex: 1; min-width: 0; }
.indicator-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.indicator-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--line-soft); background: rgba(0,0,0,.18);
  font-family: var(--pixel); color: var(--ink-soft); cursor: help;
}
.indicator-pill.up { color: var(--crimson); border-color: rgba(232,106,82,.35); }
.indicator-pill.down { color: var(--emerald); border-color: rgba(111,207,151,.35); }
.indicator-pill.cool { color: var(--indigo); }
.indicator-pct { font-family: var(--font-num); font-weight: 700; color: var(--ink-faint); }
.compass .era { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.score-ring {
  position: relative; width: 76px; height: 76px; flex: 0 0 76px;
}
.score-ring-svg { display: block; width: 100%; height: 100%; }
.score-ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 22px; font-weight: 700;
  color: var(--gold-soft); text-shadow: var(--glow-gold);
}

/* RangeBar */
.rangebar { margin: 8px 0 6px; }
.rangebar .track { position: relative; height: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--emerald-bg), var(--paper-3) 50%, var(--crimson-bg)); border: 1px solid rgba(0,0,0,.45); }
.rangebar .now { position: absolute; top: -3px; width: 4px; height: 14px; background: var(--gold); border-radius: 1px; transform: translateX(-2px); box-shadow: 0 0 6px rgba(231,198,107,.45); }
.rangebar .median { position: absolute; top: 0; width: 1px; height: 8px; background: var(--ink-faint); opacity: .7; }
.rangebar .labels { font-family: var(--pixel); display: flex; justify-content: space-between; font-size: 9px; color: var(--ink-faint); margin-top: 5px; }

/* 任務 */
.quest { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.quest:last-child { border-bottom: none; }
.quest .chk { width: 22px; height: 22px; border-radius: 3px; border: 2px solid var(--line); flex: 0 0 22px; display: grid; place-items: center; color: transparent; transition: .12s; margin-top: 1px; background: rgba(0,0,0,.3); }
.quest.done .chk { background: var(--emerald); border-color: var(--emerald); color: #0a0d18; box-shadow: 0 0 8px rgba(111,207,151,.6); }
.quest .q-body .q-title { font-weight: 600; }
.quest.done .q-body .q-title { text-decoration: line-through; color: var(--ink-faint); }
.quest .q-body .q-sub { font-size: 12px; color: var(--ink-soft); }
.quest .q-xp { font-family: var(--pixel); margin-left: auto; font-size: 12px; color: var(--gold); flex: 0 0 auto; }

/* 羅盤 */
.compass { display: flex; gap: 14px; align-items: flex-start; }
.compass .dial {
  width: 68px; height: 68px; flex: 0 0 68px; border-radius: 50%;
  border: 2px solid var(--gold); display: grid; place-items: center;
  background: radial-gradient(circle at 50% 38%, #2a325c, #11152e);
  font-size: 26px; box-shadow: 0 0 8px rgba(231,198,107,.35), inset 0 0 10px rgba(0,0,0,.55);
}
.compass .era { font-family: var(--pixel); font-size: 16px; color: var(--gold-soft); line-height: 1.35; }

/* 羅盤像素圖 */
.compass-art { flex: 0 0 108px; width: 108px; }
.compass-art-sm { flex: 0 0 80px; width: 80px; }
.compass-art-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 10px rgba(231,198,107,.25)); }

/* 可點擊的歷史相似期卡片 */
.era-card {
  display: flex; gap: 16px; align-items: flex-start; width: 100%;
  padding: 14px 16px; margin: 0; text-align: left;
  border: 2px solid var(--line); border-radius: var(--r);
  background: linear-gradient(135deg, rgba(22,27,52,.95), rgba(16,20,42,.98));
  color: var(--ink); cursor: pointer; transition: .15s;
  box-shadow: var(--shadow-sm);
}
.era-card:hover { border-color: var(--gold); box-shadow: var(--shadow), var(--glow-gold); transform: translateY(-2px); }
.era-card-compact { padding: 12px 14px; gap: 12px; }
.era-card-body { flex: 1; min-width: 0; }
.era-card-teaser { margin: 6px 0 10px; color: var(--ink-soft); line-height: 1.55; font-size: 13px; }
.era-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.era-card-cta { font-family: var(--pixel); font-size: 11px; color: var(--teal); margin-left: auto; letter-spacing: .5px; }

/* 編年史詳情面板 */
.era-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,6,14,.72); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px;
}
.era-panel {
  width: min(720px, 100%); max-height: min(88vh, 900px);
  background: var(--surface); border: 2px solid var(--gold);
  border-radius: var(--r-lg); box-shadow: var(--shadow), var(--glow-gold);
  display: flex; flex-direction: column; overflow: hidden;
  animation: eraSlide .22s ease-out;
}
@keyframes eraSlide { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.era-panel-head {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
  background: rgba(231,198,107,.05);
}
.era-panel-eyebrow { font-family: var(--pixel); font-size: 10px; color: var(--teal); letter-spacing: 2px; }
.era-panel-title { font-size: 20px; margin: 4px 0; color: var(--gold-soft); }
.era-panel-meta { font-size: 12px; color: var(--ink-soft); }
.era-close {
  width: 36px; height: 36px; border: 2px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper-2); color: var(--gold-soft); font-size: 22px; line-height: 1;
  cursor: pointer; flex: 0 0 36px;
}
.era-panel-body { overflow: auto; padding: 16px 18px 22px; }
.era-section { margin-bottom: 22px; }
.era-section h3 { font-size: 15px; margin: 0 0 8px; color: var(--gold-soft); }
.era-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.era-market-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 10px 0; }
.era-mstat { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: rgba(0,0,0,.18); }
.era-mstat-k { font-family: var(--pixel); font-size: 10px; color: var(--ink-faint); }
.era-mstat-v { font-family: var(--font-num); font-size: 20px; font-weight: 700; margin-top: 4px; color: var(--gold-soft); }
.era-mstat-v.up { color: var(--crimson); }
.era-mstat-v.down { color: var(--emerald); }
.era-trend { margin: 8px 0 12px; }
.era-chart { margin-top: 8px; }
.era-chart-cap { margin-top: 6px; text-align: center; }
.era-episode { padding: 12px 14px; border-left: 3px solid var(--crimson); background: rgba(232,106,82,.06); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.era-lesson { margin: 12px 0 0; padding: 10px 12px; background: rgba(0,0,0,.2); border-radius: var(--r-sm); font-style: italic; color: var(--ink-soft); }
.era-lesson-k { display: block; font-family: var(--pixel); font-size: 10px; color: var(--teal); font-style: normal; margin-bottom: 4px; }
.era-events { list-style: none; margin: 0; padding: 0; }
.era-events li { display: grid; grid-template-columns: 96px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.era-ev-date { font-family: var(--font-num); color: var(--gold); }

/* 指標對照橫條 */
.compare-bars { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.compare-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.compare-label { font-weight: 600; font-size: 13px; }
.compare-closeness { font-family: var(--pixel); font-size: 10px; }
.compare-closeness.up { color: var(--crimson); }
.compare-closeness.down { color: var(--emerald); }
.compare-closeness.cool { color: var(--indigo); }
.compare-closeness.gold { color: var(--gold); }
.compare-weight { font-size: 11px; color: var(--ink-faint); margin-left: auto; }
.compare-values { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.compare-tracks { display: flex; flex-direction: column; gap: 4px; }
.compare-track { display: flex; align-items: center; gap: 8px; }
.track-tag { font-family: var(--pixel); font-size: 9px; width: 28px; color: var(--ink-faint); }
.track-bar { flex: 1; height: 8px; background: var(--paper-3); border-radius: 2px; overflow: hidden; display: flex; }
.track-fill { height: 100%; border-radius: 2px; min-width: 2px; }
.track-fill.now { background: linear-gradient(90deg, #e7c66b, #f3dd96); }
.track-fill.then { background: linear-gradient(90deg, #6fe0d0, #8fb8ff); }

/* Tab / 卡片 SVG 圖示 */
.tab-ico { display: inline-flex; align-items: center; gap: 7px; }
.tab-icon { display: inline-flex; opacity: .85; }
.tab.active .tab-icon { opacity: 1; filter: drop-shadow(0 0 4px rgba(231,198,107,.4)); }
.card-title .ico-svg { display: inline-flex; align-items: center; line-height: 0; flex-shrink: 0; margin-right: 2px; }
.card-title .ico-svg .rpg-icon--hero { margin-top: -2px; }

/* RPG 金框圖示（與貓頭鷹立繪同系） */
.rpg-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 0;
}
.rpg-icon-svg { position: absolute; inset: 0; pointer-events: none; }
.rpg-icon-art { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; }
.rpg-icon-photo { image-rendering: auto; }
.rpg-icon--art .rpg-icon-svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.rpg-icon--glow { filter: drop-shadow(0 0 10px rgba(231,198,107,.55)); }
.rpg-icon--hero { animation: iconHeroPulse 4s ease-in-out infinite; }
.rpg-icon--hero.rpg-icon--glow { filter: drop-shadow(0 0 14px rgba(231,198,107,.65)); }
@keyframes iconHeroPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.rpg-sparkle { opacity: .9; }
.rpg-sparkle-a { animation: sparklePulse 2.4s ease-in-out infinite; }
.rpg-sparkle-b { animation: sparklePulse 2.4s ease-in-out .8s infinite; }
.game-icon-photo {
  border-radius: 6px; object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  image-rendering: auto;
}
.tab-ico .tab-icon .rpg-icon { margin-right: 2px; }
.map-tile:hover .rpg-icon--hero { transform: translateY(-4px) scale(1.04); transition: .2s; }

.weather-regime { display: flex; align-items: center; gap: 8px; }
.state-box--icon { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.state-box-head { display: flex; align-items: center; gap: 8px; }
.tag-icon-inline { display: inline-flex; vertical-align: middle; margin-right: 4px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-ico { flex: 0 0 auto; filter: drop-shadow(0 0 6px rgba(231,198,107,.35)); }

/* 歷史區間切換 */
.range-chips-wrap { margin-bottom: 12px; }
.range-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.range-chip {
  font-family: var(--pixel); font-size: 11px; padding: 5px 12px;
  border: 1px solid var(--line-soft); border-radius: 999px;
  background: rgba(0,0,0,.2); color: var(--ink-soft); cursor: pointer; transition: .12s;
}
.range-chip:hover { border-color: var(--gold); color: var(--gold-soft); }
.range-chip.active { border-color: var(--gold); color: var(--gold-soft); background: rgba(231,198,107,.1); box-shadow: var(--glow-gold); }
.range-chips-hint { margin-top: 6px; line-height: 1.45; }
.chart-span { text-align: center; margin-top: 8px; }

/* 編輯解讀（敘事旁白） */
.editorial { background: rgba(231,198,107,.06); border-left: 3px solid var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 14px 18px; font-family: var(--serif); color: #d9d2bd; line-height: 1.85; margin-top: 14px; }
.editorial .by { display: block; font-family: var(--pixel); font-size: 10px; color: var(--ink-faint); margin-top: 8px; letter-spacing: .5px; }

/* 地圖入口 */
.map-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); transition: .15s; color: var(--ink); position: relative; overflow: hidden; }
.map-tile::after { content:""; position:absolute; inset:0; background: radial-gradient(80% 60% at 50% -20%, rgba(231,198,107,.12), transparent 60%); pointer-events:none; }
.map-tile:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow), var(--glow-gold); color: var(--gold-soft); }
.map-tile .ic { display: flex; filter: drop-shadow(0 0 8px rgba(0,0,0,.6)); }
.map-tile .t { font-family: var(--pixel); font-size: 15px; color: var(--gold-soft); }
.map-tile .d { font-size: 12px; color: var(--ink-soft); }
.map-grid { gap: 14px; }

/* 雷達 / 屬性 */
.radar-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.attr-list { flex: 1; min-width: 180px; }
.attr-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.attr-row .nm { font-family: var(--pixel); width: 70px; font-size: 12px; color: var(--ink-soft); }
.attr-row .bar { flex: 1; }
.attr-row .vv { font-family: var(--pixel); width: 30px; text-align: right; color: var(--gold-soft); font-size: 13px; }
.attr-block { margin-bottom: 14px; }
.attr-block:last-child { margin-bottom: 0; }
.attr-formula-hint { margin: 4px 0 8px; line-height: 1.45; }
.attr-breakdown {
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.attr-breakdown-head {
  display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--pixel); font-size: 10px; color: var(--gold-soft);
  margin-bottom: 6px;
}
.attr-breakdown-row {
  display: grid; grid-template-columns: 72px 42px 1fr; gap: 6px 8px;
  align-items: baseline; font-size: 11px; padding: 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
}
.attr-breakdown-row:first-of-type { border-top: none; }
.attr-bd-label { color: var(--ink-soft); }
.attr-bd-score { font-family: var(--pixel); color: var(--gold); text-align: right; }
.attr-bd-detail { color: color-mix(in srgb, var(--ink) 75%, var(--ink-soft)); line-height: 1.4; }

/* 數據列 */
.dl { display: flex; flex-direction: column; }
.dl .row { display: flex; justify-content: space-between; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.dl .row:last-child { border-bottom: none; }
.dl .row .k { color: var(--ink-soft); }
.dl .row .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 卡牌牆 */
.card-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(166px,1fr)); gap: 14px; }
.gcard { border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: .15s; }
.gcard:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow), var(--glow-gold); }
.gcard .art {
  min-height: 96px; padding: 12px 8px 10px;
  display: grid; place-items: center; font-size: 42px;
  background: radial-gradient(circle at 50% 35%, #232a52, #11152e);
  border-bottom: 2px solid var(--line); filter: drop-shadow(0 0 10px rgba(0,0,0,.5));
  box-sizing: border-box;
}
.gcard.locked .art { filter: grayscale(1) brightness(.5); }
.gcard .body { padding: 11px 12px; }
.gcard .nm { font-family: var(--pixel); font-size: 13px; color: var(--gold-soft); }
.gcard .sub { font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.gcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* 技能樹 · 修煉區（RPG 卡牌牆） */
.skill-page .page-head p { max-width: 52em; }
.skill-quest-board {
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, rgba(231,198,107,.06), rgba(111,224,208,.04));
}
.skill-kpi .k-v { text-shadow: var(--glow-gold); }
.skill-group {
  margin-bottom: 20px; padding: 14px 16px 16px;
  border: 2px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.skill-group-head {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
  align-items: center; text-align: left; border: 0; background: transparent; color: inherit;
  padding: 0 0 10px; cursor: pointer; font: inherit;
  border-bottom: 1px dashed rgba(231,198,107,.18); margin-bottom: 12px;
}
.skill-group-head h3 {
  grid-column: 1; margin: 0;
  font-family: var(--pixel); font-size: 15px; color: var(--gold-soft);
  display: flex; align-items: center; gap: 8px; text-shadow: 0 0 10px rgba(231,198,107,.2);
}
.skill-group-when {
  grid-column: 1; font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px;
}
.skill-group-toggle {
  grid-column: 2; grid-row: 1 / span 2; font-family: var(--pixel); font-size: 10px;
  color: var(--teal); align-self: center; letter-spacing: .5px;
}
.skill-row { margin-top: 0; }
.skill-node {
  display: flex; flex-direction: column; width: 100%; padding: 0;
  border: 2px solid var(--line); border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: .15s;
  text-align: left; font: inherit; color: inherit; overflow: hidden;
}
.skill-node:hover {
  transform: translateY(-3px); border-color: var(--gold);
  box-shadow: var(--shadow), var(--glow-gold);
}
.skill-node .sn-art {
  min-height: 72px;
  padding: 10px 8px 8px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #232a52, #11152e);
  border-bottom: 2px solid var(--line);
  filter: drop-shadow(0 0 8px rgba(0,0,0,.45));
  box-sizing: border-box;
}
.skill-node .sn-art .rpg-icon { flex-shrink: 0; }
.skill-node.rar-epic .sn-art,
.skill-node.core .sn-art {
  background: radial-gradient(circle at 50% 35%, #3a2860, #14102a);
}
.skill-node.rar-rare .sn-art { background: radial-gradient(circle at 50% 35%, #1e3358, #10182e); }
.skill-node.rar-legend .sn-art { background: radial-gradient(circle at 50% 35%, #4a3a18, #1a1408); }
.skill-node.mastered .sn-art { box-shadow: inset 0 0 24px rgba(231,198,107,.25); }
/* 未精通：卡面灰階，但待補錯題紅點保留原色 */
.skill-node:not(.mastered) {
  border-color: var(--line-soft);
}
.skill-node:not(.mastered) .sn-art {
  filter: grayscale(1) brightness(0.76) saturate(0.2) drop-shadow(0 0 8px rgba(0, 0, 0, 0.45));
}
.skill-node:not(.mastered):hover {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.skill-node:not(.mastered):hover .sn-art {
  filter: grayscale(1) brightness(0.86) saturate(0.25) drop-shadow(0 0 8px rgba(0, 0, 0, 0.45));
}
.skill-node:not(.mastered) .sn-nm { color: var(--ink-soft); }
.skill-node:not(.mastered) .sn-mastery { color: var(--ink-faint); }
.skill-node:not(.mastered) .pill-rar {
  filter: grayscale(1) brightness(0.8) saturate(0.25);
  opacity: 0.72;
}
.skill-node:not(.mastered) .sn-note-dot {
  filter: grayscale(1) brightness(0.75) saturate(0.2);
  opacity: 0.65;
}
.skill-node:not(.mastered) .sn-mistake-dot {
  filter: none;
  opacity: 1;
}
.skill-node.mastered {
  border-color: var(--line);
}
.skill-node .sn-body { padding: 10px 11px 11px; min-width: 0; }
.skill-node .sn-nm {
  font-family: var(--pixel); font-size: 12px; line-height: 1.45;
  color: var(--gold-soft); min-height: 2.9em;
}
.skill-node.mastered .sn-nm { color: var(--gold-soft); }
.skill-node .sn-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 8px; flex-wrap: wrap;
}
.skill-node .sn-mastery {
  font-family: var(--pixel); font-size: 10px; color: var(--teal); letter-spacing: .5px;
}
.skill-node.mastered .sn-mastery { color: var(--gold-soft); text-shadow: var(--glow-gold); }
.skill-node.selected {
  border-color: var(--gold-soft); box-shadow: var(--shadow), var(--glow-gold);
  transform: translateY(-2px);
}
.skill-node.selected:not(.mastered) {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.skill-progress-card { margin-bottom: 16px; }
.skill-progress-row { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.skill-progress-bar-wrap { flex: 1; min-width: 200px; }
.skill-progress-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.skill-rarity-legend { margin-bottom: 14px; }
.skill-drill-rule { margin: 0 0 10px; line-height: 1.55; }
.skill-rarity-legend .mt-s { margin-top: 10px; }
.skill-rarity-legend-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.skill-rarity-legend-head strong {
  font-family: var(--pixel); font-size: 12px; color: var(--gold-soft); letter-spacing: .5px;
}
.skill-rarity-legend-grid {
  display: grid; gap: 8px 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.skill-rarity-legend-item {
  display: flex; align-items: flex-start; gap: 8px; line-height: 1.45;
}
.skill-node .sn-art { position: relative; }
.skill-node .sn-art-master {
  position: absolute; right: 6px; bottom: 6px;
  filter: drop-shadow(0 0 6px rgba(231,198,107,.55));
}
.skill-card-rarity-reason {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px; line-height: 1.5;
}
.skill-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.skill-toolbar .skill-search { flex: 1; min-width: 200px; margin: 0; }

/* 心法卡 · 置中寶箱彈窗（上下留天地，不貼邊、不裁切） */
body.skill-modal-open { overflow: hidden; }
.skill-modal {
  position: fixed; inset: 0; z-index: 520;
  display: flex; align-items: center; justify-content: center;
  padding:
    max(28px, env(safe-area-inset-top, 0px))
    16px
    max(28px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.skill-modal-backdrop {
  position: absolute; inset: 0; border: 0; cursor: pointer;
  background: rgba(5,7,16,.72); backdrop-filter: blur(4px);
}
.skill-modal-panel {
  position: relative; z-index: 1;
  width: min(680px, 100%);
  max-height: calc(
    100dvh - 56px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
  );
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 2px solid var(--gold);
  border-radius: var(--r); box-shadow: var(--shadow), var(--glow-gold);
  overflow: hidden;
}
.skill-modal-panel--tabbed { width: min(680px, 100%); }
/* 教練分頁：加寬加高，對話區更舒展 */
.skill-modal-panel--coach {
  width: min(820px, 100%);
  max-height: calc(
    100dvh - 36px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
  );
}
.skill-modal-panel--coach .skill-modal-banner {
  min-height: 48px;
  padding: 6px 0 4px;
}
.skill-modal-panel--coach .skill-modal-head {
  padding: 10px 18px;
}
.skill-modal-tabs {
  display: flex; gap: 4px; margin-left: 8px; flex: 1; justify-content: center;
}
.skill-modal-tab {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--pixel); font-size: 10px; letter-spacing: .4px;
  padding: 6px 10px; border: 2px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); color: var(--ink-soft); cursor: pointer;
}
.skill-modal-tab:hover { border-color: var(--gold); color: var(--gold-soft); }
.skill-modal-tab.active {
  border-color: var(--gold); color: var(--gold-soft);
  background: rgba(231,198,107,.12); box-shadow: var(--glow-gold);
}
.skill-modal-pane {
  flex: 1; min-height: 0; overflow: hidden;
}
.skill-modal-pane[hidden] { display: none !important; }
.skill-modal-pane:not([hidden]) {
  display: flex; flex-direction: column;
}
.skill-modal-body--coach,
.skill-modal-body--drill,
.skill-modal-body--notes {
  padding: 0 !important;
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  overflow: hidden;
}
.skill-modal-tab.has-notes::after,
.skill-modal-tab.has-open-mistake::after {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  margin-left: 2px;
}
.skill-modal-tab.has-notes::after {
  background: var(--teal);
  box-shadow: 0 0 6px rgba(111,224,208,.6);
}
.skill-modal-tab.has-open-mistake::after {
  background: var(--crimson);
  box-shadow: 0 0 6px rgba(232,106,82,.6);
}
.skill-modal-body--records {
  padding: 16px 18px 24px !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.skill-modal-body--records .skill-drill-history {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.skill-notes {
  display: flex; flex-direction: column; gap: 14px;
  flex: 1; min-height: 0;
  padding: 16px 18px 22px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.skill-notes-head {
  display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
}
.skill-notes-head strong {
  font-family: var(--pixel); font-size: 13px; color: var(--gold-soft);
}
.skill-notes-save {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.skill-notes-save-alert { color: var(--gold-soft); }
.skill-notes-field {
  display: flex; flex-direction: column; gap: 8px;
}
.skill-notes-label {
  font-family: var(--pixel); font-size: 11px; color: var(--teal);
}
.skill-notes-textarea {
  width: 100%; min-height: 180px; resize: vertical;
  background: var(--paper-2); border: 2px solid var(--line);
  border-radius: var(--r-sm); color: var(--ink);
  padding: 12px 14px; font-family: var(--sans); font-size: 14px; line-height: 1.65;
}
.skill-notes-textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(231,198,107,.15);
}
.skill-notes-coach-log {
  border: 2px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.18); padding: 12px 14px;
}
.skill-notes-coach-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.skill-notes-coach-head strong {
  font-family: var(--pixel); font-size: 11px; color: var(--gold-soft);
}
.skill-notes-empty { margin: 0; }
.skill-notes-log-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
  max-height: 240px; overflow-y: auto;
}
.skill-notes-log-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: start;
  padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.2);
}
.skill-notes-log-item.role-user .skill-notes-log-role { color: #8fb8ff; }
.skill-notes-log-item.role-assistant .skill-notes-log-role { color: var(--gold-soft); }
.skill-notes-log-role {
  font-family: var(--pixel); font-size: 10px; padding-top: 2px;
}
.skill-notes-log-body p {
  margin: 0; font-size: 13px; line-height: 1.55; white-space: pre-wrap;
}
.skill-notes-clip { font-size: 11px !important; padding: 4px 8px !important; }
.sn-foot-tags { display: inline-flex; align-items: center; gap: 6px; }
.sn-note-dot {
  display: inline-flex; color: var(--teal);
  filter: drop-shadow(0 0 4px rgba(111,224,208,.45));
}
.skill-drill {
  display: flex; flex-direction: column; gap: 14px;
  flex: 1; min-height: 0;
  padding: 16px 18px 22px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.skill-drill-intro {
  display: flex; gap: 10px; align-items: flex-start;
}
.skill-drill-intro strong {
  font-family: var(--pixel); font-size: 13px; color: var(--gold-soft);
}
.skill-drill-steps {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.skill-drill-step-pill {
  font-family: var(--pixel); font-size: 10px; padding: 4px 10px;
  border: 2px solid var(--line-soft); border-radius: 999px; color: var(--ink-soft);
}
.skill-drill-step-pill.active {
  border-color: var(--gold); color: var(--gold-soft); background: rgba(231,198,107,.1);
}
.skill-drill-step-pill.done {
  border-color: var(--teal); color: var(--teal);
}
.skill-drill-stage { display: flex; flex-direction: column; gap: 12px; }
.skill-drill-prompt {
  margin: 0; font-family: var(--pixel); font-size: 12px; line-height: 1.5; color: var(--gold-soft);
}
.skill-drill-options { display: grid; gap: 8px; }
.skill-drill-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 2px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.2); cursor: pointer; font-size: 13px; line-height: 1.5;
}
.skill-drill-option:has(input:checked) {
  border-color: var(--gold); background: rgba(231,198,107,.08);
}
.skill-drill-option input { margin-top: 3px; accent-color: var(--gold); }
.skill-drill-field {
  display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-soft);
}
.skill-drill-field textarea,
.skill-drill-field input {
  background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); padding: 8px 10px; font-family: var(--sans); font-size: 14px;
}
.skill-drill-scenario p { margin: 6px 0 0; font-size: 14px; line-height: 1.6; }
.skill-drill-snapshot pre,
.skill-drill-chart-stats {
  margin: 6px 0 0; white-space: pre-wrap; font-size: 13px; line-height: 1.55;
  color: var(--ink-soft); font-family: var(--sans);
}
.skill-drill-chart-panel { overflow: hidden; }
.skill-drill-chart-wrap { margin: 0 0 8px; }
.skill-drill-chart-meta {
  font-size: 10px; color: var(--teal); margin-bottom: 6px; letter-spacing: .4px;
}
.skill-drill-candle {
  height: 200px; min-height: 180px; width: 100%;
}
.skill-drill-chart-stats {
  margin-top: 8px; padding: 8px 10px;
  background: rgba(0,0,0,.22); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.skill-drill-event-hint { margin: 8px 0 0; }
.skill-drill-snapshot-k {
  font-family: var(--pixel); font-size: 10px; color: var(--teal);
}
.skill-drill-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; }
.skill-drill-error { color: var(--crimson); font-size: 13px; margin: 0; }
.skill-drill-result-head {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.skill-drill-score { display: flex; align-items: baseline; gap: 2px; }
.skill-drill-score-num {
  font-family: var(--pixel); font-size: 32px; color: var(--gold-soft);
  text-shadow: var(--glow-gold);
}
.skill-drill-score.mastered .skill-drill-score-num { color: #f8e6a8; }
.skill-drill-score-unit { font-size: 14px; color: var(--ink-soft); }
.skill-drill-feedback {
  margin: 0; font-size: 14px; line-height: 1.65; color: var(--ink);
}
.skill-drill-breakdown { display: grid; gap: 8px; }
.skill-drill-bar-row { display: grid; gap: 4px; }
.skill-drill-bar-label {
  font-family: var(--pixel); font-size: 10px; color: var(--ink-soft);
}
.skill-drill-fatal {
  padding: 10px 12px; border: 2px solid rgba(232,106,82,.45);
  border-radius: var(--r-sm); background: rgba(232,106,82,.1); font-size: 13px;
}
.skill-drill-fatal ul { margin: 6px 0 0; padding-left: 18px; }
.skill-drill-weak-k {
  font-family: var(--pixel); font-size: 10px; color: var(--teal); margin-bottom: 4px;
}
.skill-drill-weak ul { margin: 0; padding-left: 18px; font-size: 13px; }

.skill-mistake-book { margin-bottom: 14px; }
.skill-mistake-head {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px;
}
.skill-mistake-head strong {
  font-family: var(--pixel); font-size: 12px; color: var(--gold-soft);
}
.skill-mistake-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
}
.skill-mistake-item {
  display: flex; gap: 10px; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; padding: 10px 12px;
  border: 2px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.18);
}
.skill-mistake-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.skill-mistake-meta { margin-top: 2px; }
.skill-mistake-weak { margin-top: 4px; color: var(--teal); }
.skill-mistake-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sn-mistake-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 6px rgba(232, 106, 82, 0.55);
  flex-shrink: 0;
}

.skill-drill-history {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.skill-drill-history--compact {
  margin-bottom: 12px;
  padding-bottom: 10px;
}
.skill-drill-history-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.skill-drill-history-head strong { display: block; margin-bottom: 2px; }

.skill-drill-log-open-block {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 2px solid rgba(232, 106, 82, 0.4);
  background: rgba(232, 106, 82, 0.08);
}
.skill-drill-log-open-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: #f0a090;
}
.skill-drill-log-past-label {
  margin: 4px 0 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}
.skill-drill-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.skill-drill-log-item {
  padding: 12px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.skill-drill-log-item.open,
.skill-drill-log-item.pinned {
  border-color: rgba(232, 106, 82, 0.4);
  background: rgba(232, 106, 82, 0.06);
}
.skill-drill-log-item.wrong:not(.open) {
  border-color: rgba(232, 106, 82, 0.25);
}
.skill-drill-log-item.passed {
  border-color: rgba(111, 207, 151, 0.25);
}
.skill-drill-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.skill-drill-log-score {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.skill-drill-log-score.mastered { color: var(--gold-soft); }
.skill-drill-log-badge,
.skill-drill-history-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(111, 207, 151, 0.2);
  color: var(--emerald);
}
.skill-drill-log-badge.open,
.skill-drill-history-badge.open {
  background: rgba(232, 106, 82, 0.2);
  color: var(--crimson);
}
.skill-drill-log-you {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: rgba(143, 184, 255, 0.08);
  border: 1px solid rgba(143, 184, 255, 0.2);
}
.skill-drill-log-you-k {
  display: block;
  font-size: 11px;
  color: var(--indigo);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.skill-drill-log-you p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.skill-drill-log-you-detail {
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}
.skill-drill-log-you-detail dt {
  font-size: 11px;
  color: var(--ink-faint);
}
.skill-drill-log-you-detail dd {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.skill-drill-log-coach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.skill-drill-log-coach-body { flex: 1; min-width: 0; }
.skill-drill-log-coach-name {
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--gold-soft);
  margin-bottom: 6px;
}
.skill-drill-log-coach .guide-bubble-wrap { max-width: 100%; }
.skill-drill-log-wrong {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.skill-drill-history-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(232, 106, 82, 0.18);
  color: #f0a090;
}
.skill-drill-history-tag.fatal { max-width: 100%; }
.skill-drill-history-weak {
  width: 100%;
  margin-top: 2px;
  color: var(--teal);
}
.skill-drill-log-next {
  margin: 10px 0 0;
  line-height: 1.55;
}
.skill-drill-log-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skill-mistake-coach {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line-soft);
  line-height: 1.55;
  color: var(--ink-soft);
}
.skill-mistake-coach-k {
  display: block;
  font-size: 11px;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.skill-mistake-resolved {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.skill-coach-chat {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  overflow: hidden;
}
.skill-modal-panel--coach .skill-coach-chat {
  min-height: min(58vh, 560px);
}
.skill-coach-chat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px 12px;
  border-bottom: 2px solid var(--line-soft); background: rgba(231,198,107,.06); flex-shrink: 0;
}
.skill-coach-chat-name {
  font-family: var(--pixel); font-size: 14px; color: var(--gold-soft);
}
.skill-coach-setup {
  padding: 10px 20px; background: rgba(232,106,82,.08);
  border-bottom: 1px solid var(--line-soft); font-size: 13px; flex-shrink: 0;
}
.skill-coach-messages {
  flex: 1; min-height: 280px; max-height: none;
  padding: 16px 20px 18px !important;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.skill-coach-chat .guide-msg { gap: 10px; }
.skill-coach-chat .guide-bubble-wrap { max-width: 90%; }
.skill-coach-chat .guide-bubble {
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.65;
  border-width: 2px;
}
.skill-coach-skills {
  flex-shrink: 0;
  padding: 4px 20px 10px;
}
.skill-coach-skills .guide-skills-k { font-size: 11px; margin-bottom: 8px; }
.skill-coach-skills .guide-skill {
  font-size: 11px;
  padding: 6px 12px;
}
.skill-coach-compose {
  flex-shrink: 0;
  padding: 12px 20px max(14px, env(safe-area-inset-bottom, 0px)) !important;
  gap: 10px;
}
.skill-coach-compose textarea {
  min-height: 72px !important;
  max-height: 160px !important;
  font-size: 15px !important;
  padding: 10px 12px !important;
  border-width: 2px !important;
}
.skill-coach-compose .guide-send {
  width: 48px;
  height: 48px;
  align-self: flex-end;
  font-size: 20px;
}
.skill-modal-panel.rar-epic { border-color: var(--rar-epic); box-shadow: var(--shadow), 0 0 20px rgba(201,139,255,.35); }
.skill-modal-panel.rar-rare { border-color: var(--rar-rare); }
.skill-modal-banner {
  flex-shrink: 0;
  min-height: 68px; padding: 10px 0 8px;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(231,198,107,.22), transparent 70%),
    linear-gradient(180deg, #1a2048, var(--surface));
  border-bottom: 2px solid var(--line);
  overflow: visible;
}
.skill-modal-banner .rpg-icon {
  filter: drop-shadow(0 0 10px rgba(231,198,107,.5));
  flex-shrink: 0;
}
.skill-group-head h3 .rpg-icon { flex-shrink: 0; }
.skill-modal-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  border-bottom: 2px solid var(--line); background: rgba(0,0,0,.25); flex-shrink: 0;
  flex-wrap: wrap;
}
.skill-modal-head strong {
  font-family: var(--pixel); font-size: 14px; color: var(--gold-soft);
  text-shadow: var(--glow-gold); letter-spacing: .5px;
}
.skill-modal-close {
  margin-left: auto; width: 32px; height: 32px; border: 2px solid var(--line);
  border-radius: var(--r-sm); background: rgba(0,0,0,.3); color: var(--ink-soft);
  font-size: 18px; line-height: 1; cursor: pointer; font-family: var(--pixel);
}
.skill-modal-close:hover { border-color: var(--crimson); color: var(--crimson); }
.skill-modal-body {
  flex: 1; min-height: 0;
  padding: 16px 18px 22px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.skill-card-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.skill-card-title {
  margin: 0 0 6px; font-size: 17px; line-height: 1.4; color: var(--gold-soft);
  text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 12px rgba(231,198,107,.2);
}
.skill-card-meta {
  font-family: var(--pixel); font-size: 10px; color: var(--ink-faint);
  margin-bottom: 14px; letter-spacing: .5px;
}
.skill-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.skill-card-section { margin-bottom: 16px; }
.skill-card-section-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.skill-card-section-head h3 {
  margin: 0; font-family: var(--pixel); font-size: 13px; color: var(--gold-soft);
}
.skill-card-text, .skill-card-list, .skill-instance-text, .skill-card-raw {
  font-size: 14px; line-height: 1.65; color: var(--ink);
}
.skill-card-list { margin: 0; padding-left: 18px; }
.skill-card-list li { margin-bottom: 5px; }
.skill-card-list li::marker { color: var(--gold); }
.skill-card-quote { margin: 14px 0; }
.skill-instance-list { display: grid; gap: 8px; }
.skill-instance {
  padding: 10px 12px !important; margin: 0 !important;
  border: 2px solid var(--line-soft) !important; background: rgba(0,0,0,.22) !important;
}
.skill-instance-ep { font-family: var(--pixel); font-size: 10px; color: var(--teal); margin-bottom: 4px; }
.skill-card-raw {
  white-space: pre-wrap; background: rgba(0,0,0,.28); border: 2px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px; overflow: auto; max-height: 220px;
  font-size: 13px; line-height: 1.6; color: var(--ink-soft);
}
.skill-card-foot {
  margin: 8px 0 4px; padding-bottom: 4px;
  font-family: var(--pixel); font-size: 9px;
  color: var(--ink-faint); line-height: 1.6; letter-spacing: .3px;
}
@media (max-width: 768px) {
  .skill-progress-side { width: 100%; }
  .skill-modal {
    padding:
      max(20px, env(safe-area-inset-top, 0px))
      12px
      max(20px, env(safe-area-inset-bottom, 0px));
  }
  .skill-modal-panel {
    max-height: calc(
      100dvh - 40px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
  }
  .skill-modal-tabs { order: 3; width: 100%; justify-content: stretch; margin: 6px 0 0; }
  .skill-modal-tab { flex: 1; justify-content: center; }
  .skill-modal-close { order: 2; }
  .skill-drill { padding: 14px 14px 20px; }
  .skill-modal-body { padding: 14px 14px 20px; }
  .pat-modal .skill-modal-panel {
    max-height: calc(
      100dvh - 40px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
  }
  .pat-modal-body { padding: 14px 14px 20px; }
  .pat-modal-panel.pat-modal--book .pat-book-frame {
    height: min(420px, 46vh);
    min-height: 240px;
  }
  .skill-modal-panel--coach {
    width: 100%;
    max-height: calc(
      100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
  }
  .skill-modal-panel--coach .skill-coach-chat {
    min-height: min(52vh, 480px);
  }
  .skill-coach-messages { min-height: 220px; padding: 14px 16px 16px !important; }
  .skill-coach-compose { padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px)) !important; }
}

/* wizard */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.step.active { border-color: var(--gold); background: rgba(231,198,107,.08); box-shadow: var(--glow-gold); }
.step.done .step-no { background: var(--emerald); border-color: var(--emerald); color: #0a0d18; }
.step-no { font-family: var(--pixel); width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: 0 0 26px; }
.step.active .step-no { border-color: var(--gold); color: var(--gold); }
.step .step-t { font-family: var(--pixel); font-size: 12px; color: var(--gold-soft); }
.step .step-s { font-size: 11px; color: var(--ink-soft); }
.step-panel { display: none; } .step-panel.active { display: block; animation: fade .25s; }
@keyframes fade { from {opacity:0; transform: translateY(6px);} to {opacity:1; transform:none;} }

/* tabs */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { font-family: var(--pixel); padding: 9px 15px; cursor: pointer; border-radius: var(--r-sm) var(--r-sm) 0 0; font-size: 13px; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--gold-soft); border-bottom-color: var(--gold); text-shadow: var(--glow-gold); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { font-family: var(--pixel); text-align: left; font-size: 11px; color: var(--ink-soft); padding: 10px; border-bottom: 2px solid var(--line); letter-spacing: .5px; }
table.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
table.tbl tr:hover td { background: rgba(231,198,107,.05); }

/* 成就 */
.ach { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ach.locked { opacity: .4; }
.ach .a-ic {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); display: grid; place-items: center;
  border: 1px solid var(--line-soft); flex-shrink: 0;
}
.ach .a-ic .rpg-icon { margin: 0; }
.ach.unlocked .a-ic { background: rgba(231,198,107,.12); border-color: var(--gold); box-shadow: var(--glow-gold); }
.ach.locked .a-ic .rpg-icon { filter: grayscale(0.85) brightness(0.72); opacity: 0.75; }
.ach .a-nm { font-family: var(--pixel); color: var(--gold-soft); font-size: 14px; }
.ach .a-d { font-size: 12px; color: var(--ink-soft); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.profile-hero-card { background: linear-gradient(135deg, rgba(231,198,107,.08), rgba(111,224,208,.05)); }
.profile-hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-hero-avatar { flex-shrink: 0; }
.profile-hero-body { flex: 1; min-width: 220px; }
.profile-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.profile-hero-name { font-family: var(--pixel); font-size: 18px; color: var(--gold-soft); }
.profile-name-form { margin-bottom: 6px; }
.profile-name-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.profile-name-input {
  flex: 1; min-width: 140px; max-width: 220px;
  font-family: var(--pixel); font-size: 15px; color: var(--gold-soft);
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px;
}
.profile-name-input:focus { outline: none; border-color: var(--gold); box-shadow: var(--glow-gold); }
.profile-name-msg { color: var(--teal); margin-top: 4px; display: block; }
.profile-title-ladder { display: flex; flex-direction: column; gap: 8px; }
.profile-title-step {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  opacity: 0.55;
}
.profile-title-step.unlocked { opacity: 1; }
.profile-title-step.current {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, var(--panel));
  box-shadow: var(--glow-gold);
}
.profile-title-lv {
  font-family: var(--pixel); font-size: 11px; color: var(--ink-soft);
  min-width: 42px;
}
.profile-title-label {
  font-family: var(--pixel); font-size: 14px; color: var(--gold-soft);
  flex: 1;
}
.profile-hero-epithet {
  display: block; margin-top: 4px;
  font-family: var(--pixel); font-size: 12px; color: var(--teal);
  text-shadow: 0 0 8px rgba(111,224,208,.35);
}
.hero-meta .lvl { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.hero-epithet {
  font-family: var(--pixel); font-size: 10px; color: var(--teal);
  letter-spacing: 0.02em;
}
.profile-epithet-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px;
}
.profile-epithet-toolbar .btn-ghost.active {
  border-color: var(--gold); color: var(--gold-soft);
  background: color-mix(in srgb, var(--gold) 12%, var(--panel));
}
.profile-epithet-branch { margin-bottom: 18px; }
.profile-epithet-branch:last-child { margin-bottom: 0; }
.profile-epithet-branch-title {
  font-family: var(--pixel); font-size: 12px; color: var(--gold);
  margin-bottom: 8px; letter-spacing: 0.04em;
}
.profile-epithet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.profile-epithet-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}
.profile-epithet-card.locked { opacity: 0.5; }
.profile-epithet-card.unlocked { opacity: 1; }
.profile-epithet-card.equipped {
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel));
}
.profile-epithet-body { flex: 1; min-width: 0; }
.profile-epithet-name {
  font-family: var(--pixel); font-size: 13px; color: var(--gold-soft); margin-bottom: 4px;
}
.profile-epithet-req { margin-top: 4px; font-size: 10px !important; }
.profile-epithet-progress { color: var(--teal); margin-top: 4px; }
.profile-hero-title { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.profile-hero-gold {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--pixel); font-size: 13px; color: var(--gold);
  padding: 6px 10px; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  background: color-mix(in srgb, var(--gold) 10%, var(--panel));
}
.profile-hero-xp-note { margin: 8px 0 0; }
.profile-quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.profile-quick-links .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.profile-xp-line-head .profile-xp-ico { flex-shrink: 0; opacity: 0.95; }
.profile-quest-go {
  font-family: var(--pixel); font-size: 11px; color: var(--gold-soft);
  text-decoration: none; margin-left: 8px; flex-shrink: 0;
}
.profile-quest-go:hover { color: var(--gold); }
.attr-radar-svg { flex-shrink: 0; }
.attr-radar-label {
  font-family: var(--pixel); font-size: 10px; fill: var(--ink-soft);
}
.profile-stage-tag { margin-top: 8px; }
.profile-stage-hint { margin: 8px 0 12px; line-height: 1.5; color: color-mix(in srgb, var(--ink) 88%, var(--gold) 12%); }
.profile-xp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
}
.profile-xp-line {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--line) 75%, var(--gold) 15%);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}
.profile-xp-line-head {
  display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px;
  font-size: 13px; color: var(--gold-soft);
}
.profile-xp-line-head strong { color: var(--gold); font-family: var(--pixel); font-size: 12px; }
.profile-quest-chapter { margin-bottom: 16px; }
.profile-quest-chapter:last-child { margin-bottom: 0; }
.profile-quest-chapter-title {
  font-family: var(--pixel); font-size: 12px; color: var(--gold);
  margin-bottom: 6px; letter-spacing: 0.04em;
}
.profile-quest-why {
  font-size: 11px; line-height: 1.45; color: color-mix(in srgb, var(--ink-soft) 85%, var(--sky) 15%);
  margin-top: 4px;
}
.profile-quest-progress { color: var(--gold); font-size: 11px; }
.profile-ach-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.profile-ach-pill {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-soft);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
}
.profile-ach-section { margin-bottom: 18px; }
.profile-ach-section:last-child { margin-bottom: 0; }
.profile-ach-section-title {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--pixel); font-size: 12px; color: var(--gold-soft);
  margin-bottom: 10px;
}
.profile-ach-tier {
  margin-left: 6px; font-size: 9px; padding: 1px 5px; border-radius: 4px;
  vertical-align: middle;
}
.profile-ach-tier.tier-bronze { background: color-mix(in srgb, #c98a5a 25%, transparent); color: #e8b88a; }
.profile-ach-tier.tier-silver { background: color-mix(in srgb, #b8c0d8 20%, transparent); color: #d8e0f0; }
.profile-ach-tier.tier-gold { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
.profile-ach-tier.tier-legend { background: color-mix(in srgb, #c45cff 20%, transparent); color: #e0a8ff; }

/* KPI */
.kpi { text-align: center; }
.kpi .k-v { font-family: var(--pixel); font-size: 24px; color: var(--gold-soft); text-shadow: var(--glow-gold); }
.kpi .k-l { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.kpi .k-d { font-size: 12px; margin-top: 4px; }

/* 圖表容器：留白、縮小時高度與字級跟著收 */
.chart-panel {
  padding: 12px 10px 8px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.chart-panel--curve { padding: 10px 12px 6px; }
.chart-panel-tag { margin-bottom: 8px; }
.chart-caption { font-size: 11px; color: var(--ink-faint); margin-top: 6px; line-height: 1.5; }
.mini-chart-svg {
  display: block; width: 100%; height: auto;
  max-height: 108px; aspect-ratio: 360 / 128;
}
.px-chart {
  width: 100%; height: 188px;
  display: block; background: transparent;
}
@media (max-width: 768px){
  .px-chart { height: 148px; }
  .chart-panel { padding: 10px 8px 6px; }
  .mini-chart-svg { max-height: 88px; }
}
@media (max-width: 480px){
  .px-chart { height: 132px; }
  .mini-chart-svg { max-height: 76px; }
}
@media (min-width: 921px){
  .score-ring { width: 84px; height: 84px; flex: 0 0 84px; }
  .score-ring .num { font-size: 24px; }
  .compass-art { flex: 0 0 88px; width: 88px; }
  .era-market-grid { grid-template-columns: 1fr; }
  .era-events li { grid-template-columns: 1fr; gap: 2px; }
  .era-overlay { align-items: stretch; padding: 0; }
  .era-panel { max-height: 100vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* 抽屜 */
.drawer-mask { position: fixed; inset: 0; background: rgba(5,7,16,.6); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw; background: var(--surface); border-left: 2px solid var(--gold); box-shadow: -8px 0 40px rgba(0,0,0,.6); transform: translateX(100%); transition: transform .25s; z-index: 51; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { font-family: var(--pixel); padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; color: var(--gold-soft); }
.drawer-head .x { margin-left: auto; cursor: pointer; font-size: 22px; color: var(--ink-soft); }
.drawer-body { padding: 20px; overflow-y: auto; }
.ai-msg { background: var(--indigo-bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.ai-q { display: block; width: 100%; text-align: left; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-size: 13px; color: var(--ink); }
.ai-q:hover { background: rgba(231,198,107,.1); border-color: var(--gold); color: var(--gold-soft); }

.muted { color: var(--ink-soft); } .small { font-size: 12px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; }
.disclaimer { font-family: var(--pixel); font-size: 10px; color: var(--ink-faint); text-align: center; padding: 24px 0 6px; letter-spacing: 1px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: none; }

/* 載入/錯誤/缺金鑰狀態框 */
.state-box { border: 2px dashed var(--line); border-radius: var(--r); padding: 18px; text-align: center; color: var(--ink-soft); background: rgba(0,0,0,.2); }
.state-box .pixel { font-family: var(--pixel); color: var(--gold-soft); }
.state-box.state-error { border-color: rgba(232,106,82,.5); }
.state-box.state-key { border-color: var(--line); background: rgba(231,198,107,.06); }
.state-box.state-error .pixel { color: var(--crimson); }

/* ── 數字字體：清晰且帶遊戲感（Oxanium 等寬數字）── */
.dl .row .v { font-family: var(--font-num); font-size: 16px; font-weight: 700; color: var(--gold-soft); font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.dl .row .v .muted, .dl .row .v .small { font-family: var(--sans); font-weight: 400; }


/* 顯著統計數字卡 */
.stat-card { display: flex; flex-direction: column; gap: 2px; }
.stat-head { display: flex; align-items: center; gap: 8px; }
.stat-label { color: var(--ink-soft); font-size: 13px; }
.stat-label .en { color: var(--ink-faint); font-size: 11px; margin-left: 4px; }
.stat-value { font-family: var(--font-num); font-size: 26px; font-weight: 700; line-height: 1.15; color: var(--gold-soft); font-variant-numeric: tabular-nums; letter-spacing: 0; text-shadow: 0 0 8px rgba(231,198,107,.25); margin: 4px 0 2px; overflow-wrap: anywhere; }
.stat-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.stat-chg { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-chg.up { color: var(--crimson); } .stat-chg.down { color: var(--emerald); } .stat-chg.flat { color: var(--ink-faint); }

/* RangeBar 數值 */
.rangebar-val { font-family: var(--font-num); font-weight: 700; font-size: 15px; color: var(--gold-soft); font-variant-numeric: tabular-nums; }

/* ── 「?」三段式說明 ── */
.qbtn {
  font-family: var(--sans); font-weight: 700; width: 18px; height: 18px; flex: 0 0 18px;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(231,198,107,.18);
  color: var(--gold-soft); cursor: help; font-size: 12px; line-height: 1;
  display: inline-grid; place-items: center; padding: 0; transition: .15s;
}
/* 懸浮浮層：portal 到 body + position:fixed，避免被表格 sticky / overflow 遮住 */
.qtip { position: relative; display: inline-flex; vertical-align: middle; z-index: 1; }
.qtip:hover .qbtn, .qtip:focus-within .qbtn { background: var(--gold); color: #1a1408; border-color: var(--gold); }
.explain {
  z-index: 10050; cursor: auto; pointer-events: auto;
  width: 300px; max-width: min(300px, 92vw);
  border: 1px solid var(--line); border-top: 3px solid var(--teal);
  border-radius: var(--r-sm); background: #11152e;
  padding: 12px 14px; font-size: 13px; line-height: 1.7;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.5);
  animation: explainIn .12s ease;
}
@keyframes explainIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.explain .ex-title { font-family: var(--pixel); color: var(--gold-soft); font-size: 12px; margin-bottom: 8px; }
.explain .ex-row { margin-bottom: 8px; }
.explain .ex-row:last-of-type { margin-bottom: 0; }
.explain dt { font-family: var(--pixel); font-size: 11px; color: var(--teal); letter-spacing: .5px; margin-bottom: 1px; }
.explain dd { margin: 0; color: #efe9d8; display: block; white-space: normal; word-break: break-word; }
.explain dt { display: block; }
.explain .ex-src { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-soft); font-size: 11px; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* 重要度徽章 */
.tag.imp-high { background: rgba(231,198,107,.16); color: var(--gold-soft); border-color: var(--gold); }
.tag.imp-medium { background: var(--indigo-bg); color: var(--indigo); border-color: rgba(143,184,255,.4); }
.tag.imp-low { background: var(--paper-2); color: var(--ink-faint); }

/* 首頁週曆預覽 */
.cal-week-preview { min-width: 0; }
.cal-week-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px;
}
.cal-week-cell {
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: rgba(255,255,255,.03);
  padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; font: inherit; color: inherit; min-width: 0;
}
.cal-week-cell:hover { border-color: rgba(143,184,255,.45); background: rgba(143,184,255,.08); }
.cal-week-cell.today { border-color: var(--gold-soft); }
.cal-week-cell.selected { box-shadow: inset 0 0 0 2px var(--indigo); background: rgba(143,184,255,.1); }
.cal-week-cell.has-events .cal-week-day { color: var(--gold-soft); }
.cal-week-dow { font-size: 10px; color: var(--ink-faint); font-weight: 700; }
.cal-week-day { font-size: 15px; font-weight: 800; font-family: var(--font-num); }
.cal-dots-week { justify-content: center; }
.cal-week-empty { margin: 0 0 8px; }
.cal-week-events { display: grid; gap: 8px; margin-bottom: 10px; }
.cal-week-ev {
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 10px 12px;
  background: rgba(0,0,0,.18); border-left: 4px solid var(--ink-faint);
}
.cal-week-ev.high { border-left-color: var(--crimson); }
.cal-week-ev.medium { border-left-color: var(--gold-soft); }
.cal-week-ev-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; }
.cal-week-ev-head .cal-ev { width: auto; display: inline-block; padding: 2px 6px; }
.cal-week-ev-note { font-size: 12px; color: var(--ink-soft); margin-top: 5px; line-height: 1.45; }
.cal-week-link { display: inline-block; margin-top: 4px; }

/* 事件日曆 · 月曆格狀 */
.cal-board-wrap { width: 100%; min-width: 0; }
.cal-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px;
}
.cal-stat {
  background: rgba(0,0,0,.22); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 12px; min-width: 0;
}
.cal-stat b { display: block; font-family: var(--font-num); font-size: 1.05rem; color: var(--gold-soft); }
.cal-stat span { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  font-size: 11px; color: var(--ink-soft); margin-bottom: 14px;
}
.cal-legend .leg {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle;
}
.cal-legend .leg.high { background: var(--crimson); }
.cal-legend .leg.medium { background: var(--gold-soft); }
.cal-legend .leg.fed { background: var(--indigo); }
.cal-legend .leg.deriv { background: #c97bff; }
.cal-legend .leg.earn { background: #6fe0d0; }
.cal-legend-note { margin-left: auto; font-size: 10px; }
.cal-layout { display: flex; flex-direction: column; gap: 14px; }
.cal-month {
  background: rgba(0,0,0,.2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px;
}
.cal-month-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-month-head h3 { font-size: 17px; margin: 0; color: var(--ink); font-family: var(--font-num); }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav-btn {
  width: 32px; height: 32px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.cal-nav-btn:hover:not(:disabled) { border-color: var(--indigo); color: var(--indigo); background: rgba(143,184,255,.1); }
.cal-nav-btn:disabled { opacity: .35; cursor: default; }
.cal-today-btn {
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: rgba(231,198,107,.1);
  color: var(--gold-soft); font-size: 12px; font-weight: 700; padding: 6px 12px; cursor: pointer;
}
.cal-today-btn:hover { border-color: var(--gold-soft); background: rgba(231,198,107,.18); }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px;
}
.cal-weekdays span { text-align: center; font-size: 11px; color: var(--ink-faint); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-cell {
  min-height: 96px; min-width: 0; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(255,255,255,.03); padding: 6px 7px; display: flex; flex-direction: column; gap: 4px;
  text-align: left; font: inherit; color: inherit;
}
.cal-cell.pad, .cal-cell.off { opacity: .35; pointer-events: none; background: transparent; }
.cal-cell.in-range { cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.cal-cell.in-range:hover { border-color: rgba(143,184,255,.45); background: rgba(143,184,255,.08); }
.cal-cell.today { border-color: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(231,198,107,.35); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--indigo); background: rgba(143,184,255,.1); }
.cal-cell.has-hot { border-color: rgba(232,106,82,.45); }
.cal-day-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-day { font-size: 12px; font-weight: 800; font-family: var(--font-num); }
.cal-count {
  font-size: 10px; color: var(--ink-soft); background: rgba(0,0,0,.25);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 5px;
}
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 8px; }
.cal-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.cal-dot.high { background: var(--crimson); }
.cal-dot.medium { background: var(--gold-soft); }
.cal-dot.low { background: var(--ink-faint); }
.cal-dot.cat-fed, .cal-dot.cat-central_bank { background: var(--indigo); }
.cal-dot.cat-earnings { background: #6fe0d0; }
.cal-dot.cat-derivatives { background: #c97bff; }
.cal-dots-more { font-size: 9px; color: var(--ink-faint); line-height: 1; }
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; flex: 1; }
.cal-ev {
  display: block; width: 100%; font-size: 10px; line-height: 1.25; padding: 2px 5px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700;
}
.cal-ev.high { background: var(--crimson-bg); color: var(--crimson); }
.cal-ev.medium { background: rgba(231,198,107,.14); color: var(--gold-soft); }
.cal-ev.low { background: rgba(255,255,255,.06); color: var(--ink-soft); }
.cal-ev.cat-fed { background: var(--indigo-bg); color: var(--indigo); }
.cal-ev.cat-earnings { background: rgba(111,224,208,.12); color: #6fe0d0; }
.cal-ev.cat-derivatives { background: rgba(201,123,255,.14); color: #c97bff; }
.cal-ev.cat-market { background: rgba(255,255,255,.06); color: var(--ink-soft); }
.cal-ev.cat-central_bank { background: rgba(143,184,255,.12); color: var(--indigo); }
.cal-more, .cal-quiet { font-size: 10px; color: var(--ink-faint); }
.cal-day-panel {
  background: rgba(0,0,0,.22); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 14px 16px; min-width: 0;
}
.cal-day-empty { margin: 4px 0 0; }
.cal-day-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-day-detail-head b { font-size: 16px; }
.cal-day-detail-head span { font-size: 12px; color: var(--ink-soft); }
.cal-detail-list { display: grid; gap: 8px; }
.cal-detail-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 10px; align-items: start;
  background: rgba(0,0,0,.2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 11px 12px;
}
.cal-detail-row.high { border-left: 4px solid var(--crimson); }
.cal-detail-row.medium { border-left: 4px solid var(--gold-soft); }
.cal-detail-row.low { border-left: 4px solid var(--ink-faint); }
.cal-detail-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14px; }
.cal-detail-note { font-size: 12px; color: var(--ink-soft); line-height: 1.45; margin-top: 4px; }
.cal-detail-meta { text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal-detail-meta small { display: block; font-size: 11px; margin-top: 3px; font-weight: 500; }
.event-impact {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; font-size: 11px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.event-impact.high { background: var(--crimson); }
.event-impact.medium { background: var(--gold-soft); color: #1a1208; }
.event-impact.low { background: var(--ink-faint); }
.event-symbol {
  font-size: 11px; font-weight: 800; color: var(--gold-soft); background: rgba(231,198,107,.12);
  border-radius: 999px; padding: 3px 8px; text-decoration: none;
}
.event-symbol:hover { background: rgba(231,198,107,.22); }
@media (max-width: 768px) {
  .cal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-legend-note { margin-left: 0; width: 100%; }
  .cal-cell { min-height: 78px; padding: 5px; }
  .cal-events .cal-ev:nth-child(2) { display: none; }
  .cal-detail-row { grid-template-columns: 1fr; }
  .cal-detail-meta { text-align: left; }
}

/* DSEG 7-段數碼管字型（僅數字，符號/英文自動回退 Oxanium） */
@font-face {
  font-family: "DSEG7 Classic";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "DSEG7 Classic";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Regular.woff2") format("woff2");
}
.dl .row .v, .rangebar-val { letter-spacing: 0; }
@media (max-width: 768px){
  .stat-value { font-size: 22px; }
  .dl .row .v { font-size: 14px; }
  .rangebar-val { font-size: 13px; }
}
@media (max-width: 480px){
  .stat-value { font-size: 19px; }
}

/* 個股背包 — 高對比看盤風格 */
.backpack-msg {
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--r-sm);
  background: rgba(111,224,208,.12); border: 1px solid rgba(111,224,208,.45); color: var(--teal);
  font-size: 13px;
}
.backpack-layout {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start;
}
.backpack-groups {
  border: 2px solid var(--gold); border-radius: var(--r);
  background: linear-gradient(180deg, #1e2648 0%, #141a34 100%);
  padding: 14px; box-shadow: var(--shadow), var(--glow-gold);
}
.backpack-groups-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.backpack-groups-head b { font-family: var(--pixel); color: var(--gold-soft); font-size: 12px; letter-spacing: 1px; }
.backpack-group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.backpack-group-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border: 2px solid rgba(255,255,255,.08); border-radius: var(--r-sm);
  background: rgba(0,0,0,.2); color: #f0f4ff; font-weight: 600; cursor: pointer; transition: .12s;
}
.backpack-group-btn:hover { border-color: var(--gold); color: var(--gold-soft); }
.backpack-group-btn.active {
  border-color: var(--gold); background: rgba(231,198,107,.18); color: var(--gold-soft);
  box-shadow: inset 0 0 0 1px rgba(231,198,107,.25);
}
.backpack-group-count {
  font-family: var(--pixel); font-size: 11px; color: var(--teal); background: rgba(111,224,208,.15);
  padding: 2px 7px; border-radius: 10px;
}
.backpack-group-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.btn-primary.sm, .btn-ghost.sm, .btn-ghost.danger { font-size: 12px; padding: 6px 10px; }
.btn-ghost.danger { color: #ff8a7a; border-color: rgba(255,120,100,.4); }

.backpack-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: min(78vh, 920px);
}
.backpack-inventory-zone {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(40vh, 340px);
  border: 2px solid rgba(231,198,107,.4);
  border-radius: var(--r);
  background: linear-gradient(180deg, #171f3c 0%, #12182e 100%);
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.backpack-inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.backpack-filter {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: var(--r-sm);
  background: #0f1428;
  color: #f0f4ff;
  font-size: 13px;
}
.backpack-filter:focus { outline: none; border-color: var(--teal); }
.backpack-view-toggle {
  display: flex;
  border: 2px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.backpack-view-toggle button {
  padding: 7px 12px;
  border: none;
  background: rgba(0,0,0,.2);
  color: #a8b4d8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.backpack-view-toggle button.active {
  background: rgba(111,224,208,.2);
  color: var(--teal);
}
.backpack-symbols-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  margin-right: -2px;
}
.backpack-symbols--list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  grid-template-columns: unset;
}
.backpack-sym-row {
  display: flex;
  align-items: stretch;
  border: 2px solid rgba(255,255,255,.08);
  border-radius: var(--r-sm);
  background: #161d38;
  overflow: hidden;
  transition: .12s;
}
.backpack-sym-row:hover { border-color: rgba(231,198,107,.45); }
.backpack-sym-row.active { border-color: var(--gold); box-shadow: var(--glow-gold); background: #1c2448; }
.backpack-sym-row-open {
  flex: 1;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.backpack-sym-row .backpack-sym-ticker { grid-column: auto; font-size: 13px; }
.backpack-sym-row .backpack-sym-name {
  grid-column: auto;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.backpack-sym-row .backpack-sym-price { font-size: 15px; }
.backpack-sym-row .backpack-sym-chg { text-align: right; min-width: 56px; }
.backpack-inventory-hint { margin: 0; padding-top: 2px; }
.backpack-detail-zone {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.backpack-main-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.backpack-main-head h2 { margin: 0; font-size: 20px; color: var(--gold-soft); }
.backpack-meta { font-size: 13px; color: #b8c4e8; }
.backpack-add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.backpack-add input {
  flex: 1; min-width: 160px; padding: 10px 12px; border: 2px solid rgba(231,198,107,.35);
  border-radius: var(--r-sm); background: #12182e; color: #f5f8ff; font-size: 15px;
}
.backpack-add input:focus { outline: none; border-color: var(--gold); box-shadow: var(--glow-gold); }

.backpack-symbols {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px;
}
.backpack-inventory-zone .backpack-add { margin-bottom: 0; }
.backpack-inventory-zone .backpack-main-head { margin-bottom: 0; }
.backpack-sym-card {
  display: flex; border: 2px solid rgba(255,255,255,.1); border-radius: var(--r-sm);
  background: #161d38; overflow: hidden; transition: .12s;
}
.backpack-sym-card:hover { border-color: rgba(231,198,107,.5); }
.backpack-sym-card.active { border-color: var(--gold); box-shadow: var(--glow-gold); background: #1c2448; }
.backpack-sym-open {
  flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 10px 10px 12px;
  border: none; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.backpack-sym-ticker { font-family: var(--pixel); font-size: 14px; color: var(--gold-soft); letter-spacing: 1px; grid-column: 1 / -1; }
.backpack-sym-name { font-size: 11px; color: #9aa8cc; grid-column: 1 / -1; min-height: 14px; }
.backpack-sym-price { font-size: 17px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.backpack-sym-chg { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.backpack-sym-chg.up { color: var(--crimson); }
.backpack-sym-chg.down { color: var(--emerald); }
.backpack-sym-rm {
  width: 32px; border: none; border-left: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.15);
  color: #8892b0; cursor: pointer; font-size: 18px;
}
.backpack-sym-rm:hover { color: #ff8a7a; background: rgba(255,100,80,.12); }
.backpack-empty, .backpack-hint {
  grid-column: 1 / -1; padding: 20px; border: 2px dashed rgba(255,255,255,.12); border-radius: var(--r-sm);
  color: #a8b4d8; font-size: 14px; line-height: 1.5;
}

.backpack-detail {
  border: 2px solid rgba(231,198,107,.45); border-radius: var(--r); background: #12182e;
  padding: 16px; box-shadow: var(--shadow);
}
.backpack-detail-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px;
}
.backpack-detail-sym { font-family: var(--pixel); font-size: 24px; color: var(--gold-soft); letter-spacing: 2px; }
.backpack-detail-name { font-size: 14px; color: #c5d0ef; margin-top: 4px; }
.backpack-detail-quote { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.backpack-detail-price { font-size: 28px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }

.backpack-detail-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.backpack-tab {
  padding: 8px 16px; border: 2px solid rgba(255,255,255,.12); border-radius: var(--r-sm);
  background: #1a2240; color: #d0daf0; font-weight: 700; font-size: 14px; cursor: pointer;
}
.backpack-tab:hover { border-color: var(--teal); color: var(--teal); }
.backpack-tab.active {
  border-color: var(--gold); background: rgba(231,198,107,.15); color: var(--gold-soft);
  box-shadow: var(--glow-gold);
}

.candle-wrap { margin-top: 4px; }
.candle-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; font-size: 12px; color: #c8d4f0; }
.candle-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.candle-legend-item i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.candle-legend-item.up::before { content: "▲"; color: var(--crimson); margin-right: 2px; }
.candle-legend-item.down::before { content: "▼"; color: var(--emerald); margin-right: 2px; }
.candle-chart, .px-chart { height: 320px; min-height: 240px; }
.candle-chart-tall { height: 400px; min-height: 280px; }

.chart-ind-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px;
  padding: 10px 12px; border: 2px solid rgba(255,255,255,.08); border-radius: var(--r-sm); background: #0f1428;
}
.chart-ind-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chart-ind-label { font-size: 11px; color: var(--gold-soft); font-weight: 700; margin-right: 4px; min-width: 28px; }
.ind-chip {
  padding: 4px 10px; border-radius: 999px; border: 2px solid rgba(255,255,255,.12);
  background: #12182e; color: #9aa8cc; font-size: 11px; font-weight: 600; cursor: pointer;
}
.ind-chip.on { border-color: var(--chip-color, var(--gold)); color: #fff; background: rgba(255,255,255,.06); }

.osc-wrap { margin-top: 8px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 6px; }
.osc-title { font-size: 11px; color: #8898bc; margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.osc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.osc-ref { color: #6a7a9a; font-size: 10px; }
.osc-chart { height: 100px; min-height: 80px; }

.trade-plan-box { border-color: rgba(77,163,255,.35); }
.trade-plan-head { margin-bottom: 8px; }
.trade-plan-reasons { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: #c5d0ef; line-height: 1.45; }
.trade-plan-reasons li { margin-bottom: 4px; }
.trade-plan-cautions {
  margin: 8px 0 0; padding-left: 18px; font-size: 11px; color: #e8b88a; line-height: 1.4; list-style: disc;
}
.trade-plan-cautions li { margin-bottom: 3px; }

.chart-scan-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px;
}
.chart-scan-toolbar .btn-primary.active { box-shadow: var(--glow-gold); }
.chart-scan-toolbar .btn-ghost.active { border-color: var(--teal); color: var(--teal); }

.chart-pattern-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start;
}
.chart-main-card { min-width: 0; }

.pattern-side {
  display: flex; flex-direction: column; gap: 12px; max-height: 720px; overflow: auto;
}
.pattern-side-block {
  border: 2px solid rgba(255,255,255,.1); border-radius: var(--r-sm);
  background: #0f1428; padding: 12px;
}
.pattern-side-block h4 {
  margin: 0 0 10px; font-size: 13px; color: var(--gold-soft); font-family: var(--pixel); letter-spacing: .5px;
}

.rule-hit {
  padding: 10px; border-radius: var(--r-sm); margin-bottom: 8px;
  border-left: 4px solid var(--gold); background: rgba(0,0,0,.2);
}
.rule-hit.rule-bullish { border-left-color: var(--crimson); }
.rule-hit.rule-bearish { border-left-color: var(--emerald); }
.rule-name { font-weight: 700; color: #fff; margin: 6px 0 4px; font-size: 14px; }
.rule-summary { font-size: 13px; color: #dce4fa; margin: 0 0 4px; line-height: 1.45; }
.rule-hint { font-size: 12px; color: #9aa8cc; margin: 0; line-height: 1.4; }

.pat-signal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pat-signal-btn {
  width: 100%; text-align: left; padding: 10px; border: 2px solid rgba(255,255,255,.08);
  border-radius: var(--r-sm); background: #12182e; color: inherit; cursor: pointer; transition: .12s;
}
.pat-signal-btn:hover { border-color: var(--gold); }
.pat-signal-btn.active {
  border-color: var(--gold); background: rgba(231,198,107,.12); box-shadow: var(--glow-gold);
}
.pat-signal-name { display: block; font-weight: 700; color: #fff; font-size: 13px; margin-bottom: 4px; }
.pat-signal-meta { display: block; font-size: 11px; color: #8898bc; margin-top: 4px; }

.pat-detail-box { border-color: rgba(231,198,107,.35); }
.pat-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pat-detail-head strong { font-size: 15px; color: #fff; }
.pat-levels--stacked { display: flex; flex-direction: column; gap: 10px; }
.pat-level-row {
  padding: 8px 10px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06);
}
.pat-level-row span { display: block; font-size: 11px; color: #9aa8cc; margin-bottom: 2px; }
.pat-level-row b { font-size: 16px; color: #fff; }
.pat-level-note {
  display: block; margin-top: 4px; font-size: 11px; font-style: normal;
  color: #9aa8cc; line-height: 1.4;
}
.pat-levels {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0;
}
.pat-levels > div {
  padding: 8px; background: rgba(0,0,0,.25); border-radius: var(--r-sm);
}
.pat-levels span { display: block; font-size: 11px; color: #9aa8cc; }
.pat-levels b { font-size: 15px; color: #fff; }
.pat-hint { font-size: 12px; color: #c5d0ef; line-height: 1.45; margin: 6px 0 0; }
.pat-book-link {
  display: inline-block; margin-top: 8px; color: var(--teal); font-size: 13px; font-weight: 600;
}
.pat-book-link:hover { text-decoration: underline; }

/* 線型圖鑑 · 收集頁 */
.pattern-page .page-head p { max-width: 52em; }
.pat-progress-card { margin-bottom: 14px; }
.pat-scan-quick { margin-bottom: 14px; }
.pat-scan-quick-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.pat-scan-quick-head strong {
  font-family: var(--pixel); font-size: 12px; color: var(--gold-soft); letter-spacing: .5px;
}
.pat-toolbar { margin-bottom: 14px; }
.pat-chapter-select {
  min-width: 180px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px;
}
.pat-card-wall { margin-top: 0; }
.pat-node:not(.collected) {
  border-color: var(--line-soft);
}
.pat-node:not(.collected) .sn-art {
  filter: grayscale(1) brightness(0.76) saturate(0.2) drop-shadow(0 0 8px rgba(0, 0, 0, 0.45));
}
.pat-node:not(.collected):hover {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.pat-node:not(.collected):hover .sn-art {
  filter: grayscale(1) brightness(0.86) saturate(0.25) drop-shadow(0 0 8px rgba(0, 0, 0, 0.45));
}
.pat-node:not(.collected) .sn-nm { color: var(--ink-soft); }
.pat-node:not(.collected) .sn-mastery { color: var(--ink-faint); }
.pat-node.collected {
  border-color: var(--line);
}
.pat-node--scan.collected {
  border-color: rgba(111, 224, 208, 0.35);
}
.pat-node--scan .sn-art {
  background: radial-gradient(circle at 50% 35%, #1a3a48, #10182e);
}
.pat-scan-badge {
  position: absolute; left: 6px; top: 6px;
  font-size: 12px; line-height: 1;
  filter: drop-shadow(0 0 4px rgba(111, 224, 208, 0.6));
}
/* 線型卡彈窗：與心法卡相同，上下留天地、不貼邊 */
.pat-modal .skill-modal-panel {
  max-height: calc(
    100dvh - 56px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
  );
}
.pat-modal-panel { width: min(760px, 100%); }
.pat-modal-panel.pat-modal--scan { width: min(820px, 100%); }
.pat-modal-panel.pat-modal--book { width: min(900px, 100%); }
.pat-book-block {
  min-height: 200px;
  padding: 4px 0 8px;
}
.pat-modal-panel.pat-modal--book .pat-book-frame {
  height: min(520px, 52vh);
  min-height: 280px;
}
.pat-modal-body {
  padding: 16px 18px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pat-detail-head { margin: 2px 0 14px; }
.pat-teach-block,
.pat-scan-block { padding-bottom: 4px; }
.pat-detail-head h2 {
  margin: 0 0 8px; font-family: var(--pixel); font-size: 16px;
  color: var(--gold-soft); line-height: 1.45;
}
.pat-detail-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px;
}
.pat-detail-meta { margin: 0; line-height: 1.5; }
.pat-summary { line-height: 1.55; margin: 0 0 14px; color: var(--ink); }
.pat-teach-grid {
  display: grid; gap: 10px; margin: 0 0 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.pat-teach-grid > div {
  padding: 12px; border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.06);
}
.pat-teach-grid b {
  display: block; font-family: var(--pixel); font-size: 10px;
  color: var(--gold-soft); margin-bottom: 6px; letter-spacing: .5px;
}
.pat-teach-grid p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.pat-book-frame {
  display: block;
  width: 100%;
  height: min(460px, 48vh);
  margin: 10px 0 6px;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
}
.pat-detail-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.pat-scan-form {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 12px;
}
.pat-scan-input {
  flex: 1; min-width: 140px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px;
}
.pat-scan-block .pat-signal-list { margin-top: 8px; }
.pat-disclaimer { margin-top: 16px; font-size: 12px; }

@media (max-width: 960px) {
  .chart-pattern-layout { grid-template-columns: 1fr; }
  .pattern-side { max-height: none; }
  .pat-chapter-select { width: 100%; }
}

.equity-chart { height: 280px; min-height: 200px; }
.equity-chart-sm { height: 160px; min-height: 120px; }
.equity-wrap { margin-top: 8px; }

.bt-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: start; }
.bt-strat-list {
  border: 2px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
  padding: 10px; max-height: 520px; overflow: auto;
}
.bt-strat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bt-strat-head h4 { margin: 0; font-size: 13px; color: var(--gold-soft); }
.bt-strat-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bt-strat-btn {
  width: 100%; text-align: left; padding: 8px 10px; border: 2px solid rgba(255,255,255,.08);
  border-radius: var(--r-sm); background: #12182e; color: inherit; cursor: pointer;
}
.bt-strat-btn.active { border-color: var(--gold); background: rgba(231,198,107,.1); }
.bt-strat-name { display: block; font-weight: 700; font-size: 13px; color: #fff; }
.bt-strat-src { font-size: 10px; color: var(--teal); }
.bt-strat-formula { display: block; font-size: 10px; color: #8898bc; margin-top: 2px; }

.bt-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.bt-label { display: block; font-size: 11px; color: #9aa8cc; margin-bottom: 4px; }
.journal-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.journal-table-wrap { overflow-x: auto; }
.journal-row { cursor: pointer; }
.journal-mistake-flag { margin-left: 6px; font-size: 12px; }
.journal-form-panel { width: min(680px, 100%); max-height: min(90vh, 860px); overflow: auto; }
.journal-account-modal {
  width: min(680px, 100%);
  max-height: min(90vh, 860px);
}
.journal-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.journal-form-footer {
  flex-shrink: 0;
  padding: 12px 18px 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, var(--gold) 12%);
  background: var(--surface);
}
.journal-form-save-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--gold);
  line-height: 1.45;
}
.journal-form-body { padding: 0 18px 18px; color: var(--ink); }
.journal-account-modal .journal-form-body { padding-bottom: 12px; }
.journal-form-body .settings-field label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.journal-form-body .settings-field select,
.journal-form-body .settings-field input,
.journal-form-body .settings-field textarea {
  width: 100%;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 85%, #0d1224);
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--gold) 15%);
}
.journal-form-body .settings-field select option {
  color: var(--ink);
  background: #12182e;
}
.journal-form-section {
  margin: 14px 0;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--sky) 20%);
  background: color-mix(in srgb, var(--panel) 92%, var(--sky) 4%);
}
.journal-form-section-title {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.journal-form-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 72%, var(--ink-soft));
}
.journal-form-warn {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
}
.journal-mistake-check {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink); margin: 10px 0 6px; line-height: 1.45;
}
.journal-mistake-check input { margin-top: 3px; flex-shrink: 0; }
.journal-form-actions { display: flex; gap: 8px; margin-left: auto; }
.journal-page-tabs {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.journal-page-tab {
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink-soft); font-family: var(--pixel);
  font-size: 12px; cursor: pointer; letter-spacing: .04em;
}
.journal-page-tab.active {
  border-color: var(--gold); color: var(--gold-soft);
  background: linear-gradient(180deg, rgba(231,198,107,.16), rgba(231,198,107,.06));
  box-shadow: inset 0 -2px 0 var(--gold);
}
.journal-account-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.journal-account-bar.compact { margin-top: 0; }
.journal-account-tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.journal-account-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink-soft); font-family: var(--pixel); font-size: 11px; cursor: pointer;
}
.journal-account-tab.active {
  border-color: var(--acc-color, var(--gold));
  color: var(--ink);
  background: color-mix(in srgb, var(--acc-color, var(--gold)) 14%, var(--panel));
}
.journal-account-tab.add { border-style: dashed; }
.journal-account-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--acc-color, var(--gold));
}
.journal-account-badge {
  font-family: var(--pixel); font-size: 9px; padding: 1px 5px; border-radius: 2px;
  background: color-mix(in srgb, var(--sky) 25%, transparent); color: var(--sky);
}
.journal-account-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.journal-alloc-row { margin-bottom: 12px; }
.journal-alloc-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.journal-alloc-track {
  height: 8px; border-radius: 999px; background: var(--line); overflow: hidden;
}
.journal-alloc-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.journal-holdings { display: flex; flex-direction: column; gap: 8px; }
.position-book-summary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; margin-top: 10px;
}
.position-book-kpi {
  padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, var(--panel));
}
.position-book-kpi .k { display: block; font-family: var(--pixel); font-size: 9px; color: var(--ink-soft); margin-bottom: 3px; }
.position-book-kpi .v { display: block; font-family: var(--font-num); font-size: 14px; font-weight: 700; color: var(--ink); }
.position-book-kpi .v em { font-style: normal; font-size: 10px; font-weight: 500; color: var(--ink-soft); }
.position-book-kpi .v.over { color: var(--crimson); }
.position-book-kpi .v.under { color: var(--gold-soft); }
.position-book-alerts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.position-book-alert {
  font-size: 11px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line);
}
.position-book-alert--warn { background: color-mix(in srgb, var(--gold) 12%, var(--panel)); color: var(--gold-soft); }
.position-book-alert--danger { background: color-mix(in srgb, var(--crimson) 12%, var(--panel)); color: var(--crimson); }
.position-book-sectors { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.position-book-sector-chip {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--sky) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--sky) 30%, var(--line));
}
.position-book-table-wrap { overflow-x: auto; }
.position-book-table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 720px; }
.position-book-table th,
.position-book-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.position-book-table th { font-size: 10px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.position-book-sector { display: block; font-size: 9px; color: var(--ink-soft); }
.position-book-hold { display: block; font-size: 9px; color: var(--ink-soft); }
.position-book-dist { font-size: 9px; color: var(--ink-soft); }
.position-book-status {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.position-book-status--up { background: color-mix(in srgb, var(--emerald) 18%, transparent); color: var(--emerald); }
.position-book-status--warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-soft); }
.position-book-status--danger { background: color-mix(in srgb, var(--crimson) 18%, transparent); color: var(--crimson); }
.position-book-status--cool { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink-soft); }
.trader-follow-risk { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.trader-follow-alerts { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.trader-follow-alert { font-size: 11px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); }
.trader-follow-alert--warn { background: color-mix(in srgb, var(--gold) 10%, var(--panel)); color: var(--gold-soft); }
.trader-follow-alert--danger { background: color-mix(in srgb, var(--crimson) 10%, var(--panel)); color: var(--crimson); }
.trader-status-panel {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 4%, var(--panel));
}
.trader-status-panel--up { border-color: color-mix(in srgb, var(--emerald) 35%, var(--line)); }
.trader-status-panel--down { border-color: color-mix(in srgb, var(--crimson) 35%, var(--line)); }
.trader-status-panel--warn { border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.trader-status-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-family: var(--pixel); }
.trader-status-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.trader-status-pill--up { background: color-mix(in srgb, var(--emerald) 18%, transparent); color: var(--emerald); }
.trader-status-pill--down { background: color-mix(in srgb, var(--crimson) 18%, transparent); color: var(--crimson); }
.trader-status-pill--warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-soft); }
.trader-status-pill--cool { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink-soft); }
.trader-status-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px;
}
.trader-status-grid .k { display: block; font-size: 10px; color: var(--ink-soft); }
.trader-status-grid .v { display: block; font-size: 11px; color: var(--ink); font-weight: 600; }
.trader-status-error { color: var(--crimson); margin: 6px 0 0; }
.trader-status-blockers { margin: 6px 0 0; padding-left: 16px; color: var(--gold-soft); }
.trader-status-note { margin: 6px 0 0; }
.account-delete-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--crimson) 30%, var(--line));
  background: color-mix(in srgb, var(--crimson) 6%, var(--panel));
}
.account-delete-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.account-delete-force { display: flex; align-items: flex-start; gap: 8px; margin: 0; line-height: 1.45; color: var(--ink); }
.journal-holding-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.journal-holding-meta { text-align: right; }
.journal-sim-meta { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.journal-sim-runs { display: flex; flex-direction: column; gap: 10px; }
.journal-sim-run { padding: 10px 0; border-top: 1px solid var(--line); }
.journal-sim-run-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.journal-sim-status.up { color: var(--emerald); }
.journal-sim-status.down { color: var(--crimson); }
.journal-sim-status.cool { color: var(--ink-soft); }
.journal-trader-block { padding: 10px 0; border-top: 1px solid var(--line); }
.trader-summon {
  position: relative; width: 100%; min-height: 82px; display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px;
  padding: 12px 15px; overflow: hidden; text-align: left; color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--rar-epic) 55%, var(--line));
  border-radius: var(--r-md); cursor: pointer;
  background:
    radial-gradient(circle at 7% 50%, rgba(201,139,255,.19), transparent 22%),
    linear-gradient(105deg, rgba(31,23,55,.96), rgba(13,20,40,.97));
  box-shadow: inset 0 0 24px rgba(111,224,208,.035), 0 0 0 1px rgba(201,139,255,.06);
}
.trader-summon::before,
.trader-summon::after {
  position: absolute; pointer-events: none; color: rgba(201,139,255,.24);
  font-family: var(--pixel); font-size: 8px; letter-spacing: 8px; content: "✦ · ✧ · ✦";
}
.trader-summon::before { top: 6px; right: 92px; }
.trader-summon::after { bottom: 5px; right: 22px; transform: rotate(180deg); }
.trader-summon:hover {
  border-color: var(--rar-epic); transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(201,139,255,.16), inset 0 0 30px rgba(111,224,208,.05);
}
.trader-summon-orb {
  position: relative; z-index: 1; width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid rgba(201,139,255,.7); border-radius: 50%;
  color: var(--gold-soft); background: radial-gradient(circle, rgba(111,224,208,.18), rgba(201,139,255,.08) 48%, rgba(0,0,0,.45) 70%);
  box-shadow: 0 0 13px rgba(201,139,255,.35), inset 0 0 12px rgba(111,224,208,.18);
}
.trader-summon-orb::after {
  position: absolute; inset: -5px; border: 1px dashed rgba(111,224,208,.38);
  border-radius: 50%; content: ""; animation: trader-rune-spin 16s linear infinite;
}
.trader-summon-copy { position: relative; z-index: 1; min-width: 0; display: grid; gap: 3px; }
.trader-summon-copy strong { font-family: var(--pixel); font-size: 12px; color: var(--gold-soft); }
.trader-summon-copy > span:last-child {
  overflow: hidden; color: var(--ink-soft); font-size: 11px; line-height: 1.4;
  text-overflow: ellipsis; white-space: nowrap;
}
.trader-summon-kicker { font-family: var(--pixel); font-size: 8px; letter-spacing: .14em; color: var(--rar-epic); }
.trader-summon-status {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px; border: 1px solid rgba(111,224,208,.25); border-radius: 999px;
  background: rgba(111,224,208,.06); font-family: var(--pixel); font-size: 8px; color: var(--teal);
}
.trader-summon-status i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal);
  box-shadow: 0 0 8px var(--teal); animation: trader-signal 2s ease-in-out infinite;
}

.trader-chat-modal {
  position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center;
  padding: 22px;
}
.trader-chat-backdrop {
  position: absolute; inset: 0; border: 0; cursor: default;
  background: rgba(4,6,17,.78); backdrop-filter: blur(5px);
}
.trader-chat-console {
  position: relative; width: min(760px, 100%); height: min(760px, calc(100dvh - 44px));
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--rar-epic) 70%, var(--gold));
  border-radius: 14px; color: var(--ink);
  background:
    radial-gradient(circle at 50% -15%, rgba(201,139,255,.2), transparent 36%),
    linear-gradient(180deg, #14152c 0%, #0c1122 52%, #111326 100%);
  box-shadow: 0 0 0 1px rgba(231,198,107,.24), 0 0 42px rgba(201,139,255,.25), var(--shadow);
}
.trader-chat-console::before {
  position: absolute; inset: 6px; z-index: 2; border: 1px solid rgba(231,198,107,.12);
  border-radius: 9px; pointer-events: none; content: "";
}
.trader-chat-runes {
  position: absolute; z-index: 3; top: 7px; left: 50%; transform: translateX(-50%);
  font-family: var(--pixel); font-size: 8px; letter-spacing: 7px; color: rgba(231,198,107,.55);
}
.trader-chat-head {
  position: relative; z-index: 1; min-height: 82px; display: grid;
  grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(201,139,255,.3);
  background: linear-gradient(90deg, rgba(201,139,255,.08), rgba(111,224,208,.035), rgba(201,139,255,.08));
}
.trader-chat-avatar {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid rgba(231,198,107,.5); color: var(--gold-soft);
  background: rgba(0,0,0,.28); box-shadow: inset 0 0 14px rgba(201,139,255,.18), 0 0 12px rgba(201,139,255,.13);
}
.trader-chat-head > div { display: grid; gap: 2px; min-width: 0; }
.trader-chat-kicker { font-family: var(--pixel); font-size: 8px; color: var(--rar-epic); letter-spacing: .12em; }
.trader-chat-head strong { font-family: var(--pixel); font-size: 13px; color: var(--gold-soft); }
.trader-chat-head small { overflow: hidden; font-size: 10px; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }
.trader-chat-close {
  position: relative; z-index: 4; width: 32px; height: 32px; border: 1px solid rgba(232,106,82,.35);
  border-radius: 50%; color: var(--ink-soft); background: rgba(0,0,0,.25); cursor: pointer; font-size: 20px;
}
.trader-chat-close:hover { border-color: var(--crimson); color: var(--crimson); }
.trader-chat-log {
  position: relative; z-index: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 24px; display: flex; flex-direction: column; gap: 13px;
  scrollbar-color: rgba(201,139,255,.45) transparent;
}
.trader-chat-msg {
  position: relative; width: min(88%, 620px); padding: 11px 13px;
  border: 1px solid var(--line-soft); border-radius: 4px 10px 10px;
  background: rgba(18,25,47,.88); box-shadow: 0 5px 16px rgba(0,0,0,.18);
}
.trader-chat-msg.user {
  align-self: flex-end; border-color: rgba(231,198,107,.35); border-radius: 10px 4px 10px 10px;
  background: linear-gradient(135deg, rgba(231,198,107,.11), rgba(25,25,43,.9));
}
.trader-chat-msg.assistant {
  align-self: flex-start; border-color: rgba(201,139,255,.4);
  background: linear-gradient(135deg, rgba(201,139,255,.1), rgba(15,25,45,.92));
}
.trader-chat-role {
  margin-bottom: 6px; font-family: var(--pixel); font-size: 8px; letter-spacing: .08em; color: var(--teal);
}
.trader-chat-msg.user .trader-chat-role { color: var(--gold-soft); text-align: right; }
.trader-chat-text { min-width: 0; font-size: 13px; line-height: 1.62; overflow-wrap: anywhere; }
.trader-chat-text .markdown-message pre { max-width: 100%; overflow-x: auto; }
.trader-chat-meta { margin-top: 7px; font-size: 9px; color: var(--ink-soft); }
.trader-chat-empty {
  align-self: center; max-width: 430px; margin: auto; padding: 25px; text-align: center;
  border: 1px dashed rgba(201,139,255,.32); border-radius: 50% 50% 10px 10px;
  background: radial-gradient(circle, rgba(201,139,255,.09), transparent 68%);
}
.trader-chat-empty-glyph { display: block; color: var(--rar-epic); font-size: 28px; text-shadow: 0 0 16px var(--rar-epic); }
.trader-chat-empty strong { display: block; margin: 8px 0; font-family: var(--pixel); font-size: 11px; color: var(--gold-soft); }
.trader-chat-empty p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
.trader-chat-casting { align-self: flex-start; padding: 8px 10px; font-size: 10px; color: var(--rar-epic); }
.trader-chat-casting span {
  display: inline-block; width: 4px; height: 4px; margin-right: 3px; border-radius: 50%;
  background: var(--rar-epic); animation: trader-casting 1.1s ease-in-out infinite;
}
.trader-chat-casting span:nth-child(2) { animation-delay: .15s; }
.trader-chat-casting span:nth-child(3) { animation-delay: .3s; }
.trader-chat-compose {
  position: relative; z-index: 3; padding: 10px 18px 17px; border-top: 1px solid rgba(201,139,255,.25);
  background: rgba(7,10,22,.92);
}
.trader-chat-prompts { display: flex; gap: 6px; padding-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.trader-chat-prompts::-webkit-scrollbar { display: none; }
.trader-chat-prompts button {
  flex: 0 0 auto; padding: 5px 8px; border: 1px solid rgba(111,224,208,.22); border-radius: 999px;
  color: var(--teal); background: rgba(111,224,208,.04); cursor: pointer; font-size: 10px;
}
.trader-chat-prompts button:hover { border-color: var(--teal); background: rgba(111,224,208,.09); }
.trader-chat-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.trader-chat-input textarea {
  width: 100%; min-height: 52px; max-height: 120px; resize: none; padding: 9px 11px;
  border: 1px solid rgba(201,139,255,.35); border-radius: 7px; color: var(--ink);
  background: rgba(0,0,0,.3); font-family: var(--sans); font-size: 13px; line-height: 1.45;
}
.trader-chat-input textarea:focus { outline: 1px solid var(--rar-epic); box-shadow: 0 0 12px rgba(201,139,255,.12); }
.trader-chat-input > button {
  min-width: 70px; border: 1px solid rgba(231,198,107,.55); border-radius: 7px; cursor: pointer;
  color: #191328; background: linear-gradient(180deg, var(--gold-soft), var(--gold));
}
.trader-chat-input > button span,
.trader-chat-input > button small { display: block; font-family: var(--pixel); }
.trader-chat-input > button span { font-size: 10px; }
.trader-chat-input > button small { margin-top: 3px; font-size: 7px; opacity: .65; }
.trader-chat-input > button:disabled,
.trader-chat-prompts button:disabled { cursor: not-allowed; opacity: .45; }
.trader-chat-error { margin: 7px 0 0; color: var(--crimson); font-size: 11px; }

@keyframes trader-rune-spin { to { transform: rotate(360deg); } }
@keyframes trader-signal { 50% { opacity: .35; box-shadow: 0 0 2px var(--teal); } }
@keyframes trader-casting { 50% { transform: translateY(-3px); opacity: .45; } }

@media (max-width: 620px) {
  .trader-summon { grid-template-columns: auto minmax(0, 1fr); }
  .trader-summon-status { display: none; }
  .trader-chat-modal { padding: 0; }
  .trader-chat-console { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .trader-chat-head { min-height: 74px; padding: 16px 14px 11px; }
  .trader-chat-avatar { width: 42px; height: 42px; }
  .trader-chat-log { padding: 16px 13px; }
  .trader-chat-msg { width: 94%; }
  .trader-chat-compose { padding: 9px 11px max(11px, env(safe-area-inset-bottom, 0px)); }
}
.journal-directive-panel { margin-top: 12px; }
.journal-directive-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.journal-directive-current { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--gold) 10%, var(--panel)); }
.journal-directive-presets { margin-top: 10px; }
.journal-directive-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.trader-personality-picker { margin-top: 4px; }
.trader-personality-intro {
  margin-bottom: 12px; padding: 10px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--sky) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--sky) 22%, var(--line));
}
.trader-personality-intro strong { display: block; font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.trader-personality-intro p { margin: 0; font-size: 12px; line-height: 1.5; color: color-mix(in srgb, var(--ink) 88%, var(--ink-soft)); }
.trader-personality-loading { font-size: 12px; color: var(--ink-soft); margin: 0 0 8px; }
.trader-personality-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.trader-personality-card {
  position: relative; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--tp-bg, var(--panel));
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  color: var(--ink);
}
.trader-personality-card:hover {
  border-color: color-mix(in srgb, var(--tp-accent, var(--gold)) 45%, var(--line));
  transform: translateY(-1px);
}
.trader-personality-card.active {
  border-color: var(--tp-accent, var(--gold));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tp-accent, var(--gold)) 40%, transparent),
    0 4px 14px color-mix(in srgb, var(--tp-accent, var(--gold)) 12%, transparent);
}
.trader-personality-selected-mark {
  position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px; color: #1a1428;
  background: var(--tp-accent, var(--gold));
}
.trader-personality-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; padding-right: 36px; }
.trader-personality-name { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.trader-personality-name-en { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.trader-personality-behavior { margin: 0 0 8px; font-size: 12px; line-height: 1.45; color: color-mix(in srgb, var(--ink) 92%, var(--ink-soft)); }
.trader-personality-defaults {
  font-size: 11px; font-weight: 600; color: var(--tp-accent, var(--gold-soft));
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.trader-risk-pill {
  flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  color: var(--tp-accent, var(--gold-soft));
  background: color-mix(in srgb, var(--tp-accent, var(--gold)) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--tp-accent, var(--gold)) 45%, var(--line));
  white-space: nowrap;
}
.trader-risk-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.trader-risk-label { font-size: 10px; color: var(--ink-soft); flex-shrink: 0; }
.trader-risk-bar { display: inline-flex; gap: 2px; flex: 1; }
.trader-risk-bar span { flex: 1; max-width: 12px; height: 7px; border-radius: 2px; background: color-mix(in srgb, var(--line) 80%, transparent); }
.trader-risk-bar span.on { opacity: 1; }
.trader-risk-num { font-size: 10px; font-weight: 700; color: var(--ink-soft); flex-shrink: 0; }
.trader-personality-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.trader-personality-tag {
  font-size: 10px; padding: 3px 7px; border-radius: 5px;
  background: color-mix(in srgb, var(--ink) 10%, var(--panel));
  color: var(--ink-soft); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.trader-personality-detail {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tp-accent, var(--gold)) 35%, var(--line));
  background: color-mix(in srgb, var(--tp-accent, var(--gold)) 8%, var(--panel));
}
.trader-personality-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.trader-personality-detail-head strong { font-size: 14px; color: var(--ink); }
.trader-personality-detail-behavior { margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: var(--ink); }
.trader-personality-detail-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px;
}
.trader-personality-detail-stats > div {
  padding: 8px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 6%, var(--panel));
  border: 1px solid var(--line);
}
.trader-personality-detail-stats .k { display: block; font-size: 10px; color: var(--ink-soft); margin-bottom: 2px; }
.trader-personality-detail-stats .v { display: block; font-size: 13px; font-weight: 700; color: var(--tp-accent, var(--gold-soft)); }
.trader-personality-detail-note { margin: 0; font-size: 11px; color: var(--ink-soft); line-height: 1.45; }
.trader-personality-assets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.trader-personality-assets-label { font-size: 10px; font-weight: 700; color: var(--ink-soft); margin-right: 4px; }
.trader-personality-asset-chip {
  font-size: 10px; padding: 3px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 8%, var(--panel));
  border: 1px solid var(--line); color: var(--ink);
}
.trader-personality-asset-chip em {
  font-style: normal; font-weight: 700; font-size: 9px; margin-right: 4px;
  color: var(--tp-accent, var(--gold-soft));
}
.trader-personality-asset-chip.w-primary { border-color: color-mix(in srgb, var(--tp-accent, var(--gold)) 40%, var(--line)); }
.trader-personality-detail-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.trader-personality-detail-tab {
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 5%, var(--panel));
  color: var(--ink-soft); cursor: pointer;
}
.trader-personality-detail-tab.active {
  color: var(--ink); border-color: var(--tp-accent, var(--gold));
  background: color-mix(in srgb, var(--tp-accent, var(--gold)) 12%, var(--panel));
}
.trader-personality-obs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.trader-personality-obs-block h5,
.trader-personality-rules-block h5 {
  margin: 0 0 6px; font-size: 11px; font-weight: 700; color: var(--tp-accent, var(--gold-soft));
}
.trader-personality-obs-block ul,
.trader-personality-rules-block ul {
  margin: 0; padding-left: 16px; font-size: 11px; line-height: 1.45; color: var(--ink);
}
.trader-personality-obs-block li,
.trader-personality-rules-block li { margin-bottom: 4px; }
.trader-personality-indicators { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.trader-personality-ind-group { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 4%, var(--panel)); }
.trader-personality-ind-label { display: block; font-size: 10px; font-weight: 700; color: var(--tp-accent, var(--gold-soft)); margin-bottom: 6px; }
.trader-personality-ind-items { display: flex; flex-wrap: wrap; gap: 4px; }
.trader-personality-ind-chip {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 10%, var(--panel)); color: var(--ink-soft);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.trader-personality-rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 8px; }
.trader-personality-rules-block { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 4%, var(--panel)); }
.trader-personality-params-table { overflow-x: auto; margin-bottom: 8px; }
.trader-personality-params-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.trader-personality-params-table th,
.trader-personality-params-table td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top;
}
.trader-personality-params-table th { color: var(--ink-soft); font-weight: 600; font-size: 10px; }
.trader-personality-params-table .param-key { display: block; font-size: 9px; color: var(--ink-soft); font-weight: 400; margin-top: 2px; }
.trader-param-input {
  width: min(120px, 100%); padding: 5px 7px; border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line));
  border-radius: 5px; color: var(--gold-soft); background: rgba(0,0,0,.25); font-family: var(--font-num); font-size: 12px;
}
.trader-param-input:focus { outline: 1px solid var(--teal); box-shadow: 0 0 8px rgba(111,224,208,.12); }
.trader-personality-strategy-field { margin-top: 14px; }
.trader-custom-console {
  margin-top: 13px; padding: 13px; border: 1px solid color-mix(in srgb, var(--rar-epic) 45%, var(--line));
  border-radius: 10px; background: linear-gradient(135deg, rgba(201,139,255,.08), rgba(111,224,208,.035));
}
.trader-custom-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.trader-custom-head strong { font-family: var(--pixel); font-size: 11px; color: var(--gold-soft); }
.trader-custom-head p { margin: 4px 0 0; font-size: 11px; color: var(--ink-soft); }
.trader-custom-head > span { font-family: var(--pixel); font-size: 8px; color: var(--rar-epic); }
.trader-custom-number-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.trader-custom-number-grid label,
.trader-custom-list-grid label { display: grid; gap: 5px; min-width: 0; }
.trader-custom-number-grid span,
.trader-custom-list-grid span { font-family: var(--pixel); font-size: 8px; color: var(--teal); }
.trader-custom-number-grid input,
.trader-custom-list-grid textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
  background: rgba(0,0,0,.24); font-family: var(--sans); font-size: 12px;
}
.trader-custom-number-grid input { padding: 7px 8px; }
.trader-custom-list-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.trader-custom-list-grid textarea { min-height: 92px; padding: 8px; resize: vertical; line-height: 1.45; }
.trader-custom-number-grid input:focus,
.trader-custom-list-grid textarea:focus { outline: 1px solid var(--rar-epic); border-color: var(--rar-epic); }
.trader-personality-strategy-input {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; line-height: 1.5; color: var(--ink);
  background: color-mix(in srgb, var(--panel) 85%, #0d1224);
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--gold) 15%);
  resize: vertical; min-height: 160px;
}
@media (max-width: 760px) {
  .trader-custom-number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trader-custom-list-grid { grid-template-columns: 1fr; }
  .trader-custom-head { flex-direction: column; }
}
.trader-personality-badge { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line)); color: var(--gold-soft); }
.trader-analysis-report { margin-top: 8px; }
.trader-report-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.trader-report-section h4 { margin: 0 0 6px; }
.trader-report-markdown { line-height: 1.6; }
.trader-report-markdown .markdown-message h3 { font-size: 12px; color: var(--teal); }
.trader-report-markdown .markdown-message strong { color: var(--gold-soft); }
.trader-report-pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--sage) 15%, var(--panel)); margin-bottom: 6px; }
.trader-report-list { margin: 6px 0 0; padding-left: 18px; }
.trader-rotation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.trader-rotation-card { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }
.trader-rotation-head { display: flex; justify-content: space-between; gap: 8px; }
.trader-news-list { display: flex; flex-direction: column; gap: 8px; }
.trader-news-row { display: flex; gap: 10px; align-items: flex-start; }
.trader-news-impact { font-size: 10px; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.trader-news-impact.up { background: color-mix(in srgb, var(--sage) 20%, transparent); color: var(--sage); }
.trader-news-impact.down { background: color-mix(in srgb, var(--crimson) 15%, transparent); color: var(--crimson); }
.trader-news-impact.cool { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.trader-intraday-review { margin-top: 10px; padding: 10px; border-radius: 8px; background: color-mix(in srgb, var(--gold) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line)); }
.trader-entry-sizing { display: flex; flex-direction: column; gap: 4px; }
.trader-entry-sizing-row { padding: 6px 8px; border-radius: 6px; background: color-mix(in srgb, var(--sky) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--sky) 20%, var(--line)); }
.trader-follow-panel {
  margin-top: 12px; padding: 12px; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--emerald) 30%, var(--line));
  background: color-mix(in srgb, var(--emerald) 6%, var(--panel));
}
.trader-follow-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-family: var(--pixel); }
.trader-follow-trust { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.trader-follow-trust--up { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); }
.trader-follow-trust--down { color: var(--crimson); background: color-mix(in srgb, var(--crimson) 15%, transparent); }
.trader-follow-trust--cool { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.trader-follow-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.trader-follow-signals { display: flex; flex-direction: column; gap: 8px; }
.trader-follow-signal { padding: 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.trader-follow-signal--buy { border-left: 3px solid var(--emerald); }
.trader-follow-signal--sell { border-left: 3px solid var(--crimson); }
.trader-follow-signal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.trader-follow-action { font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
.trader-follow-action--buy { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 18%, transparent); }
.trader-follow-action--sell { color: var(--crimson); background: color-mix(in srgb, var(--crimson) 18%, transparent); }
.trader-follow-verdict { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.trader-follow-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.trader-follow-pill--up { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); }
.trader-follow-pill--down { color: var(--crimson); background: color-mix(in srgb, var(--crimson) 15%, transparent); }
.trader-follow-pill--cool { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.trader-follow-reason { margin: 4px 0; line-height: 1.45; }
.trader-follow-scale { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: color-mix(in srgb, var(--gold) 10%, var(--panel)); border: 1px dashed color-mix(in srgb, var(--gold) 35%, var(--line)); }

/* AI 交易員控制台：先摘要與操作，再展開完整資料 */
.ai-command-card { border-color: color-mix(in srgb, var(--teal) 42%, var(--line)); }
.ai-command-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.ai-command-stat {
  min-width: 0; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: linear-gradient(180deg, rgba(111,224,208,.06), rgba(0,0,0,.14));
}
.ai-command-stat .k {
  display: block; margin-bottom: 4px; font-family: var(--pixel); font-size: 9px;
  letter-spacing: .08em; color: var(--ink-soft);
}
.ai-command-stat strong {
  display: block; overflow-wrap: anywhere; font-family: var(--font-num);
  font-size: 17px; line-height: 1.3; color: var(--gold-soft);
}
.ai-command-stat .s { display: block; margin-top: 3px; font-size: 10px; line-height: 1.35; color: var(--ink-soft); }
.ai-command-stat .tone-up { color: var(--emerald); }
.ai-command-stat .tone-down { color: var(--crimson); }
.ai-command-stat .tone-cool { color: var(--ink-soft); }
.ai-command-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px;
}
.ai-command-meta span {
  padding: 3px 7px; border: 1px solid var(--line-soft); border-radius: 2px;
  background: rgba(0,0,0,.16); font-family: var(--pixel); font-size: 9px; color: var(--ink-soft);
}
.trader-effective-params {
  margin-top: 10px; padding: 11px; border: 1px solid color-mix(in srgb, var(--rar-epic) 35%, var(--line));
  border-radius: var(--r-sm); background: linear-gradient(135deg, rgba(201,139,255,.065), rgba(111,224,208,.025));
}
.trader-effective-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.trader-effective-head > div { display: grid; gap: 2px; }
.trader-effective-head > div span { font-family: var(--pixel); font-size: 8px; color: var(--teal); }
.trader-effective-head strong { font-family: var(--pixel); font-size: 11px; color: var(--gold-soft); }
.trader-effective-badge {
  padding: 3px 7px; border: 1px solid rgba(201,139,255,.3); border-radius: 999px;
  font-family: var(--pixel); font-size: 8px; color: var(--rar-epic); white-space: nowrap;
}
.trader-effective-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.trader-effective-stat {
  min-width: 0; padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 6px;
  background: rgba(0,0,0,.16);
}
.trader-effective-stat span,
.trader-effective-stat strong,
.trader-effective-stat small { display: block; overflow-wrap: anywhere; }
.trader-effective-stat span { font-size: 9px; color: var(--ink-soft); }
.trader-effective-stat strong { margin-top: 2px; font-family: var(--font-num); font-size: 15px; color: var(--gold-soft); }
.trader-effective-stat small { margin-top: 2px; font-size: 8px; color: var(--teal); }
.trader-effective-more { margin-top: 8px; border-top: 1px dashed var(--line-soft); }
.trader-effective-more > summary {
  padding: 8px 0 0; cursor: pointer; list-style: none; font-family: var(--pixel); font-size: 9px; color: var(--teal);
}
.trader-effective-more > summary::before { margin-right: 5px; content: "＋"; color: var(--gold); }
.trader-effective-more[open] > summary::before { content: "－"; }
.trader-effective-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; margin-top: 8px; }
.trader-effective-table > div { padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(0,0,0,.14); }
.trader-effective-table span,
.trader-effective-table strong,
.trader-effective-table small { display: block; }
.trader-effective-table span { font-size: 9px; color: var(--ink-soft); }
.trader-effective-table strong { margin: 2px 0; color: var(--gold-soft); font-size: 13px; }
.trader-effective-table small { font-size: 9px; line-height: 1.4; color: var(--teal); }
.trader-effective-clauses { margin-top: 8px; padding: 8px 9px; border-left: 2px solid var(--rar-epic); background: rgba(201,139,255,.035); }
.trader-effective-clauses > span { font-family: var(--pixel); font-size: 8px; color: var(--rar-epic); }
.trader-effective-clauses ul { margin: 6px 0 0; padding-left: 17px; font-size: 10px; line-height: 1.5; color: var(--ink-soft); }
.ai-command-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: rgba(231,198,107,.05);
}
.ai-command-actions > div:first-child { min-width: 170px; }
.ai-command-actions strong { display: block; font-family: var(--pixel); font-size: 11px; color: var(--gold-soft); }
.ai-command-actions span { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-soft); }
.ai-command-actions .journal-toolbar { justify-content: flex-end; }
.ai-command-strategy {
  margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--teal);
  background: rgba(111,224,208,.06);
}
.ai-command-strategy span { font-family: var(--pixel); font-size: 10px; color: var(--teal); }
.ai-command-strategy p { margin: 5px 0 0; font-size: 13px; line-height: 1.6; }
.daily-takeaway {
  margin-top: 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--gold) 58%, var(--line));
  border-left: 3px solid var(--gold); border-radius: var(--r-sm);
  background: linear-gradient(135deg, rgba(231,198,107,.09), rgba(111,224,208,.035));
}
.daily-takeaway-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line-soft);
}
.daily-takeaway-head span,
.daily-takeaway-head strong { display: block; font-family: var(--pixel); }
.daily-takeaway-head span { margin-bottom: 3px; font-size: 9px; color: var(--teal); }
.daily-takeaway-head strong { font-size: 13px; color: var(--gold-soft); }
.daily-takeaway .markdown-message { font-size: 13px; line-height: 1.62; }
.daily-takeaway .markdown-message h2 {
  margin: 13px 0 5px; font-family: var(--pixel); font-size: 10px; color: var(--teal);
}
.daily-takeaway-updated { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line-soft); }
.daily-takeaway-history { display: grid; gap: 7px; padding: 10px 0 0; }
.ai-command-details .daily-takeaway-history details { background: rgba(111,224,208,.025); }
.ai-command-details .daily-takeaway-history summary { color: var(--teal); background: transparent; }
.daily-takeaway-history .markdown-message { padding: 10px 12px; font-size: 12px; line-height: 1.6; }
.daily-takeaway-history .markdown-message h2 { font-size: 11px; color: var(--gold-soft); }
.ai-command-empty, .ai-command-notice { margin: 10px 0 0; color: var(--gold-soft); }
.ai-command-details { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.ai-command-details details {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: rgba(0,0,0,.14); overflow: hidden;
}
.ai-command-details summary {
  padding: 9px 12px; cursor: pointer; list-style: none;
  font-family: var(--pixel); font-size: 10px; color: var(--gold-soft);
  background: rgba(231,198,107,.04);
}
.ai-command-details summary::-webkit-details-marker { display: none; }
.ai-command-details summary::before { content: "＋"; margin-right: 7px; color: var(--teal); }
.ai-command-details details[open] summary::before { content: "－"; }
.ai-command-details details > :not(summary) { margin-left: 12px; margin-right: 12px; }
.ai-command-details details > :last-child { margin-bottom: 12px; }

@media (max-width: 900px) {
  .ai-command-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trader-effective-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-command-actions { align-items: flex-start; flex-direction: column; }
  .ai-command-actions .journal-toolbar { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .ai-command-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ai-command-stat { padding: 9px; }
  .ai-command-stat strong { font-size: 14px; }
  .trader-effective-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-takeaway-head { align-items: stretch; flex-direction: column; }
  .daily-takeaway-head button { align-self: flex-start; }
}

.bt-input {
  width: 96px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 2px solid rgba(255,255,255,.12); background: #12182e; color: #fff;
}
.bt-desc { font-size: 13px; color: #c5d0ef; line-height: 1.45; margin: 0 0 12px; }
.bt-result { margin-top: 12px; }
.bt-result-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.bt-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.bt-stat-card {
  padding: 12px; border-radius: var(--r-sm); background: rgba(0,0,0,.25);
  border-top: 3px solid var(--gold);
}
.bt-stat-card h5 { margin: 0 0 8px; font-size: 13px; color: #fff; }
.bt-stat-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; }
.bt-stat-rows span { display: block; color: #8898bc; font-size: 10px; }
.bt-stat-rows b { color: #fff; font-size: 14px; }
.bt-note { font-size: 12px; color: #9aa8cc; margin-top: 10px; }
.bt-import { border: 2px dashed rgba(255,255,255,.12); border-radius: var(--r-sm); padding: 12px; }
.bt-import summary { cursor: pointer; font-weight: 600; color: var(--gold-soft); }
.bt-import-area {
  width: 100%; margin: 8px 0; padding: 10px; border-radius: var(--r-sm);
  border: 2px solid rgba(255,255,255,.1); background: #0f1428; color: #e8ecf4; font-family: monospace; font-size: 12px;
}

.guide-strategy-import {
  display: block; margin-top: 8px; padding: 8px 12px; border-radius: var(--r-sm);
  border: 2px solid var(--teal); background: rgba(111,224,208,.12); color: var(--teal);
  font-size: 12px; font-weight: 700; cursor: pointer; width: 100%; text-align: left;
}
.guide-strategy-import:hover { background: rgba(111,224,208,.2); }

@media (max-width: 900px) {
  .bt-layout { grid-template-columns: 1fr; }
  .bt-strat-list { max-height: 240px; }
}

.tech-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.tech-grid > div {
  padding: 10px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: rgba(0,0,0,.2);
}
.tech-grid span { display: block; font-size: 11px; color: #9aa8cc; text-transform: uppercase; letter-spacing: .5px; }
.tech-grid strong { display: block; font-size: 18px; margin-top: 4px; color: #fff; font-variant-numeric: tabular-nums; }
.tech-grid em { font-size: 12px; color: #8ecfff; font-style: normal; }

.company-blurb { font-size: 15px; line-height: 1.65; color: #dce4fa; margin: 0; }

.fin-summary.bright { margin-bottom: 14px; }
.fin-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-steps { display: flex; flex-direction: column; gap: 16px; }
.fin-step-block h3 { margin: 0 0 10px; font-size: 16px; color: var(--gold-soft); display: flex; align-items: center; gap: 8px; }
.fin-step-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(231,198,107,.2); border: 2px solid var(--gold); font-family: var(--pixel); font-size: 11px; color: var(--gold);
}
.fin-rows { display: flex; flex-direction: column; gap: 8px; }
.fin-row {
  display: flex; gap: 12px; padding: 12px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.08); background: #0f1428;
}
.fin-row.fin-good { border-left: 4px solid #3dd68c; }
.fin-row.fin-warn { border-left: 4px solid var(--gold); }
.fin-row.fin-bad { border-left: 4px solid #ff6b6b; }
.fin-light { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.fin-light.good { background: #3dd68c; box-shadow: 0 0 10px rgba(61,214,140,.7); }
.fin-light.warn { background: var(--gold); box-shadow: 0 0 10px rgba(231,198,107,.6); }
.fin-light.bad { background: #ff6b6b; box-shadow: 0 0 10px rgba(255,107,107,.6); }
.fin-light.na { background: #667; }
.fin-label { font-weight: 700; font-size: 14px; color: #f0f4ff; }
.fin-value { font-size: 15px; color: #fff; margin-top: 3px; font-variant-numeric: tabular-nums; }
.fin-note { font-size: 13px; color: #a8b8dc; margin-top: 4px; line-height: 1.45; }

.fin-table-wrap { overflow: auto; margin: 0 -4px; }
.fund-table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  margin: 0;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  background: rgba(8,12,26,.55);
}
.fund-table-scroll .fin-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  margin: 0;
}
.fund-table-scroll .fin-table.fund-table-wide { min-width: 720px; }
.fund-table-scroll .fin-table th,
.fund-table-scroll .fin-table td {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  padding: 10px 14px;
  font-size: 13px;
}
.fund-table-scroll .fin-table th:first-child,
.fund-table-scroll .fin-table td.fin-period {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #0f1428;
  box-shadow: 2px 0 8px rgba(0,0,0,.28);
}
.fund-table-scroll .fin-table thead th:first-child { z-index: 2; background: #12182c; }
.fund-table-scroll .fin-table .qtip { position: relative; z-index: 5; }
.fund-table-scroll .fin-table th .qbtn,
.fund-table-scroll .fin-table td .qbtn { color: var(--gold-soft); background: rgba(231,198,107,.22); }
.fin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.fin-table th {
  text-align: right; padding: 10px 8px; color: var(--gold-soft); font-family: var(--pixel); font-size: 11px;
  border-bottom: 2px solid rgba(231,198,107,.35); white-space: nowrap;
}
.fin-table th:first-child, .fin-table td.fin-period { text-align: left; }
.fin-table td {
  padding: 9px 8px; text-align: right; color: #eef2ff; border-bottom: 1px solid rgba(255,255,255,.06);
  font-variant-numeric: tabular-nums;
}
.fin-table tr:hover td { background: rgba(231,198,107,.06); }
.fin-table.compact { min-width: 360px; }
.fin-table.compact td, .fin-table.compact th { font-size: 12px; padding: 7px 6px; }

.flow-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px;
}
.flow-summary > div {
  padding: 12px; border: 2px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
}
.flow-summary span { display: block; font-size: 12px; color: #9aa8cc; }
.flow-summary strong { display: block; font-size: 20px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.flow-days { display: flex; flex-direction: column; gap: 10px; }
.flow-day { padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--r-sm); background: #0d1224; }
.flow-date { font-weight: 700; color: var(--gold-soft); margin-bottom: 8px; font-size: 13px; }
.flow-bar-row { display: grid; grid-template-columns: 48px 1fr 72px; gap: 8px; align-items: center; margin-bottom: 6px; }
.flow-bar-label { font-size: 12px; color: #b8c4e8; }
.flow-bar-track { height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.flow-bar-fill { height: 100%; border-radius: 4px; }
.flow-bar-fill.up { background: linear-gradient(90deg, #c44, var(--crimson)); }
.flow-bar-fill.down { background: linear-gradient(90deg, #2a9d5c, var(--emerald)); }
.flow-bar-val { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.flow-total { margin-top: 6px; font-size: 13px; color: #c5d0ef; }

.holder-breakdown {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px;
}
.holder-breakdown > div { padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428; }
.holder-breakdown span { display: block; font-size: 12px; color: #9aa8cc; }
.holder-breakdown strong { font-size: 18px; color: #fff; }
.holder-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.holder-tables h4 { margin: 0 0 8px; color: var(--gold-soft); font-size: 14px; }

.flow-panel { display: flex; flex-direction: column; gap: 12px; }
.macro-groups-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.flow-panel-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.flow-panel-toolbar .flow-freshness { flex: 1; min-width: 240px; }
.flow-freshness {
  padding: 10px 14px; border: 1px solid rgba(111,224,208,.25); border-radius: var(--r-sm);
  background: rgba(111,224,208,.06);
}
.flow-freshness-row {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 12px; color: #b8c4e8;
}
.flow-freshness-label { font-weight: 700; color: var(--gold-soft); }
.flow-freshness-badge {
  padding: 2px 8px; border-radius: 4px; background: rgba(42,157,92,.2); color: #3dd68c; font-weight: 700;
}
.flow-freshness-badge.partial { background: rgba(231,198,107,.15); color: var(--gold-soft); }
.flow-lag-note { margin: 8px 0 0; line-height: 1.45; }

.analyst-verdict-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: baseline; margin-bottom: 12px; }
.analyst-verdict { font-size: 18px; font-weight: 800; }
.analyst-verdict--bull { color: var(--crimson); }
.analyst-verdict--bear { color: var(--emerald); }
.analyst-verdict--neutral { color: var(--gold-soft); }
.analyst-target { font-size: 14px; color: #c5d0ef; }
.analyst-rating-bar {
  display: flex; gap: 3px; min-height: 52px; border-radius: var(--r-sm); overflow: hidden;
}
.analyst-rating-seg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 44px; padding: 4px; font-size: 11px; color: #0d1224; font-weight: 700;
}
.analyst-rating-seg strong { font-size: 15px; }
.analyst-rating-seg.bull-strong { background: #1b8f4a; color: #e8fff0; }
.analyst-rating-seg.bull { background: var(--crimson); }
.analyst-rating-seg.neutral { background: #e7c66b; }
.analyst-rating-seg.bear { background: #ff9f5a; }
.analyst-rating-seg.bear-strong { background: #c44; color: #fff; }

.analyst-actions-wrap { margin-top: 4px; }
.analyst-actions-title { margin: 0 0 8px; font-size: 14px; color: var(--gold-soft); font-weight: 700; }
.analyst-actions-table { min-width: 560px; }
.analyst-firm { font-weight: 600; max-width: 200px; line-height: 1.35; }
.analyst-action {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 800;
}
.analyst-action--bull { background: var(--crimson-bg); color: var(--crimson); }
.analyst-action--bear { background: var(--emerald-bg); color: var(--emerald); }
.analyst-action--neutral { background: rgba(231,198,107,.15); color: var(--gold-soft); }

.flow-inst-layout { display: flex; flex-direction: column; gap: 16px; }
.flow-inst-block h4 { margin: 0 0 8px; color: var(--gold-soft); font-size: 14px; }
.flow-inst-table { min-width: 720px; }
.flow-inst-name { max-width: 220px; line-height: 1.35; }
.flow-etf-table { min-width: 640px; }
.flow-etf-explainer { line-height: 1.5; }
.flow-notable-explainer { line-height: 1.5; }
.flow-notable-block { margin-top: 12px; }
.flow-notable-block h4 { margin: 0 0 8px; color: var(--gold-soft); font-size: 14px; }
.flow-notable-table { min-width: 720px; }
.notable-person { min-width: 140px; line-height: 1.35; }
.notable-person strong { display: block; }
.notable-person a { color: #7ee8dc; text-decoration: none; }
.notable-person a:hover { text-decoration: underline; }
.notable-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.notable-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700;
  background: rgba(231,198,107,.12); color: var(--gold-soft);
}
.flow-breakdown { margin-bottom: 8px; }

.holder-tier {
  display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700;
  white-space: nowrap;
}
.holder-tier--top3 { background: rgba(231,198,107,.25); color: var(--gold-soft); }
.holder-tier--mega { background: rgba(111,224,208,.2); color: #7ee8dc; }
.holder-tier--large { background: rgba(126,184,255,.2); color: #9ec8ff; }
.holder-tier--mid { background: rgba(255,255,255,.08); color: #b8c4e8; }

.news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.news-list li {
  padding: 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm);
  background: #0f1428; transition: .12s;
}
.news-list li:hover { border-color: var(--teal); background: rgba(111,224,208,.06); }
.news-list a { color: #7ee8dc; font-weight: 600; font-size: 15px; text-decoration: none; display: block; line-height: 1.4; }
.news-list a:hover { text-decoration: underline; color: var(--teal); }
.news-meta { display: block; font-size: 12px; color: #8898bc; margin-top: 6px; }
.officer-list, .insider-list { margin: 12px 0 0; padding-left: 18px; color: #c5d0ef; line-height: 1.55; }
.intel-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

.company-intel-panel .intel-sync-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--r-sm); background: #0f1428;
}
.intel-sync-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.intel-health-notes { margin: 0 0 12px; padding-left: 18px; color: #9aa8cc; font-size: 13px; line-height: 1.5; }
.interpret-box {
  margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--gold);
  background: rgba(231,198,107,.08); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.interpret-label { font-size: 12px; font-weight: 700; color: var(--gold-soft); margin-bottom: 6px; letter-spacing: .04em; }
.interpret-box p { margin: 0; color: #d8dff5; line-height: 1.55; font-size: 14px; }
.interpret-bullets { margin: 8px 0 0; padding-left: 18px; color: #b8c4e8; font-size: 13px; line-height: 1.5; }

.chain-map { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chain-col { padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428; min-width: 0; }
.chain-col b { display: block; color: var(--gold-soft); margin-bottom: 8px; font-size: 14px; }
.chain-entity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chain-entity-list li { font-size: 13px; line-height: 1.45; }
.chain-entity-list strong { display: block; color: #eef2ff; }
.chain-entity-list span { color: #9aa8cc; }
.chain-note { display: block; font-size: 11px; color: #7a88b0; font-style: normal; margin-top: 2px; }
.chain-excerpt { line-height: 1.5; }
.intel-resource-links { display: flex; flex-wrap: wrap; gap: 10px; }
.intel-resource-links a { font-size: 13px; color: var(--teal); }

.officer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.officer-card { padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428; }
.officer-card b { display: block; color: #fff; font-size: 14px; }
.officer-card span { display: block; color: #9aa8cc; font-size: 12px; margin-top: 4px; }
.officer-card small { display: block; color: #7a88b0; font-size: 11px; margin-top: 4px; }

.insider-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.insider-summary > div { padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428; text-align: center; }
.insider-summary b { display: block; font-size: 22px; color: #fff; }
.insider-summary span { font-size: 12px; color: #9aa8cc; }
.insider-summary .good b { color: var(--emerald); }
.insider-summary .bad b { color: var(--crimson); }

.insider-tx-grid { display: grid; gap: 8px; margin-top: 12px; }
.insider-row {
  display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 8px; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
  text-decoration: none; color: inherit; transition: .12s;
}
.insider-row:hover { border-color: var(--teal); background: rgba(111,224,208,.06); }
.insider-row b { display: block; font-size: 14px; color: #fff; }
.insider-row span { display: block; font-size: 11px; color: #8898bc; margin-top: 2px; }
.insider-holder-list { margin: 8px 0 0; padding-left: 18px; color: #c5d0ef; font-size: 13px; line-height: 1.5; }

.mgmt-brief-list { display: grid; gap: 10px; }
.mgmt-brief-row { padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428; }
.mgmt-brief-row b { display: block; color: #fff; }
.mgmt-brief-row small { color: #8898bc; font-size: 11px; }
.mgmt-brief-row p { margin: 6px 0 0; font-size: 13px; color: #c5d0ef; line-height: 1.45; }
.mgmt-brief-row a { font-size: 12px; color: var(--teal); }
.mgmt-brief--up { border-color: rgba(111,207,151,.35); }
.mgmt-brief--down { border-color: rgba(232,106,82,.35); }

.sec-archive-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.sec-archive-block h4 { margin: 0 0 8px; color: var(--gold-soft); font-size: 14px; }
.sec-filing-list, .sec-earn-list { display: grid; gap: 8px; }
.sec-filing-row, .sec-earn-row {
  padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
  display: grid; gap: 8px;
}
@media (min-width: 720px) { .sec-filing-row { grid-template-columns: 1fr auto; align-items: start; } }
.sec-filing-row--earn { border-color: rgba(143,184,255,.35); }
.sec-filing-main b { display: block; font-size: 14px; color: #fff; }
.sec-filing-form { font-size: 11px; color: #8898bc; margin-left: 6px; }
.sec-filing-main small { display: block; color: #8898bc; margin-top: 4px; }
.sec-filing-main p { margin: 6px 0 0; font-size: 13px; color: #9aa8cc; line-height: 1.45; }
.sec-filing-excerpt { font-size: 12px !important; opacity: .9; }
.sec-filing-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-filing-links a { font-size: 13px; color: var(--teal); }
.sec-missing { font-size: 12px; color: #7a88b0; }

.news-tabs { display: flex; gap: 8px; margin-bottom: 4px; }
.news-tab {
  padding: 6px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-sm);
  background: #0f1428; color: #9aa8cc; font-size: 13px; cursor: pointer;
}
.news-tab.active { border-color: var(--gold); color: var(--gold-soft); background: rgba(231,198,107,.1); }

.ai-summary-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.ai-summary-risks { padding: 10px 12px; border: 1px solid rgba(232,106,82,.25); border-radius: var(--r-sm); background: rgba(232,106,82,.06); }

.term-label {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  vertical-align: middle;
}
.term-label-text { line-height: 1.3; }
.fin-table th .term-label { justify-content: flex-end; }
.fin-table th:first-child .term-label,
.fin-table td.fin-period .term-label { justify-content: flex-start; }

.backpack-panel { min-width: 0; }

.fund-layout-2 {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start;
}
.fund-layout-stack {
  display: flex; flex-direction: column; gap: 14px;
}
.fund-layout-2 > *, .fund-layout-stack > * { min-width: 0; }
.fund-layout-2 .card, .fund-layout-stack .card { min-width: 0; }
.fund-panel-compact .card-body { padding-top: 4px; }
.fund-panel-compact .fund-table-scroll { margin-top: 2px; }
.fund-metric-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.fund-metric-cell {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.08); background: #0f1428;
}
.fund-metric-cell .k {
  display: block; font-size: 12px; color: #9aa8cc; margin-bottom: 4px;
}
.fund-metric-cell .v {
  display: block; font-size: 16px; color: #fff; font-variant-numeric: tabular-nums;
}
.fund-metric-cell .sub {
  display: block; font-size: 11px; color: #8898bc; margin-top: 3px; font-style: normal;
}
.fin-insight-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fin-insight-item {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.08); background: #0f1428;
  font-size: 13px; color: #c5d0ef; line-height: 1.5;
}
.fin-insight-item b { color: #eef2ff; font-weight: 600; }

.sector-news-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sector-news-item {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.08); background: #0f1428;
}
.sector-news-item a {
  color: #7ee8dc; font-weight: 600; font-size: 14px; text-decoration: none; line-height: 1.4;
  word-break: break-word; overflow-wrap: anywhere;
}
.sector-news-item a:hover { text-decoration: underline; color: var(--teal); }
.sector-news-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 12px; color: #8898bc; }
.sector-news-impact { margin-top: 6px; font-size: 13px; color: #b8c4e8; line-height: 1.45; }
.sector-pulse {
  padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 10px;
  border: 1px solid rgba(111,224,208,.25); background: rgba(111,224,208,.06);
  font-size: 13px; color: #c5d0ef; line-height: 1.5;
}

.fund-verdict-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.cash-flow-grid, .balance-invest-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.cash-flow-grid > div, .balance-invest-grid > div {
  padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
}
.cash-flow-grid span, .balance-invest-grid span { display: block; font-size: 12px; color: #9aa8cc; }
.cash-flow-grid strong, .balance-invest-grid strong { display: block; font-size: 16px; color: #fff; margin-top: 4px; }
.balance-invest-grid em { display: block; font-size: 11px; color: #8898bc; margin-top: 4px; font-style: normal; }

.cash-use-list { display: flex; flex-direction: column; gap: 6px; }
.cash-use-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--r-sm); font-size: 13px;
}
.cash-use-row strong { color: #eef2ff; }
.cash-use-row em { color: #8898bc; font-style: normal; font-size: 12px; }
.cash-use--invest { border-left: 3px solid var(--indigo); }
.cash-use--return { border-left: 3px solid var(--emerald); }
.cash-use--finance { border-left: 3px solid var(--gold); }

/* 台股慣例：紅漲綠跌 */
.up { color: var(--crimson) !important; }
.down { color: var(--emerald) !important; }

@media (max-width: 1100px) {
  .fund-layout-2 { grid-template-columns: 1fr; }
}
.social-watch-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.social-lang-toggle { display: inline-flex; border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-sm); overflow: hidden; }
.social-lang-toggle button {
  padding: 6px 14px; border: none; background: #0f1428; color: #9aa8cc; font-size: 13px; cursor: pointer;
}
.social-lang-toggle button.active { background: rgba(231,198,107,.18); color: var(--gold-soft); }
.social-account-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.social-chip {
  padding: 5px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  background: #0f1428; color: #aeb4cf; font-size: 12px; cursor: pointer;
}
.social-chip.active { border-color: rgba(111,224,208,.45); color: var(--teal); background: rgba(111,224,208,.08); }
.social-post-list { display: grid; gap: 10px; max-height: 520px; overflow: auto; padding-right: 4px; }
.social-post {
  padding: 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-sm); background: #0f1428;
}
.social-post--critical { border-color: rgba(232,106,82,.45); box-shadow: inset 3px 0 0 rgba(232,106,82,.7); }
.social-post--high { border-color: rgba(231,198,107,.35); }
.social-post-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.social-post-head b { display: block; color: #fff; font-size: 14px; }
.social-post-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.social-post-body { margin: 0; font-size: 14px; line-height: 1.55; color: #dce4fa; white-space: pre-wrap; }
.social-post-alt { margin: 8px 0 0; line-height: 1.45; }
.social-post-foot { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; align-items: center; }
.social-post-foot a { font-size: 12px; color: var(--teal); }

@media (max-width: 900px) {
  .backpack-layout { grid-template-columns: 1fr; }
  .backpack-main { min-height: 0; }
  .backpack-inventory-zone { max-height: min(36vh, 300px); }
  .backpack-sym-row-open { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .backpack-sym-row .backpack-sym-chg { grid-column: 2 / -1; text-align: left; min-width: 0; }
  .flow-summary, .holder-breakdown { grid-template-columns: repeat(2, 1fr); }
  .holder-tables { grid-template-columns: 1fr; }
  .tech-grid { grid-template-columns: repeat(2, 1fr); }
  .chain-map { grid-template-columns: 1fr; }
  .insider-row { grid-template-columns: 1fr; }
  .cash-flow-grid, .balance-invest-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .backpack-symbols { grid-template-columns: 1fr 1fr; }
  .flow-summary, .holder-breakdown, .tech-grid { grid-template-columns: 1fr; }
  .candle-chart { height: 260px; }
}
