/* ── 워숭 전력 · Liquid Glass ─────────────────────────────
   애플 글래스 조형: 앰비언트 컬러 블롭 위 반투명 블러 카드,
   상단 스펙큘러 하이라이트, 연속 라운드, SF 시스템 타이포.
   차트 시리즈(검증 통과): 다크 CPU #0A84FF · GPU #2CAE49 · 에너지 #D57500
                          라이트 CPU #007AFF · GPU #248A3D · 에너지 #B25C00 */

:root {
  color-scheme: dark light;

  --bg: #0a0c13;
  --blob-a: rgba(10, 132, 255, .38);
  --blob-b: rgba(94, 92, 230, .32);
  --blob-c: rgba(100, 210, 255, .26);

  --glass: rgba(22, 26, 38, .52);
  --glass-strong: rgba(24, 28, 40, .82);
  --inset: rgba(255, 255, 255, .05);
  --stroke: rgba(255, 255, 255, .10);
  --highlight: rgba(255, 255, 255, .16);
  --shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 2px 10px rgba(0, 0, 0, .30);

  --ink: rgba(255, 255, 255, .94);
  --ink2: rgba(255, 255, 255, .60);
  --ink3: rgba(255, 255, 255, .38);
  --grid: rgba(255, 255, 255, .08);

  --cpu: #0A84FF;
  --gpu: #2CAE49;
  --board: #AF52DE;
  --energy: #D57500;
  --accent: #0A84FF;
  --spark2: #64D2FF;
  --ok: #30D158;
  --warn: #FFD60A;
  --hot: #FF453A;

  --r: 26px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", Pretendard, "Malgun Gothic", system-ui, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1f7;
    --blob-a: rgba(0, 122, 255, .22);
    --blob-b: rgba(120, 115, 245, .18);
    --blob-c: rgba(90, 200, 250, .20);

    --glass: rgba(255, 255, 255, .58);
    --glass-strong: rgba(255, 255, 255, .88);
    --inset: rgba(255, 255, 255, .55);
    --stroke: rgba(20, 30, 55, .10);
    --highlight: rgba(255, 255, 255, .90);
    --shadow: 0 20px 50px rgba(30, 42, 80, .14), 0 2px 8px rgba(30, 42, 80, .08);

    --ink: #1d1d1f;
    --ink2: rgba(29, 29, 31, .58);
    --ink3: rgba(29, 29, 31, .36);
    --grid: rgba(29, 29, 31, .08);

    --cpu: #007AFF;
    --gpu: #248A3D;
    --board: #8E24AA;
    --energy: #B25C00;
    --accent: #007AFF;
    --spark2: #30B0C7;
    --ok: #248A3D;
    --warn: #B8860B;
    --hot: #D70015;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── 앰비언트 배경 ──────────────────────── */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob {
  position: absolute;
  width: 55vmax; height: 55vmax;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}
.blob-a { background: radial-gradient(circle, var(--blob-a), transparent 65%); top: -18vmax; left: -12vmax; animation: drift-a 46s ease-in-out infinite alternate; }
.blob-b { background: radial-gradient(circle, var(--blob-b), transparent 65%); bottom: -22vmax; right: -14vmax; animation: drift-b 58s ease-in-out infinite alternate; }
.blob-c { background: radial-gradient(circle, var(--blob-c), transparent 65%); top: 30%; left: 42%; width: 40vmax; height: 40vmax; animation: drift-c 52s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(-8vmax, -6vmax, 0) scale(1.08); } }
@keyframes drift-c { to { transform: translate3d(-10vmax, 6vmax, 0); } }

/* ── 글래스 공통 ────────────────────────── */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  backdrop-filter: blur(28px) saturate(1.7);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  box-shadow: var(--shadow), inset 0 1px 0 var(--highlight);
}
/* 포인터를 따라오는 스펙큘러 시인 */
@media (hover: hover) and (pointer: fine) {
  .card::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, -30%), rgba(255, 255, 255, .10), transparent 60%);
    opacity: 0;
    transition: opacity .45s;
    pointer-events: none;
  }
  .card:hover::after { opacity: 1; }
}

main {
  width: min(1080px, 100% - 32px);
  margin: 24px auto 0;
  display: grid;
  gap: 18px;
}

.card { padding: 24px 28px; }

/* 로드 시퀀스 */
.topbar, .card { animation: rise .65s cubic-bezier(.22, .9, .3, 1) backwards; }
.hero { animation-delay: .05s; }
.machines .card { animation-delay: .12s; }
.meter { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ── 상단 바 (스크롤 시 고정 등장 모션) ───────────────────── */
.topbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 100;
  width: min(1080px, 100% - 32px);
  padding: 12px 22px;
  border-radius: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s cubic-bezier(.22, .9, .3, 1), transform .35s cubic-bezier(.22, .9, .3, 1);
}
.topbar.is-sticky {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.brand { display: flex; flex-direction: column; }
.brand-kr { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--ink3); }
.top-total-power {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--inset);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 16px;
  box-shadow: inset 0 1px 0 var(--highlight);
  transition: transform 0.2s ease, background 0.2s ease;
}
.top-total-power:hover {
  background: rgba(255, 255, 255, 0.12);
}
.top-power-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
}
.top-power-val {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.top-power-val small {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
}
.topmeta { display: flex; align-items: center; gap: 14px; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink2);
  background: var(--inset);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 5px 12px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); transition: background .4s, box-shadow .4s; }
.live.ok .live-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: breathe 2.6s ease-in-out infinite; }
.live.err .live-dot { background: var(--hot); box-shadow: 0 0 10px var(--hot); }
@keyframes breathe { 50% { opacity: .55; } }
.clock { font-family: var(--mono); font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ── 타이포 유틸 ───────────────────────── */
.label { font-size: 13px; font-weight: 600; color: var(--ink2); display: flex; align-items: center; gap: 7px; }
.caption { font-size: 12px; color: var(--ink3); }
.caption b { color: var(--ink2); font-variant-numeric: tabular-nums; }
abbr { text-decoration: none; border-bottom: 1px dotted var(--ink3); cursor: help; }

/* ── 히어로 ────────────────────────────── */
.hero { padding-bottom: 18px; }
.big-w {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(58px, 9vw, 96px);
  line-height: 1.08;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 10px;
  margin: 2px 0 6px;
}
.big-w .unit { font-size: .34em; font-weight: 500; color: var(--ink2); }

/* ── 머신 카드 ─────────────────────────── */
.machines { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.machine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.machine-title { display: flex; align-items: baseline; gap: 10px; }
.machine-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.tag { font-size: 12px; color: var(--ink3); }
.llm-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(2, 132, 199, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
@media (prefers-color-scheme: dark) {
  .llm-badge {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.45);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
  }
}
.llm-badge::before {
  content: "⚡";
  font-size: 11px;
}
.machine-subtotal { font-size: 12px; font-weight: 500; color: var(--ink2); display: flex; align-items: baseline; gap: 3px; background: var(--inset); border: 1px solid var(--stroke); border-radius: 999px; padding: 4px 12px; font-variant-numeric: tabular-nums; }
.machine-subtotal b { font-size: 15px; font-weight: 700; color: var(--ink); }
.machine-subtotal small { font-size: 11px; font-weight: 400; color: var(--ink3); margin-left: 1px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat {
  background: var(--inset);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 10px 10px 9px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 1px 4px;
}
.stat-name { font-size: 12px; font-weight: 500; color: var(--ink2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.swatch { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.sw-cpu { background: var(--cpu); }
.sw-gpu { background: var(--gpu); }
.sw-board { background: var(--board); }
.sw-energy { background: var(--energy); }
.stat-val { justify-self: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-val b { font-size: 18.5px; font-weight: 600; }
.stat-val small { font-size: 11px; font-weight: 400; color: var(--ink3); margin-left: 1px; }
.stat-temp { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-temp .t-warn { color: var(--warn); font-weight: 600; }
.stat-temp .t-hot { color: var(--hot); font-weight: 600; }

/* ── 차트 ─────────────────────────────── */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 150px; display: block; }
#spark-total { height: 76px; }
.daily { height: 96px; }

.xline {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--ink3);
  pointer-events: none;
}
.xdot {
  position: absolute; width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ylab {
  position: absolute; right: 2px;
  transform: translateY(-110%);
  font-family: var(--mono); font-size: 10px; color: var(--ink3);
  pointer-events: none;
}

.axis, .days {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--ink3);
  padding-top: 6px; margin-top: 4px;
  border-top: 1px solid var(--grid);
  font-variant-numeric: tabular-nums;
}
.days { border-top: 0; padding-top: 4px; }
.days span { flex: 1; text-align: center; }
.days span.today { color: var(--ink2); font-weight: 600; }

/* ── 누적·요금 ─────────────────────────── */
.meter {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 20px 48px;
  align-items: start;
}
.kwh, .won {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 5vw, 54px);
  line-height: 1.2;
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
}
.kwh-frac { font-size: .55em; color: var(--ink2); }
.kwh .unit { font-size: .4em; font-weight: 500; color: var(--ink2); margin-left: 8px; }
.meter-daily { min-width: 0; }
.meter-daily .chart-wrap { margin-top: 10px; }

/* ── 푸터 ─────────────────────────────── */
.colophon {
  width: min(1080px, 100% - 32px);
  margin: 24px auto 28px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink3);
}
.pill {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--ink2);
  text-decoration: none;
  transition: color .2s;
}
.pill:hover { color: var(--ink); }

/* ── 툴팁 ─────────────────────────────── */
.tip {
  position: fixed;
  z-index: 50;
  background: var(--glass-strong);
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 12px;
  pointer-events: none;
  min-width: 130px;
}

/* ── 반응형 리사이즈 (Responsive Media Queries) ──────────────── */
@media (max-width: 900px) {
  .machines {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .meter {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .card {
    padding: 20px 22px;
  }
}

@media (max-width: 640px) {
  main {
    width: calc(100% - 20px);
    margin-top: 14px;
  }
  .topbar {
    width: calc(100% - 20px);
    padding: 10px 14px;
    gap: 8px;
    border-radius: 18px;
  }
  .brand-kr { font-size: 14px; }
  .brand-sub { font-size: 10px; display: none; }
  .top-total-power {
    padding: 4px 10px;
    gap: 5px;
  }
  .top-power-label { font-size: 11px; }
  .top-power-val { font-size: 15px; }
  .clock { font-size: 11px; }
  
  .big-w {
    font-size: clamp(44px, 14vw, 76px);
  }

  .machine-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .machine-title {
    flex-wrap: wrap;
    gap: 6px;
  }
  .stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .stat {
    width: 100%;
    justify-content: space-between;
  }
}
.tip time { display: block; color: var(--ink3); font-family: var(--mono); font-size: 11px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink2); }
.tip-row b { margin-left: auto; padding-left: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── 포커스 ────────────────────────────── */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }

/* ── 반응형 ────────────────────────────── */
@media (max-width: 880px) {
  .machines { grid-template-columns: 1fr; }
  .meter { grid-template-columns: 1fr 1fr; }
  .meter-daily { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .card { padding: 20px; }
  .meter { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}

/* ── 모션 축소 ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .topbar, .card { animation: none; }
  .live.ok .live-dot { animation: none; }
  .card::after { display: none; }
}

/* ── 머신별 현재 진행 중인 작업 ── */
.machine-task {
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink3);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  margin: 0 16px;
  word-break: keep-all;
}

