:root {
  --up: #d60000;     /* 상승 붉은색 */
  --down: #0047c8;   /* 하락 파란색 */
  --text: #222;
  --sub: #777;
  --line: #ccc;
  --bg: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f4f5f7;
  color: var(--text);
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

.board {
  max-width: 860px;
  margin: 24px auto;
  padding: 20px 24px 24px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.sub { color: var(--sub); font-size: 14px; font-weight: normal; }

/* ---------- 위: 제목 + 오른쪽 위 조작부 */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
h1 { font-size: 22px; margin: 0; }
.controls { display: flex; align-items: center; gap: 8px; }
#status { margin-right: 8px; }
select, button {
  font: inherit;
  font-size: 14px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
.rate { margin: 6px 0 12px; }

/* ---------- 시세 */
.quotes {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  column-gap: 28px;
  row-gap: 8px;
  align-items: baseline;
  font-size: 18px;
}
.quotes .row { display: contents; } /* 넓은 화면: 칸이 종목끼리 세로로 맞춰짐 */
.quotes .name { font-weight: bold; }
.quotes .price, .quotes .change { font-weight: bold; font-variant-numeric: tabular-nums; }
.quotes .status { color: var(--sub); font-size: 15px; }
.quotes .msg { grid-column: 1 / -1; color: var(--sub); font-size: 14px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- 가운데 가로줄 */
.divider { border: 0; border-top: 2px solid var(--line); margin: 18px 0 12px; }

/* ---------- 아래: 뉴스 */
h2 { font-size: 17px; margin: 0 0 6px; }
.news .stock { font-weight: bold; font-size: 16px; margin: 14px 0 4px; }
.news .stock::before { content: "■ "; }
.news ul { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  padding: 3px 0 3px 14px;
  font-size: 15px;
  line-height: 1.5;
}
.news .time { color: var(--sub); font-variant-numeric: tabular-nums; }
.news a { color: var(--text); text-decoration: none; }
.news a:hover { color: var(--down); text-decoration: underline; }
.news .source { color: var(--sub); margin-left: 6px; }
.news .note { color: var(--sub); padding-left: 14px; font-size: 14px; }

/* ---------- 휴대폰 화면 */
@media (max-width: 600px) {
  .board { margin: 0; border-radius: 0; padding: 14px; box-shadow: none; }
  h1 { font-size: 19px; }
  .quotes { display: block; font-size: 16px; }
  .quotes .row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name status" "price change";
    row-gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
  }
  .quotes .name { grid-area: name; }
  .quotes .status { grid-area: status; text-align: right; }
  .quotes .price { grid-area: price; }
  .quotes .change { grid-area: change; text-align: right; }
  .quotes .msg { padding: 6px 0; }
  .news li { grid-template-columns: 1fr; gap: 0; padding-left: 8px; }
}
