:root {
  --background: #0c0e11;
  --foreground: #ece7dc;
  --muted: #8d939c;
  --line: #262b33;
  --surface-hover: #15191f;
  --surface-active: #1c2229;
  --up: #d45050;
  --down: #4a7fd4;
  --ma60: #d9a441;
  --ma120: #5c8f9a;
  --price: #f3efe6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

#app {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.header {
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.header-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend,
.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.legend {
  gap: 16px 16px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  display: inline-block;
  width: 24px;
  height: 2px;
}

.range {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.range-btn {
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}

.range-btn:hover,
.range-btn.is-active {
  color: var(--foreground);
}

.range-btn.is-active {
  background: var(--surface-active);
}

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

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
}

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

.card {
  min-width: 0;
  border: 1px solid var(--line);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 8px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}

.card-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag {
  width: 21px;
  height: 14px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 25%);
}

.card-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

.card-price {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.card-change {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.card-regime {
  flex-shrink: 0;
  margin: 0;
  font-size: 11px;
}

.chart,
.chart-fallback {
  width: 100%;
  height: 220px;
}

.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  font-size: 11px;
  color: var(--muted);
}

.note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.status {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  font-size: 14px;
  color: var(--muted);
}

.text-up {
  color: var(--up);
}

.text-down {
  color: var(--down);
}

.text-muted {
  color: var(--muted);
}

@media (min-width: 640px) {
  .header,
  .content {
    padding-left: 32px;
    padding-right: 32px;
  }

  .header-tools,
  .header-meta {
    flex-direction: row;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  .header-inner {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
