/* 내 공간 · 색과 크기 값은 여기 :root 한곳에서만 바꾼다 */
:root {
  --bg: #f6f6f3;            /* base.html 의 theme-color 와 맞춤 */
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #6e7175;
  --line: #e6e5e0;
  --accent: #2f6b5a;
  --accent-soft: #e4eee9;
  --neg: #b4473a;

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Noto Sans KR", system-ui, sans-serif;
  --text-size: 16px;
  --radius: 14px;
  --gap: 14px;
  --gutter: 16px;
  --max-width: 680px;
  --nav-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131415;
    --surface: #1c1d1f;
    --text: #e9e8e4;
    --muted: #9b9da0;
    --line: #2c2e31;
    --accent: #8fcbb5;
    --accent-soft: #1f2e29;
    --neg: #e58a7d;
  }
}

/* ── 기본 ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-size);
  line-height: 1.65;
  letter-spacing: -0.01em;
  word-break: keep-all;          /* 한국어 낱말 중간에서 줄이 안 끊기게 */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 24px);
}
body.bare { padding-bottom: 0; }
.bare .page { padding-top: 0; padding-bottom: 0; }
h1, h2, h3 { line-height: 1.35; letter-spacing: -0.02em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--neg); }
.r { text-align: right; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── 머리와 탭 (폰: 탭은 아래 고정 · 넓은 화면: 위) ── */
.top {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) var(--gutter) 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: var(--text); font-weight: 700; font-size: 15px; text-decoration: none; }
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1;
  height: var(--nav-height);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 15px; font-weight: 500;
  text-decoration: none;
}
.tabs a[aria-current="page"] { color: var(--text); font-weight: 700; }

@media (min-width: 720px) {
  body { padding-bottom: 48px; }
  .tabs {
    position: static;
    gap: 4px;
    background: none; border: 0; padding: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs a { flex: none; height: auto; padding: 6px 14px; border-radius: 999px; }
  .tabs a[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
}

/* ── 본문 ── */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px var(--gutter);
  display: grid;
  gap: var(--gap);
}
.page-title { font-size: 26px; font-weight: 700; margin: 8px 0 4px; }
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 28px; font-weight: 700; margin: 0; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
.label { margin: 0 0 10px; color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.empty { margin: 0; color: var(--muted); }
.placeholder {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.status { margin: 0; font-size: 18px; font-weight: 600; }

/* 체크 목록 (할 일 · 버킷리스트) */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.checklist li:first-child { border-top: 0; padding-top: 0; }
.checklist li:last-child { padding-bottom: 0; }
.box {
  flex: none;
  width: 17px; height: 17px;
  margin-top: 4px;
  border: 1.5px solid var(--muted);
  border-radius: 5px;
}
.done .box { background: var(--accent); border-color: var(--accent); }
.done .text { color: var(--muted); text-decoration: line-through; }
.side { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }

/* 기록 */
.entry .meta { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.entry h2 { margin: 0 0 8px; font-size: 19px; font-weight: 700; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child, .prose blockquote > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 0.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 17px; margin: 1.2em 0 0.4em; }
.prose blockquote { margin-left: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.prose code { font-size: 0.9em; padding: 0.1em 0.35em; border-radius: 5px; background: var(--accent-soft); }
.prose pre { overflow-x: auto; padding: 12px; border-radius: 10px; background: var(--accent-soft); }
.prose pre code { padding: 0; background: none; }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); }

/* 자산 */
.total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.total .label { margin: 0; }
.total strong { font-size: 24px; font-weight: 700; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 600; text-align: left;
}
.table th.r { text-align: right; }
.table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; padding-bottom: 0; }
.table th + th, .table td + td { padding-left: 12px; }
.rows { list-style: none; margin: 12px 0 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }

/* 목표 */
.goal-title { margin: 0 0 14px; font-size: 22px; font-weight: 700; }
progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%; height: 8px;
  border: 0; border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.facts { margin: 16px 0 0; display: grid; gap: 8px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }

/* 로그인 */
.login {
  min-height: 100svh;
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 24px 0;
}
.login h1 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
input[type="password"] {
  width: 100%;
  padding: 13px 14px;
  font: inherit; font-size: 17px;  /* 16px 이상이라야 아이폰이 확대하지 않는다 */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
input:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary {
  padding: 13px;
  font: inherit; font-size: 16px; font-weight: 600;
  color: var(--bg);
  background: var(--text);
  border: 0; border-radius: 12px;
  cursor: pointer;
}
.error { margin: 0; color: var(--neg); font-size: 14px; }

/* 꼬리 */
.foot { max-width: var(--max-width); margin: 20px auto 0; padding: 0 var(--gutter); text-align: center; }
.foot form { margin: 0; }
.link {
  padding: 8px;
  font: inherit; font-size: 14px;
  color: var(--muted);
  background: none; border: 0;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
