/* 本の案内所 v2 — large-text, calm look (pattern F27 + spine shelf from F30) */
:root {
  --bg: #F5F6F2;
  --paper: #FFFFFF;
  --ink: #22282B;
  --muted: #5B6166;
  --line: #D9DCD4;
  --main: #1E5B4F;
  --main-ink: #FFFFFF;
  --accent: #B4520F;
  --ok: #1F6B3A;
  --busy: #9A4A0C;
  --focus: #2F5FA7;
  --radius: 14px;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.9; letter-spacing: 0.02em; }
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, main, .foot-inner { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.brand { display: inline-block; padding: 12px 0; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }

.journey { background: var(--paper); border-bottom: 1px solid var(--line); }
.journey-list { list-style: none; display: flex; gap: 6px; margin: 0 auto; max-width: 760px; padding: 8px 16px; font-size: 0.9rem; }
.journey-list li { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.journey-list li + li::before { content: "→"; color: var(--line); margin-right: 6px; }
.journey-list .dot { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; border: 2px solid var(--line); font-size: 0.85rem; }
.journey-list .now { color: var(--main); font-weight: 700; }
.journey-list .now .dot { border-color: var(--main); background: var(--main); color: var(--main-ink); }
.journey-list .done .dot { border-color: var(--main); color: var(--main); }

main { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 1.6rem; line-height: 1.5; margin: 8px 0 12px; }
h1:focus { outline: none; }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 0 0 8px; }
h3 { font-size: 1.1rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.lead { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.warn { color: var(--accent); font-weight: 700; }
.progress { color: var(--main); font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 20px; border-radius: 999px; border: 2px solid var(--main); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-main { background: var(--main); color: var(--main-ink); }
.btn-sub { background: var(--paper); color: var(--main); }
.btn[disabled] { opacity: 0.4; cursor: default; }
.btn-big { width: 100%; min-height: 64px; font-size: 1.1rem; }
.link { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--focus); text-decoration: underline; cursor: pointer; }
.entrances { display: grid; gap: 14px; margin: 20px 0; }

.cards, .options { display: grid; gap: 12px; margin: 16px 0 20px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.option { min-height: 64px; padding: 14px 18px; text-align: left; font: inherit; line-height: 1.6; background: var(--paper); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.cards .option { min-height: 110px; font-weight: 700; }
.option:hover { border-color: var(--main); }
.option.picked { border-color: var(--main); box-shadow: inset 0 0 0 2px var(--main); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 18px; }
.book-card { display: grid; gap: 16px; grid-template-columns: 1fr; }
.book-card.hero { grid-template-columns: minmax(120px, 180px) 1fr; align-items: start; }
.book-body .btn { margin-top: 4px; }
.author, .subtitle { color: var(--muted); font-size: 0.95rem; }
.voice { background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; color: #fff; background: var(--c, var(--main)); }
.chip-plain { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }

.cover-box { margin: 0; }
.cover { display: block; width: 100%; max-width: 180px; height: auto; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,0.12); background: #eee; }
.credit { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.spine-cover { display: grid; place-items: center; width: 100%; max-width: 180px; aspect-ratio: 2 / 3; border-radius: 6px; background: var(--c); color: #fff; padding: 12px; font-weight: 700; writing-mode: vertical-rl; text-orientation: upright; line-height: 1.4; overflow: hidden; }

.others-wrap { margin: 0 0 18px; }
.others-wrap summary { cursor: pointer; font-weight: 700; color: var(--main); padding: 10px 0; }
.flip { display: flex; justify-content: space-between; gap: 10px; }
.after { display: flex; flex-wrap: wrap; gap: 20px; }

.shelf { margin: 0 0 26px; }
.shelf h2 { border-left: 8px solid var(--c); padding-left: 10px; }
.spines { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 14px; scroll-snap-type: x proximity; }
.spine { flex: 0 0 auto; width: 56px; height: 230px; border: 0; border-radius: 6px 6px 3px 3px; background: var(--c); color: #fff; font: inherit; font-weight: 700; font-size: 0.9rem; line-height: 1.3; padding: 10px 4px; cursor: pointer; scroll-snap-align: start; box-shadow: inset -4px 0 0 rgba(0,0,0,0.15); }
.spine-title { writing-mode: vertical-rl; text-orientation: upright; display: block; height: 100%; overflow: hidden; }
.spine:hover { filter: brightness(1.1); }

.borrow .row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.select { min-height: 52px; padding: 8px 12px; font: inherit; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-width: 12em; }
.fieldset { border: 0; padding: 0; margin: 14px 0; }
.fieldset legend { font-weight: 700; margin-bottom: 6px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.choice input { width: 22px; height: 22px; }
.borrow-status { margin-top: 12px; }
.lib-system { font-weight: 700; }
.libs { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.libs li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 6px 0; }
.st { font-weight: 700; color: var(--muted); }
.st-ok { color: var(--ok); }
.st-busy { color: var(--busy); }
.links { display: flex; flex-wrap: wrap; gap: 10px; }

.foot { border-top: 1px solid var(--line); background: var(--paper); }
.foot-inner { padding: 16px; font-size: 0.8rem; color: var(--muted); line-height: 1.7; }

@media (max-width: 520px) {
  .book-card.hero { grid-template-columns: 1fr; }
  .cover, .spine-cover { max-width: 160px; }
  .journey-list { font-size: 0.8rem; }
}

/* ---------- opening letter (version 2 of design/opening-letter.html) ---------- */
.opening { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow: hidden; background: linear-gradient(180deg, #111A30 0%, #22305A 40%, #6B6790 72%, #E6C6A4 100%); }
.op-scene { display: grid; place-items: center; width: 100%; padding: 16px; }
.op-scene > * { grid-area: 1 / 1; }
.op-glow { width: min(86vw, 400px); aspect-ratio: 2.6 / 1; transform: translateY(118px); opacity: 0.9; background: radial-gradient(closest-side, rgba(232,199,122,0.6), rgba(232,199,122,0.18) 60%, rgba(232,199,122,0)); }
.op-drop, .op-sway { will-change: transform; }
.op-env { position: relative; width: min(72vw, 300px); aspect-ratio: 16 / 10.5; perspective: 900px; opacity: 0; }
.op-env > div { position: absolute; inset: 0; }
.op-back { background: #E7DCC8; border-radius: 6px; box-shadow: 0 20px 44px rgba(5,8,20,0.45); }
.op-env .op-peek { inset: auto; left: 7%; right: 7%; top: 9%; height: 82%; background: #FBF7EF; border-radius: 3px; z-index: 2; display: grid; align-content: start; gap: 9%; padding: 13% 11%; transform: translateY(-48%); }
.op-peek span { display: block; height: 6px; border-radius: 3px; background: #E4DAC7; }
.op-peek span:nth-child(1) { width: 46%; margin-inline: auto; background: #CFE0DA; }
.op-peek span:nth-child(2) { width: 82%; }
.op-peek span:nth-child(3) { width: 64%; }
.op-front { background: #FBF7EF; clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%); z-index: 3; border-radius: 6px; }
.op-flap { background: #F2E9DA; clip-path: polygon(0 0, 100% 0, 50% 58%); transform-origin: 50% 0; z-index: 1; transform: rotateX(180deg); border-radius: 6px 6px 0 0; }
.op-env .op-seal { inset: auto; left: 50%; top: 58%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; z-index: 5; background: #1E5B4F; color: #FBF7EF; display: grid; place-items: center; font-weight: 700; font-size: 21px; opacity: 0; }
.op-invite { width: min(86vw, 360px); padding: 30px 24px 26px; background: #FBF7EF; border-radius: 4px; text-align: center; box-shadow: 0 26px 64px rgba(6,10,26,0.5); outline: 1px solid #E2D6BF; outline-offset: -11px; display: grid; gap: 12px; justify-items: center; color: #2A2B36; }
.op-kicker { margin: 0; font-size: 0.75rem; letter-spacing: 0.32em; color: #1E5B4F; font-weight: 700; }
.op-title { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: 0.06em; line-height: 1.3; }
.op-body { margin: 0; line-height: 2.1; }
.op-body span { display: block; }
.op-start { margin-top: 4px; border: 0; border-radius: 999px; background: #1E5B4F; color: #FBF7EF; font: inherit; font-weight: 700; padding: 13px 36px; cursor: pointer; }
.op-skip { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: rgba(251,247,239,0.85); border: 0; border-radius: 999px; padding: 8px 18px; font: inherit; font-size: 0.85rem; cursor: pointer; color: #2A2B36; }

.play .op-drop { animation: op-fall 3s cubic-bezier(.33,.05,.25,1) both; }
@keyframes op-fall { from { transform: translateY(-80vh); } to { transform: none; } }
.play .op-sway { animation: op-sway 3s ease-in-out both; }
@keyframes op-sway {
  0% { transform: translateX(-46px) rotate(-12deg); }
  20% { transform: translateX(38px) rotate(9deg); }
  40% { transform: translateX(-26px) rotate(-6deg); }
  60% { transform: translateX(15px) rotate(3.5deg); }
  80% { transform: translateX(-6px) rotate(-1.2deg); }
  100% { transform: none; }
}
.play .op-glow { animation: op-glow 3.4s cubic-bezier(.4,0,.2,1) both; }
@keyframes op-glow { from { opacity: 0.12; transform: translateY(118px) scale(.7); } to { opacity: 0.9; transform: translateY(118px) scale(1); } }
.play .op-seal { animation: op-seal .6s cubic-bezier(.4,0,.2,1) 3.15s both; }
@keyframes op-seal { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(1.25); } }
.play .op-flap { animation: op-flap .9s cubic-bezier(.45,0,.25,1) 3.45s both; }
@keyframes op-flap { from { transform: rotateX(0); z-index: 4; } to { transform: rotateX(180deg); z-index: 1; } }
.play .op-peek { animation: op-peek 1s cubic-bezier(.22,.7,.2,1) 4.1s both; }
@keyframes op-peek { from { transform: none; } to { transform: translateY(-55%); } }
.play .op-env { animation: op-envout .9s cubic-bezier(.4,0,.2,1) 4.85s both; }
@keyframes op-envout { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(30px) scale(.97); } }
.play .op-invite { animation: op-invite 1.1s cubic-bezier(.22,.8,.24,1) 4.85s both; }
@keyframes op-invite { from { opacity: 0; transform: translateY(-80px) scale(.7); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .play * { animation: none !important; }
  .op-env { display: none; }
}
