/* 우리의 1년 2차: 쇼릴 문법(박 충격·띠 타이포·바탕색 전환) + 러블리 4색 */
:root {
  --blush: #FFEFF2;
  --rose: #FF4D7E;
  --lav: #8F7BFF;
  --plum: #2B0F1E;
  --white: #FFF8FA;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #f7dfe5; overflow: hidden; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--plum);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* 무대: --bg/--ink/--acc는 바탕색 면에 따라 스크립트가 바꾼다 */
.stage {
  --bg: var(--blush); --ink: var(--plum); --acc: var(--rose);
  position: fixed; inset: 0; margin: 0 auto;
  width: min(100vw, 520px); height: 100%;
  overflow: hidden; color: var(--ink);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.stage > * { position: absolute; }
.field { inset: 0; background: var(--bg); }
.strips { inset: 0; pointer-events: none; }
.strips i { position: absolute; top: 0; bottom: 0; transform-origin: 0 50%; transform: scaleX(0); }
.strips.h i { left: 0; right: 0; top: auto; bottom: auto; transform-origin: 50% 0; transform: scaleY(0); }

/* 시작 화면 */
.start {
  inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 24px calc(14vh + env(safe-area-inset-bottom, 0px)); text-align: center; z-index: 30;
}
.start .kicker { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; opacity: .55; font-variant-numeric: tabular-nums; }
.start h1 { margin: 0; font-size: clamp(30px, 9vw, 42px); font-weight: 900; letter-spacing: -.03em; }
.start .sub { margin: 8px 0 28px; opacity: .6; font-size: 15px; }
.start .credit { margin: 22px 0 0; font-size: 11px; opacity: .4; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; padding: 0 24px; border-radius: 999px;
  border: 2px solid var(--plum); background: transparent;
  font-size: 16px; font-weight: 800; text-decoration: none; color: var(--plum); cursor: pointer;
}
.btn.primary { background: var(--rose); border-color: var(--rose); color: #fff; box-shadow: 4px 4px 0 var(--plum); }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--plum); }

.mute {
  top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 40;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(43, 15, 30, .08);
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.mute svg { width: 20px; height: 20px; fill: currentColor; }
.mute.off .wave { opacity: 0; }

/* 하트 */
.heart { left: 0; top: 0; width: 100px; height: 90px; fill: var(--acc); z-index: 15; transform-origin: 50% 50%; overflow: visible; }  /* 박자 펄스로 커진 하트가 틀에 잘리지 않게 */
.heart path { transform-box: fill-box; }

/* 오프닝 선 */
.lines { inset: 0; pointer-events: none; }
.lines i { position: absolute; left: -10%; right: -10%; top: 50%; height: 12px; margin-top: -6px; background: var(--rose); visibility: hidden; }

/* 카운터 */
.counter {
  left: 0; right: 0; top: calc(4.5vh + env(safe-area-inset-top, 0px));
  display: flex; align-items: baseline; justify-content: center; z-index: 12; visibility: hidden;
}
/* 숫자가 굴러가는 위아래만 자르고 좌우는 자르지 않는다. 칸 너비는 Pretendard 900 숫자 잉크 폭 최대 .617em(0)보다 넓게 */
.odo { display: inline-flex; font-size: clamp(60px, 18vw, 88px); font-weight: 900; letter-spacing: -.05em; line-height: 1; height: 1em; clip-path: inset(0 -20% 0 -20%); }
.odo .col { display: block; width: .66em; height: 1em; clip-path: inset(0 -20% 0 -20%); }
.odo .col b { display: block; font-weight: 900; text-align: center; }
.odo .col b span { display: block; height: 1em; }
.counter .unit { font-size: clamp(22px, 6vw, 30px); font-weight: 900; margin: 0 12px 0 2px; }
.counter .date { font-size: 14px; font-weight: 700; letter-spacing: .04em; opacity: .7; font-variant-numeric: tabular-nums; }
.counter.noday .odo, .counter.noday .unit { display: none; }
.counter.noday .date { font-size: 26px; font-weight: 900; opacity: 1; }

/* 1일 전화 */
.phone {
  left: 50%; top: 46%; width: 44%; aspect-ratio: 9 / 16; margin: calc(-0.5 * 44% * 16 / 9) 0 0 -22%;
  border-radius: 30px; background: var(--plum); color: var(--blush);
  display: flex; flex-direction: column; align-items: center; justify-content: center; visibility: hidden;
}
.phone .ring-waves { position: relative; width: 64px; height: 64px; }
.phone .ring-waves i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--rose); }
.phone .handset { position: absolute; width: 30px; height: 30px; fill: var(--blush); top: calc(50% - 15px - 16px); }
.phone .call { margin: 26px 0 0; font-size: 14px; font-weight: 700; opacity: .7; }
.phone > * { opacity: 0; }

/* 사진 스티커: 색 블록 + 띠로 잘린 사진 */
.stack { inset: 0; pointer-events: none; }
.ph { position: absolute; left: 50%; top: 53%; visibility: hidden; }
.ph .blk { position: absolute; inset: 0; border-radius: 18px; transform: translate(12px, 12px); }
.ph .win { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; }
.ph .bd { position: absolute; left: 0; width: 100%; background-repeat: no-repeat; will-change: transform; }

/* 기념일 도장: 큰 원(이전 바탕색)이 조여서 도장이 된다 */
.stamps { inset: 0; pointer-events: none; }
.stamp {
  position: absolute; left: 50%; top: 53%; width: 58%; aspect-ratio: 1; margin: -29% 0 0 -29%;
  border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  visibility: hidden; overflow: hidden;
}
.stamp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stamp .tx { position: relative; display: flex; flex-direction: column; align-items: center; }
.stamp b { font-size: clamp(54px, 16vw, 78px); font-weight: 900; letter-spacing: -.05em; line-height: 1; }
.stamp small { margin-top: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.stamp.photo b { color: #fff; text-shadow: 0 2px 18px rgba(43, 15, 30, .45); }
.stamp.photo small { color: #fff; }

/* 1주년 차트와 벽 */
.chart { left: 0; top: 0; width: 100%; height: 100%; overflow: visible; visibility: hidden; }
.chart text { font-family: inherit; }
.wall { left: 50%; top: 52%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.wall img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; visibility: hidden; display: block; }

/* 거리 */
.dist { inset: 0; visibility: hidden; }
.d-map { position: absolute; left: 12%; right: 12%; top: 50%; height: 4px; }
.d-line { position: absolute; left: 0; right: 0; top: 0; height: 4px; display: flex; justify-content: space-between; transform-origin: 50% 50%; }
.d-line i { width: 3%; height: 4px; border-radius: 2px; background: var(--ink); opacity: .7; }
.d-dot { position: absolute; top: -10px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 4px var(--white); }
.d-dot span { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 14px; font-weight: 800; font-style: normal; color: var(--ink); }
#dA { left: 0; } #dB { left: 100%; }

/* 띠로 잘린 문구: 같은 블록을 띠 수만큼 겹치고 각자 한 띠만 보인다 */
.says { inset: 0; pointer-events: none; }
.say { position: absolute; left: 6%; right: 6%; top: 0; visibility: hidden; }
.say .sl { position: absolute; left: 0; right: 0; top: 0; text-align: center; will-change: transform; }
.say .sz { visibility: hidden; text-align: center; }
.say p { margin: 0; white-space: nowrap; font-size: clamp(26px, 8vw, 40px); font-weight: 900; letter-spacing: -.035em; line-height: 1.22; }
.say .xl { font-size: clamp(54px, 17vw, 84px); letter-spacing: -.05em; line-height: 1.05; }
.say .xxl { font-size: clamp(96px, 30vw, 150px); letter-spacing: -.06em; line-height: .95; }
.say .sm { font-size: clamp(18px, 5vw, 22px); font-weight: 800; letter-spacing: -.01em; line-height: 1.5; }
.say .hand { font-family: "Nanum Pen Script", cursive; font-weight: 400; font-size: clamp(50px, 15vw, 76px); letter-spacing: 0; line-height: 1; }
.say .acc { color: var(--acc); }
.say .n { font-variant-numeric: tabular-nums; }

/* 반지 */
.ring { left: 50%; top: 44%; width: 58%; aspect-ratio: 200 / 220; margin: calc(-0.5 * 58% * 220 / 200) 0 0 -29%; visibility: hidden; z-index: 14; }
.ring svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.ring .spark {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; background: var(--rose);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.ring .spark:nth-of-type(1) { left: 16%; top: 14%; } .ring .spark:nth-of-type(2) { left: 86%; top: 10%; background: var(--lav); }
.ring .spark:nth-of-type(3) { left: 94%; top: 46%; background: #f2c45a; } .ring .spark:nth-of-type(4) { left: 6%; top: 50%; background: var(--lav); }

/* 선물상자 */
.gift {
  left: 50%; top: 47%; width: 58%; aspect-ratio: 1; margin: -29% 0 0 -29%; padding: 0; border: 0; background: none;
  visibility: hidden; cursor: pointer; z-index: 16;
}
.gift:disabled { cursor: default; }
.gift svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.gift .bubble {
  position: absolute; left: 50%; top: -12%; transform: translateX(-50%);
  padding: 9px 18px; border-radius: 18px; background: var(--plum); color: var(--blush); font-weight: 900; font-size: 17px; white-space: nowrap;
  opacity: 0;
}
.gift .bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--plum); }

.fx { inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 18; }

/* 선물 영상 */
.reveal {
  left: 0; right: 0; top: 0; bottom: 0; visibility: hidden; z-index: 17;
  /* 화면이 낮으면(가로 모드 등) 저장 버튼까지 스크롤로 닿게. 남는 높이는 위아래 빈칸이 나눠 가운데 정렬 */
  display: flex; flex-direction: column; overflow-y: auto;
  /* 오른쪽·아래 그림자 10px가 스크롤 영역 안에 들어오게 그만큼 더 비운다 */
  padding: 16px calc(5% + 10px) 26px 5%;
}
.reveal::before, .reveal::after { content: ""; flex: 1 0 0; }
.reveal .screen { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 10px 10px 0 var(--plum); }
.reveal video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.tap-play { position: absolute; inset: 0; margin: auto; width: 160px; height: 52px; border-radius: 999px; border: 0; background: var(--rose); color: #fff; font-weight: 800; }
.reveal .screen, .after { flex-shrink: 0; }
.after { margin-top: 32px; text-align: center; visibility: hidden; }
.after .hint { margin: 14px auto 18px; max-width: 30em; font-size: 12.5px; line-height: 1.55; opacity: .7; }
.after .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
