/* ============================================================
   styles.css — shadcn 스타일 토큰 + 레이아웃
   ============================================================ */
@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("./vendor/fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --accent: 217 91% 60%; /* blue-600 살 강조 */
  --accent-foreground: 0 0% 100%;
  --ring: 240 5% 64.9%;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 5.5%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 18%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui,
    -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 헤더 ---------- */
header {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid hsl(var(--border));
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.brand .dim { color: hsl(var(--muted-foreground)); font-size: 12px; }

/* ---------- 본문 ---------- */
main { flex: 1; display: flex; min-height: 0; }

#viewport {
  flex: 1;
  position: relative;
  min-width: 0;
  background:
    radial-gradient(120% 120% at 50% 0%, hsl(var(--muted)) 0%, hsl(var(--background)) 70%);
}
#viewport canvas { display: block; }

/* 상태/스피너 */
.statusbar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: hsl(var(--card) / 0.9);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  backdrop-filter: blur(6px);
}
.spinner {
  width: 13px; height: 13px;
  border: 2px solid hsl(var(--border));
  border-top-color: hsl(var(--accent));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 사이드바 ---------- */
.sidebar {
  width: 320px;
  flex: 0 0 320px;
  border-left: 1px solid hsl(var(--border));
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 탭(패턴) — 헤더 세그먼트 컨트롤 */
#tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: hsl(var(--muted));
  border-radius: var(--radius);
}
.tab {
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  padding: 6px 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: hsl(var(--foreground)); }
.tab.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}
.tab-label { font-weight: 600; }
.tab-sub { display: none; } /* 헤더 세그먼트에선 부제 숨김 */

/* 슬라이더 컨트롤 */
#controls { display: flex; flex-direction: column; gap: 16px; }
.ctrl { display: flex; flex-direction: column; gap: 7px; }
.ctrl-head { display: flex; justify-content: space-between; align-items: baseline; }
.ctrl-head label { font-size: 13px; font-weight: 500; }
.ctrl-head output {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: hsl(var(--muted));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: hsl(var(--background));
  border: 2px solid hsl(var(--accent));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: hsl(var(--background)); border: 2px solid hsl(var(--accent));
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, background .15s, border-color .15s;
}
.btn-primary { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.btn-ghost:hover { background: hsl(var(--muted)); }

.note {
  font-size: 11px;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
  padding-top: 14px;
}
.note b { color: hsl(var(--foreground)); font-weight: 600; }
