:root {
  --bg: #0b1020;
  --bg2: #11182c;
  --card: #111827;
  --card2: #0f172a;
  --text: #eef2ff;
  --muted: #9aa4c7;
  --line: rgba(255,255,255,.08);
  --accent: #60a5fa;
  --accent-soft: rgba(96,165,250,.18);
  --bull: #ef4444;
  --bear: #22c55e;
  --neutral: #f59e0b;
  --tw-up: #ef4444;
  --tw-down: #22c55e;
  --tw-flat: #f59e0b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; background: linear-gradient(180deg, var(--bg), var(--bg2)); color: var(--text); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 56px; }
.eyebrow, .muted { color: var(--muted); }
.meta-lines { line-height: 1.7; }
h1 { margin: 8px 0 6px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.03em; }
.card { margin-top: 16px; background: rgba(17,24,39,.88); border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.hero-card { padding: 22px; }
.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; }
.headline { margin-top: 12px; font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 850; line-height: 1.2; }
.hero-narrative {
  margin-top: 14px;
  font-size: .9rem;
  line-height: 1.7;
  color: #c8d0f0;
  max-width: 780px;
}

.summary-badges { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.summary-badge { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.06); color: #e7ebff; font-size: .8rem; font-weight: 800; border: 1px solid rgba(255,255,255,.06); }
.summary-badge.tw-up { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.22); }
.summary-badge.tw-down { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.22); }
.summary-badge.tw-flat { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.22); }
.summary-notes { margin-top: 12px; display: grid; gap: 8px; }
.summary-note { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); color: #dfe5ff; font-size: .88rem; line-height: 1.45; }
.summary-note-label { display: inline-block; margin-right: 8px; color: var(--accent); font-weight: 800; }
.section-title { font-size: 1rem; font-weight: 800; margin-bottom: 14px; border-bottom: 2px solid var(--line); padding-bottom: 8px; }
#inputsSection .section-title { border-bottom-color: var(--accent); }
#riskSection .section-title { border-bottom-color: var(--neutral); }
#targetsSection .section-title { border-bottom-color: var(--tw-up); }
#technicalSection .section-title { border-bottom-color: #8b5cf6; }
#flowSection .section-title { border-bottom-color: #14b8a6; }
#marketStructureSection .section-title { border-bottom-color: #eab308; }
#specialObservationSection .section-title { border-bottom-color: #38bdf8; }
#sectorSection .section-title { border-bottom-color: #f97316; }
#premarketSection .section-title { border-bottom-color: #ec4899; }
#dirSection .section-title { border-bottom-color: var(--accent-soft); }

.subsection-title { margin: 6px 0 12px; font-size: .88rem; font-weight: 800; color: var(--muted); letter-spacing: .02em; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.signal-card, .target-card, .technical-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 16px 22px;
  position: relative;
}
.signal-card::before, .target-card::before, .technical-card::before, .dir-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 18px 0 0 18px;
}
.signal-card.tw-up::before, .target-card.tw-up::before, .technical-card.tw-up::before { background: var(--tw-up); }
.signal-card.tw-down::before, .target-card.tw-down::before, .technical-card.tw-down::before { background: var(--tw-down); }
.signal-card.tw-flat::before, .target-card.tw-flat::before, .technical-card.tw-flat::before { background: var(--tw-flat); }
.dir-card::before { background: var(--accent); }

.target-card { display: flex; flex-direction: column; min-height: 190px; }
.technical-card { display: flex; flex-direction: column; min-height: 190px; }
.signal-label, .target-label, .technical-label { font-size: .86rem; color: var(--muted); }
.signal-value { margin-top: 8px; font-size: 1.35rem; font-weight: 850; }
.target-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.target-badge { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.05); font-size: .78rem; font-weight: 800; }
.target-bias, .technical-bias { margin-top: 10px; font-size: 1.35rem; font-weight: 850; }
.signal-meta, .target-meta, .technical-meta { margin-top: 8px; font-size: .92rem; color: var(--muted); }
.target-meta-row { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.target-confidence-badge { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06); color: #dfe5ff; font-size: .78rem; font-weight: 800; }
.target-quote, .technical-quote { margin-top: 8px; font-size: .84rem; color: var(--muted); }
.signal-detail { margin-top: 6px; font-size: .84rem; color: var(--muted); }
.signal-note { margin-top: 8px; font-size: .82rem; line-height: 1.45; color: #cfd6f6; }
.reason, .technical-reason {
  margin-top: 10px;
  font-size: .88rem;
  line-height: 1.6;
  color: #c0c8e8;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bias-bullish, .bias-neutral-bullish { color: var(--bull); }
.bias-bearish, .bias-neutral-bearish { color: var(--bear); }
.bias-neutral { color: var(--neutral); }
.tw-up { color: var(--tw-up); }
.tw-down { color: var(--tw-down); }
.tw-flat { color: var(--tw-flat); }
.top-gap { margin-top: 12px; }
@media (max-width: 760px) {
  .wrap { padding: 20px 14px 44px; }
  .hero-card { padding: 18px; }
  .summary-badges { gap: 6px; }
  .summary-badge { padding: 6px 10px; font-size: .76rem; }
  .grid.two { grid-template-columns: 1fr; }
  .target-card { min-height: auto; }
}

/* Directional tools card */
.dir-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dir-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.dir-value { font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.dir-meta { font-size: .82rem; color: var(--muted); }
.dir-reason { font-size: .82rem; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.dir-bias {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}
.dir-bias.bullish { background: rgba(34,197,94,.15); color: var(--bull); }
.dir-bias.bearish { background: rgba(239,68,68,.15); color: var(--bear); }
.dir-bias.neutral { background: rgba(245,158,11,.12); color: var(--neutral); }
.dir-up { color: var(--tw-up); }
.dir-down { color: var(--tw-down); }

/* === 現代 CSS 增強 ============================== */

/* 淺色模式 */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg2: #ffffff;
    --card: #f1f5f9;
    --card2: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: rgba(0,0,0,.08);
  }
  body { background: linear-gradient(180deg, var(--bg), var(--bg2)); }
  .card, .signal-card, .target-card, .dir-card { background: var(--card2); }
  .summary-note, .summary-badge { background: rgba(0,0,0,.04); }
}

/* 減少動畫（眩光敏感） */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 高對比度 */
@media (prefers-contrast: high) {
  :root {
    --accent: #1d4ed8;
    --text: #000;
    --muted: #374151;
    --line: rgba(0,0,0,.2);
  }
  .card, .signal-card, .target-card, .dir-card { border-width: 2px; }
}

/* color-mix 支援 */
@supports (background: color-mix(in srgb, #000 50%, #fff)) {
  .summary-badge.tw-up { background: color-mix(in srgb, var(--tw-up) 15%, transparent); }
  .summary-badge.tw-down { background: color-mix(in srgb, var(--tw-down) 15%, transparent); }
  .summary-badge.tw-flat { background: color-mix(in srgb, var(--tw-flat) 15%, transparent); }
}

.hero-narrative {
  margin-top: 14px;
  font-size: .96rem;
  line-height: 1.8;
  color: #d8e0ff;
  max-width: 780px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}

.fgi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 800;
  margin-left: 6px;
}
.fgi-badge.fear { background: rgba(231,76,60,.18); color: #ff8a7a; border: 1px solid rgba(231,76,60,.35); }
.fgi-badge.neutral-badge { background: rgba(245,158,11,.15); color: #ffc56e; border: 1px solid rgba(245,158,11,.3); }

.conclusion-block {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(88,166,255,.14), rgba(17,24,39,.96));
  border: 1px solid rgba(88,166,255,.24);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.conclusion-block .section-title { border-bottom-color: rgba(88,166,255,.3); }

.observation-bullet {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: #dfe5ff;
  font-size: .88rem;
  line-height: 1.55;
}

.disclaimer-card {
  margin-top: 18px;
}
.disclaimer-text {
  font-size: .92rem;
  line-height: 1.7;
  color: #d8e0ff;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
