/* ═══════════════════════════════════════════
   감사합니다 — 스타일
   기존 앱의 아이폰 다크 톤을 그대로 이어받는다.
   ═══════════════════════════════════════════ */
:root {
    --primary: #0064D2;
    --primary-soft: #5AC8FA;
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --surface-3: #3A3A3C;
    --card: #1C1C1E;
    --text: #FFFFFF;
    --sub: #98989F;
    --dim: #8E8E93;
    --red: #FF453A;
    --green: #30D158;
    --gold: #FFD60A;
    --separator: #38383A;

    --sat: env(safe-area-inset-top);
    --sab: env(safe-area-inset-bottom);
}

html {
    background: var(--bg);
    color-scheme: dark;
    height: 100%;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; margin: 0; padding: 0; word-break: keep-all; }
button, input, textarea { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    background: var(--bg);
    color: var(--text);
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(16px, var(--sat)) 16px max(20px, var(--sab));
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
/* 기록·설명 글자는 길게 눌러 복사할 수 있게 둔다 */
.list-item-text, .hist-item, .guide, .guide *, #pane-privacy, #pane-privacy * {
    -webkit-user-select: text; user-select: text;
}

#confetti-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 9999;
}

/* ── 카드 ─────────────────────────────── */
.card {
    width: 100%;
    max-width: 390px;
    background: var(--card);
    border-radius: 28px;
    padding: 20px 18px 18px;
    box-shadow: 0 2px 30px rgba(0,0,0,0.6), 0 0 0 0.5px rgba(255,255,255,0.06);
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
}
.card > :not(.list-viewport) { flex-shrink: 0; }

/* 음성 인식 중 카드 테두리 글로우 */
.card.recording { animation: cardRecGlow 2s ease-in-out infinite; }
@keyframes cardRecGlow {
    0%, 100% { box-shadow: 0 2px 30px rgba(0,0,0,.6), 0 0 0 1.5px rgba(255,69,58,.55), 0 0 22px rgba(255,69,58,.18); }
    50%      { box-shadow: 0 2px 30px rgba(0,0,0,.6), 0 0 0 2px   rgba(255,69,58,.95), 0 0 40px rgba(255,69,58,.40); }
}

/* ── 헤더 ─────────────────────────────── */
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15; }
.date-text { font-size: 12.5px; color: var(--sub); font-weight: 500; margin-top: 3px; }
/* 「감사합니다 / 인생이 바뀝니다」 — 아이콘·스크린샷과 같은 말 */
.title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tagline { font-size: 12.5px; font-weight: 600; color: #E0A93A; letter-spacing: -.2px; white-space: nowrap; }
/* 소리 켜고 끄기 스위치 */
.row-switch { width: 38px; height: 22px; border-radius: 11px; background: #3A3A3C; position: relative; flex: none; transition: background .18s; }
.row-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; }
#row-sound[aria-pressed="true"] .row-switch { background: #34C759; }
#row-sound[aria-pressed="true"] .row-switch::after { transform: translateX(16px); }


.menu-btn {
    width: 40px; height: 40px; flex: 0 0 40px;
    background: var(--surface-2); border: none; border-radius: 13px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    cursor: pointer; transition: transform .15s, background .2s; margin-top: 1px;
}
.menu-btn span { display: block; width: 16px; height: 1.8px; background: var(--text); border-radius: 2px; }
.menu-btn:active { transform: scale(.92); background: var(--surface-3); }

/* ── 나무 ─────────────────────────────── */
.hero {
    display: block;
    margin: 10px 0 10px;
    padding: 6px 14px 9px;
    background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
    border-radius: 20px;
    border: 0.5px solid rgba(255,255,255,.06);
    min-height: 0;
}
.hero-art {
    width: clamp(90px, 27vw, 120px);
    height: clamp(88px, 27vw, 116px);
    flex: none;                            /* 나무는 오른쪽 */
    display: flex; align-items: flex-end; justify-content: center;
    margin-bottom: -7px;                   /* 나무 밑동이 막대에 닿게 */
}
.hero-art svg { width: 100%; height: 100%; overflow: visible; }
.hero-art .breathe {
    animation: breathe 3.4s ease-in-out infinite;
    transform-box: fill-box; transform-origin: 50% 100%;
    will-change: transform;   /* 잎이 많아도 숨쉬기 애니메이션이 끊기지 않게 층으로 올린다 */
}
@keyframes breathe { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.015); } }
.hero-art.pop .breathe { animation: heroPop .6s cubic-bezier(.34,1.56,.64,1); }
@keyframes heroPop { 0% { transform: scale(1); } 40% { transform: scale(1.13) translateY(-5px); } 100% { transform: scale(1); } }

.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hero-top .counter-row { flex: 1; min-width: 0; margin-bottom: 0; }

/* 단계 오를 때 반짝 */
.hero-art .levelup-ring {
    opacity: 0;
}
.hero-art.levelup .levelup-ring { animation: ringOut .9s ease-out; }
@keyframes ringOut {
    0%   { opacity: .85; transform: scale(.4); }
    100% { opacity: 0;   transform: scale(1.5); }
}

/* ── 카운터 ───────────────────────────── */
.counter-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.counter-num {
    font-size: clamp(62px, 19vw, 84px);
    font-weight: 800; color: var(--primary);
    letter-spacing: -3.5px; line-height: .92;
    font-variant-numeric: tabular-nums;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.counter-num.bump { transform: scale(1.14); }
.counter-denom { font-size: 24px; font-weight: 600; color: var(--sub); letter-spacing: -0.5px; }
.counter-num.over { color: var(--gold); }

.hero .progress-track { margin-top: 6px; }
.progress-track {
    width: 100%; height: 6px; background: rgba(255,255,255,.08);
    border-radius: 99px; margin-bottom: 14px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-soft));
    border-radius: 99px; transition: width .45s cubic-bezier(.34,1.56,.64,1);
}
.progress-fill.done { background: linear-gradient(90deg, var(--gold), #FF9F0A); }

/* ── 입력 ─────────────────────────────── */
.input-wrap { position: relative; margin-bottom: 10px; }
.interim-box {
    width: 100%; min-height: 54px;
    background: var(--surface-2); border-radius: 16px;
    padding: 15px 46px 15px 15px;
    font-size: 16px; color: var(--text);
    border: 1.5px solid transparent;
    resize: none; overflow: hidden; line-height: 1.5;
    transition: border-color .25s, background .25s;
    max-height: 110px;
}
.interim-box::placeholder { color: var(--sub); }
.interim-box:focus { border-color: var(--primary); outline: none; background: #1A1A1C; }
.send-btn {
    position: absolute; right: 9px; bottom: 9px;
    width: 32px; height: 32px;
    background: var(--primary); border: none; border-radius: 50%;
    color: #fff; font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, opacity .15s; opacity: .3;
}
.send-btn.active { opacity: 1; }
.send-btn:active { transform: scale(.88); }

/* ── 마이크 ───────────────────────────── */
.mic-btn {
    width: 100%; background: var(--primary); color: #fff; border: none;
    border-radius: 16px; padding: 16px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: transform .15s, background .25s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mic-btn:active { transform: scale(.98); }
.mic-btn.recording { background: var(--red); animation: pulse 1.5s infinite; }
.mic-btn.armed { animation: pulseSoft 1.6s infinite; }
.mic-btn[disabled] { background: var(--surface-3); color: var(--sub); animation: none; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255,69,58,.45); }
    70% { box-shadow: 0 0 0 14px rgba(255,69,58,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,69,58,0); }
}
@keyframes pulseSoft {
    0% { box-shadow: 0 0 0 0 rgba(10,132,255,.55); }
    70% { box-shadow: 0 0 0 12px rgba(10,132,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(10,132,255,0); }
}
.mic-hint { font-size: 11.5px; color: var(--dim); text-align: center; min-height: 15px; margin-top: 6px; line-height: 1.35; }

/* ── 목록 ─────────────────────────────── */
.list-label {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 12px; font-weight: 600; color: var(--sub);
    letter-spacing: .6px; margin: 12px 0 10px;
}
.list-count { color: var(--dim); font-weight: 500; letter-spacing: 0; }

.list-viewport {
    perspective: 800px;
    flex: 1 1 auto;
    min-height: 62px;
    overflow-y: auto; overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* 아래로 갈수록 살짝 흐려지는 마감 */
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 72%, rgba(0,0,0,.25) 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 72%, rgba(0,0,0,.25) 100%);
}
.list-viewport::-webkit-scrollbar { width: 4px; }
.list-viewport::-webkit-scrollbar-thumb { background: #48484A; border-radius: 10px; }
.list-track { transform-style: preserve-3d; padding: 2px 2px 6px; }

.list-item {
    background: var(--surface-2);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 7px;
    border: 1px solid rgba(255,255,255,.04);
    display: flex; gap: 10px; align-items: flex-start;
    transform-origin: top center;
    /* 새 항목이 위로 끼어들 때 아래 항목들이 부드럽게 작아지며 밀린다 */
    transition: transform .38s cubic-bezier(.25,.9,.3,1), opacity .38s ease, margin-bottom .38s ease;
}
.list-item:last-child { margin-bottom: 0; }

/* 아래로 갈수록 조금씩 작아지고 흐려진다 */
.list-item:nth-child(1)   { transform: scale(1)     translateZ(0);      opacity: 1;    }
.list-item:nth-child(2)   { transform: scale(.972)  translateZ(-10px);  opacity: .93;  }
.list-item:nth-child(3)   { transform: scale(.948)  translateZ(-20px);  opacity: .86;  }
.list-item:nth-child(4)   { transform: scale(.928)  translateZ(-30px);  opacity: .79;  }
.list-item:nth-child(5)   { transform: scale(.912)  translateZ(-38px);  opacity: .72;  }
.list-item:nth-child(6)   { transform: scale(.900)  translateZ(-44px);  opacity: .66;  }
.list-item:nth-child(n+7) { transform: scale(.892)  translateZ(-48px);  opacity: .60;  }

/* 새로 들어온 항목: 위에서 툭 떨어진다 */
.list-item.enter { animation: itemDrop .42s cubic-bezier(.25,1.2,.4,1); }
@keyframes itemDrop {
    0%   { opacity: 0; transform: translateY(-14px) scale(.9); }
    60%  { opacity: 1; }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.list-item-num {
    font-size: 11px; font-weight: 700; color: var(--primary-soft);
    min-width: 30px; padding-top: 2px; font-variant-numeric: tabular-nums;
}
.list-item-text { font-size: 14px; line-height: 1.5; color: var(--text); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-item-time { font-size: 10.5px; color: var(--dim); padding-top: 3px; flex: none; }

.list-more {
    text-align: center; font-size: 11.5px; color: var(--dim);
    padding: 10px 6px 4px; line-height: 1.5;
}
.list-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 13px; color: var(--dim); line-height: 1.7;
    pointer-events: none;
}
.list-empty[hidden] { display: none; }

/* ── 축하 배지 ────────────────────────── */
.milestone-badge {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--surface); border-radius: 24px;
    padding: 28px 38px; text-align: center; z-index: 9000;
    box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 .5px rgba(255,255,255,.08);
    transition: transform .5s cubic-bezier(.34,1.56,.64,1);
    pointer-events: none;
}
.milestone-badge.show { transform: translate(-50%, -50%) scale(1); }
.milestone-badge .emoji { font-size: 50px; display: block; margin-bottom: 8px; }
.milestone-badge .label { font-size: 21px; font-weight: 800; }
.milestone-badge .sub { font-size: 13.5px; color: var(--sub); margin-top: 4px; }

/* ── 메뉴 시트 ────────────────────────── */
.sheet-scrim {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 800;
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.sheet-scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
    /* 오른쪽에서 왼쪽으로 반쯤만 나오는 서랍 */
    position: fixed; top: 0; bottom: 0; right: 0; left: auto;
    width: min(62%, 340px); min-width: 232px;
    margin: 0;
    background: #141416;
    border-radius: 22px 0 0 22px;
    z-index: 900;
    transform: translateX(102%);
    transition: transform .34s cubic-bezier(.32,.72,0,1);
    box-shadow: -14px 0 44px rgba(0,0,0,.6), 0 0 0 .5px rgba(255,255,255,.08);
    display: flex; flex-direction: column;
    padding-top: max(10px, var(--sat));
    padding-bottom: var(--sab);
}
.sheet.show { transform: translateX(0); }
.sheet-grip { display: none; }
.sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 18px 12px; flex: none;
}
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.4px; flex: 1; }
.sheet-back {
    width: 32px; height: 32px; border-radius: 50%; border: none; flex: none;
    background: var(--surface-2); color: var(--text); font-size: 20px; line-height: 1;
    cursor: pointer; margin-right: 10px; padding: 0 3px 3px 0;
}
.sheet-back[hidden] { display: none; }
.sheet-back:active { transform: scale(.9); }
.sheet-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: var(--surface-2); color: var(--sub); font-size: 14px; cursor: pointer;
}
.sheet-close:active { transform: scale(.9); }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 16px 20px; }
.pane[hidden] { display: none; }

.row {
    width: 100%; display: flex; align-items: center; gap: 13px;
    background: var(--surface); border: none; border-radius: 16px;
    padding: 15px 15px; margin-bottom: 8px; cursor: pointer;
    text-align: left; color: var(--text);
    transition: transform .13s, background .2s;
}
.row:active { transform: scale(.985); background: var(--surface-2); }
.row-ico { font-size: 20px; flex: none; width: 24px; text-align: center; }
.row-txt { flex: 1; min-width: 0; }
.row-txt b { display: block; font-size: 15.5px; font-weight: 600; }
.row-txt i { display: block; font-style: normal; font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.row-arrow { color: var(--dim); font-size: 20px; flex: none; }

.sheet-foot { text-align: center; font-size: 11.5px; color: var(--dim); padding: 14px 0 4px; }

.pane-lead { font-size: 14px; color: var(--sub); line-height: 1.6; margin-bottom: 14px; }
.pane-note { font-size: 12px; color: var(--dim); line-height: 1.6; margin-top: 10px; text-align: center; }

.chip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.chip {
    background: var(--surface); border: 1.5px solid transparent; border-radius: 14px;
    padding: 13px 4px; color: var(--text); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: transform .13s, border-color .2s, background .2s;
    font-variant-numeric: tabular-nums;
}
.chip small { display: block; font-size: 10.5px; color: var(--sub); font-weight: 500; margin-top: 2px; }
.chip:active { transform: scale(.95); }
.chip.on { border-color: var(--primary); background: rgba(10,132,255,.13); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 7px; }
.field input {
    width: 100%; padding: 14px 15px; background: var(--surface-2); color: var(--text);
    border: 1.5px solid transparent; border-radius: 14px; font-size: 16px;
}
.field input:focus { border-color: var(--primary); outline: none; }

.primary, .secondary, .danger {
    width: 100%; padding: 15px; border: none; border-radius: 16px;
    font-size: 15.5px; font-weight: 600; cursor: pointer; margin-bottom: 9px;
    transition: transform .14s;
}
.primary { background: var(--primary); color: #fff; }
.secondary { background: var(--surface-2); color: var(--text); }
.danger { background: rgba(255,69,58,.15); color: var(--red); }
.primary:active, .secondary:active, .danger:active { transform: scale(.98); }

/* 나무 도감 */
.tree-now {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border-radius: 18px; padding: 12px 14px; margin-bottom: 14px;
}
.tree-now-art { width: 86px; height: 102px; flex: none; }
.tree-now-art svg { width: 100%; height: 100%; display: block; }
.tree-now-txt { min-width: 0; }
.tree-now-txt b { display: block; font-size: 16px; font-weight: 700; color: #E0A93A; }
.tree-now-txt span { display: block; font-size: 12.5px; color: var(--sub); line-height: 1.55; margin-top: 4px; }

.tree-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tree-cell {
    background: var(--surface); border-radius: 12px; padding: 5px 2px 6px; text-align: center;
    border: 1.5px solid transparent;
}
.tree-cell svg { width: 100%; height: 56px; display: block; }
.tree-grid.few { grid-template-columns: repeat(3, 1fr); }
.tree-grid.few .tree-cell svg { height: 78px; }
.tree-cell b { display: block; font-size: 10.5px; font-weight: 700; color: var(--sub); margin-top: 2px; }
.tree-cell i {
    display: block; font-style: normal; font-size: 10px; color: var(--sub);
    margin-top: 1px; line-height: 1.25; height: 25px; overflow: hidden;
}
.tree-cell.on { border-color: #E0A93A; background: rgba(224,169,58,.13); }
.tree-cell.on b { color: #E0A93A; }
.tree-cell.dim svg { opacity: .42; }
.tree-cell.dim b, .tree-cell.dim i { color: var(--dim); }

/* 기록 */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat {
    background: var(--surface); border-radius: 16px; padding: 13px 6px; text-align: center;
}
.stat b { display: block; font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 11.5px; color: var(--sub); margin-top: 2px; }

.hist-day { background: var(--surface); border-radius: 16px; margin-bottom: 8px; overflow: hidden; }
.hist-head {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 14px 15px; background: none; border: none; color: var(--text);
    cursor: pointer; text-align: left;
}
.hist-date { flex: 1; font-size: 14.5px; font-weight: 600; }
.hist-date small { display: block; font-size: 11.5px; color: var(--sub); font-weight: 500; margin-top: 2px; }
.hist-badge {
    font-size: 12px; font-weight: 700; color: var(--primary);
    background: rgba(10,132,255,.14); padding: 5px 9px; border-radius: 9px;
    font-variant-numeric: tabular-nums; flex: none;
}
.hist-badge.done { color: var(--gold); background: rgba(255,214,10,.14); }
.hist-arrow { color: var(--dim); font-size: 13px; transition: transform .25s; flex: none; }
.hist-day.open .hist-arrow { transform: rotate(90deg); }
.hist-body { display: none; padding: 0 15px 14px; }
.hist-day.open .hist-body { display: block; }
.hist-wish {
    background: rgba(255,214,10,.10); border-radius: 12px; padding: 11px 13px;
    font-size: 13.5px; line-height: 1.55; margin-bottom: 10px; color: #FFE98A;
    overflow-wrap: anywhere;
}
.hist-wish b { display: block; font-size: 11px; color: var(--gold); margin-bottom: 3px; font-weight: 700; }
.hist-item {
    display: flex; gap: 9px; font-size: 13px; line-height: 1.55;
    padding: 7px 0; border-top: .5px solid var(--separator); color: var(--sub);
}
.hist-item:first-child { border-top: none; }
.hist-item i { font-style: normal; color: var(--dim); font-size: 11px; flex: none; min-width: 26px; }
.hist-item span { min-width: 0; overflow-wrap: anywhere; }
.hist-empty { text-align: center; color: var(--dim); font-size: 13px; padding: 26px 0; line-height: 1.7; }

/* 설명 */
.guide h3 { font-size: 15.5px; font-weight: 700; margin: 18px 0 7px; letter-spacing: -.3px; }
.guide h3:first-child { margin-top: 0; }
.guide p { font-size: 13.5px; line-height: 1.72; color: var(--sub); margin-bottom: 7px; }
.guide b { color: var(--text); font-weight: 600; }

.privacy-box {
    background: rgba(48,209,88,.10); border: .5px solid rgba(48,209,88,.25);
    border-radius: 16px; padding: 15px; margin-bottom: 14px;
}
.privacy-box b { display: block; font-size: 14.5px; color: var(--green); margin-bottom: 7px; }
.privacy-box p { font-size: 13px; line-height: 1.68; color: var(--sub); margin-bottom: 7px; }
.privacy-box p:last-child { margin-bottom: 0; }

/* ── 모달 ─────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.72);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    justify-content: center; align-items: center; z-index: 1000;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--surface); border-radius: 28px; padding: 30px 22px 24px;
    width: 100%; max-width: 340px; text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 0 .5px rgba(255,255,255,.08);
    max-height: 92vh; max-height: 92dvh; overflow-y: auto;
    animation: modalIn .4s cubic-bezier(.34,1.4,.64,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.genie-emoji { font-size: 54px; margin-bottom: 10px; animation: genieFloat 2.6s ease-in-out infinite; }
@keyframes genieFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.modal-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 7px; }
.modal-box p { color: var(--sub); font-size: 13.5px; line-height: 1.6; margin-bottom: 18px; }
.modal-input {
    width: 100%; padding: 14px 16px; background: var(--surface-2); color: var(--text);
    border: 1.5px solid transparent; border-radius: 14px; font-size: 16px;
    margin-bottom: 12px; text-align: center;
}
.modal-input::placeholder { color: var(--sub); }
.modal-input:focus { border-color: var(--primary); outline: none; }
.modal-btn {
    width: 100%; padding: 16px; background: var(--primary); color: #fff;
    border: none; border-radius: 16px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: transform .15s;
}
.modal-btn:active { transform: scale(.97); }
.modal-ghost {
    width: 100%; padding: 12px; background: none; border: none;
    color: var(--sub); font-size: 13.5px; cursor: pointer; margin-top: 6px;
}
.onboard .onboard-art { height: 116px; margin-bottom: 8px; }
.onboard .onboard-art svg { width: auto; }
.onboard .onboard-art svg { height: 100%; }
.onboard-note { font-size: 11.5px !important; color: var(--dim) !important; margin: 12px 0 0 !important; }

/* ── 토스트 ───────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: calc(28px + var(--sab));
    transform: translateX(-50%) translateY(16px);
    background: rgba(58,58,60,.96); color: #fff;
    padding: 12px 18px; border-radius: 14px; font-size: 13.5px;
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
    z-index: 11000; max-width: 84vw; text-align: center; line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 키보드가 올라온 동안 — 나무 칸을 접어 마이크 버튼이 안 잘리게 */
.card.kb .hero-art { display: none; }
.card.kb .hero { padding: 8px 12px; margin: 8px 0; }
.card.kb .counter-num { font-size: 38px; }
.card.kb .mic-hint { font-size: 10.5px; margin-top: 3px; min-height: 0; }
.card.kb .list-label { margin: 8px 0 7px; }

/* ── 좁은 화면 대응 ───────────────────── */
@media (max-height: 700px) {
    .hero { margin: 9px 0 8px; padding: 8px 10px; }
    .hero-art { width: 74px; height: 86px; }
    .counter-num { font-size: clamp(52px, 16vw, 68px); }
    .mic-btn { padding: 14px; }
    .list-label { margin: 9px 0 8px; }
    .card { padding: 16px 16px 14px; border-radius: 24px; }
}
@media (max-height: 620px) {
    .hero-art { width: 64px; height: 74px; }
    .counter-num { font-size: clamp(46px, 14vw, 58px); }
    .interim-box { min-height: 48px; padding: 13px 44px 13px 14px; }
    .mic-hint { font-size: 10.5px; margin-top: 3px; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    html, .list-viewport, .sheet-body { scroll-behavior: auto !important; }
}

/* ── 지난 기록 = 달력 ─────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 10px; }
.cal-head b { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.cal-nav {
    width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2);
    color: var(--text); font-size: 20px; line-height: 1; flex: none;
}
.cal-nav:active { transform: scale(.92); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: 11px; color: var(--dim); font-weight: 600; }
.cal-dow span:first-child { color: #FF6B6B; }
.cal-dow span:last-child  { color: #6FA8FF; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
    position: relative; aspect-ratio: 1 / 1.24;
    border-radius: 11px; background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px;
    border: 1.5px solid transparent; padding: 4px 0 3px; overflow: hidden;
}
.cal-cell.empty { background: none; }
.cal-d { font-size: 12.5px; font-weight: 600; color: var(--sub); line-height: 1; }
.cal-n { font-size: 11px; font-weight: 700; color: var(--primary); line-height: 1; }
.cal-cell.today { border-color: rgba(255,255,255,.28); }
.cal-cell.picked { border-color: var(--primary); background: rgba(10,132,255,.14); }
/* 목표를 채운 날 — 참 잘했어요 도장 */
.cal-cell.perfect { background: rgba(224,169,58,.14); }
.cal-cell.perfect .cal-d { color: var(--gold); }
.cal-stamp {
    font-size: 7.6px; font-weight: 800; color: #FF5A4E; line-height: 1.1;
    border: 1.5px solid #FF5A4E; border-radius: 50%;
    width: 29px; height: 29px; display: flex; align-items: center; justify-content: center;
    text-align: center; letter-spacing: -.5px; transform: rotate(-12deg);
    margin-top: 1px; opacity: .96;
}
.cal-cell.perfect { background: rgba(255,90,78,.10); }
.cal-cell.perfect .cal-d { color: #FF8A80; }
.cal-det-head { margin: 14px 0 8px; font-size: 14px; font-weight: 700; color: var(--text); }

/* 앱 설명 */
.guide-lead { font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--text); margin-bottom: 16px; }
.guide-note { color: var(--sub); font-size: 12.5px; }
#guide-backup { margin-top: 14px; }


/* ── 소원 화면 (크게) ─────────────────── */
.genie-full { padding: 0; align-items: stretch; }
.genie-box {
    max-width: 100%; width: 100%; border-radius: 0;
    max-height: none; height: 100%;
    padding: max(24px, var(--sat)) 22px max(18px, var(--sab));
    display: flex; flex-direction: column; justify-content: center; gap: 0;
    box-shadow: none; background: #0E0E10;
}
.genie-box .genie-stage { width: min(74vw, 300px); height: min(74vw, 300px); margin: 0 auto 14px; }
.wish-big {
    min-height: 108px; font-size: 20px; font-weight: 600; line-height: 1.5;
    padding: 18px 16px; border-radius: 18px; resize: none; text-align: center;
    margin-bottom: 10px;
}
/* 음성으로 말하기 — 소원 이루어지기와 같은 크기 */
.wish-mic {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--surface-2); color: var(--text); margin-bottom: 10px;
}
.wish-mic .wish-mic-ico { font-size: 18px; }
.wish-mic.on { background: rgba(255,59,48,.18); color: #FF6B6B; }
@media (max-height: 760px) {
    .genie-box .genie-stage { width: min(52vw, 210px); height: min(52vw, 210px); margin-bottom: 10px; }
    .wish-big { min-height: 84px; font-size: 18px; }
}

/* ── 지니 (램프에서 솟아오른다) ────────── */
.genie-stage { width: 190px; height: 200px; margin: 0 auto 4px; }
.gn-img {
    width: 100%; height: 100%; object-fit: contain; display: block;
    animation: gnRise 1.1s cubic-bezier(.22,1,.36,1) both, gnFloat 4s ease-in-out 1.2s infinite;
    transform-origin: 50% 92%;
}
@keyframes gnRise { 0% { opacity: 0; transform: translateY(46px) scale(.22); }
                    55% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes gnFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .gn-img { animation: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 소원 이루어지기 = 위쪽 동그란 아이콘 ── */
.wish-top { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 8px; padding-top: 6px; }
.wish-star {
    width: 74px; height: 74px; border-radius: 50%; border: none; padding: 0;
    background: radial-gradient(circle at 34% 28%, #FFF3C4, #F7D774 42%, #E0A93A 72%, #A9741C);
    box-shadow: 0 0 0 1.5px rgba(255,235,170,.55), 0 8px 26px rgba(224,169,58,.35);
    display: flex; align-items: center; justify-content: center;
    animation: wsPulse 1.5s ease-in-out infinite;
}
.wish-star-mark { font-size: 34px; color: #6B4708; line-height: 1; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.wish-star-cap { font-size: 14px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.35; margin-top: 2px; }
.wish-star-cap small { font-size: 12px; font-weight: 600; color: #E0A93A; animation: wsBlink 1.5s ease-in-out infinite; display: inline-block; }
@keyframes wsBlink { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.wish-star:active { transform: scale(.94); }
@keyframes wsPulse {
    0%,100% { transform: scale(1);    box-shadow: 0 0 0 1.5px rgba(255,235,170,.5),  0 8px 24px rgba(224,169,58,.3); }
    50%     { transform: scale(1.14); box-shadow: 0 0 0 2px   rgba(255,235,170,.95), 0 10px 44px rgba(224,169,58,.75); }
}

/* 눌렀을 때 — 모두 별로 빨려 들어가 반짝이며 사라진다 */
.genie-box.granting .genie-stage,
.genie-box.granting .wish-big,
.genie-box.granting .wish-mic {
    animation: wsSuck .78s cubic-bezier(.55,0,.9,.3) forwards;
}
.genie-box.granting .wish-big  { animation-delay: .05s; }
.genie-box.granting .wish-mic  { animation-delay: .1s; }
.genie-box.granting .wish-star-cap { animation: wsFade .3s forwards; }
.genie-box.granting .wish-star { animation: wsFlash 1.1s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes wsSuck {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-46vh) scale(.04); }
}
@keyframes wsFade { to { opacity: 0; } }
@keyframes wsFlash {
    0%   { transform: scale(1);   filter: brightness(1); }
    45%  { transform: scale(1.5); filter: brightness(2.6); }
    70%  { transform: scale(2.4); filter: brightness(4); opacity: .9; }
    100% { transform: scale(.1);  filter: brightness(6); opacity: 0; }
}
/* 별가루 */
.wish-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wish-burst i {
    position: absolute; left: 50%; top: 22%;
    width: 6px; height: 6px; border-radius: 50%;
    background: #FFF3C4; box-shadow: 0 0 10px 3px rgba(255,220,120,.9);
    opacity: 0; transform: translate(-50%, -50%);
}
.genie-box.granting .wish-burst i { animation: wsSpark .85s ease-out forwards; }
@keyframes wsSpark {
    0%   { opacity: 0; transform: translate(-50%,-50%) scale(.4); }
    18%  { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2); }
}
.genie-box { position: relative; }
