:root {
  --bg: #EFF3F6;
  --surface: #FFFFFF;
  --line: #D3DCE4;
  --fg: #16212C;
  --muted: #56657A;
  --accent: #1C6FA8;
  --accent-soft: #DCEBF6;
  --stage: #1B2B3D;
  --stage2: #2B4A66;
  --stage-fg: #E8EEF5;
  --stage-muted: #A6B5C8;
  --overlay: rgba(12, 21, 32, .72);
  --font: system-ui, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10161D; --surface: #18212B; --line: #2B3744; --fg: #E4EAF1; --muted: #9AA8B9;
    --accent: #6CB6E8; --accent-soft: #15303F; --stage: #0C1520; --stage2: #1A3148;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10161D; --surface: #18212B; --line: #2B3744; --fg: #E4EAF1; --muted: #9AA8B9;
  --accent: #6CB6E8; --accent-soft: #15303F; --stage: #0C1520; --stage2: #1A3148;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
[hidden] { display: none !important; }

/* 홈페이지 */
.home {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.hero {
  border-radius: 12px;
  padding: 48px 24px;
  background: linear-gradient(160deg, var(--stage), var(--stage2));
  color: var(--stage-fg);
}
.hero h1 { margin: 0 0 8px; font-size: clamp(28px, 6vw, 44px); line-height: 1.2; }
.hero p { margin: 0; color: var(--stage-muted); max-width: 52ch; }
h2 { font-size: 20px; margin: 0 0 12px; }

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}
.entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.entry:hover, .entry:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.entry b { font-size: 17px; color: var(--accent); }
.entry span { font-size: 14px; color: var(--muted); }

.progress-row { display: flex; align-items: center; gap: 12px; }
.track { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.progress-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.progress-warn { margin: 8px 0 0; font-size: 14px; color: var(--muted); }

.guide ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* 뷰어 */
.page-tour { overflow: hidden; background: #000; }
#pano { position: fixed; inset: 0; }

.ov {
  position: fixed;
  z-index: 10;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--overlay);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}
.ov-home {
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
}

.ov-stamp {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  background: #E08A1E;
  color: #3A2300;
  cursor: pointer;
}
.ov-stamp span { font-variant-numeric: tabular-nums; }
.stamp-panel {
  top: calc(max(12px, env(safe-area-inset-top)) + 42px);
  right: max(12px, env(safe-area-inset-right));
  width: min(240px, calc(100vw - 24px));
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 12px;
}
.stamp-panel ul { list-style: none; margin: 0; padding: 0; }
.stamp-panel li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; opacity: .55; }
.stamp-panel li.got { opacity: 1; }
.stamp-warn { margin: 0 0 6px; font-size: 13px; color: #F2C48A; }
.toast {
  left: 50%;
  bottom: max(48px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: #2E7D4F;
  text-align: center;
}

.notice {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(160deg, var(--stage), var(--stage2));
  color: var(--stage-fg);
}
.notice p { margin: 0; max-width: 100%; word-break: keep-all; overflow-wrap: anywhere; }
.notice-title { font-size: 20px; font-weight: 700; }
.notice-body { color: var(--stage-muted); }
.btn {
  margin-top: 12px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--stage-fg);
  color: var(--stage);
  font-weight: 700;
  text-decoration: none;
}
