/*
  폰 틀
  - 휴대폰(터치 기기·좁은 화면): 실제 화면을 꽉 채운다. 고정 393×852로 줄이지 않는다.
    높이는 dvh(주소창 변화 반영), 노치·하단 제스처는 안전 영역 변수로 비운다.
  - PC: 393×852 폰 틀을 가운데에 두고, 창이 낮으면 비율 그대로 줄인다.
*/
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 80% at 50% 0%, #2A2470 0%, var(--surface-ink) 70%);
}
.device {
  position: relative;
  width: 393px;
  height: 852px;
  border-radius: 48px;
  overflow: hidden;
  background: var(--surface-ink);
  box-shadow: 0 0 0 10px #0B0926, 0 0 0 11px rgba(255,255,255,.08), 0 30px 80px rgba(0,0,0,.5);
  transform: scale(var(--fit, 1));
  transform-origin: center center;
  isolation: isolate;
  /* PC 틀에서는 안전 영역이 없다 */
  --sat: 0px; --sab: 0px; --sal: 0px; --sar: 0px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.screens, .layer { position: absolute; inset: 0; }
.layer { pointer-events: none; z-index: 20; }
.layer > * { pointer-events: auto; }

@media (max-width: 560px), (hover: none) and (pointer: coarse) {
  .stage { background: var(--surface-ink); }
  .device {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
  }
  /*
    실제 폰에서는 폰의 진짜 상태 표시줄(시계·배터리)을 그대로 쓰고, 알파폰의 가짜 상태 표시줄은 숨긴다.
    그 자리는 노치·다이내믹 아일랜드·카메라 구멍(--sat)만큼 비우고 + 손가락으로 끌어내릴 띠 20px.
  */
  .device .status-bar { height: calc(var(--sat) + 20px); padding: 0; }
  .device .status-bar > :not(.pull) { display: none; }
}
/* 좁은 폰(갤럭시 기본 360) — 좌우 여백 살짝 줄임 */
@media (max-width: 374px) { .device { --gutter: 16px; } }

/* 가로 모드 안내 */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (hover: none) {
  .rotate-hint {
    display: flex; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center;
    background: var(--surface-ink); color: var(--white); font-size: 16px; font-weight: 600;
  }
}

/* 화면 공통 */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-snow);
  will-change: transform, opacity;
}
.screen.wall { background: var(--wallpaper); color: var(--white); }
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }

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