/* Clausemint 디자인 토큰과 공통 컴포넌트.
   한 가지 강조색(deep teal)만 쓰고, 앰버는 "놓침"이라는 의미 상태에만 쓴다.
   한국어·영어를 같이 담아야 해서 웹폰트를 받지 않고 OS의 한글 UI 폰트를 그대로 쓴다 —
   Pretendard가 깔려 있으면 그것을, 없으면 각 OS 기본을 탄다. */

:root {
  --ink: #17171a;
  --ink-2: #4a4a52;
  --ink-3: #7c7c86;
  --paper: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --line: #e3e0d9;
  --line-strong: #cfcbc1;

  --accent: #0d6e5a;
  --accent-ink: #ffffff;
  --accent-soft: #e6f1ed;
  --accent-line: #a9cec2;

  --warn: #b45309;          /* 놓침·연체 전용. 다른 데 쓰지 않는다. */
  --warn-soft: #fdf1e3;

  --r: 10px;                /* 코너 반경은 하나로 고정. 버튼만 pill. */
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(23, 23, 26, .04), 0 8px 24px -12px rgba(23, 23, 26, .12);
  --shadow-lg: 0 2px 4px rgba(23, 23, 26, .04), 0 24px 48px -24px rgba(23, 23, 26, .2);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Segoe UI Variable Text", "Segoe UI", "Malgun Gothic",
    system-ui, "Noto Sans KR", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas,
    "Liberation Mono", monospace;

  --page: 1180px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececef;
    --ink-2: #a5a5ae;
    --ink-3: #74747e;
    --paper: #121214;
    --surface: #1a1a1d;
    --surface-2: #232327;
    --line: #2e2e33;
    --line-strong: #3d3d44;
    --accent: #35b394;
    --accent-ink: #08211b;
    --accent-soft: #14332b;
    --accent-line: #245346;
    --warn: #e0913f;
    --warn-soft: #3a2a15;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -24px rgba(0, 0, 0, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;              /* 한글 줄바꿈이 단어 중간에서 끊기지 않게 */
}

h1, h2, h3, h4 { margin: 0; line-height: 1.18; letter-spacing: -.022em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); letter-spacing: -.032em; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.15rem); letter-spacing: -.026em; }
h3 { font-size: 1.06rem; }
p { margin: 0; }
a { color: inherit; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 65ch; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hide { display: none !important; }

/* ---------- 버튼: 모두 pill. 텍스트는 한 줄을 넘지 않게 짧게 유지한다. ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 560; font-size: .95rem; line-height: 1.1;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-2); border-color: var(--ink-3); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 7px 12px; font-size: .85rem; }
.btn-quiet:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- 폼 ---------- */
label { display: block; font-size: .85rem; font-weight: 560; color: var(--ink-2); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="date"], input[type="number"],
input[type="url"], select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
::placeholder { color: var(--ink-3); opacity: 1; }
textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: 5px; }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.check label { margin: 0; color: var(--ink); font-weight: 500; }

/* ---------- 배지 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 560;
  border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.badge-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.badge-quiet { background: var(--surface-2); border-color: transparent; color: var(--ink-3); }

/* ---------- 카드 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
}
.card-flat { background: transparent; border: 1px solid var(--line); }

/* ---------- 언어·테마 토글 ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 560; padding: 6px 13px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- 진행/로딩 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; border-radius: var(--r); animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* 확신도 막대. 배경 트랙 없이 얇은 선 하나로 — 대시보드 위젯처럼 보이지 않게. */
.conf { display: inline-flex; align-items: center; gap: 7px; }
.conf-bar { width: 34px; height: 2px; background: var(--line-strong); position: relative; }
.conf-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.conf-low .conf-bar i { background: var(--warn); }

.quote {
  border-left: 2px solid var(--accent-line); padding: 2px 0 2px 12px;
  color: var(--ink-2); font-size: .85rem; line-height: 1.62;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px;
  font-size: .88rem; font-weight: 540; box-shadow: var(--shadow-lg); z-index: 90;
  max-width: calc(100vw - 32px);
}

.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }

@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  body { font-size: 15.5px; }
}
