/* 인생샷 웹 데모 — 앱의 PURE 배치를 그대로 옮긴 단일 페이지 스타일.
   수치는 spec.json 의 layout.constants(393pt) 그대로이고 화면 폭 배율 --u 만 곱한다.
   색도 spec.json 의 palette 값이며 JS 가 같은 값으로 덮어써 낮/밤을 맡는다.
   낮/밤과 글자 크기는 <html> 의 data-theme·data-text-size 가 정하고, 그 둘은 JS 가 얹는다. */

:root {
  /* palette.day */
  --ground: #F5F5F5;
  --sheet: #FFFFFF;
  --ink: #0A0A0A;
  --dim: #737373;
  --line: #E5E5E5;
  --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  /* onTargetGold — 유일한 유채색, 뜻은 '지금 찍어도 된다' 하나뿐 */
  --gold: #E8B54A;
  --gold-text: #1A1200;
  /* 토스트 바탕(ink 92%). hex 는 섞을 수 없어 JS 가 palette 값으로 덮어쓴다. */
  --ink-92: rgba(10, 10, 10, 0.92);

  /* layout.constants (pt) */
  --u: 1px;
  --topRowHeight: 62;
  --topCircleSize: 34;
  --topCircleGap: 8;
  --topCircleLabelGap: 3;
  --topRowTrailingInset: 22;
  --chipRowHeight: 32;
  --chipGap: 8;
  --buttonRowHeight: 96;
  --buttonRowTopInset: 14;
  --buttonCircleSize: 48;
  --buttonSlotWidth: 56;
  --buttonSlotGap: 14;
  --buttonLabelFontSize: 10;
  --shutterOuterSize: 80;
  --shutterInnerSize: 56;
  --pillHeight: 28;
  --pillInset: 14;
  --topScrimHeight: 96;
  --tapTargetSize: 44;

  /* layout.formulas 가 푼 화면 좌표(px) — JS 가 배치마다 덮어쓴다 */
  --top-top: 59px;
  --photo-top: 137px;
  --photo-h: 524px;
  --chip-top: 678px;
  --btn-top: 722px;
  --pill-bottom: 14px;
  --bubble-top: 687px;
  --bubble-left: 8px;
  --bubble-tail-dx: -88px;
  --sheet-h: 613px;
  --btnx0: 44.5px;
  --btnx1: 114.5px;
  --btnx2: 278.5px;
  --btnx3: 348.5px;

  --font: -apple-system, "Apple SD Gothic Neo", Roboto, "Noto Sans KR", sans-serif;
  --anim: 0.2s;   /* overlayStyle.onTargetAnimation */

  /* 큰글자 배율 — 읽는 글에만 곱한다. 카메라 배치 수치(알약·버튼 줄)는 따라가지 않는다. */
  --text-scale: 1;
}

:root[data-text-size="large"] { --text-scale: 1.2; }

/* 낮/밤은 세 갈래다: 시스템 설정을 따르거나, 사용자가 밝게·어둡게로 못을 박거나.
   사용자가 고른 값이 시스템을 이겨야 하므로 밤 팔레트를 두 번 적는다 —
   (1) 시스템이 밤이고 「밝게」로 못 박히지 않았을 때, (2) 「어둡게」로 못 박혔을 때.
   같은 특이도라 (2)를 뒤에 두어 순서로 이긴다. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* palette.night */
    --ground: #0A0A0A;
    --sheet: #171717;
    --ink: #FAFAFA;
    --dim: #A3A3A3;
    --line: #262626;
    --card-shadow: none;
    --ink-92: rgba(250, 250, 250, 0.92);
  }
}

:root[data-theme="dark"] {
  /* palette.night */
  --ground: #0A0A0A;
  --sheet: #171717;
  --ink: #FAFAFA;
  --dim: #A3A3A3;
  --line: #262626;
  --card-shadow: none;
  --ink-92: rgba(250, 250, 250, 0.92);
}

/* 스크롤 막대·슬라이더 같은 브라우저 기본 부품도 고른 테마를 따라오게 한다 */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root { --anim: 0s; }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

.app {
  position: relative;
  width: 100%;
  max-width: 472px; /* 393pt * 1.2 — 데스크톱에서도 폰 한 칸처럼 보이게 */
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ground);
  -webkit-tap-highlight-color: transparent;
}

.safe-probe { position: fixed; top: 0; left: 0; width: 0; visibility: hidden; pointer-events: none; }
.safe-probe i { display: block; height: env(safe-area-inset-top, 0px); }
.safe-probe b { display: block; height: env(safe-area-inset-bottom, 0px); }

.screen { position: absolute; inset: 0; }

button, a, input { font-family: inherit; }
button { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* 아이콘 — 앱의 SF Symbols / Material Outlined 과 같은 모양(24 그리드 선화).
   색은 담긴 원에서 currentColor 로 받는다. */
.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic .fill { fill: currentColor; stroke: none; }
.ic .thin { stroke-width: 1.55; }
/* RecipeIcon: 뷰파인더 모서리는 앱과 같은 1.6 */
.ic-recipe .vf { stroke-width: 1.6; }
.ic-gear { stroke-width: 1.55; }

/* 보이는 크기는 그대로 두고 탭 영역만 tapTargetSize(44)까지 넓힌다 */
.topcircle, .chip, .pill-zoom { position: relative; }
.topcircle::after, .chip::after, .pill-zoom::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  width: calc(var(--tapTargetSize) * var(--u));
  height: calc(var(--tapTargetSize) * var(--u));
  transform: translate(-50%, -50%);
}

/* ── 화면 1 — 소개 ─────────────────────────────────────────── */

.screen-intro { overflow: hidden; background: var(--ground); }

.intro-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 24px calc(env(safe-area-inset-bottom, 0px) + 20px);
  text-align: center;
}

/* 보기 설정 묶음 — 글이 밑으로 지나가므로 sheet 바탕을 깔아 글자와 겹쳐 읽히지 않게 한다 */
.intro-tools {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.toolbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  /* tapTargetSize(44) — 보이는 크기가 곧 탭 영역이다 */
  width: calc(var(--tapTargetSize) * 1px);
  height: calc(var(--tapTargetSize) * 1px);
  border-radius: 13px;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  color: var(--ink);
}
.toolbtn:active { opacity: 0.7; }

.toolicon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.toolicon svg { width: 100%; height: 100%; }

/* 테마 아이콘 셋을 다 두고 지금 상태 하나만 보인다 — 아이콘을 JS 로 그리지 않아도 된다 */
.toolbtn .tic { display: none; }
.toolbtn[data-mode="system"] .tic-system,
.toolbtn[data-mode="light"] .tic-light,
.toolbtn[data-mode="dark"] .tic-dark { display: block; }

.toolaa { align-items: baseline; gap: 1px; }
.toolaa .aa-small { font-size: 11px; font-weight: 600; line-height: 1; }
.toolaa .aa-large { font-size: 17px; font-weight: 600; line-height: 1; }
.toolbtn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }

.intro-icon { width: 64px; height: 64px; border-radius: 15px; box-shadow: var(--card-shadow); }

.intro-title { margin: 10px 0 0; font-size: calc(26px * var(--text-scale)); font-weight: 600; letter-spacing: -0.02em; }

.intro-lead { margin: 6px auto 0; max-width: 300px; font-size: calc(14.5px * var(--text-scale)); line-height: 1.45; color: var(--ink); opacity: 0.8; }

/* 두 플랫폼의 실제 앱 캡처를 각각의 원본 비율로 전부 보여 준다. */
.intro-shots { display: flex; gap: 12px; justify-content: center; margin: 16px 0 0; }
.intro-shots figure { margin: 0; display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
.intro-shots img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 10px; background: var(--sheet);
}
.intro-shots figcaption { margin-top: auto; padding-top: 5px; font-size: calc(11px * var(--text-scale)); color: var(--dim); }

.intro-points { list-style: none; margin: 16px 0 0; padding: 0; text-align: left; }
.intro-points li {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--sheet); box-shadow: var(--card-shadow);
}
.intro-points li + li { margin-top: 6px; }
.intro-points b { display: block; font-size: calc(13.5px * var(--text-scale)); font-weight: 600; }
.intro-points span { display: block; margin-top: 2px; font-size: calc(12px * var(--text-scale)); line-height: 1.4; color: var(--dim); }
/* iOS 에는 진동 API 가 없다 — 안 울려도 고장이 아니다 */
.intro-points small { display: block; margin-top: 4px; font-size: calc(11px * var(--text-scale)); line-height: 1.4; color: var(--dim); opacity: 0.8; }

.intro-start {
  display: block; width: 100%; min-height: 54px; margin: 18px 0 0;
  border-radius: 27px; background: var(--ink); color: var(--ground);
  font-size: calc(17px * var(--text-scale)); font-weight: 600;
}
.intro-start:active { opacity: 0.85; }

.intro-note { margin: 8px auto 0; max-width: 320px; font-size: calc(11px * var(--text-scale)); line-height: 1.45; color: var(--dim); }

.intro-error {
  margin: 8px auto 0; max-width: 320px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--sheet);
  font-size: calc(12.5px * var(--text-scale)); line-height: 1.5; color: var(--ink);
}

/* 배지 원본·높이 40px을 보존한다. 준비중 칩은 사용자 요청대로
   배너 위 모서리에 겹치며, 후광에는 별도 배경판·윤곽선을 만들지 않는다. */
.store-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; justify-content: center; margin: 22px 0 0; }
.store-option { display: flex; flex-direction: column; align-items: center; }
.store-badge-frame { position: relative; padding: 10px; }
.store-badge-frame-available { isolation: isolate; }
.store-badge-frame-available::before {
  content: ""; position: absolute; inset: -12px -24px; z-index: -1;
  pointer-events: none; border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(232, 181, 74, 0.10) 0%,
    rgba(232, 181, 74, 0.26) 42%,
    rgba(232, 181, 74, 0) 72%);
}
:root[data-theme="dark"] .store-badge-frame-available::before { inset: -8px -16px; opacity: 0.45; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .store-badge-frame-available::before { inset: -8px -16px; opacity: 0.45; }
}
.store-badge { display: inline-flex; align-items: center; min-height: 44px; border-radius: 6px; }
.store-badge:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.store-badge img { display: block; height: 40px; width: auto; }
.store-badge-pending { position: relative; }
.store-status {
  display: inline-flex; align-items: center; gap: 4px; min-height: 20px; margin-top: 6px;
  font-size: calc(11px * var(--text-scale)); line-height: 1.4; color: var(--dim);
}
.store-pending-tag {
  position: absolute; right: -6px; bottom: calc(100% - 9px); z-index: 1;
  pointer-events: none;
  padding: 3px 10px; border: 1px solid var(--gold); border-radius: 999px;
  background: var(--gold); color: var(--gold-text); font-weight: 400;
  font-size: calc(13px * var(--text-scale)); line-height: 1.4; white-space: nowrap;
}

.store-note { margin: 10px auto 0; max-width: 320px; font-size: calc(11px * var(--text-scale)); line-height: 1.45; color: var(--dim); }

.intro-links { margin: 12px 0 0; display: flex; gap: 18px; justify-content: center; }
.intro-links a { font-size: calc(12.5px * var(--text-scale)); color: var(--dim); text-decoration: none; padding: 8px 2px; }
.intro-links a:hover, .intro-links a:focus-visible { color: var(--ink); text-decoration: underline; }

/* ── 화면 2 — 카메라 ───────────────────────────────────────── */

.screen-cam { background: var(--ground); }

/* 상단 줄: 원형 셋을 오른쪽 정렬 */
.cam-top {
  position: absolute;
  top: var(--top-top);
  right: calc(var(--topRowTrailingInset) * var(--u));
  height: calc(var(--topRowHeight) * var(--u));
  display: flex;
  align-items: center;
  gap: calc(var(--topCircleGap) * var(--u));
  z-index: 4;
}

.topbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--topCircleLabelGap) * var(--u));
  min-width: calc(var(--topCircleSize) * var(--u));
}

.topcircle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--topCircleSize) * var(--u));
  height: calc(var(--topCircleSize) * var(--u));
  border-radius: 50%;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  color: var(--ink);
}
.topcircle svg { width: 56%; height: 56%; }
.topbtn[data-on="1"] .topcircle { background: var(--ink); border-color: var(--ink); color: var(--ground); }

.toplabel { font-size: calc(10 * var(--u)); line-height: 1.2; color: var(--dim); white-space: nowrap; }

/* 사진 띠 — 크기는 --photo-h 만 정한다. video 의 내재 크기가 띠를 밀지 못하게
   min/max 로 못을 박는다(전·후면을 바꾸면 트랙 해상도가 달라진다). */
.cam-photo {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--photo-top);
  height: var(--photo-h);
  min-height: var(--photo-h);
  max-height: var(--photo-h);
  overflow: hidden;
  background: var(--ground);
  z-index: 1;
}

/* 카메라를 못 열었을 때: ground 바탕 + 이유 한 줄 */
.cam-novideo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
  background: var(--ground);
  color: var(--dim);
  font-size: calc(13px * var(--text-scale));
  line-height: 1.5;
  text-align: center;
}

.cam-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  background: #000;
  transform: scale(var(--video-zoom, 1));
  transform-origin: center;
}
.cam-photo[data-mirror="1"] .cam-video { transform: scale(var(--video-zoom, 1)) scaleX(-1); }
.cam-photo[data-video="0"] .cam-video { display: none; }

.cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.cam-scrim {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(var(--topScrimHeight) * var(--u));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0));
  pointer-events: none;
}

/* 안내 문구: 상자 없이 글자 + 그림자만 */
.cam-guide {
  position: absolute;
  /* 우상단 줌 알약과 겹치지 않게 양쪽을 알약 폭만큼 비운다 */
  left: calc(72 * var(--u));
  right: calc(72 * var(--u));
  top: calc(12 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4 * var(--u));
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.guide-line { display: flex; align-items: center; gap: calc(6 * var(--u)); }
.guide-arrow { font-size: calc(17 * var(--u)); font-weight: 600; line-height: 1; }
.guide-arrow:empty { display: none; }
.guide-msg { font-size: calc(15 * var(--u) * var(--text-scale)); font-weight: 600; line-height: 1.2; }
.guide-tip { font-size: calc(12 * var(--u) * var(--text-scale)); opacity: 0.86; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.guide-tip:empty, .guide-msg:empty { display: none; }

/* 사진 위 알약 (palette.photoOverlay.pill) */
.pill {
  display: inline-flex;
  align-items: center;
  height: calc(var(--pillHeight) * var(--u));
  padding: 0 calc(12 * var(--u));
  border-radius: 999px;
  font-size: calc(13 * var(--u));
  font-weight: 500;
  white-space: nowrap;
}
.pill-glass { background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; }
.pill-solid { background: #fff; color: #0A0A0A; }
.pill-gold { background: var(--gold); color: var(--gold-text); border: 0; }

.pill-zoom { position: absolute; top: calc(var(--pillInset) * var(--u)); right: calc(var(--pillInset) * var(--u)); z-index: 3; }
.pill-group {
  position: absolute;
  left: calc(var(--pillInset) * var(--u));
  bottom: var(--pill-bottom);
  display: flex;
  gap: calc(6 * var(--u));
  z-index: 3;
}
.pill-mode { position: absolute; right: calc(var(--pillInset) * var(--u)); bottom: var(--pill-bottom); z-index: 3; }

/* 센서를 못 쓰는 기기용 기울기 슬라이더 — 알약 줄 바로 위 */
.tiltbar {
  position: absolute;
  left: calc(var(--pillInset) * var(--u));
  right: calc(var(--pillInset) * var(--u));
  bottom: calc(var(--pill-bottom) + var(--pillHeight) * var(--u) + 10 * var(--u));
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  z-index: 3;
}
.tiltbar-label { font-size: 12px; opacity: 0.85; }
.tiltbar input { flex: 1 1 auto; min-width: 0; accent-color: var(--gold); height: 24px; }
.tiltbar-out { font-size: 12px; min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }

.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash[data-fire="1"] { opacity: 0.7; transition: none; }
.cam-flash[data-fire="0"] { opacity: 0; transition: opacity 0.2s ease-out; }

/* 비율 칩 줄 */
.cam-chips {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--chip-top);
  height: calc(var(--chipRowHeight) * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--chipGap) * var(--u));
  z-index: 3;
  transition: opacity var(--anim) ease-in-out;
}
.cam-chips[data-hidden="1"] { opacity: 0; pointer-events: none; }

.chip {
  height: calc(var(--chipRowHeight) * var(--u));
  padding: 0 calc(14 * var(--u));
  border-radius: 999px;
  font-size: calc(13 * var(--u));
  font-weight: 400;
  background: var(--sheet);
  color: var(--dim);
  border: 1px solid var(--line);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); font-weight: 600; }
/* 사진이 칩 줄을 덮으면 칩이 사진 위 표현으로 바뀐다 */
.cam-chips[data-onphoto="1"] .chip { background: rgba(0, 0, 0, 0.45); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.cam-chips[data-onphoto="1"] .chip[aria-pressed="true"] { background: #fff; color: #0A0A0A; border-color: #fff; }

/* 버튼 줄 */
.cam-buttons {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--btn-top);
  height: calc(var(--buttonRowHeight) * var(--u));
  z-index: 4;
}

.slotbtn {
  position: absolute;
  top: calc(var(--buttonRowTopInset) * var(--u));
  width: calc(var(--buttonSlotWidth) * var(--u));
  margin-left: calc(var(--buttonSlotWidth) * var(--u) / -2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4 * var(--u));
}
#btn-recipes { left: var(--btnx0); }
#btn-lock { left: var(--btnx1); }
#btn-save { left: var(--btnx2); }
#btn-flip { left: var(--btnx3); }

.slotcircle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--buttonCircleSize) * var(--u));
  height: calc(var(--buttonCircleSize) * var(--u));
  border-radius: 50%;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  color: var(--ink);
}
.slotcircle svg { width: 52%; height: 52%; }
.slotbtn[data-on="1"] .slotcircle { background: var(--ink); border-color: var(--ink); color: var(--ground); }
/* 전환 중 연타를 막는다 */
.slotbtn:disabled { opacity: 0.45; cursor: default; }
.slotlabel { font-size: calc(var(--buttonLabelFontSize) * var(--u)); color: var(--dim); white-space: nowrap; }

.shutter {
  position: absolute;
  top: calc(var(--buttonRowTopInset) * var(--u));
  left: 50%;
  width: calc(var(--shutterOuterSize) * var(--u));
  height: calc(var(--shutterOuterSize) * var(--u));
  margin-left: calc(var(--shutterOuterSize) * var(--u) / -2);
  border-radius: 50%;
  border: calc(3 * var(--u)) solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: border-color var(--anim) ease-in-out;
}
.shutter-inner {
  display: block;
  width: calc(var(--shutterInnerSize) * var(--u));
  height: calc(var(--shutterInnerSize) * var(--u));
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.09s ease-out, background-color var(--anim) ease-in-out;
}
.shutter[data-press="1"] .shutter-inner { transform: scale(0.86); }
.screen-cam[data-ontarget="1"] .shutter { border-color: var(--gold); }
.screen-cam[data-ontarget="1"] .shutter-inner { background: var(--gold); }

/* 진동 대체 신호 — vibrate 가 없는 iOS 에서 각 잡힘을 120ms 펄스로 알린다 */
.shutter[data-pulse="1"] { animation: shutter-pulse 0.12s ease-out; }
@keyframes shutter-pulse { from, to { transform: scale(1); } 50% { transform: scale(1.1); } }

/* 말풍선 (layout.bubble) */
.bubble {
  position: absolute;
  left: var(--bubble-left);
  top: var(--bubble-top);
  width: calc(250 * var(--u));
  z-index: 6;
}
.bubble-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(40 * var(--u));
  padding: 0 calc(16 * var(--u));
  border-radius: calc(14 * var(--u));
  background: var(--ink);
  color: var(--ground);
  font-size: calc(15 * var(--u));
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  animation: bubble-bob 0.7s ease-in-out infinite alternate;
}
.bubble-tail {
  position: absolute;
  top: calc(40 * var(--u) - 1px);
  left: 50%;
  margin-left: calc(var(--bubble-tail-dx) - 10 * var(--u));
  width: calc(20 * var(--u));
  height: calc(10 * var(--u));
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
@keyframes bubble-bob { from { transform: translateY(0); } to { transform: translateY(calc(-6 * var(--u))); } }
@media (prefers-reduced-motion: reduce) { .bubble-card, .sheet { animation: none; transition: none; } }

/* 추천 각도 시트 */
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.28); z-index: 7; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sheet-h);
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  z-index: 8;
  transform: translateY(0);
  transition: transform 0.28s ease-out;
}
.sheet[data-enter="1"] { transform: translateY(100%); transition: none; }

.sheet-handle { display: flex; justify-content: center; padding: 8px 0 4px; touch-action: none; cursor: grab; }
.sheet-handle span { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet-title { margin: 2px 0 10px; text-align: center; font-size: calc(15px * var(--text-scale)); font-weight: 600; }

.sheet-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
  align-content: start;
}

.cell { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; }
.cell-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 0.8;
  border-radius: 2px;
  overflow: hidden;
  background: var(--line);
}
.cell[data-wide="1"] .cell-photo { aspect-ratio: 1.25; }
.cell-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cell-photo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cell-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px;
  border: 1.5px solid transparent;
}
.cell[aria-pressed="true"] .cell-photo::after { border-color: var(--ink); }
.cell-name { display: block; font-size: calc(12px * var(--text-scale)); font-weight: 500; color: var(--ink); padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-tilt { display: block; margin-top: 2px; font-size: calc(10px * var(--text-scale)); color: var(--dim); padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 화면 3 — 결과 ─────────────────────────────────────────── */

.screen-shot { display: flex; flex-direction: column; background: var(--ground); }
.shot-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 8px;
}
.shot-image { width: 100%; height: 100%; min-height: 0; border-radius: 8px; object-fit: contain; }
.shot-actions { display: flex; gap: 10px; padding: 8px 16px 0; }
.shot-save, .shot-again {
  flex: 1 1 0; min-height: 52px; display: flex; align-items: center; justify-content: center;
  border-radius: 26px; font-size: 16px; font-weight: 600; text-decoration: none;
}
.shot-save { background: var(--ink); color: var(--ground); }
.shot-again { background: var(--sheet); color: var(--ink); border: 1px solid var(--line); }
.shot-note { margin: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 14px); text-align: center; font-size: calc(11.5px * var(--text-scale)); color: var(--dim); }

/* ── 공통 안내 ─────────────────────────────────────────────── */

.rotate-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--ground); color: var(--ink); font-size: calc(17px * var(--text-scale)); font-weight: 600; z-index: 20;
}

/* 토스트 — 손가락이 있는 버튼 줄이 아니라 눈이 머무는 사진 띠 한가운데에 */
.toast {
  position: absolute;
  left: 50%;
  top: calc(var(--photo-top, 50%) + var(--photo-h, 0px) / 2);
  transform: translate(-50%, -50%);
  /* left:50% 만 두면 오른쪽 절반에 맞춰 줄바꿈된다. 글 길이대로 폭을 잡고 화면만 넘지 않게 */
  width: max-content;
  max-width: calc(100% - 48px);
  padding: 14px 20px;
  word-break: keep-all;
  border-radius: 14px;
  background: var(--ink-92);
  color: var(--ground);
  font-size: calc(15px * var(--text-scale));
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--anim) ease-out;
}
.toast[data-show="1"] { opacity: 1; }
