:root {
  --navy: #1d2b4f;
  --navy-2: #2d3f6b;
  --navy-soft: #e6eaf3;
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #1b2233;
  --muted: #5b6475;
  --line: #e3ddd2;
  --accent: #c8792b;
  --accent-soft: #fbf0e3;
  --good: #22704a;
  --work: #9a5a12;
  --hold: #5b6475;
  --danger: #a3282d;
  --pause-bg: #f1e3c8;
  --radius: 14px;
  --tap: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.6 -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--navy-2); }
h2 { font-size: 1.45rem; margin: 0.2em 0; line-height: 1.3; }
h3 { font-size: 1.18rem; margin: 0 0 0.5em; }
h4 { font-size: 1.05rem; margin: 1em 0 0.4em; }
p { margin: 0.5em 0; }
.small { font-size: 0.88rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--navy); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.topbar .btn { background: #fff; color: var(--navy); }

main { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60px; text-decoration: none; color: var(--muted); font-size: 0.8rem; gap: 2px;
  border-top: 3px solid transparent;
}
.tabbar a span:first-child { font-size: 1.3rem; }
.tabbar a[aria-current='page'] { color: var(--navy); font-weight: 800; border-top-color: var(--navy); }
body.no-tabs .tabbar { display: none; }
body.focus-mode .tabbar { display: none; }
body.focus-mode { padding-bottom: 24px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(29, 43, 79, 0.05);
}
.card-sub { background: var(--paper); border-radius: 10px; padding: 12px; margin: 12px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1.5px solid var(--navy); background: #fff; color: var(--navy);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 56px; font-size: 1.08rem; padding: 0 22px; }
.btn-xl { width: 100%; min-height: 64px; font-size: 1.2rem; margin-top: 8px; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 0.92rem; }
.btn-xs { min-height: 34px; padding: 0 10px; font-size: 0.85rem; border-width: 1px; margin: 4px 4px 0 0; }
.btn-stop { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-warn { border-color: var(--work); color: var(--work); }
.danger { color: var(--danger); }
.linkbtn { background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 8px 0; width: 100%; }
.linkbtn:hover { background: var(--navy-soft); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--navy-soft); color: var(--navy); margin: 0 6px 6px 0;
}
.badge-fic { background: var(--accent-soft); color: #7a4410; border: 1px dashed #c8792b; }
.badge-fic::before { content: '※ '; }
.badge-syn { background: #eee; color: #333; border: 1px dashed #777; }
.badge-diag { background: var(--accent-soft); color: #7a4410; display: inline-block; }
.badge-src { background: #e7f2ec; color: var(--good); }

.hero { padding: 6px 2px 14px; }
.hero .date { color: var(--accent); font-weight: 800; margin: 0; }
.banner { background: var(--accent-soft); border: 1px solid #e7c9a3; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.note { background: var(--navy-soft); border-radius: 10px; padding: 12px; margin: 10px 0; }
.care { background: #eef6f1; border: 1px solid #cfe5d8; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.tip { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.alert { background: #fdf0ef; border: 1.5px solid #e7b8b5; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }

.goal-list, .stat-list { list-style: none; padding: 0; margin: 0 0 12px; }
.goal-list li, .stat-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.goal-list .k, .stat-list .k { display: inline-block; min-width: 88px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }

.steps { list-style: none; padding: 0; margin: 14px 0 6px; counter-reset: s; }
.steps li a {
  display: grid; grid-template-columns: 34px 1fr auto auto; gap: 8px; align-items: center;
  min-height: 52px; padding: 6px 10px; border-radius: 10px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); margin-bottom: 6px; background: #fff;
}
.steps li.done a { background: #f3f7f4; }
.steps .st-min { color: var(--muted); font-size: 0.9rem; }
.steps .st-done { color: var(--good); font-weight: 800; font-size: 0.9rem; min-width: 52px; text-align: right; }

.segs { display: flex; flex-wrap: wrap; gap: 8px; }
.segs.col { flex-direction: column; }
.seg input, .chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .chip-check span {
  display: block; min-height: var(--tap); padding: 10px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
}
.seg input:checked + span, .chip-check input:checked + span { border-color: var(--navy); background: var(--navy-soft); font-weight: 700; }
.seg input:checked + span::before, .chip-check input:checked + span::before { content: '✓ '; }
.seg input:focus-visible + span, .chip-check input:focus-visible + span { outline: 3px solid var(--accent); }
.course-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.course-pick .seg span { min-height: 42px; padding: 8px 12px; font-size: 0.92rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.chip {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font: inherit; font-size: 0.92rem; cursor: pointer;
}
.chip.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.chip.on::before { content: '✓ '; }

.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); list-style: none; padding: 0; margin: 8px 0; text-align: center; }
.wd { display: flex; flex-direction: column; align-items: center; font-size: 0.9rem; color: var(--muted); }
.wd .wd-mark { font-size: 1.3rem; color: var(--line); }
.wd.did .wd-mark { color: var(--navy); }
.wd.today { font-weight: 800; color: var(--ink); text-decoration: underline; }

.page-head { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; }
.back { font-size: 2rem; line-height: 1; text-decoration: none; color: var(--navy); min-width: 36px; min-height: 44px; display: inline-flex; align-items: center; }

.course-head { display: flex; gap: 10px; align-items: center; }
.timer { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.progress { height: 6px; background: var(--navy-soft); border-radius: 3px; margin: 10px 0 16px; overflow: hidden; }
.progress div { height: 100%; background: var(--navy); }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 8px; }

/* 원고 */
.script-lines { padding-left: 1.6em; margin: 8px 0; }
.script-lines li { margin: 0 0 0.9em; line-height: 2.1; }
.script-lines li .btn { margin-left: 6px; vertical-align: middle; }
.pz { font-weight: 900; color: var(--accent); padding: 0 2px; }
.pz-long { color: #9c4f12; letter-spacing: -2px; }
.emph { font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--accent); }
ruby.rd rt { font-size: 0.55em; color: var(--navy-2); font-weight: 600; }
.legend { color: var(--muted); }
.words ul { padding-left: 1.2em; }
.goal { background: var(--navy-soft); padding: 8px 12px; border-radius: 10px; }
.prompter-ctrl { margin: 12px 0 6px; font-size: 0.9rem; gap: 14px; }
.prompter-ctrl input[type='range'] { width: 110px; vertical-align: middle; }
.prompter {
  max-height: 52vh; overflow-y: auto; border: 2px solid var(--navy); border-radius: 12px;
  padding: 10px 14px; background: #fffdf8; scroll-behavior: auto;
}
.prompter .script-lines li { line-height: 2.2; }
.big-line { font-size: 1.35rem; line-height: 2.2; padding: 10px 12px; background: #fffdf8; border-radius: 10px; border: 1px solid var(--line); }
.topic-scene { font-size: 2.6rem; text-align: center; padding: 14px; background: var(--paper); border-radius: 12px; letter-spacing: 0.1em; }
.topic-scene.big { font-size: 3.4rem; }
.prompts { padding-left: 1.4em; }
.drill-lines li { margin-bottom: 0.7em; font-size: 1.1rem; line-height: 2; }
.script-list { list-style: none; padding: 0; margin: 0; }
.script-list li a { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; color: var(--ink); text-decoration: none; }
.script-list .t { font-weight: 800; margin-bottom: 4px; }
.pick-lines li { margin-bottom: 4px; }

.quiz { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; }
.choice { display: flex; gap: 10px; align-items: center; min-height: var(--tap); padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line); margin: 6px 0; cursor: pointer; }
.choice.is-answer { border-color: var(--good); background: #eef6f1; }
.choice.is-wrong { border-color: var(--danger); background: #fdf0ef; }
.quiz-result { font-weight: 700; }
textarea, input[type='text'], input[type='url'], input[type='date'], input[type='time'], select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-height: var(--tap);
}
.field { display: block; margin: 12px 0; font-weight: 700; }
.field input, .field select, .field textarea { margin-top: 4px; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 12px 0; }
legend { font-weight: 700; margin-bottom: 6px; }
.check, .switch { display: flex; gap: 10px; align-items: center; min-height: var(--tap); cursor: pointer; }
.check input, .switch input { width: 22px; height: 22px; accent-color: var(--navy); }
.model { background: var(--paper); padding: 8px 12px; border-radius: 8px; }
.err { color: var(--danger); font-weight: 700; }
details > summary { cursor: pointer; min-height: 40px; display: list-item; padding: 6px 0; }

/* 녹음기 */
.rec { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 14px; }
.rec-live { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 700; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.rec-time { font-variant-numeric: tabular-nums; font-size: 1.3rem; }
.meter { flex: 1; min-width: 120px; height: 10px; background: var(--navy-soft); border-radius: 5px; overflow: hidden; }
.meter-bar { height: 100%; width: 0; background: var(--navy); transition: width 0.08s; }
.rec-note { margin-top: 8px; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--navy-soft); border-top-color: var(--navy); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
audio { width: 100%; margin: 8px 0; }

/* 피드백 */
.wave { width: 100%; height: 90px; display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.fb-block { border-left: 4px solid var(--navy); padding: 4px 0 4px 14px; margin: 16px 0; }
.fb-block ol { padding-left: 1.2em; margin: 0; }
.fb-fix { border-left-color: var(--accent); }
.example { background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.example-line { font-size: 1.15rem; line-height: 2.1; }
table.areas, table.cmp { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.areas th, table.areas td, table.cmp th, table.cmp td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.areas th { width: 7em; }
.st-chip { display: inline-block; white-space: nowrap; font-weight: 800; font-size: 0.85rem; padding: 2px 8px; border-radius: 8px; border: 1.5px solid; }
.st-chip.st-good { color: var(--good); }
.st-chip.st-work { color: var(--work); }
.st-chip.st-hold { color: var(--hold); border-style: dashed; }
.transcript { background: var(--paper); padding: 8px 12px; border-radius: 8px; }
.diff { line-height: 2; }
.w-miss { text-decoration: line-through; color: var(--danger); }
.w-chg { text-decoration: underline wavy var(--work); }
.w-miss small, .w-chg small { font-size: 0.7em; margin-left: 2px; text-decoration: none; display: inline-block; }
.sc-row { border-top: 1px dashed var(--line); padding-top: 8px; }
.sc-row .seg span { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }

.ab { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ab-label { font-weight: 800; }
@media (max-width: 520px) { .ab { grid-template-columns: 1fr; } }

.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rec-list .t { font-weight: 800; }
.rl-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.program { list-style: none; padding: 0; display: grid; gap: 8px; }
.pw { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pw.current { border: 2px solid var(--navy); background: var(--navy-soft); }
.dots { letter-spacing: 4px; color: var(--navy); }

.warm-list { list-style: none; padding: 0; }
.warm.done { background: #f3f7f4; }
.warm.done h3::after { content: ' ✓'; color: var(--good); }
.breath { height: 90px; display: flex; align-items: center; justify-content: center; }
.breath-ball { width: 36px; height: 36px; border-radius: 50%; background: var(--navy-soft); border: 2px solid var(--navy); }
.breath.run .breath-ball { animation: breath 10s ease-in-out infinite; }
@keyframes breath { 0% { transform: scale(1); } 40% { transform: scale(2.2); } 100% { transform: scale(1); } }
.structure { font-size: 1.1rem; }
.q { font-size: 1.25rem; line-height: 1.5; }

.consent { background: var(--navy-soft); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.status-list { padding-left: 1.2em; }
.status-list li { margin-bottom: 6px; }

.onb { max-width: 560px; margin: 0 auto; }
.onb-progress { display: flex; gap: 6px; margin: 8px 0 16px; }
.onb-progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.onb-progress span.on { background: var(--navy); }
.onb-hero { text-align: center; }
.logo { font-size: 3rem; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; opacity: 0; transition: 0.25s; z-index: 50; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

@media (min-width: 900px) {
  body { font-size: 19px; }
  main { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 600px) {
  table.areas tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.areas th, table.areas td { border: 0; padding: 0; width: auto; }
  table.areas td:last-child { grid-column: 1 / -1; }
}

.upload { cursor: pointer; }
.row.end { justify-content: flex-end; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 48, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
