:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --kr: #1d4ed8;
  --kr-soft: #dbeafe;
  --global: #ea580c;
  --global-soft: #ffedd5;
  --fear: #d9461a;
  --neutral: #6b7280;
  --greed: #2f855a;
  --key-green: hsl(131.7 29.1% 31%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 0% 0%, #eef4ff 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Pretendard", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Noto Sans KR", sans-serif;
  font-weight: 430;
}

.app {
  max-width: 1220px;
  margin: 0 auto;
  padding: 34px 22px 64px;
}

.app-header {
  margin-bottom: 36px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1f2937;
}

.subtitle {
  margin-top: 10px;
  font-size: 19px;
  line-height: 1.45;
  color: #6c7a8c;
  font-weight: 430;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(30, 41, 59, 0.06);
}

.range-panel {
  margin-bottom: 28px;
}

.range-label {
  color: var(--muted);
  font-size: 13px;
}

.range-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.range-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.end-date-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.end-date-note {
  font-size: 10px;
  color: #64748b;
  line-height: 1.35;
  font-weight: 400;
  white-space: nowrap;
}

.range-form input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: #ffffff;
}

.apply-btn {
  border: 0;
  background: var(--key-green);
  color: #fff;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 550;
  cursor: pointer;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.wide-gap {
  gap: 28px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

h2 {
  font-size: 24px;
  font-weight: 650;
}

.head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-tag {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
  padding: 4px 9px;
}

.market-tag-kr {
  background: var(--kr-soft);
  color: var(--kr);
}

.market-tag-global {
  background: var(--global-soft);
  color: var(--global);
}

.source-btn {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  right: 0;
  top: 30px;
  min-width: 240px;
  background: #111827;
  color: #f9fafb;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.source-btn:hover .tooltip,
.source-btn:focus .tooltip,
.source-btn:focus-visible .tooltip {
  display: block;
}

.gauge-wrap {
  margin-top: 14px;
}

.gauge-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.gauge-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 12px;
}

.updated-at {
  color: var(--muted);
  font-size: 13px;
  font-weight: 420;
}

.calc-note {
  display: block;
  margin-top: 8px;
  color: #5f6f84;
  font-size: 12px;
  font-weight: 430;
}

.trend-content {
  margin-top: 26px;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.trend-head h3 {
  font-size: 19px;
  font-weight: 600;
}

.trend-range {
  font-size: 12px;
  color: var(--muted);
  font-weight: 450;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 430;
}

.trend-dates {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #607089;
  font-weight: 430;
}

.trend-layout {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  gap: 6px;
  align-items: center;
}

.axis-text {
  font-size: 11px;
  color: #64748b;
  font-weight: 420;
  line-height: 1.4;
  white-space: normal;
  word-break: keep-all;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.axis-text span {
  font-weight: 520;
}

.axis-left-text {
  transform: rotate(180deg);
  text-align: center;
}

.axis-right-text {
  text-align: center;
}

.trend-layout svg {
  width: 100%;
  max-width: 100%;
  display: block;
}

.trend-content {
  margin-top: 20px;
}

.trend-dates {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #607089;
  font-weight: 430;
}

.trend-dates span {
  min-width: 72px;
}

.notice {
  margin-top: 36px;
}

.notice p {
  color: var(--muted);
  font-size: 12px;
}

.trend-legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-solid {
  background: currentColor;
}

.legend-dash {
  background: transparent;
  border-top: 2px dashed currentColor;
  width: 12px;
  height: 0;
  border-radius: 0;
  transform: translateY(4px);
}

.notice {
  margin-top: 36px;
}

.notice p {
  color: var(--muted);
  font-size: 14px;
}

.empty {
  color: var(--muted);
  margin: 10px 0 4px;
}

@media (min-width: 960px) {
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 18px 14px 40px;
  }

  h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 18px;
  }

  .trend-layout {
    grid-template-columns: 1fr;
  }

  .axis-text {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    text-align: center;
    font-size: 13px;
  }

  .axis-right-text {
    text-align: left;
  }

  .range-form {
    grid-template-columns: 1fr;
  }

  .apply-btn {
    width: 100%;
  }
}
