/* 갓생 — 갓(笠). 한지 바탕에 먹·옻칠 점수판, 주칠(朱漆) 하나와 놋쇠 하나.
   점수 링은 위에서 비스듬히 본 갓의 양태(챙), 대우는 점수만큼 옻칠로 차올라요. */
:root {
  color-scheme: light;
  --bg: #f1ece2;
  --bg-2: #e8e2d6;
  --surface: #fbf9f4;
  --surface-2: #f5f1e8;
  --surface-3: #ebe5d9;
  --ink: #17140f;
  --ink-2: #2f2a23;
  --muted: #6e665a;
  --faint: #a49b8d;
  --line: rgba(23, 20, 15, .09);
  --line-2: rgba(23, 20, 15, .16);
  --ember: #a8261a;
  --ember-ink: #9a2317;
  --orange: #c0402a;
  --amber: #c9a24e;
  --gold: #c9a24e;
  --brass: #b08a3e;
  --tint: #f4e3db;
  --medal-line: rgba(23, 20, 15, .14);

  --hero: #100e0b;
  --hero-2: #1a1713;
  --hero-ink: #f2ebdd;
  --hero-muted: rgba(242, 235, 221, .56);
  --hero-line: rgba(242, 235, 221, .09);

  --h-1: #e6e0d4;
  --h0: #dcd5c7;
  --h1: #ebc9bb;
  --h2: #d7907a;
  --h3: #bb4f37;
  --h4: #962216;
  --h5: #b8892f;

  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --num: "Hahmlet", "Nanum Myeongjo", "AppleMyungjo", serif;
  --serif: "Hahmlet", "Nanum Myeongjo", "AppleMyungjo", serif;
  --brush: "Song Myung", "Hahmlet", serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r-lg: 18px;
  --r-md: 14px;
  --shadow: 0 1px 0 rgba(23, 20, 15, .04), 0 1px 2px rgba(23, 20, 15, .04), 0 14px 32px -20px rgba(40, 28, 14, .22);
  --gutter: 16px;
  --tabbar: 0px;
  --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cg fill='none' stroke='%23c9a24e' stroke-width='1'%3E%3Cpath d='M0 .5h48M.5 0v48M24 0v48M0 24h48'/%3E%3Cpath d='M12 12h24v24H12z' stroke-opacity='.55'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0b09;
    --bg-2: #13110e;
    --surface: #171512;
    --surface-2: #1d1a16;
    --surface-3: #26221c;
    --ink: #efe8da;
    --ink-2: #d8cfbf;
    --muted: #968c7d;
    --faint: #645c50;
    --line: rgba(239, 232, 218, .07);
    --line-2: rgba(239, 232, 218, .13);
    --ember: #c8442a;
    --ember-ink: #e0694e;
    --brass: #d2ad5c;
    --tint: rgba(200, 68, 42, .12);
    --medal-line: rgba(239, 232, 218, .14);
    --hero: #13110e;
    --hero-2: #1c1915;
    --h-1: #161410;
    --h0: #221e19;
    --h1: #3d1b14;
    --h2: #6a2418;
    --h3: #a2321f;
    --h4: #cf4a2e;
    --h5: #d9b25a;
    --shadow: 0 0 0 1px rgba(239, 232, 218, .05), 0 12px 32px -18px rgba(0, 0, 0, .6);
  }
}

@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-padding-top: 76px; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh;
  font-feature-settings: "ss05" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { flex: none; }
:focus-visible { outline: 2.5px solid var(--ember); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1100px) { :root { --gutter: 32px; } }

/* ───── 헤더 ───── */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid transparent; transition: border-color .3s; }
.top.scrolled { border-bottom-color: var(--line); }
.top-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--brush); font-weight: 400; font-size: 24px; letter-spacing: -.02em; line-height: 1; }
.brand-mark { width: 30px; height: 30px; color: var(--ink); }
.tabs { display: none; position: relative; margin-left: 22px; padding: 4px; border-radius: 13px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.tabs a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: 9px; text-decoration: none; font-size: 14.5px; font-weight: 600; color: var(--muted); transition: color .25s; white-space: nowrap; }
.tabs a .ico { width: 17px; height: 17px; }
.tabs a[aria-current="page"] { color: var(--surface); }
.tab-ind { position: absolute; z-index: 0; top: 4px; left: 0; height: 36px; border-radius: 9px; background: var(--ink); transition: transform .5s var(--spring), width .5s var(--spring); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mini { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 5px; border-radius: 99px; background: var(--hero); color: var(--hero-ink); opacity: 0; transform: translateY(-6px) scale(.96); pointer-events: none; transition: opacity .3s var(--ease), transform .45s var(--spring); }
.mini.show { opacity: 1; transform: none; pointer-events: auto; }
.mini b { font-family: var(--num); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.mini small { font-size: 12px; color: var(--hero-muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; transition: transform .2s var(--ease), background .2s, box-shadow .2s, color .2s; }
.btn:active { transform: scale(.97); }
.btn .ico { width: 18px; height: 18px; }
.btn-ghost { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn-ink { background: var(--ink); color: var(--surface); }
.btn-ink:hover { background: var(--ink-2); }
.btn-ember { background: var(--ember); color: #fff; box-shadow: 0 8px 20px -10px rgba(168, 38, 26, .8); }
.btn-ember:hover { background: #8f1f15; }
.btn-danger { background: transparent; color: #a3261c; box-shadow: inset 0 0 0 1px rgba(163, 38, 28, .35); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; transition: background .2s, transform .2s var(--ease); }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }
.print-lbl { display: none; }
@media (min-width: 640px) { .print-lbl { display: inline; } }
@media (min-width: 900px) {
  .tabs { display: inline-flex; }
}

.demo-bar { background: var(--ink); color: var(--surface); font-size: 13.5px; }
.demo-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; padding-top: 9px; padding-bottom: 9px; text-align: center; }
.demo-bar a { color: var(--amber); font-weight: 600; }

/* ───── 하단 탭(휴대폰) ───── */
.tabbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--faint); position: relative; transition: color .2s; }
.tabbar a .ico { width: 23px; height: 23px; transition: transform .45s var(--spring); }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ico { transform: translateY(-1px) scale(1.06); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -7px; width: 18px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ember); }
@media (max-width: 899px) { :root { --tabbar: calc(64px + env(safe-area-inset-bottom)); } body { padding-bottom: var(--tabbar); } }
@media (min-width: 900px) { .tabbar { display: none; } }

/* ───── 공통 섹션 ───── */
main { padding: 8px 0 40px; }
.view { display: none; }
.view.on { display: block; animation: viewIn .5s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 26px 2px 12px; }
.sec-h h2 { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: -.03em; }
.sec-h .meta { font-size: 13px; color: var(--muted); }
.sec-h .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.link { font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 4px; }
.link:hover { color: var(--ink); }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
@media (min-width: 640px) { .card-pad { padding: 24px; } }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.card-h h3 { font-family: var(--serif); font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.card-h .sub { font-size: 13px; color: var(--muted); }
.card-h .end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip.ember { background: var(--tint); color: var(--ember-ink); }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 650; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

/* ───── 점수판(먹·옻칠 판) ───── */
.board {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; color: var(--hero-ink);
  background:
    radial-gradient(120% 70% at 50% 0%, #1f1b16 0%, var(--hero) 62%),
    var(--hero);
  box-shadow: 0 30px 60px -30px rgba(26, 16, 8, .6), 0 0 0 1px rgba(201, 162, 78, .14) inset, 0 0 0 4px var(--hero) inset, 0 0 0 5px rgba(201, 162, 78, .1) inset;
}
.board::before { /* 창살(정자살) 무늬 — 갓 뒤로만 옅게 */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .09;
  background: var(--lattice) center var(--ring-y, 44%) / 48px 48px;
  -webkit-mask-image: radial-gradient(circle at 50% var(--ring-y, 44%), #000 0, transparent 62%); mask-image: radial-gradient(circle at 50% var(--ring-y, 44%), #000 0, transparent 62%);
}
.board::after { /* 갓 뒤 주칠빛 */
  content: ""; position: absolute; z-index: -1; left: 50%; top: var(--ring-y, 44%); width: 520px; height: 520px; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(168, 38, 26, var(--glow, .2)), transparent 70%); transition: background .8s;
}
.board.perfect::after { background: radial-gradient(closest-side, rgba(201, 162, 78, .26), transparent 70%); }
.board-top { display: flex; align-items: flex-start; gap: 10px; padding: 20px 20px 0; }
.date-b { min-width: 0; }
.date-b h1 { font-family: var(--serif); font-size: 23px; font-weight: 700; letter-spacing: -.03em; line-height: 1.25; }
.date-b p { font-size: 13px; color: var(--hero-muted); margin-top: 2px; }
.date-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.date-nav button { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--hero-ink); box-shadow: inset 0 0 0 1px var(--hero-line); transition: background .2s, transform .2s var(--ease), opacity .2s; }
.date-nav button:hover:not(:disabled) { background: rgba(255, 255, 255, .07); }
.date-nav button:disabled { opacity: .28; cursor: default; }
.date-nav .today-btn { width: auto; padding: 0 13px; border-radius: 99px; font-size: 13px; font-weight: 650; background: var(--hero-ink); color: var(--hero); box-shadow: none; }
.date-nav .today-btn:hover { background: #fff !important; }

.stage { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: 2px auto 0; touch-action: pan-y; }
.stage canvas { position: absolute; inset: -9%; width: 118%; height: 118%; display: block; opacity: 0; transition: opacity .8s var(--ease); }
.stage.has3d canvas { opacity: 1; }
.stage.has3d .ring-css { opacity: 0; }
.ring-css-wrap { position: absolute; inset: 0; transition: opacity .6s; }
.stage.has3d .ring-css-wrap { opacity: 0; }
.ring-css { position: absolute; inset: 6%; border-radius: 50%; --t: 31%; transition: --p 1s var(--spring);
  background:
    repeating-radial-gradient(circle, rgba(242, 235, 221, .07) 0 1px, transparent 1px 5px),
    conic-gradient(from 0deg, #5c100b 0, #9c2216 calc(var(--p) * 55%), #c8442a calc(var(--p) * 100%), #2a2520 calc(var(--p) * 100%));
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - var(--t)), #000 calc(100% - var(--t) + .6px));
  mask: radial-gradient(closest-side, transparent calc(100% - var(--t)), #000 calc(100% - var(--t) + .6px));
  box-shadow: inset 0 0 0 1.5px rgba(201, 162, 78, .7);
}
.ring-css-wrap::after { /* 대우(윗면) */
  content: ""; position: absolute; inset: 27%; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(242, 235, 221, .06) 0 1px, transparent 1px 6px), radial-gradient(circle at 40% 35%, #2a251f, #0d0b09 70%);
  box-shadow: 0 0 0 1px rgba(201, 162, 78, .55), 0 10px 24px -8px rgba(0, 0, 0, .7);
}
.board.perfect .ring-css { background: repeating-radial-gradient(circle, rgba(255, 255, 255, .08) 0 1px, transparent 1px 5px), conic-gradient(from 0deg, #f0d79a, #c9a24e, #8e6a2a, #e3c47a, #f0d79a); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.score { font-family: var(--num); font-weight: 700; text-shadow: 0 2px 18px rgba(0, 0, 0, .55); font-size: clamp(64px, 19vw, 88px); line-height: .92; letter-spacing: -.045em; font-variant-numeric: tabular-nums; display: inline-flex; justify-content: center; }
.board.perfect .score { text-shadow: none; filter: drop-shadow(0 2px 14px rgba(0, 0, 0, .6)); color: #e3c47a; }
.board.perfect .score .odo-s span { background: linear-gradient(180deg, #fbf1d8 12%, #dcb866 58%, #a57d33); -webkit-background-clip: text; background-clip: text; color: transparent; }
.board.perfect .score-l { opacity: 0; }
.score-l { text-shadow: 0 1px 8px rgba(0, 0, 0, .7); transition: opacity .4s; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--hero-muted); letter-spacing: .01em; }
.perfect-t { position: absolute; left: 0; right: 0; top: calc(50% + 40px); display: flex; justify-content: center; gap: .02em; font-family: var(--brush); font-weight: 400; font-size: 15px; letter-spacing: .28em; color: #e3c47a; text-indent: .28em; text-shadow: 0 1px 10px rgba(0, 0, 0, .8); }
.perfect-t span { display: inline-block; opacity: 0; transform: translateY(8px); }
.board.perfect .perfect-t span { animation: letterIn .7s var(--spring) forwards; animation-delay: calc(var(--i) * 45ms + 250ms); }
@keyframes letterIn { to { opacity: 1; transform: none; } }

/* 숫자 굴러가기 */
.odo { display: inline-flex; }
.odo-d { position: relative; display: inline-block; width: 1ch; height: 1em; overflow: hidden; transition: width .55s var(--spring), opacity .4s; }
.odo-d.out { width: 0; opacity: 0; }
.odo-s { display: flex; flex-direction: column; transition: transform .9s var(--spring); will-change: transform; }
.odo-s span { display: block; height: 1em; line-height: 1em; }
.still .odo-d, .still .odo-s { transition: none !important; }

.status { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 4px auto 0; padding: 0 20px; font-size: 14.5px; font-weight: 600; color: var(--hero-ink); min-height: 24px; text-align: center; }
.status .ico { width: 17px; height: 17px; color: var(--ember); }
.board.goal .status { color: #e7a28c; }
.board.perfect .status { color: #dcb866; }

.b-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 20px 0; border-top: 1px solid var(--hero-line); }
.b-stat { padding: 14px 4px 2px; text-align: center; }
.b-stat + .b-stat { border-left: 1px solid var(--hero-line); }
.b-stat b { display: block; font-family: var(--num); font-weight: 800; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.b-stat b small { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--hero-muted); margin-left: 2px; letter-spacing: 0; }
.b-stat span { font-size: 12.5px; color: var(--hero-muted); }

.wstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 14px 12px 16px; margin-top: 12px; border-top: 1px solid var(--hero-line); }
.wday { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 4px; border-radius: 14px; color: var(--hero-muted); font-size: 11.5px; font-weight: 600; transition: background .2s, color .2s; position: relative; }
.wday:hover:not(:disabled) { background: rgba(255, 255, 255, .05); }
.wday:disabled { cursor: default; opacity: .35; }
.wday .rw { position: relative; width: 36px; height: 36px; }
.wday .rw svg { display: block; }
.wday .rw i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-family: var(--num); font-size: 11.5px; font-weight: 700; color: var(--hero-ink); font-variant-numeric: tabular-nums; }
.wday[aria-pressed="true"] { background: rgba(255, 255, 255, .09); color: var(--hero-ink); }
.wday.is-today::after { content: ""; position: absolute; bottom: -1px; width: 4px; height: 4px; border-radius: 50%; background: var(--ember); }
.mring .mr-track { stroke: rgba(255, 255, 255, .1); }
.mring .mr-bar { transition: stroke-dasharray .8s var(--spring); }
.light-rings .mring .mr-track { stroke: var(--surface-3); }

/* ───── 오늘 레이아웃 ───── */
.today-grid { display: grid; gap: 18px; padding-top: 6px; }
@media (min-width: 640px) and (max-width: 1023px) {
  .board-mid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 0 12px; }
  .board-mid .b-stats { margin: 0; grid-template-columns: 1fr; border-top: 0; }
  .board-mid .b-stat { text-align: left; padding: 12px 0 12px 20px; border-left: 1px solid var(--hero-line); }
  .board-mid .b-stat + .b-stat { border-top: 1px solid var(--hero-line); }
  .board-mid .status { justify-content: flex-start; padding: 0 0 0 20px; margin-bottom: 8px; text-align: left; }
  .board { --ring-y: 50%; }
  .board::after { left: 27%; }
  .board::before { background: repeating-radial-gradient(circle at 27% 50%, rgba(255, 255, 255, .045) 0 1px, transparent 1px 34px); -webkit-mask-image: radial-gradient(circle at 27% 50%, #000 0, transparent 60%); mask-image: radial-gradient(circle at 27% 50%, #000 0, transparent 60%); }
}
@media (min-width: 1024px) {
  .today-grid { grid-template-columns: 420px minmax(0, 1fr); gap: 28px; align-items: start; padding-top: 10px; }
  .today-grid > .board { position: sticky; top: 76px; }
  .today-main > .sec-h:first-child { margin-top: 4px; }
}

/* 루틴 체크리스트 */
.list { list-style: none; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.rt { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 12px 18px 12px 14px; text-align: left; transition: background .35s var(--ease); }
.list li + li .rt::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
.rt:hover { background: var(--surface-2); }
.rt[aria-checked="true"] { background: var(--tint); }
.rt-body { flex: 1; min-width: 0; }
.rt-name { display: block; font-size: 15.5px; font-weight: 650; letter-spacing: -.02em; line-height: 1.35; transition: color .3s; }
.rt-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.rt-meta .fl { display: inline-flex; align-items: center; gap: 3px; color: var(--ember-ink); font-weight: 650; }
.rt-meta .fl .ico { width: 13px; height: 13px; stroke-width: 2.2; }
.rt[aria-checked="true"] .rt-name { color: var(--ink-2); }
.rt-pts { font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--faint); font-variant-numeric: tabular-nums; transition: color .3s, transform .5s var(--spring); }
.rt[aria-checked="true"] .rt-pts { color: var(--ember-ink); transform: scale(1.08); }
.rt-pts.bonus { font-family: var(--sans); font-size: 12px; font-weight: 650; }

.ck { position: relative; width: 30px; height: 30px; flex: none; }
.ck svg { width: 30px; height: 30px; overflow: visible; }
.ck .c-ring { fill: none; stroke: var(--line-2); stroke-width: 1.8; transition: stroke .3s; }
.rt:hover .ck .c-ring { stroke: var(--faint); }
.ck .c-fill { fill: var(--ember); transform-origin: 15px 15px; transform: scale(0); transition: transform .5s var(--spring); }
.ck .c-tick { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .32s var(--ease) .08s; }
.rt[aria-checked="true"] .c-fill { transform: scale(1); }
.rt[aria-checked="true"] .c-tick { stroke-dashoffset: 0; }
.rt[aria-checked="true"] .c-ring { stroke: transparent; }
.ck.pop { animation: ckPop .55s var(--spring); }
@keyframes ckPop { 0% { transform: scale(1); } 30% { transform: scale(.78); } 100% { transform: scale(1); } }
.ck .burst { position: absolute; inset: -14px; pointer-events: none; }
.ck .burst i { position: absolute; left: 50%; top: 50%; width: 2.5px; height: 8px; margin: -4px 0 0 -1.25px; border-radius: 2px; background: var(--ember); opacity: 0; transform: rotate(calc(var(--a) * 1deg)) translateY(-14px) scaleY(.4); }
.ck.pop .burst i { animation: rayOut .6s var(--ease) forwards; }
.ck.pop .burst i:nth-child(even) { background: var(--amber); }
@keyframes rayOut { 0% { opacity: 1; transform: rotate(calc(var(--a) * 1deg)) translateY(-13px) scaleY(.4); } 60% { opacity: 1; } 100% { opacity: 0; transform: rotate(calc(var(--a) * 1deg)) translateY(-24px) scaleY(1); } }
.fly { position: fixed; z-index: 60; pointer-events: none; font-family: var(--num); font-weight: 800; font-size: 15px; color: var(--ember-ink); }

.list-empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.list-empty .btn { margin-top: 12px; }
.prog-line { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: 1; max-width: 120px; }
.prog-line i { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: linear-gradient(90deg, #7f1a13, #cf5a3c); transition: width .8s var(--spring); }
details.off { margin-top: 10px; }
details.off > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
details.off > summary::-webkit-details-marker { display: none; }
details.off > summary .ico { width: 16px; height: 16px; transition: transform .3s var(--ease); }
details.off[open] > summary .ico { transform: rotate(90deg); }
details.off .list { margin-top: 4px; }

/* 추가 기록 타일 */
.xgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .xgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.xt { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); transition: box-shadow .3s; min-width: 0; }
.xt.full { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(168, 38, 26, .55); }
.xt-top { display: flex; align-items: baseline; gap: 6px; }
.xt-top b { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.xt-top span { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.xt-ok { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ember); color: #fff; display: grid; place-items: center; transform: scale(0); transition: transform .5s var(--spring); }
.xt-ok .ico { width: 13px; height: 13px; stroke-width: 3; }
.xt.full .xt-ok { transform: scale(1); }
.xt-val { display: flex; align-items: baseline; gap: 3px; min-height: 40px; text-align: left; border-radius: 8px; }
.xt-val .v { font-family: var(--num); font-weight: 800; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.xt-val .u { font-size: 13px; font-weight: 600; color: var(--muted); }
.xt-val .v.zero { color: var(--faint); }
.xt-in { width: 100%; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ink); padding: 0 10px; font-family: var(--num); font-weight: 700; font-size: 20px; outline: none; }
.xt-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.xt-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: linear-gradient(90deg, #7f1a13, #c0402a); transition: width .7s var(--spring); }
.xt-ctrl { display: flex; gap: 6px; margin-top: 4px; }
.xt-ctrl button { flex: 1; height: 36px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 700; display: grid; place-items: center; transition: background .2s, transform .15s var(--ease); white-space: nowrap; min-width: 0; }
.xt-ctrl button:hover { background: var(--surface-3); }
.xt-ctrl button:active { transform: scale(.95); }
.xt-ctrl button .ico { width: 16px; height: 16px; stroke-width: 2.3; }
.xt-ctrl .minus { flex: 0 0 36px; }
.sw { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 0; text-align: left; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.sw-t { position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background .3s; }
.sw-t::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .45s var(--spring); }
[aria-checked="true"] > .sw-t, .sw[aria-checked="true"] .sw-t { background: var(--ember); box-shadow: none; }
[aria-checked="true"] > .sw-t::after, .sw[aria-checked="true"] .sw-t::after { transform: translateX(18px); }
.xt.saving .xt-val .v { font-family: var(--sans); font-size: 20px; font-weight: 800; letter-spacing: -.03em; }

.note-card { margin-top: 10px; padding: 16px; display: grid; gap: 14px; }
.mood { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mood > b { font-size: 14px; font-weight: 700; }
.mood-seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; flex: 1; min-width: 240px; }
.mood-seg button { height: 38px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; font-weight: 650; color: var(--muted); transition: background .25s, color .25s, transform .35s var(--spring); white-space: nowrap; padding: 0 2px; }
.mood-seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; transform: translateY(-1px); }
.note-in { width: 100%; height: 46px; border: 0; border-radius: 12px; padding: 0 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; outline: none; transition: box-shadow .2s; }
.note-in:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.note-in::placeholder { color: var(--faint); }

.hint-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); font-size: 13.5px; color: var(--ink-2); margin-bottom: 4px; }
.hint-card b { color: var(--ink); }
.hint-card .x { margin-left: auto; flex: none; width: 32px; height: 32px; margin: -6px -8px -6px auto; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.hint-card .x:hover { background: var(--surface-3); }
.hint-card .ico.lead { color: var(--ember); margin-top: 1px; }

/* ───── 주간 ───── */
.pnav { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; }
.pnav h2 { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.pnav .range { font-size: 13.5px; color: var(--muted); font-family: var(--num); }
.pnav .end { margin-left: auto; display: flex; gap: 6px; }
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); transition: transform .2s var(--ease), background .2s; }
.round:hover:not(:disabled) { background: var(--surface-2); }
.round:active:not(:disabled) { transform: scale(.94); }
.round:disabled { opacity: .35; cursor: default; }
.wboard { display: grid; gap: 20px; padding: 22px 20px; }
@media (min-width: 768px) { .wboard { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 36px; padding: 28px 32px; } }
.wbig { display: flex; align-items: flex-end; gap: 14px; }
.wbig .score { font-size: clamp(72px, 20vw, 104px); }
.wbig .lab { padding-bottom: 10px; }
.wbig .lab b { display: block; font-size: 14px; font-weight: 700; }
.wbig .lab span { font-size: 12.5px; color: var(--hero-muted); }
.delta { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; margin-top: 6px; font-family: var(--num); font-size: 12.5px; font-weight: 700; background: rgba(255, 255, 255, .08); color: var(--hero-ink); }
.delta.up { background: rgba(192, 57, 43, .2); color: #e7a28c; }
.wrings { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wr { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--hero-muted); font-weight: 600; min-width: 0; }
.wr .rw { position: relative; width: 100%; max-width: 64px; aspect-ratio: 1; }
.wr .rw svg { width: 100%; height: 100%; }
.wr .rw i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-family: var(--num); font-weight: 800; font-size: clamp(11px, 3.2vw, 16px); color: var(--hero-ink); }
.wr.is-today > span { color: var(--hero-ink); }
.wr.is-today > span::after { content: ""; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--ember); margin: 3px auto 0; }

.grid2 { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 1024px) { .grid2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.bars { position: relative; display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: 8px; height: 190px; padding-top: 22px; }
.bars .goal-l { position: absolute; left: 0; right: 0; bottom: calc(26px + (100% - 48px) * var(--g) / 100); border-top: 1.5px dashed var(--line-2); }
.bars .goal-l span { position: absolute; right: 0; top: -20px; font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface); padding-left: 6px; }
.bar { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.bar .col { position: relative; width: 100%; max-width: 44px; height: calc(100% - 20px); display: flex; align-items: flex-end; }
.bar .col i { display: block; width: 100%; height: calc(var(--v) * 1%); min-height: 3px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #ff7a2a, #ff3a14); transform-origin: bottom; animation: grow .9s var(--spring) both; animation-delay: calc(var(--i) * 45ms); }
.bar.under .col i { background: linear-gradient(180deg, #e2b7a7, #c98a76); }
.bar.perfect .col i { background: linear-gradient(180deg, #f0d79a, #c9a24e 55%, #94702f); }
.bar.none .col i { background: repeating-linear-gradient(-45deg, var(--surface-3) 0 4px, transparent 4px 8px); height: 100%; box-shadow: inset 0 0 0 1px var(--line); animation: none; }
.bar .v { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-family: var(--num); font-weight: 750; font-size: 12.5px; color: var(--ink-2); }
.bar .col .v { top: auto; bottom: calc(var(--v) * 1% + 4px); }
.bar > span { font-size: 12px; color: var(--muted); font-weight: 600; height: 14px; line-height: 14px; }
.bar.is-today > span { color: var(--ember-ink); }
@keyframes grow { from { transform: scaleY(0); } }

.matrix { display: grid; grid-template-columns: minmax(0, 1fr) repeat(7, 30px) 44px; align-items: center; gap: 6px 4px; font-size: 13.5px; }
@media (max-width: 420px) { .matrix { grid-template-columns: minmax(0, 1fr) repeat(7, 24px) 38px; gap: 6px 2px; } }
.matrix .mh { font-size: 11.5px; color: var(--muted); font-weight: 650; text-align: center; }
.matrix .mn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; padding-right: 6px; }
.matrix .mc { justify-self: center; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.matrix .mc.y { background: var(--ember); box-shadow: none; }
.matrix .mc.n { background: transparent; }
.matrix .mc.x { box-shadow: none; background: repeating-linear-gradient(-45deg, var(--surface-3) 0 3px, transparent 3px 6px); border-radius: 6px; }
.matrix .mc.f { box-shadow: inset 0 0 0 1.5px var(--line); opacity: .5; }
.matrix .mr { font-family: var(--num); font-weight: 750; font-size: 13px; text-align: right; color: var(--ink-2); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b { display: block; margin-top: 2px; font-family: var(--num); font-weight: 800; font-size: 28px; line-height: 1.15; letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi b small { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi.hl { background: var(--hero); color: var(--hero-ink); }
.kpi.hl span, .kpi.hl b small { color: var(--hero-muted); }
.kpis.k5 .kpi:first-child { grid-column: 1 / -1; }
@media (min-width: 640px) { .kpis.k5 .kpi:first-child { grid-column: auto; } }
.xsum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .xsum { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.xsum > div { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.xsum span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.xsum b { font-family: var(--num); font-weight: 800; font-size: 20px; letter-spacing: -.03em; white-space: nowrap; }
.xsum b small { font-family: var(--sans); font-size: 12.5px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.notes { list-style: none; display: grid; gap: 2px; }
.notes li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.notes li:first-child { border-top: 0; }
.notes time { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.notes .sc { font-family: var(--num); font-weight: 750; font-size: 13px; color: var(--muted); }
.empty-s { padding: 18px 4px; font-size: 14px; color: var(--muted); text-align: center; }

/* ───── 기록(통계) ───── */
.hm-wrap { position: relative; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 6px; margin: 0 -4px; padding-left: 4px; padding-right: 4px; }
.heatmap { display: block; }
.heatmap .hm-c { transition: opacity .2s; }
.heatmap .hm-c.l-1 { fill: var(--h-1); }
.heatmap .hm-c.l0 { fill: var(--h0); }
.heatmap .hm-c.l1 { fill: var(--h1); }
.heatmap .hm-c.l2 { fill: var(--h2); }
.heatmap .hm-c.l3 { fill: var(--h3); }
.heatmap .hm-c.l4 { fill: var(--h4); }
.heatmap .hm-c.l5 { fill: var(--h5); }
.heatmap .hm-c.today { stroke: var(--ink); stroke-width: 1.5; }
.heatmap .hm-c:hover { stroke: var(--ink); stroke-width: 1.5; }
.heatmap text { font-size: 10.5px; fill: var(--muted); font-family: var(--sans); font-weight: 600; }
.legend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 70; padding: 6px 10px; border-radius: 9px; background: var(--ink); color: var(--surface); font-size: 12.5px; font-weight: 600; pointer-events: none; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }
.trend { display: block; width: 100%; height: auto; overflow: visible; }
.tc-grid { stroke: var(--line); }
.tc-goal { stroke: var(--line-2); stroke-dasharray: 4 4; }
.tc-goal-t, .tc-ax { font-size: 11px; fill: var(--muted); font-family: var(--sans); font-weight: 600; }
.tc-dot { fill: var(--h2); }
.tc-dot.p { fill: var(--gold); stroke: var(--surface); stroke-width: 1.5; }
.tc-line { stroke: var(--ember); stroke-width: 2.6; stroke-linecap: round; }
.tc-hl { stroke: var(--ink); stroke-opacity: .25; }
.tc-hd { fill: var(--ember); stroke: var(--surface); stroke-width: 2.5; }
.tc-hit { cursor: crosshair; }
.rates { display: grid; gap: 12px; }
.rate { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 4px 12px; align-items: center; }
.rate .n { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rate .p { font-family: var(--num); font-weight: 800; font-size: 14px; text-align: right; }
.rate .b { grid-column: 1 / -1; height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.rate .b i { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: linear-gradient(90deg, #7f1a13, #c0402a); transform-origin: left; animation: growX .9s var(--spring) both; }
@keyframes growX { from { transform: scaleX(0); } }
.medals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 10px; }
@media (min-width: 640px) { .medals { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .medals { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.mdl { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.mdl svg { width: 100%; max-width: 92px; height: auto; transition: transform .6s var(--spring); }
.mdl:hover svg.on { transform: rotate(-8deg) scale(1.05); }
.medal-glyph { font-family: var(--num); font-weight: 800; letter-spacing: -.04em; }
.mdl b { font-size: 13px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.mdl span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.mdl.locked b { color: var(--muted); }

/* ───── 루틴 설정 ───── */
.rlist { list-style: none; }
.redit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.redit:first-child { border-top: 0; padding-top: 2px; }
.rname { width: 100%; height: 42px; border: 0; border-radius: 10px; padding: 0 10px; margin-left: -10px; font-size: 15.5px; font-weight: 650; background: transparent; outline: none; transition: background .2s, box-shadow .2s; min-width: 0; }
.rname:hover { background: var(--surface-2); }
.rname:focus { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.ract { display: flex; gap: 2px; }
.ract .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.ract .icon-btn:hover { color: var(--ink); }
.ract .icon-btn.del:hover { color: #a3261c; }
.ropts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.wsel { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.wdots { display: inline-flex; gap: 3px; }
.wdots button { width: 26px; height: 30px; display: grid; place-items: center; }
.wdots button i { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background .25s, transform .4s var(--spring); }
.wdots button.on i { background: var(--ember); box-shadow: none; }
.wdots button:active i { transform: scale(.8); }
.dsel { display: inline-flex; gap: 3px; }
.dsel button { width: 32px; height: 32px; border-radius: 9px; font-size: 12.5px; font-weight: 700; color: var(--faint); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s; }
.dsel button[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.addrow { display: flex; gap: 8px; margin-top: 14px; }
.addrow input { flex: 1; min-width: 0; height: 46px; border: 0; border-radius: 12px; padding: 0 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; outline: none; }
.addrow input:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.addrow .btn { height: 46px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets button { height: 32px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, transform .2s var(--ease); }
.presets button:hover { background: var(--surface-3); }
.presets button:active { transform: scale(.96); }
.set-grid { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 1024px) { .set-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } .set-col { display: grid; gap: 14px; } }
@media (max-width: 1023px) { .set-col { display: grid; gap: 14px; } }
.xrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.xrow:first-of-type { border-top: 0; }
.xrow .sw { width: auto; flex: 1; min-width: 140px; font-size: 14.5px; color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-3); }
.stepper button .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.stepper output { min-width: 74px; text-align: center; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.dim { opacity: .4; pointer-events: none; }
.rule { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.rule:first-of-type { border-top: 0; padding-top: 0; }
.rule .rl { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rule .rl b { font-size: 14.5px; font-weight: 700; }
.rule .rl output { font-family: var(--num); font-weight: 800; font-size: 20px; }
.rule p { font-size: 12.5px; color: var(--muted); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--ember) calc(var(--p, .5) * 100%), var(--surface-3) 0); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--ember) calc(var(--p, .5) * 100%), var(--surface-3) 0); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .05); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.data-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.small { font-size: 12.5px; color: var(--muted); }

/* ───── 대화상자 / 토스트 ───── */
dialog { margin: auto; border: 0; padding: 0; background: transparent; color: var(--ink); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10, 10, 12, .5); backdrop-filter: blur(3px); }
dialog[open] .dlg { animation: dlgIn .5s var(--spring); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 22px; border-radius: 24px; background: var(--surface); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .45); }
.dlg-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dlg-h h2 { font-size: 20px; font-weight: 800; letter-spacing: -.035em; }
.dlg-h .icon-btn { margin-left: auto; margin-right: -8px; }
.dlg p.lead { font-size: 14px; color: var(--muted); }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.popts { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 520px) { .popts { grid-template-columns: 1fr 1fr; } }
.popt { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; text-decoration: none; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .25s, transform .35s var(--spring); }
.popt:hover { box-shadow: inset 0 0 0 1.5px var(--ink); transform: translateY(-2px); }
.popt b { font-size: 16px; font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 6px; }
.popt span { font-size: 13px; color: var(--muted); line-height: 1.5; }
.paper-thumb { position: relative; width: 92px; aspect-ratio: 210 / 297; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 10px 22px -10px rgba(0, 0, 0, .35); padding: 9px 8px; display: grid; gap: 4px; align-content: start; transform: rotate(-3deg); transition: transform .5s var(--spring); }
.popt:hover .paper-thumb { transform: rotate(0) translateY(-2px); }
.paper-thumb i { display: block; height: 3px; border-radius: 2px; background: #ddd6c8; }
.paper-thumb i.t { width: 60%; height: 5px; background: #111; }
.paper-thumb .g { display: grid; grid-template-columns: 2fr repeat(7, 1fr); gap: 2px; margin-top: 3px; }
.paper-thumb .g u { height: 5px; border: 1px solid #c9c1b2; border-radius: 1px; }
.paper-thumb .g u:nth-child(8n + 1) { border: 0; background: #e9e3d7; }
.paper-thumb .r { display: flex; gap: 3px; align-items: flex-end; height: 22px; margin-top: 4px; }
.paper-thumb .r u { flex: 1; background: #a8261a; border-radius: 1px; }
.paper-thumb .h { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5px; margin-top: 4px; }
.paper-thumb .h u { aspect-ratio: 1; border-radius: 1px; background: #ecc9bb; }
.paper-thumb .h u:nth-child(3n) { background: #a8261a; }
.paper-thumb .h u:nth-child(5n) { background: #e9e3d7; }
.toasts { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tabbar) + 16px); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 16px; background: var(--hero); color: var(--hero-ink); font-size: 14px; font-weight: 600; box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .5); pointer-events: auto; animation: toastIn .55s var(--spring); max-width: 100%; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast button { flex: none; height: 32px; padding: 0 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); color: var(--amber); font-weight: 700; font-size: 13px; }
.toast.ach { padding: 10px 18px 10px 10px; }
.toast.ach svg { width: 52px; height: 52px; animation: medalIn 1s var(--spring); }
.toast.ach small { display: block; font-size: 12px; color: var(--hero-muted); font-weight: 500; }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes medalIn { from { transform: rotateY(180deg) scale(.6); } }

/* ───── 푸터 ───── */
footer { padding: 34px 0 40px; border-top: 1px solid var(--line); margin-top: 40px; font-size: 13px; color: var(--muted); }
footer .wrap { display: grid; gap: 8px; }
footer a { color: var(--ink-2); text-underline-offset: 3px; }
footer .f1 { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
footer .f1 b { color: var(--ink); font-family: var(--brush); font-weight: 400; font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

/* 앱 화면을 그대로 인쇄할 때(전용 인쇄 페이지가 따로 있어요) */
@media print {
  @page { size: A4; margin: 12mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --shadow: none; --hero: #fff; --hero-ink: #111; --hero-muted: #555; --hero-line: #ddd; }
  body { background: #fff; padding: 0; font-size: 12px; }
  .top, .tabbar, footer, .toasts, .demo-bar, .date-nav, .hint-card, .xt-ctrl, .stage canvas, .addrow, .presets, .data-btns, .pnav .end, .no-print { display: none !important; }
  .board { box-shadow: none; border: 1px solid #ccc; background: #fff; color: #111; }
  .board::before, .board::after { display: none; }
  .stage.has3d .ring-css-wrap { opacity: 1; }
  .card, .list, .xt, .kpi { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .today-grid { grid-template-columns: 1fr; }
  .today-grid > .board { position: static; }
  .view.on { animation: none; }
}
