*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ivory);
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
/* 은은한 종이 질감 + 성당 유리창 빛 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 12% 0%, rgba(156, 196, 242, 0.22), transparent 70%),
    radial-gradient(50% 35% at 95% 8%, rgba(143, 178, 220, 0.16), transparent 70%),
    radial-gradient(60% 40% at 80% 100%, rgba(214, 231, 251, 0.35), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.35  0 0 0 0 0.25  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    var(--ivory);
}
img,
svg {
  display: block;
  max-width: 100%;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
}
:focus-visible {
  outline: 3px solid rgba(93, 163, 236, 0.7);
  outline-offset: 2px;
  border-radius: 10px;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
.serif {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

/* ── 앱 프레임 ─────────────────────────────────────────
   모바일: 화면 전체 / 태블릿·PC: 가운데 휴대폰 크기 프레임
   페이지 스크롤 없이 한 화면에 모든 내용을 담습니다. */
html,
body {
  height: 100%;
  overflow: hidden;
}
#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ivory);
  isolation: isolate;
}
#app::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 40% at 10% 0%, rgba(156, 196, 242, 0.2), transparent 70%),
    radial-gradient(60% 35% at 100% 6%, rgba(143, 178, 220, 0.14), transparent 70%),
    radial-gradient(70% 40% at 80% 100%, rgba(214, 231, 251, 0.35), transparent 70%);
}
@media (min-width: 520px) {
  body {
    display: grid;
    place-items: center;
    background: #e9e4dc;
  }
  body::before {
    display: none;
  }
  #app {
    width: 390px;
    height: min(844px, calc(100dvh - 40px));
    border-radius: 44px;
    box-shadow: 0 0 0 10px #1d1a19, 0 0 0 11px #3a3533, 0 30px 80px rgba(20, 40, 80, 0.35);
  }
}

.screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px var(--gutter) 8px;
  overflow: hidden;
  animation: screen-in var(--dur-m) var(--ease) both;
}
/* 아주 작은 화면(높이 600 미만)에서만 스크롤 허용 */
@media (max-height: 600px) {
  .screen {
    overflow-y: auto;
  }
}
@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}
.screen.is-back {
  animation-name: screen-in-back;
}
@keyframes screen-in-back {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
}
.grow {
  flex: 1;
  min-height: 0;
}
.stack > * + * {
  margin-top: var(--stack, 16px);
}
.full-bleed {
  margin-inline: calc(var(--gutter) * -1);
}

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