/* 종이접기 도안 뷰어 — 모바일/태블릿 우선 반응형 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2530;
  --muted: #67727e;
  --line: #e2e6ea;
  --accent: #3b6ef5;
  --accent-ink: #ffffff;
  --warn: #b8860b;
  --warn-bg: #fff4d6;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 45, .08), 0 6px 18px rgba(20, 30, 45, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e7ecf2;
    --muted: #97a2ad;
    --line: #2b333d;
    --accent: #5b8bff;
    --warn: #e6b84a;
    --warn-bg: #3a2f14;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ---- topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; padding: 12px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.crumb { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---- filters ---- */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-bottom: 18px;
}
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.filters select {
  min-height: 42px; padding: 8px 10px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.filters .clear { align-self: end; padding: 10px 12px; color: var(--accent); text-decoration: none; font-size: 14px; }
.filters .count { margin-left: auto; align-self: end; color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---- grid ---- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card a { display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease; }
.card a:active { transform: scale(.98); }
.thumb { position: relative; aspect-ratio: 1 / 1; background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 10px; }
@media (prefers-color-scheme: dark) { .thumb { background: #f2f4f7; } }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nothumb { color: #9aa4ae; font-size: 13px; }
.badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; letter-spacing: .02em;
}
.badge.status-draft { background: #8b93a0; }
.badge.status-verified { background: #2f9e5a; }
.badge.status-published { background: #3b6ef5; }
.badge.warn { left: auto; right: 8px; background: var(--warn); }
.meta { padding: 10px 12px 12px; }
.meta h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.row2 { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stars { letter-spacing: 1px; font-size: 13px; }
.stars .on { color: #f2b01e; }
.stars .off { color: var(--line); }
.steps { color: var(--muted); font-size: 13px; }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; }
.warning { margin-top: 8px; font-size: 11px; color: var(--warn);
  background: var(--warn-bg); padding: 5px 8px; border-radius: 8px; }

/* ---- detail viewer ---- */
.viewer { max-width: 820px; margin: 0 auto; }
.stage {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  min-height: 46vh; transition: opacity .12s ease; touch-action: pan-y;
}
@media (prefers-color-scheme: dark) { .stage { background: #f7f8fa; } }
.stage.loading { opacity: .35; }
.stage svg { width: 100%; height: auto; max-height: 68vh; display: block; }

.controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 16px 0 6px;
}
.navbtn {
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 40px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease, background .1s ease;
}
.navbtn:active { transform: scale(.94); background: var(--accent); color: var(--accent-ink); }
.navbtn:disabled { opacity: .3; cursor: default; box-shadow: none; }
.progress { font-size: 26px; font-weight: 700; letter-spacing: .04em; }
.progress .sep { color: var(--muted); margin: 0 4px; }

.stepinfo { margin-top: 6px; text-align: center; padding: 0 6px; }
.stepinfo h2 { margin: 8px 0 4px; font-size: 20px; }
.stepinfo p { margin: 0; color: var(--muted); font-size: 16px; }

.detailmeta { margin: 22px auto 40px; max-width: 520px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.detailmeta summary { padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--muted); }
.detailmeta dl { margin: 0; padding: 0 16px 14px; display: grid;
  grid-template-columns: 88px 1fr; gap: 6px 12px; font-size: 14px; }
.detailmeta dt { color: var(--muted); }
.detailmeta dd { margin: 0; }

/* 큰 화면: 컨트롤을 스테이지 좌우로 넉넉히 */
@media (min-width: 720px) {
  .navbtn { width: 84px; height: 84px; font-size: 46px; }
}
