:root {
  --ink: #1f2a22;
  --sub: #5a6358;
  --bg: #f4f3ee;
  --card: #ffffff;
  --g1: #dad7cd;
  --g2: #a3b18a;
  --g3: #588157;
  --g4: #3a5a40;
  --g5: #344e41;
  --tint: #eef1e8;
  --line: #eeede7;
  --amber: #7a4e12;
  --amber-bg: #f3e9d6;
  --gray-bg: #e9e7e0;
  --radius: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--g4); }
button { font-family: inherit; }
img { max-width: 100%; }

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 상단 바 */
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); padding: 6px 10px 6px 6px; margin-left: -6px; border-radius: 14px; min-height: 44px; }
.brand:hover { background: rgba(0, 0, 0, 0.04); }
.brand b { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.brandmark { width: 30px; height: 30px; border-radius: 9px; background: var(--g4); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; }
.iconbtn {
  width: 44px; height: 44px; border: none; background: none; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; cursor: pointer;
  text-decoration: none;
}
.iconbtn:hover { background: rgba(0, 0, 0, 0.04); }
.navlinks { display: flex; gap: 4px; }
.navlinks { gap: 6px; }
.navlink {
  display: inline-flex; align-items: center; gap: 5px; min-height: 40px;
  font-size: 14px; font-weight: 700; color: var(--g4); text-decoration: none;
  padding: 0 12px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--g1);
  white-space: nowrap;
}
.navlink:hover { background: var(--tint); border-color: var(--g2); }
.moretoggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1.5px dashed var(--g2); background: var(--bg); color: var(--g4);
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.moretoggle[aria-expanded='true'] .chev { transform: rotate(180deg); }
.more[hidden] { display: none; }

/* 글자 */
.h1 { font-size: 28px; font-weight: 800; line-height: 1.35; letter-spacing: -0.7px; margin: 0; }
.h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; margin: 0; line-height: 1.4; }
.lead { font-size: 15px; color: var(--sub); margin: 0; line-height: 1.6; }
.small { font-size: 13px; color: var(--sub); line-height: 1.6; }
.tiny { font-size: 12px; color: var(--sub); }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--g4); }
.big { font-size: 34px; font-weight: 800; letter-spacing: -0.8px; color: var(--g5); }
.hero { padding: 16px 4px 4px; display: flex; flex-direction: column; gap: 10px; }

/* 카드 */
.card { background: var(--card); border-radius: var(--radius); padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.card.tight { padding: 16px; gap: 12px; }
.card.list { padding: 8px 20px; gap: 0; }
.card.dark { background: var(--g4); color: #fff; }
.card.dark .small { color: var(--g1); }
.card.outline { border: 2px solid var(--g4); }
.note { border-radius: 16px; background: var(--bg); padding: 14px 16px; font-size: 13px; color: var(--sub); line-height: 1.6; }
.note.tint { background: var(--tint); color: var(--g5); }

/* 버튼 */
.btn {
  min-height: 56px; border: none; border-radius: 16px; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; padding: 8px 16px; width: 100%;
}
.btn small { font-size: 13px; font-weight: 500; }
.btn.primary { background: var(--g4); color: #fff; }
.btn.primary small { color: var(--g1); }
.btn.primary:hover { background: var(--g5); }
.btn.secondary { background: var(--card); color: var(--g4); }
.btn.soft { background: var(--tint); color: var(--g4); }
.btn.text { background: none; color: var(--g4); min-height: 48px; font-weight: 500; font-size: 15px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.inline { flex-direction: row; gap: 6px; }
.cell.today.done { border: 2px solid var(--g5); background: var(--g4); color: #fff; }
.btn.sm { min-height: 44px; width: auto; font-size: 15px; padding: 0 18px; border-radius: 14px; flex-direction: row; }
.btnrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .label { font-size: 14px; font-weight: 700; }
.input, textarea.input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--g1); background: #fff;
  padding: 12px 14px; font-size: 16px; font-family: inherit; color: var(--ink);
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--g4); }
.inputrow { display: flex; gap: 8px; }
.inputrow .input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--g1); background: #fff;
  font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--g4); border-color: var(--g4); color: #fff; font-weight: 700; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--g4); }
.error { color: #9b2c1f; font-size: 14px; font-weight: 500; }

/* 배지·칩 */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--tint); color: var(--g4); white-space: nowrap; }
.pill.strong { background: var(--g4); color: #fff; font-size: 14px; font-weight: 800; padding: 6px 14px; }
.ts {
  align-self: flex-start; font-size: 12px; font-weight: 500; background: var(--tint); color: var(--g4);
  padding: 4px 8px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit;
}
.ts.none { background: var(--bg); color: var(--sub); cursor: default; }

/* 영상 */
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--g1); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vtitle { font-size: 18px; font-weight: 800; line-height: 1.4; letter-spacing: -0.3px; margin: 0; }

/* 핵심 4칸 */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--card); border-radius: 20px; padding: 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.tile .k { font-size: 13px; color: var(--sub); }
.tile .v { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.3; }
.tile .v.muted { font-size: 16px; color: var(--sub); font-weight: 700; }

/* 나와 맞을까요 */
.fitrow { display: flex; gap: 12px; align-items: flex-start; }
.status { flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 14px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.status.ok { background: var(--tint); color: var(--g4); }
.status.adjust { background: var(--amber-bg); color: var(--amber); }
.status.unknown { background: var(--gray-bg); color: var(--sub); }
.fitrow .t { font-size: 15px; font-weight: 700; }
.fitrow .d { font-size: 14px; color: var(--sub); line-height: 1.55; }

/* 30일 칸 */
.grid30 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cell { height: 48px; border-radius: 12px; font-size: 12px; font-weight: 500; padding: 6px 8px; display: flex; flex-direction: column; justify-content: space-between; }
.cell.s1 { background: var(--g1); color: var(--g5); }
.cell.s2 { background: var(--g2); color: var(--ink); }
.cell.s3 { background: var(--g4); color: #fff; }
.cell.done { background: var(--g4); color: #fff; }
.cell.rest { background: var(--gray-bg); color: var(--sub); }
.cell.today { background: #fff; border: 2px solid var(--g4); color: var(--g4); font-weight: 800; padding: 4px 6px; }
.cell.future { background: #fff; border: 1px solid var(--g1); color: var(--sub); padding: 5px 7px; }
.cell svg { align-self: flex-end; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--sub); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.phase { display: flex; gap: 12px; align-items: flex-start; }
.phase .sw { flex-shrink: 0; width: 14px; height: 14px; border-radius: 4px; margin-top: 5px; }
.phase .body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.phase .t { font-size: 15px; font-weight: 700; }
.phase .t span { font-weight: 400; color: var(--sub); font-size: 13px; }
.phase .d { font-size: 14px; color: var(--sub); line-height: 1.55; }

/* 목록 */
.row {
  min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; border: none; background: none;
  width: 100%; padding: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.row + .row { border-top: 1px solid var(--line); }
.row .meta { font-size: 12px; color: var(--sub); font-weight: 400; }
.bullet { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.bullet::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--g2); flex-shrink: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item svg { flex-shrink: 0; margin-top: 2px; }

/* 비교 */
.cmpheads { display: grid; gap: 8px; }
.cmphead { background: var(--card); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; cursor: pointer; text-align: left; font-family: inherit; color: var(--ink); }
.cmphead[aria-pressed='true'] { border-color: var(--g4); }
.letter { height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; }
.l0 { background: var(--g1); color: var(--g5); }
.l1 { background: var(--g2); color: var(--ink); }
.l2 { background: var(--g4); color: #fff; }
.cmprow { padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.cmprow + .cmprow { border-top: 1px solid var(--line); }
.cmpvals { display: grid; gap: 8px; font-size: 15px; font-weight: 700; }
.bar { height: 14px; border-radius: 7px; background: #f0efe9; overflow: hidden; }
.bar > div { height: 14px; border-radius: 7px; background: var(--g2); }

/* 로딩 */
.loading { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--g1); border-top-color: var(--g4); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.footer { text-align: center; font-size: 12px; color: var(--sub); line-height: 1.8; padding: 8px 12px; }
.footer a { color: var(--sub); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 14px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px);
}
.prose h3 { font-size: 16px; margin: 20px 0 6px; }
.prose p, .prose li { font-size: 14px; color: var(--ink); }
.prose ul { padding-left: 20px; margin: 6px 0; }
.spacer { height: 4px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
