:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #16202a;
  --muted: #6b7682;
  --line: #e3e7ec;
  --accent: #0b2a44;
  --sea: #0268ba;
  --orange: #e8743a;
  --accent-soft: #e4eff3;
  --gold: #9a7b2f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 48px 16px 32px; min-height: 100dvh; display: flex; flex-direction: column; }
.hero { text-align: center; margin-bottom: 32px; }
.logo {
  width: 88px; height: 88px; border: 0;
  background: transparent; display: inline-grid; place-items: center; padding: 0; border-radius: 50%;
  cursor: default; user-select: none; -webkit-user-select: none;
  transition: transform .08s;
}
.logo:active { transform: scale(.94); }
.logo .mark { width: 88px; height: 88px; display: block; pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.eyebrow { margin: 18px 0 0; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.tagline { margin: 0 0 10px; font-size: 15px; color: var(--sea); font-weight: 600; letter-spacing: .06em; }
h1 { font-size: 26px; margin: 4px 0 6px; letter-spacing: .04em; font-family: "Georgia", "Times New Roman", serif; font-weight: 600; }
.lead { color: var(--muted); font-size: 14px; margin: 0; }

.docs { display: grid; gap: 12px; }
.doc {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.doc:active { background: #fafbfc; }
.doc-icon {
  flex: none; width: 44px; height: 52px; border-radius: 8px;
  background: var(--accent-soft); color: var(--sea);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.doc-text { flex: 1; display: grid; gap: 2px; }
.doc-text strong { font-size: 16px; }
.doc-text small { color: var(--muted); font-size: 12px; }
.chev { color: var(--muted); font-size: 24px; }
.detail { border-color: #f3cdb6; }
.detail .doc-icon { background: #fdeee5; color: var(--orange); }
.doc[hidden] { display: none; }
.detail.appear { animation: appear .35s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(-6px); } }

.lock-row { text-align: center; margin: 16px 0 0; }
.link { background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.foot-links { display: flex; justify-content: center; gap: 8px; margin: 0 0 8px; }
.foot-links a { color: var(--sea); text-decoration: none; }
.foot { margin-top: auto; padding-top: 40px; text-align: center; color: var(--muted); font-size: 12px; }

.sheet { border: 0; border-radius: 16px; padding: 20px; width: min(320px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.sheet::backdrop { background: rgba(10,20,30,.45); }
.sheet-title { margin: 0 0 12px; font-weight: 700; text-align: center; }
.sheet input { width: 100%; font-size: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; text-align: center; letter-spacing: .15em; }
.msg { min-height: 1.2em; font-size: 13px; color: #b3261e; text-align: center; margin: 8px 0; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.btn { white-space: nowrap; padding: 12px 16px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }

.viewer { position: fixed; inset: 0; background: #2b3138; display: flex; flex-direction: column; z-index: 10; }
.viewer[hidden] { display: none; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: #fff; }
.viewer-title { flex: 1; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-pages { color: var(--muted); font-size: 12px; }
.pages { flex: 1; overflow: auto; padding: 12px; display: grid; gap: 12px; justify-items: center; -webkit-overflow-scrolling: touch; }
.pages canvas { width: 100%; max-width: 900px; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.loading { color: #cfd6dd; padding: 40px; font-size: 14px; }

/* ---- 常時QR ---- */
.content { display: grid; gap: 24px; }
.docs { align-content: start; }
.qr-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; text-align: center; justify-self: center; width: 100%; max-width: 280px;
}
.qr-box { position: relative; width: 100%; aspect-ratio: 1; }
.qr-box #qrImg { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-logo { position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 50%; padding: 4px; }
.qr-cap { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.qr-tabs { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.qr-tabs[hidden] { display: none; }
.qr-tabs button { flex: 1; border: 0; background: #fff; padding: 8px 0; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.qr-tabs button.on { background: var(--accent); color: #fff; }
.qr-card.detail-mode { border-color: #f3cdb6; }

@media (min-width: 820px) {
  .wrap { max-width: 880px; padding-top: 64px; }
  .content { grid-template-columns: 1fr 280px; align-items: start; gap: 32px; }
  .qr-card { position: sticky; top: 24px; }
}
