:root {
  --bg: #10120f;
  --panel: #f7f2e6;
  --panel-2: #ede4d0;
  --ink: #17211c;
  --muted: #6d746e;
  --line: rgba(23, 33, 28, 0.16);
  --green: #0f7b5f;
  --red: #b23a2f;
  --amber: #bf7a1f;
  --blue: #245f87;
  --white: #fffaf0;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(15, 123, 95, 0.32), transparent 28%),
    radial-gradient(circle at 85% 14%, rgba(191, 122, 31, 0.24), transparent 24%),
    linear-gradient(135deg, #0f1713 0%, #1b1c16 54%, #2a2017 100%);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 42px);
  color: var(--white);
  background: rgba(16, 18, 15, 0.84);
  border-bottom: 1px solid rgba(255, 250, 240, 0.14);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: #dfc696;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(24px, 2.5vw, 40px);
  line-height: 1.13;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 17px;
  letter-spacing: 0;
}

.live-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.16), 0 0 24px rgba(52, 211, 153, 0.8);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-state {
  min-width: 112px;
  color: #dfc696;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

button {
  border: 1px solid rgba(255, 250, 240, 0.22);
  border-radius: 8px;
  background: #f2d58f;
  color: #1d1710;
  font-weight: 900;
  cursor: pointer;
}

#refreshBtn {
  height: 42px;
  padding: 0 16px;
}

.shell {
  padding: 22px clamp(14px, 3vw, 42px) 46px;
}

.market-strip {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(130px, 0.5fr));
  gap: 12px;
  margin-bottom: 14px;
}

.market-strip article,
.feed,
.detail,
.analysis-card,
.chart-panel {
  border: 1px solid rgba(255, 250, 240, 0.15);
  border-radius: 8px;
  background: rgba(247, 242, 230, 0.94);
  box-shadow: var(--shadow);
}

.market-strip article {
  min-height: 104px;
  padding: 18px;
}

.market-strip span,
.score-grid span,
.feed-tools span,
.section-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.market-strip strong {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.05;
}

.dashboard {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.skill-console {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 250, 240, 0.15);
  border-radius: 8px;
  background: rgba(247, 242, 230, 0.94);
  box-shadow: var(--shadow);
}

.console-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.console-head h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif KR", serif;
}

#apiHealth {
  padding: 7px 10px;
  border-radius: 8px;
  background: #d9efe5;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tool-grid article {
  min-height: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.inline-form {
  display: flex;
  gap: 8px;
}

.tool-grid input,
.tool-grid select,
.tool-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fffdf7;
  color: var(--ink);
}

.tool-grid button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.tool-output {
  max-height: 240px;
  overflow: auto;
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #efe6d3;
  color: #303832;
  font-size: 13px;
  line-height: 1.55;
}

.tool-output a {
  color: #164f7a;
  font-weight: 800;
}

.visual-output svg {
  max-width: 100%;
  height: auto;
  background: #fffdf7;
}

.report-output {
  white-space: pre-wrap;
}

.feed {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.feed-tools {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.feed-tools input {
  width: 100%;
  height: 44px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.filters button {
  height: 34px;
  padding: 0 6px;
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 12px;
}

.filters button.active {
  background: #19473d;
  color: var(--white);
}

.signal-list {
  overflow: auto;
  padding: 10px;
}

.signal-card {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  text-align: left;
  box-shadow: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.signal-card + .signal-card {
  margin-top: 8px;
}

.signal-card:hover,
.signal-card.active {
  border-color: var(--green);
  transform: translateY(-1px);
}

.signal-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.signal-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mini-row,
.detail-head,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pill,
.mood {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 7px;
  background: #e8dcc7;
  color: #57422b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.good,
.mood.good {
  background: #d9efe5;
  color: var(--green);
}

.pill.bad,
.mood.bad {
  background: #f2d9d4;
  color: var(--red);
}

.pill.neutral,
.mood.neutral {
  background: #e5e1d4;
  color: #5d625c;
}

.detail {
  padding: clamp(16px, 2vw, 24px);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0 12px;
}

.score-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.score-grid strong {
  display: block;
  margin: 8px 0;
  font-size: 23px;
}

meter {
  width: 100%;
  height: 8px;
}

.analysis-card,
.chart-panel {
  padding: 18px;
  margin-top: 12px;
  box-shadow: none;
}

.analysis-card p,
.chain-list,
.link-list {
  color: #3f4943;
  line-height: 1.72;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chain-list li {
  position: relative;
  padding: 0 0 14px 28px;
  border-left: 2px solid #d4c7ad;
}

.chain-list li:last-child {
  padding-bottom: 0;
}

.chain-list li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
}

.chain-list strong {
  display: block;
  margin-bottom: 4px;
}

.ticker-list {
  display: grid;
  gap: 8px;
}

.ticker-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-align: left;
}

.ticker-button.active {
  border-color: var(--blue);
  background: #e1edf0;
}

.ticker-button small {
  display: block;
  color: var(--muted);
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 320px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.link-list {
  display: grid;
  gap: 8px;
}

.link-list a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #164f7a;
  background: var(--white);
  text-decoration: none;
  font-weight: 800;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .dashboard,
  .split,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .feed {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-strip,
  .score-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .market-strip,
  .score-grid,
  .filters {
    grid-template-columns: 1fr;
  }
}
