/* ============================================================
   YOUROUND — iOS 네이티브 다크 스타일
   순검정 배경 · 그룹 리스트 · 시스템 블루 · 시간축 곡선 차트
   ============================================================ */
:root {
  --bg: #000000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --fill: #48484a;
  --sep: rgba(84, 84, 88, .65);
  --label: #ffffff;
  --sec: #8e8e93;
  --ter: #636366;
  --blue: #0a84ff;
  --red: #ff453a;
  --green: #30d158;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --tan: #b08968;       /* 카페인 곡선 (스크린샷의 브라운) */
  --brown: #8d6e52;
  --radius: 12px;
  --tabbar-h: 76px;
  font-size: 17px;      /* iOS body */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

/* 탭마다 내용 길이가 달라 스크롤바가 생겼다 사라지며 화면이 좌우로 밀리는 걸 막아요.
   스크롤바 자리를 항상 예약해 가운데 정렬을 고정해요. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
  word-break: keep-all;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(var(--tabbar-h) + 24px);
  position: relative;
}
@media (min-width: 480px) {
  .app { box-shadow: 0 0 0 1px #1c1c1e; }
}

/* ---- 라지 타이틀 ---- */
.lt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 54px 0 14px;
}
.lt {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .2px;
}
.now-clock {
  font-size: 15px;
  color: var(--sec);
  font-variant-numeric: tabular-nums;
}

/* ---- 뷰 전환 ---- */
.view { display: none; }
.view.is-active { display: block; animation: fade .22s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .view.is-active { animation: none; }
}

/* ---- 카드 / 차트 카드 ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.chart-card { padding: 14px 14px 8px; }
.chart-cap {
  font-size: 13px;
  color: var(--sec);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.chart-time {
  font-size: 34px;
  font-weight: 800;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
  line-height: 1.2;
}
.chart-time.tan { color: var(--tan); }
.chart-sub { font-size: 13px; color: var(--sec); margin-bottom: 6px; }
.chart-card svg { display: block; width: 100%; height: auto; }

/* ---- 세그먼트 컨트롤 (iOS) ---- */
.seg {
  display: flex;
  background: var(--card);
  border-radius: 9px;
  padding: 2px;
  margin-bottom: 22px;
}
.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--sec);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.is-on { background: var(--fill); color: var(--label); }

/* ---- 섹션 헤더 / 풋노트 ---- */
.sec-h {
  font-size: 13px;
  color: var(--sec);
  letter-spacing: .4px;
  margin: 0 16px 7px;
}
.footnote {
  font-size: 13px;
  color: var(--sec);
  margin: -14px 16px 24px;
  line-height: 1.45;
}
.footnote.dim { color: var(--ter); margin-top: 0; }
.footnote.loose { margin-top: -12px; }
.footnote.warn { color: #ff9e97; }
.footnote.ok { color: var(--green); }
.footnote.bad { color: var(--red); }

/* ---- 그룹 리스트 ---- */
.group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  border: 0;
  border-top: .5px solid var(--sep);
  background: transparent;
  color: var(--label);
  font: inherit;
  text-align: left;
  cursor: default;
}
.row:first-child { border-top: 0; }
.row[hidden] { display: none; }
button.row { cursor: pointer; }
button.row:active { background: var(--card-2); }

.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 17px; font-weight: 600; }
.row-desc { font-size: 13px; color: var(--sec); margin-top: 1px; }
.row-value {
  font-size: 17px;
  color: var(--sec);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* 좌측 컬러 바 (저널 행 스타일) */
.vbar {
  width: 4px;
  align-self: stretch;
  min-height: 34px;
  border-radius: 2px;
  flex-shrink: 0;
}
.vbar-blue { background: var(--blue); }
.vbar-dim { background: var(--fill); }
.vbar-tan { background: var(--tan); }

/* 컬러 도트 (Dosage Stats 스타일) */
.dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-tan { background: var(--tan); }
.dot-blue { background: var(--blue); }
.dot-brown { background: var(--brown); }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-purple { background: var(--purple); }
.dot-indigo { background: #5e5ce6; }
.dot-teal { background: #64d2ff; }

/* 인라인 태그 */
.tag { font-style: normal; font-size: 12px; font-weight: 700; margin-left: 4px; }
.tag-reco { color: var(--blue); }
.tag-min { color: var(--orange); }
.tag-late { color: var(--red); }

/* 체크마크 */
.check { width: 22px; text-align: center; color: var(--blue); font-size: 17px; font-weight: 700; flex-shrink: 0; }

/* ---- 기상 옵션 행 ---- */
.option .opt-time {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
  display: block;
}
.option.is-picked .opt-time { color: var(--blue); }
.option .opt-meta { font-size: 13px; color: var(--sec); }
.option.is-late { opacity: .45; }

/* 주기 도트 (용량 도트 스타일) */
.dots { font-size: 12px; letter-spacing: 2.5px; flex-shrink: 0; }
.dots .on { color: var(--blue); }
.dots .off { color: var(--fill); }
.option.is-late .dots .on { color: var(--sec); }

/* ---- 손절 라인 행 ---- */
.cut-time {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
  min-width: 56px;
  flex-shrink: 0;
}
.cut-desc { font-size: 14px; color: var(--sec); flex: 1; }
.cut-desc strong { color: var(--label); font-weight: 600; }
.row.is-passed { opacity: .4; }
.row.is-passed .cut-desc, .row.is-passed .cut-time { text-decoration: line-through; color: var(--sec); }

/* ---- 입력 컨트롤 ---- */
.stepper { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.stepper-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--card-2);
  color: var(--label);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.stepper-btn:active { background: var(--fill); }
.stepper-val {
  min-width: 52px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.time-input {
  border: 0;
  background: var(--card-2);
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 6px 11px;
  border-radius: 8px;
  color-scheme: dark;
  flex-shrink: 0;
}

/* ---- 차트 SVG 공통 텍스트 ---- */
.ax { fill: var(--sec); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---- 섹션 헤더 + 액션 버튼 ---- */
.sec-h.with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-action {
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* ---- 애플워치 / 건강 데이터 카드 ---- */
.health-card { padding: 16px 18px 18px; }
.health-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; margin-bottom: 3px;
}
.health-head .wa { color: var(--green); font-size: 17px; }
.health-sub { font-size: 13px; color: var(--sec); margin-bottom: 14px; }
.health-connect {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%;
  border: 0;
  background: var(--card-2);
  color: var(--blue);
  font: inherit; font-size: 15px; font-weight: 700;
  padding: 13px; border-radius: 10px; cursor: pointer;
}
.health-connect:active { filter: brightness(1.2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: var(--card-2);
  border-radius: 10px;
  padding: 11px 6px;
  text-align: center;
}
.stat-val {
  font-size: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.stat-val.blue { color: var(--blue); }
.stat-val.green { color: var(--green); }
.stat-val.purple { color: var(--purple); }
.stat-label { font-size: 11px; color: var(--sec); margin-top: 3px; }

.health-vitals {
  display: flex; gap: 16px;
  font-size: 13px; color: var(--sec);
  padding-top: 12px; margin-bottom: 12px;
  border-top: .5px solid var(--sep);
}
.health-vitals b { color: var(--label); font-weight: 700; font-variant-numeric: tabular-nums; }
.health-actions { display: flex; gap: 8px; }
.health-btn {
  flex: 1;
  border: 0; background: var(--card-2); color: var(--blue);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px; border-radius: 9px; cursor: pointer;
}
.health-btn.danger { color: var(--sec); }

/* ---- PRO 카드 ---- */
.pro-card {
  padding: 16px 18px;
  background: linear-gradient(135deg, #1d2a44, var(--card) 70%);
  display: flex; align-items: center; gap: 12px;
}
.pro-main { flex: 1; }
.pro-title { font-size: 16px; font-weight: 800; }
.pro-title .pro-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .5px;
  color: #201302; background: var(--orange);
  padding: 2px 7px; border-radius: 5px; margin-left: 6px; vertical-align: 2px;
}
.pro-desc { font-size: 12px; color: var(--sec); margin-top: 4px; line-height: 1.45; }
.pro-price { font-size: 12px; color: var(--sec); margin-top: 6px; }
.pro-price b { color: var(--label); font-size: 15px; font-weight: 800; }

/* ---- 시험 프리셋 행 ---- */
.preset .row-title { font-weight: 650; }
.preset.is-picked .row-title { color: var(--blue); }
.preset-del {
  border: 0; background: transparent; color: var(--faint, #636366);
  font-size: 15px; cursor: pointer; flex-shrink: 0; padding: 4px 2px 4px 8px;
}
.preset-del:active { color: var(--red); }

/* ---- 텍스트 입력 ---- */
.text-input {
  border: 0;
  background: var(--card-2);
  color: var(--label);
  font: inherit;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  text-align: right;
  min-width: 0;
  width: 130px;
  outline: none;
}
.text-input::placeholder { color: var(--ter); }

/* ---- 시험 D-day 카드 ---- */
.dday-card {
  padding: 20px 18px;
  text-align: center;
  background: linear-gradient(150deg, #14233f, var(--card) 60%);
}
.dday-num {
  font-size: 44px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -.5px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.dday-name { font-size: 17px; font-weight: 700; margin-top: 6px; }
.dday-when { font-size: 13px; color: var(--sec); margin-top: 2px; }

/* ---- 복용 기록 버튼 ---- */
.log-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  border: 0;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 22px;
}
.log-btn:active { filter: brightness(.9); }
.log-plus { font-size: 19px; line-height: 1; }

.del-btn {
  border: 0;
  background: transparent;
  color: var(--faint, #636366);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px 2px 4px 6px;
}
.del-btn:active { color: var(--red); }
.intake-ago { font-variant-numeric: tabular-nums; }

/* ---- 누적 카페인 안전 게이지 ---- */
.cap-card { padding: 16px 18px 18px; }
.cap-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--sec); margin-bottom: 10px;
}
.cap-head strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.cap-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--card-2);
  margin-bottom: 24px;
}
.cap-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--green);
  transition: width .35s ease, background .35s;
}
.cap-mark {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  background: var(--sec);
}
.cap-mark span {
  position: absolute;
  top: 15px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--sec);
  white-space: nowrap;
}
.cap-mark-danger { background: var(--red); }
.cap-mark-danger span { color: var(--red); }
.cap-msg { font-size: 14px; font-weight: 600; }
.cap-msg.ok { color: var(--green); }
.cap-msg.warn { color: var(--orange); }
.cap-msg.bad { color: var(--red); }

/* ---- 시중 제품 그리드 (2행 × 3열 칩) ---- */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.prod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  background: var(--card);
  border-radius: var(--radius);
  padding: 13px 6px 11px;
  font: inherit;
  color: var(--label);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.prod:active { background: var(--card-2); }
.prod.is-picked { border-color: var(--blue); background: var(--card-2); }
.prod .dot { width: 18px; height: 18px; }
.prod-name { font-size: 13px; font-weight: 650; white-space: nowrap; }
.prod-mg { font-size: 11px; color: var(--sec); font-variant-numeric: tabular-nums; }

/* ============ 용량 직접 입력 시트 ============ */
.dose-sheet[hidden] { display: none; }
.dose-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  overflow-y: auto;
}
.dose-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 16px 40px;
}
.dose-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 4px;
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  padding: 4px 0;
}
.nav-strong { font-weight: 700; }
.dose-title { padding: 8px 0 20px; }

.dose-card { margin-bottom: 22px; }

/* 용량 밴드: 역치 – 약함 – 보통 – 강함 – 과량 */
.tier-nums {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  padding: 15px 16px 3px;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tier-labels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 0 16px 13px;
  font-size: 13px;
  font-weight: 600;
}
.c-thresh { color: var(--blue); }
.c-light  { color: var(--green); }
.c-common { color: #ffd60a; }
.c-strong { color: var(--orange); }
.c-heavy  { color: var(--red); }
.c-dim    { color: var(--sec); font-weight: 500; }
.tier-labels .is-on { text-decoration: underline; text-underline-offset: 3px; }

/* 용량 입력 */
.dose-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
#doseInput {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--label);
  font: inherit;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}
#doseInput::-webkit-outer-spin-button, #doseInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
#doseInput::placeholder { color: var(--ter); }
#doseInput:focus-visible { outline: none; }
.dose-unit { font-size: 28px; font-weight: 600; }

.switch-row { border-top: .5px solid var(--sep); cursor: pointer; }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0;
  background: var(--fill);
  border-radius: 999px;
  transition: background .2s;
  pointer-events: none;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .2s;
}
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

/* 직접 입력 행 도트 */
.dot-edit {
  background: var(--card-2);
  color: var(--sec);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* ============ 낮잠 타이머 오버레이 ============ */
.nap-timer[hidden] { display: none; }
.nap-timer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nap-timer svg { width: min(320px, 84vw); height: auto; }
.nap-timer-center {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.nap-timer-label { color: var(--sec); font-size: 15px; }
.nap-timer-time {
  font-size: 56px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
}
.btn-ghost {
  margin-top: 12px;
  border: 0;
  background: var(--card);
  color: var(--blue);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
}
.btn-ghost:active { background: var(--card-2); }

/* ============ 리퀴드 글라스 탭바 ============ */
.tabbar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(64,64,72,.42), rgba(28,28,34,.52));
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow:
    0 16px 44px rgba(0,0,0,.6),
    inset 0 1px 0 rgba(255,255,255,.14),
    inset 0 -1px 0 rgba(0,0,0,.25);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: rgba(235, 235, 245, .62);
  font: inherit;
  cursor: pointer;
  padding: 7px 13px 6px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tab-ico { width: 22px; height: 22px; fill: currentColor; }
.tab-name { font-size: 10px; font-weight: 600; letter-spacing: .1px; }
.tab.is-on {
  color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    inset 0 -1px 0 rgba(0,0,0,.18),
    0 4px 14px rgba(0,0,0,.35);
}
.tab.is-on .tab-ico { fill: var(--blue); }

/* 설정: 단위 입력 */
.unit-input {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--card-2);
  border-radius: 8px;
  padding: 6px 11px;
  flex-shrink: 0;
}
.unit-input input {
  width: 52px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}
.unit-input input::-webkit-outer-spin-button, .unit-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.unit-input input::placeholder { color: var(--ter); }
.unit-input span { color: var(--sec); font-size: 15px; }

/* 포커스 표시 */
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
