/* 일일 투자지표 3색 브리핑 — 외부 의존 없는 단일 스타일시트 */
:root {
  --bg: #0a0f1c;
  --bg-soft: #0f1626;
  --panel: #121a2b;
  --panel-2: #16203400;
  --line: #22304a;
  --text: #e8eef9;
  --muted: #93a3bf;
  --green: #2ecc71;
  --green-dim: #14502f;
  --yellow: #f2c94c;
  --yellow-dim: #574612;
  --red: #ff5d5d;
  --red-dim: #5a1d1d;
  --gray: #7d8ba6;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, #16233c 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, #1a1630 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Malgun Gothic", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── header ───────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 15, 28, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { font-size: 24px; line-height: 1; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -.2px; }
.brand-sub { margin: 0; font-size: 11.5px; color: var(--muted); }
.top-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  background: #1d2a44; color: #cdd9ee; border: 1px solid #2b3c5c; white-space: nowrap;
}
.badge-ghost { background: transparent; color: var(--muted); }
.stamp { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ── panels ───────────────────────────────────────────── */
main { padding: 18px 0 8px; display: grid; gap: 14px; }

.panel {
  background: linear-gradient(180deg, rgba(23, 33, 54, .9), rgba(16, 23, 38, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.panel-head h2 { font-size: 15px; margin: 0; letter-spacing: -.2px; }
.hint { font-size: 11.5px; color: var(--muted); }

.hero { padding: 18px 16px; }
.eyebrow {
  margin: 0 0 6px; font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.cycle-line {
  margin: 0; font-size: clamp(19px, 4.6vw, 26px); font-weight: 700;
  letter-spacing: -.4px; line-height: 1.35;
  background: linear-gradient(92deg, #9fe6ff, #c9b7ff 45%, #ffd6a1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.counts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.count {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #0e1728;
}
.count b { font-size: 14px; }
.count.green { border-color: #1f6b43; color: #93e9b7; background: #0f2a1d; }
.count.yellow { border-color: #6b5717; color: #ffe28f; background: #2a2410; }
.count.red { border-color: #6e2626; color: #ff9c9c; background: #2a1414; }
.count.gray { border-color: #34405a; color: #b6c2d8; }
.hero-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

/* ── changes ──────────────────────────────────────────── */
.changes { display: grid; gap: 8px; }
.change-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: #0e1728; border: 1px solid var(--line);
}
.change-row .name { font-weight: 700; }
.change-row .flow { font-size: 13px; letter-spacing: .04em; }
.change-row .why { font-size: 12px; color: var(--muted); flex: 1 1 260px; min-width: 0; }
.no-change {
  display: flex; align-items: center; gap: 8px; font-weight: 600;
  padding: 14px; border-radius: 10px; background: #0e1728; border: 1px dashed var(--line);
  color: #cdd9ee;
}

/* ── table ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
.signal-table, .sell-table {
  width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px;
}
.sell-table { min-width: 420px; }
.signal-table th, .sell-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.signal-table td, .sell-table td {
  padding: 9px 10px; border-bottom: 1px solid rgba(34, 48, 74, .6); white-space: nowrap;
}
.signal-table tr:last-child td, .sell-table tr:last-child td { border-bottom: 0; }
.signal-table td.name { font-weight: 600; }
.signal-table tr.is-changed { background: rgba(255, 214, 120, .07); }

.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.pill.green { background: var(--green-dim); color: #9df0bf; border-color: #23794a; }
.pill.yellow { background: var(--yellow-dim); color: #ffe08a; border-color: #8a6f1a; }
.pill.red { background: var(--red-dim); color: #ffb3b3; border-color: #a13232; }
.pill.unavailable { background: #1b2437; color: #b3bfd4; border-color: #38455f; }

/* ── filters ──────────────────────────────────────────── */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  padding: 5px 10px; border-radius: 999px; color: var(--muted);
  background: #0e1728; border: 1px solid var(--line);
}
.chip.is-on { color: #0a0f1c; background: #cdd9ee; border-color: #cdd9ee; }

/* ── asset cards ──────────────────────────────────────── */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
.card {
  position: relative; overflow: hidden;
  background: #0e1728; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 13px 11px;
}
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--gray);
}
.card.green::before { background: var(--green); }
.card.yellow::before { background: var(--yellow); }
.card.red::before { background: var(--red); }
.card.changed { box-shadow: 0 0 0 1px #d8a23c inset, 0 6px 18px rgba(216, 162, 60, .12); }
.card[hidden] { display: none; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-name .n { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.card-name .t { font-size: 11.5px; color: var(--muted); }
.card-price { text-align: right; }
.card-price .p { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.card-price .u { font-size: 11px; color: var(--muted); margin-left: 3px; }
.card-price .c { font-size: 11.5px; font-weight: 600; }
.up { color: #6fd8a0; }
.down { color: #ff8a8a; }
.flat { color: var(--muted); }

.card-signal { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.basis { font-size: 11px; color: var(--muted); }
.tag {
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px;
  background: #1a2337; color: #a9b8d3; border: 1px solid #2b3a56;
}
.tag.chg { background: #3a2c0d; color: #ffd98a; border-color: #7a5f1c; }
.tag.ready { background: #123a26; color: #8fe9b4; border-color: #246b45; }

/* 52주 범위 바 */
.range { margin-top: 11px; }
.range-track {
  position: relative; height: 7px; border-radius: 999px;
  background: linear-gradient(90deg, #2ecc71 0%, #2ecc71 25%, #f2c94c 25%, #f2c94c 70%, #ff5d5d 70%, #ff5d5d 100%);
  opacity: .85;
}
.range-marker {
  position: absolute; top: -4px; width: 3px; height: 15px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
}
.range-labels {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 10.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums;
}
.range-note { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

.card details { margin-top: 9px; border-top: 1px solid rgba(34, 48, 74, .7); padding-top: 8px; }
.card summary {
  cursor: pointer; font-size: 12px; font-weight: 600; color: #c7d4ea;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: "▸"; color: var(--muted); font-size: 10px; }
.card details[open] summary::before { content: "▾"; }
.card dl { margin: 8px 0 0; display: grid; gap: 6px; }
.card dt { font-size: 11px; font-weight: 700; color: #9fb0cc; }
.card dd { margin: 2px 0 0; font-size: 12px; color: #d7e1f1; }
.card .src-line { margin: 8px 0 0; font-size: 10.5px; color: var(--muted); word-break: break-all; }
.card .src-line a { color: #8fc7ff; text-decoration: none; }
.card .reasons { margin: 8px 0 0; padding-left: 16px; font-size: 11.5px; color: #b9c7de; }
.card .reasons li { margin-bottom: 3px; }

.legend { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }

/* ── macro ────────────────────────────────────────────── */
.macro-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.macro {
  background: #0e1728; border: 1px solid var(--line); border-radius: 10px; padding: 11px;
  min-width: 0;
}
.macro .l { font-size: 11.5px; color: var(--muted); }
.macro .v { font-size: 17px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.macro .v small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.macro .n { font-size: 11px; color: #b9c7de; margin-top: 5px; }
.macro .s { font-size: 10.5px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.macro.is-na { opacity: .78; }

.memo { margin-top: 14px; background: #0d1524; border: 1px solid var(--line); border-radius: 10px; padding: 13px; }
.memo h3 { margin: 0 0 8px; font-size: 13px; }
.memo ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: #d3deee; }
.memo li { margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }

/* ── rules ────────────────────────────────────────────── */
.split-rule {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
  background: #1a2233; border: 1px solid #2f3f5d; color: #ffe1a6;
}
.rules { margin: 0 0 12px; padding-left: 18px; font-size: 12.5px; color: #d3deee; }
.rules li { margin-bottom: 5px; }
.caps { margin-bottom: 0; }

.disclaimer {
  margin: 14px 0 0; padding: 12px; border-radius: 10px; font-size: 12px;
  background: #1a1420; border: 1px solid #463049; color: #e3cfe8;
}
.src { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.src summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #c7d4ea; }
.src ul { margin: 8px 0 0; padding-left: 18px; font-size: 11.5px; color: var(--muted); word-break: break-all; }
.src ul a { color: #8fc7ff; text-decoration: none; }

.error-panel { border-color: #7a2c2c; background: #1d1114; }
.error-panel h2 { margin: 0 0 6px; font-size: 15px; }

.foot { padding: 20px 0 34px; border-top: 1px solid var(--line); margin-top: 18px; }
.foot p { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #a9c7ff; }

/* ── responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .signal-table { min-width: 0; table-layout: fixed; width: 100%; }
  .signal-table td:nth-child(2), .signal-table th:nth-child(2) { width: 34%; }
  .signal-table th:nth-child(4), .signal-table td:nth-child(4),
  .signal-table th:nth-child(6), .signal-table td:nth-child(6) { display: none; }
  .signal-table th, .signal-table td { padding: 8px 5px; font-size: 12px; white-space: nowrap; }
  .signal-table .pill .lbl { display: none; }
  .signal-table .pill { padding: 2px 6px; }
}

@media (min-width: 560px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  main { gap: 16px; padding-top: 22px; }
  .panel { padding: 20px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-name .n { font-size: 16px; }
}
@media (max-width: 380px) {
  .brand h1 { font-size: 15.5px; }
  .card-price .p { font-size: 16px; }
  .panel { padding: 13px; }
}

@media (prefers-reduced-motion: no-preference) {
  .card, .macro, .count { transition: transform .15s ease, box-shadow .15s ease; }
}
