/* 부표 — 안개 낀 바다 위의 노란 부표 하나.
   강조색은 부표 노랑 하나만 쓴다: 지금 붙잡을 것, 눌러야 할 것에만. */
:root {
  --mist: #E9EEEC;
  --paper: #F6F9F8;
  --ink: #14242B;
  --slate: #4E646B;
  --line: #C4D1CF;
  --buoy: #F4B400;
  --on-buoy: #14242B;
  --kelp: #2B6A5C;
  --alert: #9A3B2E;
  --wave: rgba(20, 36, 43, 0.045);
  --radius: 14px;
  --font: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mist: #0F1B21;
    --paper: #17272E;
    --ink: #E7EFED;
    --slate: #9BB0B6;
    --line: #2B3E46;
    --kelp: #74C7B2;
    --alert: #F0998B;
    --wave: rgba(231, 239, 237, 0.04);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--mist);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--wave) 31px, var(--wave) 32px);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.app { max-width: 560px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px calc(108px + env(safe-area-inset-bottom)); }
main:focus { outline: none; }

h1, h2, h3, p { margin: 0; }
.head h1 { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -0.03em; }
.head p { color: var(--slate); font-size: 14px; margin-top: 4px; }
h2 { font-size: 15px; font-weight: 700; color: var(--slate); margin-bottom: 10px; letter-spacing: 0; }
section { margin-top: 36px; }
section:first-child { margin-top: 28px; }
.sub { color: var(--slate); font-size: 14px; }
.small { font-size: 13px; color: var(--slate); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--mist); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* 입력 */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.help { display: block; font-weight: 400; color: var(--slate); font-size: 13px; }
input[type=text], input[type=number], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
::placeholder { color: var(--slate); opacity: 0.75; }
.field { margin-top: 18px; }
.field:first-child { margin-top: 0; }

/* 버튼 */
.btn {
  appearance: none; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--buoy); color: var(--on-buoy); border: 2px solid var(--buoy);
  padding: 12px 22px; border-radius: 999px; min-height: 48px;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--slate); font-weight: 600; padding: 10px 12px; text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { background: transparent; border-color: var(--alert); color: var(--alert); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.inline { display: flex; gap: 10px; align-items: stretch; }
.inline input { flex: 1; min-width: 0; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 8px; }
.btn:focus-visible { border-radius: 999px; }

/* 이어서 하기: 지난 메모 — 왼쪽 부표 선이 "여기서 이어가라"는 표시 */
.resume { border-left: 4px solid var(--buoy); padding: 2px 0 2px 16px; }
.resume .when { font-size: 13px; color: var(--slate); margin-bottom: 6px; }
.resume p + p { margin-top: 4px; }
.resume .k { display: block; font-size: 13px; color: var(--slate); }

/* 지금 1개: 이 앱에서 가장 큰 글자 */
.focus-text { font-size: 30px; line-height: 1.3; font-weight: 800; letter-spacing: -0.03em; padding-left: 36px; position: relative; }
.focus-text::before {
  content: ''; position: absolute; left: 0; top: 0.42em; width: 22px; height: 22px; border-radius: 50%;
  background: var(--buoy); box-shadow: 0 0 0 5px color-mix(in srgb, var(--buoy) 28%, transparent);
}
.focus-text.done { color: var(--slate); text-decoration: line-through; text-decoration-thickness: 2px; }
.focus-text.done::before { background: var(--kelp); box-shadow: none; }
.focus-state { color: var(--kelp); font-weight: 700; font-size: 14px; margin-top: 6px; padding-left: 36px; }

/* 약 체크 */
.med {
  appearance: none; font: inherit; width: 100%; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 14px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 56px; font-weight: 600;
}
.med .box { width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 16px; line-height: 1; }
.med[aria-pressed=true] { border-color: var(--kelp); }
.med[aria-pressed=true] .box { background: var(--kelp); border-color: var(--kelp); color: var(--mist); }

/* 목록 */
details > summary { cursor: pointer; font-weight: 700; color: var(--slate); font-size: 15px; padding: 8px 0; min-height: 44px; }
details[open] > summary { margin-bottom: 8px; }
.items { list-style: none; margin: 10px 0 0; padding: 0; }
.items li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.items li:first-child { border-top: 0; }
.items .t { flex: 1; min-width: 0; }
.items .acts { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.items .btn.quiet { padding: 8px 8px; min-height: 40px; font-size: 14px; }
.group-title { font-size: 13px; color: var(--slate); font-weight: 700; margin-top: 18px; }

/* 타이머: 수평선 위를 부표가 간다 */
.phase { font-size: 18px; font-weight: 700; }
.clock { font-size: clamp(64px, 22vw, 96px); line-height: 1.05; font-weight: 300; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.horizon { position: relative; height: 40px; margin: 14px 0 6px; }
.horizon::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--ink); opacity: 0.85; transform: translateY(-1px); }
.horizon::after { content: ''; position: absolute; left: 0; right: 0; top: calc(50% + 8px); height: 1px; background: var(--line); }
.buoy { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; background: var(--buoy); box-shadow: 0 0 0 5px color-mix(in srgb, var(--buoy) 28%, transparent); transition: left 0.5s linear; }
.next { color: var(--slate); font-size: 14px; min-height: 22px; }
.status-done { color: var(--kelp); font-weight: 700; }

/* 복기 */
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { appearance: none; border: 0; font: inherit; font-weight: 700; font-size: 14px; background: transparent; color: var(--ink); padding: 8px 18px; min-height: 40px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--mist); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; background: transparent; color: var(--ink); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--mist); border-color: var(--ink); }
.energy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; border: 0; padding: 0; margin: 0; }
.energy label { margin: 0; font-weight: 700; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 0; cursor: pointer; background: var(--paper); font-size: 16px; }
.energy input { position: absolute; opacity: 0; pointer-events: none; }
.energy input:checked + span { color: var(--on-buoy); }
.energy label:has(input:checked) { background: var(--buoy); border-color: var(--buoy); color: var(--on-buoy); }
.energy label:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.energy-legend { display: flex; justify-content: space-between; color: var(--slate); font-size: 12px; margin-top: 6px; }
.errors { color: var(--alert); font-weight: 600; margin-top: 16px; }
.errors p + p { margin-top: 4px; }
.review-clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.saved-note { color: var(--kelp); font-weight: 700; }

/* 기록 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.stat span { font-size: 13px; color: var(--slate); }
.bars { list-style: none; padding: 0; margin: 10px 0 0; }
.bars li { display: grid; grid-template-columns: 7.5em 1fr 2em; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.bars .bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--ink); border-radius: 6px; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.day { border-top: 1px solid var(--line); }
.day summary { display: flex; gap: 12px; align-items: baseline; padding: 12px 0; font-weight: 600; color: var(--ink); }
.day summary .d { flex: none; width: 5.2em; color: var(--slate); font-weight: 700; font-size: 14px; }
.day summary .f { flex: 1; min-width: 0; }
.day .body { padding: 2px 0 16px 0; font-size: 15px; }
.day .body p { margin-top: 8px; }
.day .k { display: block; font-size: 12px; color: var(--slate); font-weight: 700; }
.mark-done { color: var(--kelp); }
.empty { color: var(--slate); padding: 8px 0; }

/* 알림 */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; max-width: 560px; margin: 0 auto;
  background: var(--mist); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav a { flex: 1; text-align: center; text-decoration: none; color: var(--slate); font-weight: 700; font-size: 15px; padding: 16px 4px 14px; position: relative; min-height: 56px; }
.nav a[aria-current=page] { color: var(--ink); }
.nav a[aria-current=page]::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 4px; background: var(--buoy); border-radius: 0 0 4px 4px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(8px); background: var(--ink); color: var(--mist); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 30; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.banner { background: var(--alert); color: #fff; padding: 12px 20px; font-weight: 600; font-size: 14px; text-align: center; }
.banner[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .buoy, .toast, .btn { transition: none; }
}
