/* Forest Focus — Claude Design "Forest Focus v3" (organic 디자인 시스템 색·글꼴). 색 값은 디자인 파일과 같다. */
@font-face {
  font-family: "Lora";
  src: url("assets/fonts/lora/lora-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: oklch(0.975 0.006 100);
  --surface: oklch(0.995 0.003 100);
  --line: oklch(0.925 0.008 110);
  --text: oklch(0.24 0.015 160);
  --muted: oklch(0.5 0.015 150);
  --green-900: oklch(0.36 0.07 160);
  --green-800: oklch(0.3 0.06 160);
  --green-700: oklch(0.44 0.08 160);
  --green-500: oklch(0.55 0.09 160);
  --green-200: oklch(0.92 0.045 160);
  --green-100: oklch(0.96 0.025 160);
  --mint: oklch(0.9 0.07 160);
  --sand-bg: oklch(0.955 0.025 75);
  --sand-fg: oklch(0.48 0.07 60);
  --lav-bg: oklch(0.95 0.025 285);
  --lav-fg: oklch(0.47 0.11 285);
  --on-dark: oklch(0.99 0.005 100);
  --glass: oklch(0.15 0.02 160 / 0.42);
  --glass-hover: oklch(0.15 0.02 160 / 0.6);
  --off: oklch(0.82 0.01 110);
  --danger: oklch(0.5 0.14 30);
  --danger-bg: oklch(0.96 0.02 30);
  --radius: 14px;
  --font: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font);
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { letter-spacing: -0.02em; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; }
.stage :focus-visible { outline-color: var(--on-dark); }
input[type="range"] { accent-color: var(--green-500); cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.b { font-size: 14px; font-weight: 700; } .b.sm { font-size: 13px; } .b.lg { font-size: 16px; }
.accent { color: var(--green-700); }
.row { display: flex; align-items: center; gap: 6px; } .row.wrap { flex-wrap: wrap; } .row.tight { gap: 0; }

/* ── 배치: 사이드바 | 화면 ───────────────────────────────────────── */
.app { display: flex; align-items: flex-start; min-height: 100dvh; }
.view { flex: 1; min-width: 0; }
.sidebar { flex: none; width: 210px; height: 100dvh; position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; padding: 26px 14px 20px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; }
.brand-mark { color: var(--green-700); flex: none; }
.brand-name { font-family: Lora, Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1.1; color: var(--green-900); letter-spacing: 0; }
.brand-tag { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: none; border-radius: 10px;
  background: transparent; color: oklch(0.36 0.015 155); font-size: 13.5px; font-weight: 600; text-align: left; white-space: nowrap;
}
.nav-item:hover { background: var(--green-100); }
.nav-item[aria-current="page"] { background: var(--green-200); color: var(--green-800); }
.sidebar-fill { flex: 1; }
.mini-timer {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 12px 14px; border: none; border-radius: 12px;
  background: var(--green-100); color: var(--green-900); text-align: left;
}
.mini-timer:hover { background: var(--green-200); }
.mini-label { font-size: 11.5px; font-weight: 600; }
.mini-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sidebar-note { margin: 12px 8px 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }

/* ── 홈: 본문 | 사이클 패널 ─────────────────────────────────────── */
.view-home { display: flex; flex-wrap: wrap; align-items: flex-start; }
.main { flex: 1 1 640px; min-width: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.cycle-panel { flex: 0 0 340px; max-width: 100%; padding: 8px 8px 8px 0; position: sticky; top: 0; align-self: flex-start; }
.cycle-panel.open { flex-basis: 400px; }

/* ── 집중 화면(스테이지) ────────────────────────────────────────── */
.stage {
  position: relative; height: clamp(440px, 62dvh, 640px); border-radius: var(--radius); overflow: hidden;
  color: var(--on-dark); isolation: isolate; background: var(--scene-base); display: flex; flex-direction: column;
}
.stage:fullscreen, .stage.fs-css { height: 100dvh; border-radius: 0; }
.stage.fs-css { position: fixed; inset: 0; z-index: 90; }
.bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: var(--scene-base); }
.blob { position: absolute; aspect-ratio: 1; border-radius: 999px; }
.bg::after { content: ""; position: absolute; inset: 0; z-index: 2; background: oklch(0.15 0.02 160 / 0.26); }
/* 배경 영상: 재생이 시작돼야 보인다(.is-playing). 없거나 실패하면 장면 색 배경이 그대로 보인다 */
.bg-video { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s; }
.bg-video.is-playing { opacity: 1; }
body[data-env="forest"] { --scene-base: oklch(0.36 0.07 160); }
body[data-env="ocean"] { --scene-base: oklch(0.42 0.045 228); }
body[data-env="rain"] { --scene-base: oklch(0.36 0.015 155); }
body[data-env="fire"] { --scene-base: oklch(0.3 0.06 40); }

/* 높이가 자동인 모바일에서도 하단 막대가 바닥에 붙도록 남은 높이를 채운다 */
.stage-inner { position: relative; z-index: 3; flex: 1; display: flex; flex-direction: column; padding: 18px 20px 14px; }
.stage-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.greeting { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; text-shadow: 0 1px 8px oklch(0.15 0.02 160 / 0.4); }
.greeting svg { color: var(--mint); flex: none; }
.video-note { margin: 4px 0 0; font-size: 11.5px; opacity: .85; }
.glass-btn {
  flex: none; width: 38px; height: 38px; border-radius: 999px; border: none; display: grid; place-items: center;
  color: var(--on-dark); background: var(--glass); backdrop-filter: blur(8px);
}
.glass-btn:hover:not(:disabled) { background: var(--glass-hover); }
.glass-btn.round { width: 44px; height: 44px; }

.stage-center { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0; }
.ring { position: relative; width: clamp(200px, 30vh, 280px); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.stage.is-fs .ring { width: min(52vh, 380px); }
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: oklch(0.99 0.005 100 / 0.22); stroke-width: 3; }
.ring-bar { fill: none; stroke: oklch(0.99 0.005 100 / 0.92); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 590.62; transition: stroke-dashoffset .4s linear; }
.ring p { margin: 0; }
.phase-label { font-size: 13px; font-weight: 600; opacity: .92; }
.time {
  font-size: clamp(44px, 7.5vh, 62px); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; margin: 4px 0 6px !important; text-shadow: 0 2px 18px oklch(0.15 0.02 160 / 0.35);
}
.stage.is-fs .time { font-size: 88px; }
.phase-sub { max-width: 72%; font-size: 12px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.controls { display: flex; align-items: center; gap: 10px; margin-top: -22px; position: relative; }
.primary-btn {
  display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 30px 0 26px; border-radius: 999px; border: none;
  font-size: 15px; font-weight: 700; background: var(--mint); color: var(--green-900); box-shadow: 0 6px 20px oklch(0.15 0.02 160 / 0.25);
}
.primary-btn:hover { background: oklch(0.93 0.06 160); }
.primary-btn:active { background: oklch(0.85 0.08 160); }
.next-text { margin: 10px 0 0; min-height: 1.2em; font-size: 12px; font-weight: 600; opacity: .92; text-shadow: 0 1px 6px oklch(0.15 0.02 160 / 0.4); white-space: pre-wrap; text-align: center; }

.stage-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 50px; padding: 6px 10px; border-radius: 12px; background: var(--glass); backdrop-filter: blur(10px); }
.scene-thumb { position: relative; flex: none; width: 42px; height: 30px; border-radius: 6px; overflow: hidden; }
.scene-select { height: 32px; padding: 0 6px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; background: transparent; color: var(--on-dark); }
.scene-select option { color: var(--text); }
.sound-on { height: 28px; padding: 0 12px; border-radius: 999px; border: none; background: var(--mint); color: var(--green-900); font-size: 12px; font-weight: 700; }
.audio-error { font-size: 12px; }
.bar-sep { width: 1px; height: 18px; background: oklch(0.99 0.005 100 / 0.25); }
.strict-btn { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 6px 0 10px; border: none; border-radius: 8px; background: transparent; color: var(--on-dark); font-size: 13px; font-weight: 600; }
.strict-btn:hover { background: oklch(0.99 0.005 100 / 0.14); }
.strict-btn > svg { opacity: .85; }
.bar-spacer { flex: 1; }
.bar-btn { width: 40px; height: 40px; border-radius: 999px; border: none; display: grid; place-items: center; background: transparent; color: var(--on-dark); }
.bar-btn:hover { background: oklch(0.99 0.005 100 / 0.14); }
.volume { width: 110px; accent-color: var(--on-dark); }
.volume-value { width: 26px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 켜기·끄기 스위치 (role="switch", aria-checked) */
.switch { flex: none; position: relative; width: 40px; height: 22px; border-radius: 999px; border: none; padding: 0; background: var(--off); }
.switch[aria-checked="true"], [aria-checked="true"] > .switch { background: var(--green-500); }
.switch > span { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 999px; background: var(--surface); box-shadow: 0 1px 2px oklch(0.2 0.02 160 / 0.25); transition: transform .16s ease; }
.switch[aria-checked="true"] > span, [aria-checked="true"] > .switch > span { transform: translateX(18px); }
.switch.sm { width: 34px; height: 20px; background: oklch(0.99 0.005 100 / 0.3); }
.switch.sm > span { width: 16px; height: 16px; }
[aria-checked="true"] > .switch.sm > span { transform: translateX(14px); }

/* ── 카드 ───────────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px; align-items: stretch; }
.card, .card-like { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card { display: flex; flex-direction: column; gap: 12px; }
.card-title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.card-title svg { color: var(--green-700); flex: none; }
.card-sub { margin: 3px 0 0 24px; font-size: 11.5px; color: var(--muted); }
.card-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 10px; min-width: 0; }
.tile dt { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.tile dd { margin: 0; }
.tile dd:not(.tile-sub) { font-size: 19px; font-weight: 700; word-break: keep-all; overflow-wrap: break-word; }
.tile .tile-sub { font-size: 11px; color: var(--muted); }
.tile.green { background: var(--green-100); } .tile.green dt { color: var(--green-700); }
.tile.sand { background: var(--sand-bg); } .tile.sand dt { color: var(--sand-fg); }
.tile.lavender { background: var(--lav-bg); } .tile.lavender dt { color: var(--lav-fg); }

.task-row { display: flex; gap: 6px; }
.task-row input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--surface); }
.task-row input:focus { border-color: var(--green-500); outline: none; }
.line-btn { flex: none; display: flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--green-700); font-size: 12.5px; font-weight: 600; }
.line-btn:hover:not(:disabled) { background: var(--green-100); }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px 0 6px; border-radius: 8px; }
.task.active { background: var(--green-100); }
.task-check { flex: none; width: 20px; height: 20px; border-radius: 999px; border: 1.5px solid oklch(0.68 0.012 120); background: transparent; color: var(--on-dark); display: grid; place-items: center; padding: 0; }
.task.done .task-check { border-color: var(--green-500); background: var(--green-500); }
.task-text { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .task-text { text-decoration: line-through; color: oklch(0.6 0.012 130); }
.badge { flex: none; font-size: 10.5px; font-weight: 600; padding: 3px 7px; border-radius: 999px; background: var(--green-100); color: var(--green-700); white-space: nowrap; }
.badge.solid { font-weight: 700; background: var(--green-700); color: var(--on-dark); }
.icon-btn { flex: none; width: 30px; height: 30px; border-radius: 999px; border: none; display: grid; place-items: center; background: transparent; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: var(--green-100); color: var(--green-700); }
.icon-btn.xs { width: 20px; height: 20px; }
.task-focus[aria-pressed="true"] { color: var(--green-700); }

.envs { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.env { display: flex; flex-direction: column; gap: 5px; padding: 0; border: none; background: transparent; font-size: 11px; font-weight: 600; text-align: center; color: var(--muted); }
.env[aria-pressed="true"] { color: var(--green-900); }
.env-thumb { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; outline-offset: 2px; }
.env:hover .env-thumb { outline: 2px solid var(--green-200); }
.env[aria-pressed="true"] .env-thumb { outline: 2px solid var(--green-500); }
.env-check { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; background: var(--green-500); color: var(--on-dark); }
/* 환경 저장 상태: 타일 위에 겹쳐 표시해 배치를 바꾸지 않는다. 저장 중은 0.3초 넘게 걸릴 때만 보인다(보통 수 ms → 깜빡임 없음) */
.env-status { position: absolute; left: 0; bottom: calc(100% + 4px); padding: 2px 8px; border-radius: 6px; font-size: .75rem; white-space: nowrap; background: var(--green-100); color: var(--green-900); pointer-events: none; opacity: 0; }
.env-status[data-state="saving"] { opacity: 1; transition: opacity .15s .3s; }
.env-status[data-state="saving"]::before { content: "환경 저장 중…"; }
/* transition: none — 저장 중 표시의 지연 전환이 남아 있으면 실패 표시가 늦게 뜨므로 즉시 취소한다 */
.env-status[data-state="unsaved"] { opacity: 1; transition: none; background: var(--danger); color: var(--on-dark); }
.vol-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.vol-row input { flex: 1; min-width: 0; }
.vol-row .num { width: 24px; text-align: right; color: var(--text); }
.warn { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--sand-bg); color: var(--sand-fg); font-size: 12px; font-weight: 600; }

/* ── 사이클 패널 ────────────────────────────────────────────────── */
.panel-card { max-height: calc(100dvh - 16px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cycle-panel.open .panel-card { height: calc(100dvh - 16px); }
.panel-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 18px 18px 12px; }
.panel-head > svg { color: var(--green-700); flex: none; }
.panel-head h2 { margin: 0; min-width: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-fill { flex: 1; }
.tag { flex: none; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--green-100); color: var(--green-700); white-space: nowrap; }
.tag.sand { background: var(--sand-bg); color: var(--sand-fg); }
.tag.xs { font-size: 10px; padding: 1px 6px; }
.small-btn { flex: none; display: flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; }
.small-btn:hover { background: var(--green-100); border-color: var(--green-200); }
.state-tag { flex: none; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--green-100); color: var(--green-700); font-size: 12px; font-weight: 600; }
.state-tag::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--green-500); }
.chev { display: grid; transition: transform .2s; }
.chev.flip { transform: rotate(180deg); }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 18px 18px; display: flex; flex-direction: column; gap: 20px; }
.cycle-panel:not(.open) .panel-body { overflow: visible; }
.prog { display: flex; flex-direction: column; gap: 14px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.progress-pct { color: var(--green-700); font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 999px; background: var(--green-100); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--green-700); transition: width .4s linear; }
.progress-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--muted); }

/* 단계 칩: 접힌 패널은 한 줄 가로 스크롤, 미리보기는 줄바꿈 */
.strip { position: relative; list-style: none; margin: 0; padding: 6px 2px 8px; display: flex; align-items: center; gap: 3px; overflow-x: auto; }
.strip::-webkit-scrollbar { height: 6px; }
.strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.strip li { flex: none; display: flex; align-items: center; gap: 3px; }
.chip {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 40px; height: 52px; border-radius: 10px; border: 2px solid transparent; font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center;
}
.strip .chip { width: 44px; height: 56px; }
.chip.focus { background: oklch(0.94 0.04 160); color: var(--green-700); }
.chip.short { background: var(--sand-bg); color: var(--sand-fg); }
.chip.long { background: var(--lav-bg); color: var(--lav-fg); }
.chip.done { background: var(--green-100); color: var(--green-700); }
.chip.todo { opacity: .72; }
.chip.current { border-color: var(--green-500); }
.chip.current::after { content: ""; position: absolute; top: -6px; right: -6px; width: 12px; height: 12px; border-radius: 999px; background: var(--green-500); border: 2px solid var(--surface); }
.chip.ring { outline: 2px solid var(--green-900); }
.strip-arrow { display: grid; color: var(--muted); opacity: .6; }
.step-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.step-box { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); min-width: 0; }
.step-box-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.step-box-label svg { color: var(--green-700); }
.step-box-name { font-size: 15px; font-weight: 700; }
.step-box-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-box-meta.accent { color: var(--green-700); font-weight: 600; }
.panel-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.outline-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; }
.outline-btn:hover:not(:disabled) { background: var(--green-100); border-color: var(--green-200); }
.solid-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border-radius: 999px; border: none; background: var(--green-900); color: var(--on-dark); font-size: 14px; font-weight: 700; }
.solid-btn:hover:not(:disabled) { background: var(--green-700); }
.solid-btn:active { background: var(--green-800); }
.solid-btn.grow { flex: 1; }
.solid-btn.danger { background: var(--danger); }
.solid-btn.danger:hover { filter: brightness(.92); background: var(--danger); }
.outline-btn.sm, .solid-btn.sm, .ghost-btn { min-height: 40px; padding: 0 16px; font-size: 13px; }
.ghost-btn { border: none; border-radius: 999px; background: transparent; font-weight: 600; }
.ghost-btn:hover { background: var(--green-100); }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill:hover:not(:disabled) { background: var(--green-100); }
.pill.solid { border-color: transparent; background: var(--green-900); color: var(--on-dark); font-weight: 700; }
.pill.solid:hover { background: var(--green-700); }
.pill.danger { border-color: transparent; background: transparent; color: var(--danger); }
.pill.danger:hover { background: var(--danger-bg); }

.run-banner { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sand-bg); color: var(--sand-fg); }
.run-banner p { margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.5; }
.run-banner .row { flex-wrap: wrap; }
.run-banner .pill:not(.solid) { color: var(--text); }
.psec { display: flex; flex-direction: column; gap: 8px; }
.psec.tight { gap: 0; }
.psec-title { font-size: 12.5px; font-weight: 700; }
.psec.tight .psec-title { margin-bottom: 4px; }
.psec-title.split { display: flex; justify-content: space-between; align-items: center; }
.psec-title.split > span:last-child { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.with-ic { display: flex; align-items: center; gap: 6px; font-weight: 700 !important; color: var(--text) !important; font-size: 12.5px !important; }
.with-ic svg { color: var(--green-700); }
.psec-note { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; min-height: 62px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; }
.preset:hover { border-color: var(--green-500); }
.preset.sel { border-color: var(--green-500); background: var(--green-100); }
.preset-name { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.preset.sel .preset-name { color: var(--green-900); }
.preset-time { font-size: 10.5px; line-height: 1.4; color: var(--muted); }
.saved { display: flex; align-items: center; gap: 4px; padding: 2px; border-radius: 10px; border: 1.5px solid transparent; background: oklch(0.975 0.006 100); }
.saved.sel { border-color: var(--green-500); background: var(--green-100); }
.saved-load { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; text-align: left; }
.saved-load:hover { background: var(--green-100); }
.saved-name { max-width: 100%; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-sum { font-size: 11px; color: var(--muted); }
.stepper-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stepper-row.last { border-bottom: none; }
.round-ic { flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); }
.round-ic.short { background: var(--sand-bg); color: var(--sand-fg); }
.round-ic.long { background: var(--lav-bg); color: var(--lav-fg); }
.round-ic.muted { background: var(--bg); color: var(--muted); }
.round-ic.white { background: var(--surface); }
.stepper-label { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; }
.stepper-label .sub { font-size: 11px; font-weight: 400; color: var(--muted); }
.stepper { flex: none; display: flex; align-items: center; height: 34px; padding: 0 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.stepper-row.off .stepper { opacity: .5; }
.stepper > button { width: 30px; height: 30px; border: none; border-radius: 999px; background: transparent; display: grid; place-items: center; }
.stepper > button:hover:not(:disabled) { background: var(--green-100); }
.stepper > button:active:not(:disabled) { background: var(--green-200); }
.stepper label { display: flex; align-items: baseline; justify-content: center; width: 50px; font-size: 12.5px; font-weight: 600; }
.stepper input { width: 22px; padding: 0; border: none; border-radius: 4px; background: transparent; text-align: right; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper input:focus { background: var(--green-100); outline: none; }
.goal-val { min-width: 88px; text-align: center; font-size: 14px; font-weight: 700; }
.goal-val.sm { min-width: 44px; font-size: 13.5px; }
.preview { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 3px; }
.preview-item { display: flex; align-items: center; gap: 3px; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.totals > div { display: flex; flex-direction: column; padding: 8px 6px 8px 0; }
.totals span { font-size: 10.5px; color: var(--muted); }
.totals b { font-size: 13px; }
.totals .all { padding: 8px 10px; border-radius: 8px; background: var(--green-100); }
.totals .all span { color: var(--green-700); }
.totals .all b { color: var(--green-900); }
.panel-foot { flex: none; display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }

/* ── 캘린더 ─────────────────────────────────────────────────────── */
.view-calendar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; min-height: 100dvh; align-items: stretch; }
.cal { flex: 1 1 640px; min-width: 0; height: calc(100dvh - 16px); min-height: 560px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.cal-head { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cal-head h1 { margin: 0 6px 0 2px; font-size: 19px; font-weight: 700; white-space: nowrap; }
.cal-head .icon-btn { width: 32px; height: 32px; color: var(--text); }
.search { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.search input { width: 130px; border: none; background: transparent; font-size: 12.5px; color: var(--text); padding: 0; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--green-500); }
.search input::-webkit-search-cancel-button { display: none; }
.seg { display: flex; padding: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.seg button { height: 26px; padding: 0 12px; border-radius: 999px; border: none; font-size: 12.5px; font-weight: 600; background: transparent; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px oklch(0.2 0.02 160 / 0.12); }
.solid-btn.sm { gap: 6px; }
.cal-head .solid-btn.sm { min-height: 34px; padding: 0 14px 0 12px; font-size: 13px; }
.legend { flex: none; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 16px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.legend > span { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 8px; height: 8px; background: var(--green-500); }
.lg { width: 14px; height: 8px; border-radius: 3px; }
.lg.plan { border: 1.5px dashed var(--green-500); }
.lg.rec { background: var(--green-500); }
.legend-hint { margin-left: auto; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 999px; }
.mhead { flex: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mhead > div { padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.mhead .sun { color: oklch(0.55 0.12 30); } .mhead .sat { color: oklch(0.5 0.08 235); }
.mgrid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(96px, 1fr)); }
.mcell { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 6px 6px 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.mcell:hover { background: var(--bg); }
.mcell.out { background: oklch(0.985 0.004 100); }
.daynum { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.daynum.sun { color: oklch(0.55 0.12 30); }
.daynum.out { color: oklch(0.72 0.01 120); }
.daynum.sel { background: var(--green-200); color: var(--green-900); font-weight: 700; }
.daynum.today { background: var(--green-900); color: var(--on-dark); font-weight: 700; }
.daynum.big { width: 30px; height: 30px; font-size: 15px; font-weight: 700; }
button.daynum { border: 0; background: transparent; color: inherit; font-family: inherit; cursor: pointer; }
.mcell.sel { background: oklch(0.985 0.01 160); box-shadow: inset 0 0 0 2px var(--green-500); }
/* 오늘(진한 원)과 선택(연한 원)은 따로 보이고, 오늘을 선택하면 고리를 더한다 */
.daynum.today[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green-500); }
/* 연도·월 선택 */
.ym { position: relative; }
.ym-btn { display: inline-flex; align-items: center; gap: 4px; margin: -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.ym-btn:hover { background: var(--green-100); }
.ym-btn svg { color: var(--muted); }
.ym-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; width: 252px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 30px oklch(0.2 0.02 160 / 0.16); }
.ym-pop select { width: 100%; height: 36px; }
.ym-months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.ym-m { height: 34px; border-radius: 8px; border: 0; background: transparent; font-size: 12.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ym-m:hover { background: var(--green-100); }
.ym-m[aria-pressed="true"] { background: var(--green-200); color: var(--green-900); }
.ym-m.today { background: var(--green-900); color: var(--on-dark); }
.ym-m.today[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green-500); }
.mitem { flex: none; display: flex; align-items: center; gap: 5px; min-width: 0; height: 20px; padding: 0 6px; border-radius: 5px; border: none; font-size: 11px; font-weight: 600; text-align: left; }
.mitem:hover { filter: brightness(.97); }
.mitem .num { flex: none; opacity: .8; }
.mitem .ell { flex: 1; }
.mitem svg { flex: none; }
.mitem.rec { background: var(--green-500); color: var(--on-dark); }
.mitem.rec .dot { background: var(--on-dark); }
.more { font-size: 10.5px; color: var(--muted); padding-left: 6px; }
.tg-head { flex: none; display: grid; border-bottom: 1px solid var(--line); }
.tg-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border: none; background: transparent; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tg-day:hover { background: var(--bg); }
.tg-day.today { color: var(--green-900); }
.tg-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.tg-body { position: relative; display: grid; }
.tg-hours { position: relative; }
.tg-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-col { position: relative; border-left: 1px solid var(--line); }
.tg-col.sel { background: oklch(0.985 0.01 160); }
.hline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.tblock { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 3px 6px; border-radius: 6px; border: none; font-size: 11px; font-weight: 600; line-height: 1.25; overflow: hidden; text-align: left; }
.tblock .ell { max-width: 100%; }
.tblock .num { font-weight: 500; opacity: .85; white-space: nowrap; }
.tblock.ev { left: 3px; width: calc(62% - 5px); z-index: 1; }
.tblock.plan { left: 62%; width: calc(38% - 3px); z-index: 2; background: oklch(0.975 0.015 160); color: var(--green-700); border: 1.5px dashed var(--green-500); }
.tblock.rec { left: 62%; width: calc(38% - 3px); z-index: 3; background: var(--green-500); color: var(--on-dark); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 999px; background: var(--danger); }
.cal-side { flex: 0 1 300px; min-width: 260px; height: calc(100dvh - 16px); min-height: 560px; display: flex; flex-direction: column; gap: 8px; }
.side-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.side-title { font-size: 14px; font-weight: 700; }
.side-head { display: flex; align-items: center; gap: 8px; }
.side-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.side-sub { display: block; margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.side-head + .side-sub { margin-top: 4px; }
.agenda { display: flex; flex-direction: column; gap: 6px; }
.ag { border-radius: 10px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.ag-head { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: none; background: transparent; text-align: left; }
.ag-head > .dot { width: 8px; height: 8px; margin-top: 5px; }
.ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.ag-title { display: flex; align-items: center; gap: 6px; max-width: 100%; font-size: 13px; font-weight: 700; }
.plan-chip { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; height: 22px; padding: 0 8px; border-radius: 5px; border: 1.5px dashed var(--green-500); background: var(--surface); color: var(--green-700); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ag-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px 30px; }
.ag-sessions { display: flex; flex-direction: column; gap: 4px; }
.ag-sessions > div { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.empty-box { padding: 14px; border-radius: 10px; background: var(--bg); font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: none; background: transparent; color: var(--green-700); font-size: 12.5px; font-weight: 700; }
.link-btn.muted { align-self: flex-start; color: var(--muted); font-size: 11.5px; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.recs { display: flex; flex-direction: column; gap: 8px; }
.rec-row { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.rec-row .side-sub { flex: none; }
.rec-bar { flex: none; width: 14px; height: 8px; border-radius: 3px; background: var(--green-500); }
.rec-bar.rest { background: var(--green-200); }
.load-err { margin: 0; line-height: 1.5; }
.sample-box { padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--off); font-size: 12px; line-height: 1.5; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.results { display: flex; flex-direction: column; gap: 4px; }
.result { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px; border: none; background: transparent; text-align: left; }
.result:hover { background: var(--bg); }
.result .dot { width: 8px; height: 8px; margin-top: 5px; }
.result b { display: block; font-size: 13px; }
.gcal { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; }

/* ── 내 기록 · 환경 설정 ────────────────────────────────────────── */
.page { max-width: 860px; padding: 36px 32px 60px; display: flex; flex-direction: column; gap: 20px; }
#view-settings { max-width: 760px; gap: 8px; }
.page-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
#view-settings .page-title { margin-bottom: 12px; }
.page-sub { margin: 0; font-size: 13px; color: var(--muted); }
.hist-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.hist-stats .side-sub { font-size: 12px; }
.big-num { font-size: 22px; font-weight: 700; }
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px; }
.hist-day { display: flex; flex-direction: column; gap: 8px; }
.hist-day-head { display: flex; align-items: baseline; gap: 10px; }
.hist-day-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.hist-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.hist-list li { display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist-list li:last-child { border-bottom: none; }
.hist-list .side-sub { width: 48px; font-size: 12.5px; }
.set-row { display: flex; align-items: center; gap: 14px; }
.set-row .side-sub { font-size: 12.5px; }
.set-row .stepper { height: 36px; }
.set-row .pill { min-height: 36px; padding: 0 14px; font-size: 12.5px; }
.set-row .pill.danger { border-color: var(--line); }

/* ── 대화 상자 · 토스트 ─────────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: oklch(0.2 0.02 160 / 0.4); }
.dialog { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 20px 60px oklch(0.2 0.02 160 / 0.25); display: flex; flex-direction: column; gap: 14px; }
.dialog[role="alertdialog"] { width: min(440px, 100%); gap: 10px; }
.dialog.wide { width: min(480px, 100%); padding: 22px 24px; }
.dialog h2 { margin: 0; font-size: 17px; font-weight: 700; }
.dlg-body { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; }
.field input, .field-input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; background: var(--surface); }
.field input { height: 42px; padding: 0 14px; font-size: 14px; font-weight: 400; }
.field input:focus, .field-input:focus { border-color: var(--green-500); outline: none; }
.field-input.title { height: 44px; font-size: 15px; font-weight: 600; }
.field-input.memo { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.ev-times { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.err { margin: -6px 0 0; font-size: 12px; color: var(--danger); }
.ev-plan .err { margin: 0; }
.ev-colors { display: flex; align-items: center; gap: 10px; }
.ev-colors .b { width: 36px; }
.color-dot { width: 22px; height: 22px; border-radius: 999px; border: none; padding: 0; }
.ev-plan { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--green-100); }
.ev-plan .row { gap: 10px; }
.ev-plan .row.tight { gap: 4px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 999px; background: var(--green-900); color: var(--on-dark); font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px oklch(0.2 0.02 160 / 0.25); white-space: nowrap; }

/* ── 반응형 ─────────────────────────────────────────────────────── */
/* 패널이 들어갈 폭이 없으면 본문 아래로 */
@media (max-width: 1240px) {
  .cycle-panel, .cycle-panel.open { flex: 1 1 100%; padding: 0 8px 8px; position: static; }
  .panel-card, .cycle-panel.open .panel-card { max-height: none; height: auto; }
  .panel-body { overflow: visible; }
}
/* 좁은 화면: 사이드바를 위쪽 막대로 */
@media (max-width: 900px) {
  .app { flex-direction: column; align-items: stretch; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .brand { padding: 0; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav-item { min-height: 40px; }
  .sidebar-fill, .sidebar-note { display: none; }
  #mini { margin-left: auto; }
  .mini-timer { flex-direction: row; align-items: baseline; gap: 8px; padding: 8px 12px; }
  .mini-time { font-size: 16px; }
  .view-calendar { min-height: 0; }
  .cal { height: 70dvh; }
  .cal-side { flex: 1 1 100%; height: auto; min-height: 0; }
  .page { padding: 20px 16px 48px; }
}
@media (max-width: 560px) {
  .brand-tag { display: none; }
  .stage { height: auto; min-height: 560px; }
  .stage-inner { padding: 14px 12px 10px; }
  .greeting { font-size: 14px; }
  .ring { width: min(260px, 72vw); }
  .controls { margin-top: -18px; gap: 6px; }
  .primary-btn { padding: 0 20px 0 16px; }
  .stage-bar { padding: 6px; gap: 4px; }
  .volume { flex: 1; min-width: 80px; width: auto; }
  .bar-sep { display: none; }
  .step-boxes { grid-template-columns: 1fr; }
  .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-head h1 { font-size: 16px; }
  .search { flex: 1 1 100%; order: 5; }
  .search input { width: 100%; }
  .legend-hint { display: none; }
  .mgrid { grid-template-rows: repeat(6, minmax(72px, 1fr)); }
  .mitem .num, .mitem svg { display: none; }
  .mitem { padding: 0 4px; gap: 3px; }
  .ev-times { grid-template-columns: 1fr 1fr; }
  .ev-times > input[type="date"] { grid-column: 1 / -1; }
  .ev-times > span { display: none; }
  .set-row { flex-wrap: wrap; }
  .toast { white-space: normal; border-radius: 16px; max-width: calc(100vw - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-video, .ring-bar, .progress-bar, .switch > span, .chev { transition: none; }
}
