/* chub 홈(chub-home/public/style.css)과 같은 색을 쓰고, 표가 많은 화면이라 여백은 더 촘촘하게 둔다. */
:root {
  color-scheme: light dark;
  --bg: #f9f5ff;
  --surface: #ffffff;
  --surface-2: #f5effd;
  --line: #ebe2f6;
  --ink: #2b2140;
  --ink-2: #594c6e;
  --muted: #76688d;
  --accent: #8a63d2;
  --accent-text: #6c45ba;
  --accent-soft: #efe7fd;
  --good: #1b8a5a;
  --warn: #b26a00;
  --bad: #d0344a;
  --bad-soft: #fde8eb;
  --warn-soft: #fff3df;
  --chzzk-text: #00845e;
  --soop-text: #2f4fd0;
  --radius: 14px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141019;
    --surface: #211a2b;
    --surface-2: #2a2236;
    --line: #362c45;
    --ink: #f4eefc;
    --ink-2: #d0c4e0;
    --muted: #a99cbd;
    --accent: #9b78f0;
    --accent-text: #c5adff;
    --accent-soft: #2f2546;
    --good: #45c98d;
    --warn: #f0b34d;
    --bad: #ff6b7f;
    --bad-soft: #45202c;
    --warn-soft: #3a2c14;
    --chzzk-text: #3cf0b0;
    --soop-text: #9db0ff;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent-text); }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { color: var(--muted); cursor: default; background: var(--surface); }
.btn-primary { background: var(--accent-text); border-color: var(--accent-text); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-small { padding: 5px 10px; font-size: 13px; }

/* 로그인 전 화면 */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 16px; text-align: center; }
.gate h1 { font-size: 22px; }
.gate p { color: var(--ink-2); max-width: 420px; }
.gate-code { font: 13px/1.5 ui-monospace, monospace; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); word-break: break-all; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

/* 머리글 */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }

.view { max-width: 1120px; margin: 0 auto; padding: 24px; display: grid; gap: 16px; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.head h1 { font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h2 { font-size: 15px; margin-bottom: 8px; }

.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 14px; }
.notice.bad { background: var(--bad-soft); }

/* 숫자 카드 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--ink-2); font-size: 13px; }
.tile-value { font-size: 28px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 12.5px; }

/* 차트 */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .bar { fill: var(--accent); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--accent-soft); fill-opacity: 0.6; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.tip {
  position: absolute; top: 0; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 12px;
}
details { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
summary { cursor: pointer; }

/* 표 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12.5px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font: 12.5px ui-monospace, monospace; color: var(--ink-2); }
.empty { padding: 24px 0; text-align: center; color: var(--muted); }

.state { font-weight: 600; }
.state-icon { display: inline-block; width: 1.2em; }
.state-up .state-icon { color: var(--good); }
.state-stale .state-icon, .state-error .state-icon { color: var(--warn); }
.state-detail { margin-left: 6px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.state-down .state-icon { color: var(--bad); }
.platform-chzzk { color: var(--chzzk-text); font-weight: 600; }
.platform-soop { color: var(--soop-text); font-weight: 600; }

/* 검색, 쪽 넘기기 */
.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }

@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .view { padding: 16px; }
  .tabs { order: 3; width: 100%; }
}
