:root {
  color-scheme: light;
  --accent: #dd458e;
  --ink: #202124;
  --muted: #727276;
  --surface: #f7f7f8;
  --line: #e8e8ea;
  --page: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page); }
body { margin: 0; color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }

::view-transition-old(root) { animation: page-fade-out .22s ease both; }
::view-transition-new(root) { animation: page-fade-in .32s .04s ease both; }
::view-transition-group(topic-cover) { animation-duration: .48s; animation-timing-function: cubic-bezier(.22,.8,.28,1); }
::view-transition-old(topic-cover),
::view-transition-new(topic-cover) { height: 100%; object-fit: cover; border-radius: 12px; }

@keyframes page-fade-out { to { opacity: .35; transform: scale(.992); } }
@keyframes page-fade-in { from { opacity: 0; transform: translateY(8px); } }

.shell { width: min(100%, 760px); margin: 0 auto; }
.hero { padding: calc(24px + env(safe-area-inset-top)) 20px 28px; }
.hero-visual {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  border-radius: 24px;
  background: linear-gradient(145deg, #fff5fa 0%, #fff 45%, #f8f5f7 100%);
  border: 1px solid #f3dde8;
}
.hero-visual::before { content: ""; position: absolute; width: 180px; height: 180px; border: 1px solid rgba(221,69,142,.18); border-radius: 50%; right: -62px; top: -85px; }
.hero-visual::after { content: ""; position: absolute; width: 130px; height: 130px; background: rgba(221,69,142,.05); border-radius: 50%; left: -58px; bottom: -70px; }
.hero-photo { width: 100%; height: 100%; min-height: 150px; object-fit: cover; }
.hero-lockup { text-align: center; position: relative; z-index: 1; padding: 25px; }
.clinic { margin: 0 0 7px; font-size: .84rem; font-weight: 650; letter-spacing: .08em; }
.event { margin: 0 0 12px; font-size: .72rem; color: var(--muted); letter-spacing: .16em; }
.guide-title { margin: 0; font-size: clamp(1.8rem, 8vw, 2.55rem); line-height: 1; letter-spacing: .04em; font-weight: 720; }
.guide-title span { color: var(--accent); }
.intro { text-align: center; padding: 24px 12px 4px; }
.intro p { margin: 0; font-size: 1rem; line-height: 1.9; }

.library { padding: 22px 16px 48px; background: var(--surface); border-radius: 30px 30px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; margin: 0 4px 16px; }
.section-head h2 { margin: 0; font-size: 1.28rem; letter-spacing: .02em; }
.section-head p { margin: 0; color: var(--muted); font-size: .78rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { min-width: 0; color: inherit; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 17px; overflow: hidden; transition: transform .18s ease, border-color .18s ease; }
.card:active { transform: scale(.985); }
.card:focus-visible { outline: 3px solid rgba(221,69,142,.28); outline-offset: 2px; }
.thumb { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: contain; background: #eee; }
.card-copy { padding: 10px 10px 12px; }
.card-no { margin: 0 0 4px; color: var(--accent); font-size: .7rem; font-weight: 750; letter-spacing: .1em; }
.card h3 { margin: 0; font-size: .96rem; line-height: 1.42; }
.card-sub { margin: 3px 0 10px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.card-link { color: var(--accent); font-size: .78rem; font-weight: 700; }

.detail-head { position: sticky; top: 0; z-index: 10; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.detail-bar { min-height: 48px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.back-icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); text-decoration: none; border-radius: 50%; font-size: 1.6rem; }
.detail-title { text-align: center; }
.detail-title > span { display: block; margin: 0 0 2px; color: var(--accent); font-size: .62rem; font-weight: 700; letter-spacing: .08em; }
.detail-title h1 { margin: 0; font-size: 1rem; line-height: 1.35; }
.detail-title p { margin: 2px 0 0; color: var(--muted); font-size: .66rem; letter-spacing: .08em; }
.reading-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; background: transparent; }
.reading-progress span { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform .12s linear; }
.slides { padding: 18px 10px 40px; background: var(--surface); }
.slides-intro { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 18px; color: var(--muted); font-size: .75rem; }
.slides-intro span:first-child { color: var(--ink); font-weight: 700; }
.slide-item { margin: 0 0 26px; }
.page-marker { display: flex; align-items: center; gap: 8px; margin: 0 5px 8px; color: var(--muted); }
.page-marker span { color: var(--accent); font-size: .82rem; font-weight: 750; }
.page-marker i { width: 18px; height: 1px; background: #c9c9cc; }
.page-marker small { font-size: .7rem; }
.slide-button { appearance: none; display: block; width: 100%; height: auto; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 1px 0 rgba(20,20,22,.04); font-size: 0; line-height: 0; cursor: zoom-in; }
.slide-button img { display: block; width: 100%; height: auto; aspect-ratio: auto; }
.slides-note { margin: 2px 0 22px; text-align: center; color: var(--muted); font-size: .75rem; }
.smile-view { margin: 0 0 18px; padding: 24px 20px; text-align: center; background: #fff; border: 1px solid #f0dce6; border-radius: 18px; }
.smile-view-label { margin: 0 0 8px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .08em; }
.smile-view h2 { margin: 0 0 14px; font-size: 1.25rem; line-height: 1.5; }
.smile-view > p:not(.smile-view-label) { margin: 0; font-size: .92rem; line-height: 1.8; }
.smile-view .smile-view-note { margin-top: 12px; color: var(--muted); font-size: .75rem; line-height: 1.7; text-align: left; }
.smile-view-button { min-height: 54px; display: grid; place-items: center; margin-top: 18px; color: #fff; background: #17364d; text-decoration: none; border-radius: 15px; font-weight: 700; }
.smile-view-button:active { background: #0e2739; }
.return-button { min-height: 54px; display: grid; place-items: center; width: 100%; color: #fff; background: var(--accent); text-decoration: none; border-radius: 15px; font-weight: 700; }
.footer { padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: .75rem; }

#viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(10,10,12,.96); }
#viewer::backdrop { background: rgba(10,10,12,.96); }
#viewer[open] { display: grid; place-items: center; }
#viewer img { width: 100%; max-height: calc(100dvh - 78px); object-fit: contain; touch-action: pinch-zoom; }
.viewer-close { position: fixed; z-index: 2; top: calc(12px + env(safe-area-inset-top)); right: 12px; min-width: 64px; min-height: 44px; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; font: inherit; }

@media (max-width: 360px) { .library { padding-inline: 12px; } .grid { gap: 8px; } .card-copy { padding-inline: 9px; } .card h3 { font-size: .88rem; } }
@media (min-width: 680px) { .hero { padding-inline: 28px; } .hero-visual { min-height: 220px; } .library { padding: 28px; } .grid { gap: 18px; } .card-copy { padding: 15px 16px 17px; } .card h3 { font-size: 1.05rem; } .slides { padding-inline: 22px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card, .reading-progress span { transition: none; } ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
