*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
input, select { font-size: max(16px, var(--fs-body)); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 화면 틀: 광고(고정) → 본문 → 탭바(고정) */
#ad-slot {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--ad-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
#ad-slot .ad-box {
  width: min(320px, calc(100% - 24px)); height: 50px;
  border: 1px dashed #C8CDD4; border-radius: 8px; background: #FAFBFC;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: var(--ink3);
}
#ad-slot .ad-tag { font-size: 12px; font-weight: 800; color: #fff; background: var(--ink3); border-radius: 4px; padding: 1px 5px; }
html.native #ad-slot .ad-box { display: none; }

#app {
  padding-top: calc(var(--ad-h) + env(safe-area-inset-top) + var(--gap));
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 560px; margin: 0 auto;
}
body.no-tabs #app { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
}
body.no-tabs #tabbar { display: none; }
#tabbar a {
  min-width: 72px; min-height: var(--touch);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: var(--fs-small); font-weight: 700; color: var(--ink3); text-decoration: none;
}
#tabbar a svg { width: 28px; height: 28px; }
#tabbar a[aria-current="page"] { color: var(--ink); }
#tabbar a[aria-current="page"] svg { color: var(--primary); }
