:root {
  color-scheme: dark;
  --bg: #080808;
  --surface: #11110f;
  --surface-2: #191812;
  --text: #f7f1e4;
  --muted: #aaa18e;
  --line: rgba(240, 185, 11, 0.24);
  --gold: #f0b90b;
  --gold-deep: #b88600;
  --green: #22d69a;
  --red: #ff6675;
  --orange: #ffb23f;
}

body.light {
  color-scheme: light;
  --bg: #f4efe4;
  --surface: #fffdf7;
  --surface-2: #eee5d2;
  --text: #1a1712;
  --muted: #6f6655;
  --line: rgba(132, 90, 0, 0.28);
  --gold: #8a5b00;
  --gold-deep: #6f4700;
  --green: #087f5b;
  --red: #c92f45;
  --orange: #a75a00;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.member-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 12px clamp(18px, 4vw, 54px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.member-brand { display: flex; align-items: center; gap: 12px; }
.member-brand img { width: 54px; height: 54px; object-fit: cover; border: 2px solid var(--gold); border-radius: 50%; }
.member-brand span { display: grid; gap: 3px; }
.member-brand strong { font-size: 22px; }
.member-brand small { color: var(--muted); font-weight: 700; }
.member-topbar nav { display: flex; align-items: center; gap: 8px; }
.member-topbar nav a,
.member-topbar nav button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}
.member-topbar nav a:hover,
.member-topbar nav button:hover { color: var(--text); border-color: var(--gold); }

.member-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 80px; }
.member-heading { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: 0; }
.member-heading h1 { margin: 0; font-size: clamp(38px, 6vw, 68px); line-height: 1.05; }
.member-heading > p:last-child { max-width: 680px; margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }

.auth-panel,
.tool-panel,
.activity-panel,
.result-panel {
  margin-top: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.auth-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 28px; }
.auth-panel h2,
.tool-head h2 { margin: 0; font-size: 26px; }
.auth-panel p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); }
.auth-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.auth-actions span { flex-basis: 100%; color: var(--muted); text-align: right; font-size: 13px; }
.primary-action,
.secondary-action {
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
}
.primary-action { background: var(--gold); color: #151000; }
.primary-action:hover { background: color-mix(in srgb, var(--gold) 86%, white); }
.primary-action:disabled { cursor: wait; opacity: 0.65; }
.secondary-action { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--gold); }

.tool-panel { padding: 28px; }
.tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.member-badge { display: grid; grid-template-columns: auto auto auto; gap: 3px 8px; align-items: center; color: var(--text); font-weight: 800; text-align: right; }
.member-badge small { grid-column: 2 / -1; color: var(--muted); font-weight: 600; }
.member-tier { padding: 3px 7px; border: 1px solid color-mix(in srgb, var(--green) 55%, transparent); border-radius: 4px; color: var(--green); font-size: 11px; font-weight: 900; }
.member-tier.trial { border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--gold); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px color-mix(in srgb, var(--green) 60%, transparent); }
.member-access-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 170px)) minmax(220px, 1fr); gap: 1px; margin-top: 20px; border: 1px solid var(--line); background: var(--line); }
.member-access-summary > div,
.member-access-summary > p { margin: 0; padding: 13px 15px; background: var(--surface-2); }
.member-access-summary > div { display: grid; gap: 4px; }
.member-access-summary span { color: var(--muted); font-size: 11px; font-weight: 800; }
.member-access-summary strong { color: var(--gold); font-size: 15px; }
.member-access-summary > p { display: flex; align-items: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
.symbol-form { margin-top: 24px; }
.symbol-form label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 800; }
.symbol-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--line); background: var(--surface-2); }
.symbol-control > span { padding-left: 18px; color: var(--gold); font-size: 24px; font-weight: 900; }
.symbol-control input { width: 100%; min-width: 0; height: 58px; padding: 0 12px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 21px; font-weight: 800; text-transform: uppercase; }
.symbol-control input::placeholder { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.symbol-control .primary-action { margin: 6px; min-width: 126px; }
#tool-status { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.recommendation-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.recommendation-tool h3 { margin: 0; font-size: 21px; }
.recommendation-tool p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.recommendation-tool .secondary-action { flex: 0 0 auto; min-width: 146px; }
.recommendation-tool .secondary-action:disabled { cursor: wait; opacity: 0.65; }

.recommendation-results { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.recommendation-results > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.recommendation-results h3 { margin: 0; font-size: 22px; }
.recommendation-results header p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
#recommendation-status { color: var(--gold); font-size: 13px; font-weight: 800; text-align: right; }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.recommendation-card { display: flex; min-width: 0; min-height: 300px; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.recommendation-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recommendation-card > header strong { font-size: 20px; overflow-wrap: anywhere; }
.recommendation-action { flex: 0 0 auto; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--green) 60%, transparent); border-radius: 4px; color: var(--green); font-size: 11px; font-weight: 900; }
.recommendation-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.recommendation-score b { color: var(--gold); font-size: 15px; }
.recommendation-card > small { color: var(--muted); font-weight: 800; }
.recommendation-card ul { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.recommendation-card li { position: relative; padding-left: 14px; line-height: 1.45; }
.recommendation-card li::before { position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); content: ""; }
.recommendation-risk { margin: 16px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recommendation-inspect { width: 100%; min-height: 42px; margin-top: auto; border: 1px solid var(--gold); border-radius: 5px; background: transparent; color: var(--gold); cursor: pointer; font-weight: 900; }
.recommendation-inspect:hover { background: var(--gold); color: #151000; }
.recommendation-empty { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line); border-radius: 6px; text-align: center; }
.recommendation-empty strong { font-size: 22px; }
.recommendation-empty p { margin: 9px auto 0; color: var(--muted); line-height: 1.6; }

.activity-panel { overflow: hidden; }
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.activity-head h2 { margin: 0; font-size: 26px; }
.activity-head > p { max-width: 440px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: right; }
.activity-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); }
.activity-grid > section { min-width: 0; padding: 26px 28px; }
.activity-grid > section + section { border-left: 1px solid var(--line); }
.activity-grid section > header { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.activity-grid section header span { color: var(--muted); font-size: 12px; font-weight: 800; }
.activity-grid section h3 { margin: 4px 0 0; font-size: 19px; }
.activity-grid section header small { max-width: 220px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: right; }
.popular-list,
.recent-list { border-top: 1px solid var(--line); }
.popular-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 62px; border-bottom: 1px solid var(--line); }
.popular-rank { color: var(--gold); font-size: 18px; font-weight: 900; }
.popular-row strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.popular-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.popular-row button,
.recent-row button,
.history-dialog button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--gold); cursor: pointer; font-weight: 900; }
.popular-row button:hover,
.recent-row button:hover,
.history-dialog button:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, transparent); }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; min-height: 68px; border-bottom: 1px solid var(--line); }
.recent-main { min-width: 0; }
.recent-main strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.recent-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.recent-verdict { min-width: 84px; text-align: right; }
.recent-verdict strong { display: block; color: var(--text); font-size: 13px; }
.recent-verdict span { color: var(--gold); font-size: 12px; font-weight: 900; }
.activity-empty { margin: 0; padding: 18px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
.activity-status { min-height: 18px; margin: 0; padding: 0 28px 18px; color: var(--muted); font-size: 12px; }

.history-dialog { width: min(760px, calc(100% - 32px)); max-height: min(820px, calc(100vh - 36px)); padding: 0; border: 1px solid var(--gold); border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: 0 22px 70px rgba(0, 0, 0, .55); }
.history-dialog::backdrop { background: rgba(0, 0, 0, .76); backdrop-filter: blur(5px); }
.history-dialog > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.history-dialog h2 { margin: 0; font-size: 24px; }
.history-dialog header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.history-dialog-body { overflow-y: auto; padding: 24px; }
.history-snapshot-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.history-snapshot-head strong { display: block; font-size: 27px; }
.history-snapshot-head p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.history-snapshot-head small { display: block; max-width: 540px; margin-top: 5px; color: var(--muted); line-height: 1.5; }
.history-score { flex: 0 0 auto; color: var(--gold); font-size: 30px; font-weight: 900; }
.history-score span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.history-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.history-metrics > div { min-height: 78px; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.history-metrics span { display: block; color: var(--muted); font-size: 11px; }
.history-metrics strong { display: block; margin-top: 6px; font-size: 16px; overflow-wrap: anywhere; }
.history-copy-grid { display: grid; grid-template-columns: 1fr 1fr; }
.history-copy-grid section { padding: 22px 0; }
.history-copy-grid section + section { padding-left: 22px; border-left: 1px solid var(--line); }
.history-copy-grid h3,
.history-extra h3 { margin: 0 0 12px; font-size: 16px; }
.history-copy-grid ul { display: grid; gap: 9px; margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.history-extra { padding-top: 20px; border-top: 1px solid var(--line); }
.history-extra p { margin: 0; color: var(--muted); line-height: 1.65; }
.history-extra strong { color: var(--gold); }
.history-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.history-levels .history-metric { min-height: 68px; padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.history-levels span { display: block; color: var(--muted); font-size: 11px; }
.history-levels strong { display: block; margin-top: 5px; font-size: 15px; overflow-wrap: anywhere; }

.result-panel { overflow: hidden; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.result-symbol { margin: 0; font-size: 30px; font-weight: 900; }
.result-time { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.verdict-chip { padding: 7px 11px; border: 1px solid currentColor; border-radius: 4px; font-size: 13px; font-weight: 900; }
.verdict-chip.positive { color: var(--green); }
.verdict-chip.warning { color: var(--orange); }
.verdict-chip.danger { color: var(--red); }
.verdict-chip.neutral { color: var(--muted); }
.result-primary { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; padding: 34px 28px; background: var(--surface-2); }
.result-primary span { color: var(--muted); font-size: 13px; font-weight: 800; }
.result-primary > div:first-child > strong { display: block; margin-top: 7px; font-size: clamp(28px, 5vw, 46px); }
.result-primary p { max-width: 670px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.confidence-block { min-width: 150px; padding-left: 28px; border-left: 1px solid var(--line); text-align: right; }
.confidence-block strong { color: var(--gold); font-size: 54px; line-height: 1; }
.confidence-block small { color: var(--muted); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.metric-item { min-height: 106px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-item strong { display: block; margin-top: 8px; font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.metric-item strong.positive { color: var(--green); }
.metric-item strong.negative { color: var(--red); }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; }
.analysis-grid section { padding: 28px; }
.analysis-grid section + section { border-left: 1px solid var(--line); }
.analysis-grid h3,
.levels-section h3 { margin: 0 0 18px; font-size: 17px; }
.analysis-grid ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.analysis-grid li { position: relative; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.analysis-grid li::before { position: absolute; left: 0; content: ""; width: 7px; height: 7px; margin-top: 8px; border-radius: 50%; background: var(--gold); }

.pullback-section { display: grid; grid-template-columns: minmax(220px, .8fr) 1.2fr; gap: 28px; align-items: center; padding: 24px 28px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 7%, var(--surface-2)); }
.pullback-section span,
.signal-history-section header span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.pullback-section strong { display: block; margin-top: 6px; color: var(--gold); font-size: clamp(22px, 3vw, 32px); letter-spacing: 0; }
.pullback-section p { margin: 0; color: var(--muted); line-height: 1.65; }

.signal-history-section { padding: 26px 28px; border-top: 1px solid var(--line); }
.signal-history-section > header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.signal-history-section h3 { margin: 5px 0 0; font-size: 18px; }
.signal-history-section header p { margin: 0; color: var(--muted); font-size: 12px; }
.signal-history-list { border-top: 1px solid var(--line); }
.signal-history-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.signal-history-row > div { display: grid; gap: 4px; }
.signal-history-row > div:last-child { text-align: right; }
.signal-history-row span { color: var(--muted); font-size: 12px; }
.signal-history-row strong { font-size: 15px; }
.signal-history-empty { margin: 0; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--muted); line-height: 1.6; }

.levels-section { padding: 28px; border-top: 1px solid var(--line); }
.levels-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); }
.level-item { padding: 16px; border-right: 1px solid var(--line); }
.level-item:last-child { border-right: 0; }
.level-item span { display: block; color: var(--muted); font-size: 12px; }
.level-item strong { display: block; margin-top: 7px; font-size: 17px; }
.level-item.sl strong { color: var(--red); }
.levels-section > p,
.result-notice { color: var(--muted); font-size: 13px; line-height: 1.6; }
.result-notice { margin: 0; padding: 18px 28px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .member-topbar { min-height: 70px; padding: 10px 14px; }
  .member-brand img { width: 46px; height: 46px; }
  .member-brand strong { font-size: 18px; }
  .member-brand small { display: none; }
  .member-topbar nav a { display: none; }
  .member-topbar nav button { min-height: 38px; padding: 7px 9px; }
  .member-shell { width: min(100% - 24px, 1120px); padding: 34px 0 58px; }
  .member-heading h1 { font-size: 39px; }
  .auth-panel { align-items: stretch; flex-direction: column; padding: 22px; }
  .auth-actions { justify-content: stretch; }
  .auth-actions .primary-action,
  .auth-actions .secondary-action { width: 100%; }
  .auth-actions span { text-align: left; }
  .tool-panel { padding: 20px; }
  .tool-head { display: grid; }
  .member-badge { justify-self: start; text-align: left; }
  .member-access-summary { grid-template-columns: 1fr 1fr; }
  .member-access-summary > p { grid-column: 1 / -1; }
  .symbol-control { grid-template-columns: auto minmax(0, 1fr); }
  .symbol-control .primary-action { grid-column: 1 / -1; width: calc(100% - 12px); }
  .recommendation-tool { align-items: stretch; flex-direction: column; gap: 16px; }
  .recommendation-tool .secondary-action { width: 100%; }
  .recommendation-results > header { display: grid; }
  #recommendation-status { text-align: left; }
  .recommendation-grid { grid-template-columns: 1fr; }
  .recommendation-card { min-height: 0; }
  .activity-head { display: grid; padding: 22px 20px; }
  .activity-head > p { text-align: left; }
  .activity-grid { grid-template-columns: 1fr; }
  .activity-grid > section { padding: 22px 20px; }
  .activity-grid > section + section { border-top: 1px solid var(--line); border-left: 0; }
  .activity-grid section > header { align-items: start; }
  .recent-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 11px 0; }
  .recent-verdict { grid-column: 1; grid-row: 2; text-align: left; }
  .recent-row button { grid-column: 2; grid-row: 1 / span 2; }
  .history-dialog { width: calc(100% - 20px); max-height: calc(100vh - 20px); }
  .history-dialog > header,
  .history-dialog-body { padding: 20px; }
  .history-snapshot-head { display: grid; }
  .history-score { font-size: 27px; }
  .history-copy-grid { grid-template-columns: 1fr; }
  .history-copy-grid section + section { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .result-head { padding: 22px 20px; }
  .result-primary { grid-template-columns: 1fr; padding: 26px 20px; }
  .confidence-block { padding: 20px 0 0; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-grid section { padding: 24px 20px; }
  .analysis-grid section + section { border-top: 1px solid var(--line); border-left: 0; }
  .pullback-section { grid-template-columns: 1fr; gap: 12px; padding: 22px 20px; }
  .signal-history-section { padding: 22px 20px; }
  .signal-history-section > header { display: grid; gap: 7px; }
  .signal-history-row { align-items: end; }
  .levels-section { padding: 24px 20px; }
  .levels-grid { grid-template-columns: 1fr 1fr; }
  .level-item { border-bottom: 1px solid var(--line); }
  .level-item:nth-child(2n) { border-right: 0; }
  .level-item:last-child { border-bottom: 0; }
  .result-notice { padding: 16px 20px; }
}
