/* 트러블 일기 v4 (12-05 성제 "AI 티 말고 전문 디자이너 수준").
 * 방향: 스킨케어 브랜드 편집 디자인 — 종이 톤 바탕, 카드·그림자·그라데이션·이모지 없음,
 * 머리카락 선(1px)으로 구획, 숫자는 세리프 대형, 글자는 작게·자간 넓게, 강조색은 테라코타 하나만. */
:root {
  --paper: #F4EFE9;
  --paper-2: #ECE5DD;
  --ink: #1D1915;
  --ink-2: #5B524B;
  --ink-3: #8F857C;
  --line: #DCD3C9;
  --accent: #A8482A;
  --accent-ink: #FFFFFF;
  --red: #C23B4C;
  --pus: #CF9A22;
  --mark: #86685A;
  --ok: #3F7A52;
  --danger: #A12E22;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif KR", "Nanum Myeongjo", serif;
  --sans: system-ui, -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141210; --paper-2: #1E1B18; --ink: #EFE8E0; --ink-2: #B5AAA0; --ink-3: #82786F; --line: #2F2A25;
    --accent: #E08A66; --accent-ink: #1A0E08; --red: #E06272; --pus: #E2B44C; --mark: #B0907F; --ok: #7FBF90; --danger: #F08070;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 15px/1.55 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.005em; word-break: keep-all;
  padding: env(safe-area-inset-top) 0 calc(78px + env(safe-area-inset-bottom)); -webkit-font-smoothing: antialiased; }
svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* 머리 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 0; max-width: 560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; letter-spacing: .02em; }
.logo { width: 20px; height: 20px; }
.logo circle { fill: var(--accent); stroke: none; }
.local { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); }
.local svg { width: 14px; height: 14px; }
main { padding: 0 22px; max-width: 560px; margin: 0 auto; }
.view { display: none; }
.view.on { display: block; animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }
.date, .page { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; margin: 26px 0 0; }
.page { margin-bottom: 8px; }

/* 오늘 숫자 */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin: 26px 0 22px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; }
.num { margin: 4px 0 6px; display: flex; align-items: baseline; gap: 6px; }
.num b { font-family: var(--serif); font-weight: 400; font-size: 92px; line-height: .9; letter-spacing: -.04em; font-variant-numeric: lining-nums tabular-nums; }
.unit { font-size: 16px; color: var(--ink-2); }
.delta { margin: 0; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.delta.down { color: var(--ok); } .delta.up { color: var(--accent); }
.delta svg { width: 14px; height: 14px; stroke-width: 2; }
.thumb { width: 96px; height: 128px; flex: none; border-radius: 4px; background: var(--paper-2) center/cover no-repeat;
  outline: 1px solid var(--line); outline-offset: 4px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:active { opacity: .85; }
.btn.big { width: 100%; min-height: 56px; font-size: 16px; letter-spacing: .01em; }
.btn.text { border: 0; padding: 0 4px; color: var(--ink-2); font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }
#btn-nophoto { display: flex; margin: 8px auto 0; }
.btn.text.light { color: #fff; text-decoration: none; }
.btn.danger { color: var(--danger); }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--ink-3); text-align: center; }
.hint.center { color: var(--ink-2); padding: 0 16px 14px; }

/* 수기 개수 */
.stepper { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stepper > button:not(.btn) { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink); font-size: 20px; }
.stepper b { font-family: var(--serif); font-weight: 400; font-size: 34px; min-width: 44px; text-align: center; }
.stepper .btn { margin-left: auto; }

/* 구획 */
.block { border-top: 1px solid var(--line); padding: 22px 0 6px; margin-top: 26px; }
.block.first { margin-top: 12px; }
.block h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 14px;
  font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.block h2 small { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; transition: background .15s, color .15s; }
.chip svg { width: 15px; height: 15px; stroke-width: 2; display: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.on svg { display: block; }
.product { margin-top: 12px; }
.product input { width: 100%; min-height: 46px; border: 0; border-bottom: 1px solid var(--ink-3); background: transparent; color: var(--ink);
  font: inherit; padding: 0 2px; border-radius: 0; }
.product input:focus { outline: none; border-bottom-color: var(--ink); }
.zones { display: grid; gap: 10px; }
.zrow { display: grid; grid-template-columns: 58px 1fr 28px; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.zbar { height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.zbar i { display: block; height: 100%; background: var(--ink); }
.zrow b { text-align: right; font-family: var(--serif); font-weight: 400; font-size: 16px; color: var(--ink); }
.chart svg { width: 100%; height: 170px; display: block; stroke: none; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.sw.red { background: var(--red); } .sw.pus { background: var(--pus); } .sw.mark { background: var(--mark); }
.ins { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.6; }
.ins:last-child { border-bottom: 0; }
.ins b { font-weight: 650; }
.ins small { color: var(--ink-3); }
.fine { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; line-height: 1.6; }
.empty { color: var(--ink-3); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid button { position: relative; aspect-ratio: 3/4; border: 0; border-radius: 2px; padding: 0; background: var(--paper-2) center/cover; cursor: pointer; overflow: hidden; }
.grid button span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); padding: 14px 7px 5px; letter-spacing: .02em; }
.grid button.sel { outline: 2px solid var(--ink); outline-offset: 2px; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cmp figure { margin: 0; } .cmp img { width: 100%; border-radius: 2px; display: block; }
.cmp figcaption { font-size: 12px; color: var(--ink-2); margin-top: 6px; letter-spacing: .02em; }
.toggles { display: grid; margin-top: 6px; }
.toggles label { display: flex; align-items: center; justify-content: space-between; min-height: 50px; font-size: 15px; border-bottom: 1px solid var(--line); }
.toggles label:last-child { border-bottom: 0; }
.toggles input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggles input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.toggles input:checked { background: var(--ink); }
.toggles input:checked::after { transform: translateX(16px); }

/* 아래 탭 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); z-index: 5; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 56px; justify-content: center;
  border: 0; background: none; font: inherit; font-size: 11px; letter-spacing: .04em; color: var(--ink-3); cursor: pointer; }
.tabs svg { width: 22px; height: 22px; }
.tabs button.on { color: var(--ink); font-weight: 650; }

/* 카메라·표시 */
.sheet { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; }
.sheet.light { background: var(--paper); }
.cam-box { position: relative; flex: 1; overflow: hidden; }
#video, #ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#ghost { opacity: .35; pointer-events: none; transform: none; }
#ghost:not([src]) { display: none; }
.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.guide ellipse { fill: none; stroke: rgba(255,255,255,.8); stroke-width: .4; stroke-dasharray: 1.6 1.2; }
.cam-tip { position: absolute; left: 0; right: 0; top: calc(16px + env(safe-area-inset-top)); text-align: center; color: #fff; font-size: 13px; letter-spacing: .02em; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.cam-bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px calc(18px + env(safe-area-inset-bottom)); }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 3px solid #fff; background: transparent; cursor: pointer; position: relative; }
.shutter::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active::after { transform: scale(.9); }
.mark-head { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 8px; font-size: 14px; }
.mark-head b { font-weight: 600; }
.types { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; }
.types button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: 13px; white-space: nowrap; }
.types button svg { width: 15px; height: 15px; }
.types button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.mark-box { position: relative; flex: 1; margin: 0 14px; overflow: hidden; border-radius: 4px; background: #000; touch-action: manipulation; }
#mark-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink);
  color: var(--paper); padding: 11px 18px; border-radius: 999px; font-size: 13px; z-index: 30; max-width: 90vw; white-space: nowrap; }
