/* ==========================================================================
   針の筵 試作
   いま見ている作品の色（--amb）がページ全体ににじむ。ほかの装飾は控えめに。
   ========================================================================== */

@property --amb {
  syntax: '<color>';
  inherits: true;
  initial-value: rgb(150 40 52);
}

:root {
  --font: 'Murecho', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Noto Sans CJK JP', system-ui, sans-serif;
  --font-logo: 'Dela Gothic One', 'Murecho', 'Noto Sans CJK JP', sans-serif;
  --font-mincho: 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', 'Noto Serif JP', 'Noto Serif CJK JP', serif;

  --amb: rgb(150 40 52);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.5, .5, 1);
  --t-press: 110ms; --t-fast: 180ms; --t-base: 320ms; --t-slow: 700ms;

  --r-s: 10px; --r-m: 18px; --r-l: 28px; --r-pill: 999px;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --bar-h: 72px;
  transition: --amb 1.1s ease;
}

/* 暗い面：作品の色を少しだけ混ぜた黒 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --base: #0a0a0d;
  --bg: color-mix(in oklch, var(--amb) 14%, var(--base));
  --panel: color-mix(in oklch, var(--amb) 10%, #15161b);
  --panel-2: color-mix(in oklch, var(--amb) 14%, #1d1e25);
  --fg: #f3f1ec;
  --muted: color-mix(in oklch, var(--fg) 62%, var(--bg));
  --line: color-mix(in oklch, var(--fg) 13%, transparent);
  --hi: color-mix(in oklch, var(--amb) 58%, #fff);
  --on-hi: #0a0a0d;
  --glow-a: 55%;
  --shadow: 0 30px 80px -20px #000c;
}
/* 明るい面：紙のような白に、作品の色をほんのり */
:root[data-theme="light"] {
  color-scheme: light;
  --base: #f4f3ef;
  --bg: color-mix(in oklch, var(--amb) 6%, var(--base));
  --panel: color-mix(in oklch, var(--amb) 4%, #ffffff);
  --panel-2: color-mix(in oklch, var(--amb) 9%, #ffffff);
  --fg: #131318;
  --muted: color-mix(in oklch, var(--fg) 60%, var(--bg));
  --line: color-mix(in oklch, var(--fg) 12%, transparent);
  --hi: color-mix(in oklch, var(--amb) 72%, #000);
  --on-hi: #ffffff;
  --glow-a: 30%;
  --shadow: 0 30px 70px -28px #2a1e1e66;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 24px); }
body { min-height: 100svh; color: var(--fg); background: var(--bg); font-family: var(--font); font-size: 16px; line-height: 1.75; -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { width: 1em; height: 1em; flex-shrink: 0; }
::selection { background: color-mix(in oklch, var(--amb) 50%, transparent); }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 3px; border-radius: 6px; }
kbd { display: inline-grid; place-items: center; min-width: 1.9em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; font-family: inherit; font-size: .72rem; font-weight: 500; line-height: 1.6; color: var(--muted); }
.skip { position: fixed; z-index: 300; top: 8px; left: 8px; padding: 8px 16px; border-radius: var(--r-pill); color: var(--on-hi); background: var(--hi); transform: translateY(-200%); }
.skip:focus { transform: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#view { position: relative; z-index: 1; outline: none; }

/* --- 背景：作品の色の光と、紙のざらつき ------------------------------------ */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.ambient-glow { position: absolute; inset: -20vh -10vw auto auto; width: 90vw; height: 90vh; background: radial-gradient(closest-side, color-mix(in oklch, var(--amb) var(--glow-a), transparent), transparent); filter: blur(10px); opacity: .9; }
.ambient-grain { position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* --- 上のバー：ロゴ、探す、言語、明るさ ------------------------------------ */
.bar { position: fixed; z-index: 100; top: 12px; left: 50%; display: flex; align-items: center; gap: 12px; width: min(var(--wrap), calc(100% - 24px)); height: 60px; padding: 6px 8px 6px 20px; border: 1px solid var(--line); border-radius: var(--r-pill); background: color-mix(in oklch, var(--bg) 72%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); translate: -50% 0; transition: translate var(--t-base) var(--ease), opacity var(--t-base); }
.bar.away { translate: -50% calc(-100% - 20px); }
.logo { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--font-logo); font-size: 1.25rem; letter-spacing: .02em; white-space: nowrap; }
.bar-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.search-btn { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 16px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); font-size: .9rem; transition: border-color var(--t-fast), color var(--t-fast); }
.search-btn:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 30%, transparent); }
.lang-btn { min-width: 44px; height: 44px; padding: 0 10px; border-radius: var(--r-pill); color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; transition: color var(--t-fast), background var(--t-fast); }
.lang-btn:hover { color: var(--fg); background: var(--line); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 1.15rem; transition: color var(--t-fast), background var(--t-fast); }
.icon-btn:hover { color: var(--fg); background: var(--line); }
[data-theme="dark"] .when-light, [data-theme="light"] .when-dark { display: none; }

/* --- セクションの移動（スマホ・タブレット）：親指の届く下側に浮かぶ ---------- */
.dock { position: fixed; z-index: 101; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 2px; width: max-content; padding: 5px; border: 1px solid var(--line); border-radius: var(--r-pill); background: color-mix(in oklch, var(--bg) 78%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); box-shadow: var(--shadow); white-space: nowrap; translate: -50% 0; transition: translate var(--t-base) var(--ease); }
.bar.away + .dock { translate: -50% calc(100% + 30px); }
[data-route="reader"] .dock { display: none; }
.dock a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 62px; height: 52px; border-radius: var(--r-pill); color: var(--muted); font-size: .64rem; font-weight: 500; transition: color var(--t-fast); }
.dock a svg { font-size: 1.15rem; }
.dock a:hover { color: var(--fg); }
.dock a[aria-current="true"] { color: var(--on-hi); }
.dock-pill { position: absolute; z-index: 0; top: 0; left: 0; height: 52px; width: 0; border-radius: var(--r-pill); background: var(--hi); opacity: 0; transition: translate .5s var(--ease-spring), width .5s var(--ease-spring), opacity var(--t-fast), background-color 1.1s; }

/* --- セクションの移動（マウスのPC）：左端に浮かぶ縦のカプセル。乗せると名前が出る -- */
.rail { display: none; }
.rail ol { position: relative; z-index: 1; display: grid; gap: 2px; width: 164px; list-style: none; }
.rail a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 13px; border-radius: var(--r-pill); color: var(--muted); font-size: .86rem; font-weight: 500; white-space: nowrap; transition: color var(--t-fast), background var(--t-fast); }
.rail a svg { font-size: 1.12rem; }
.rail a:hover { color: var(--fg); background: var(--line); }
.rail a[aria-current="true"], .rail a[aria-current="true"]:hover { color: var(--on-hi); background: none; }
.rail a:focus-visible { outline-offset: -2px; }
.rail-label { opacity: 0; translate: -6px 0; transition: opacity var(--t-fast), translate var(--t-base) var(--ease); }
/* いまのセクションの札。ばねのように滑って動き、下の細い線が読み進めた分だけ伸びる */
.rail-pill { position: absolute; z-index: 0; top: 6px; left: 6px; right: 6px; height: 44px; overflow: hidden; border-radius: var(--r-pill); background: var(--hi); opacity: 0; transition: translate .5s var(--ease-spring), opacity var(--t-fast), background-color 1.1s; }
.rail-pill i { position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px; border-radius: 2px; background: color-mix(in oklch, var(--on-hi) 50%, transparent); transform: scaleX(var(--p, 0)); transform-origin: left; }

/* --- いちばん上へ -------------------------------------------------------- */
.to-top { position: fixed; z-index: 105; right: calc(12px + env(safe-area-inset-right)); bottom: calc(86px + env(safe-area-inset-bottom)); display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; color: var(--fg); background: color-mix(in oklch, var(--bg) 78%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); box-shadow: var(--shadow); font-size: 1.15rem; opacity: 0; scale: .7; translate: 0 10px; pointer-events: none; transition: opacity var(--t-base), scale var(--t-base) var(--ease-spring), translate var(--t-base) var(--ease), background var(--t-fast); }
.to-top.on { opacity: 1; scale: 1; translate: 0 0; pointer-events: auto; }
.to-top.on:active { scale: .9; transition-duration: var(--t-press); }
.to-top:hover { background: var(--panel-2); }
.to-top > svg:last-child { transition: translate var(--t-base) var(--ease); }
.to-top:hover > svg:last-child { translate: 0 -2px; }
.to-top .ring { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); rotate: -90deg; pointer-events: none; }
.to-top .ring circle { fill: none; stroke: var(--hi); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p, 0)); transition: stroke 1.1s; }
[data-route="reader"] .to-top { display: none; }

/* --- 共通の部品 ---------------------------------------------------------- */
.wrap { width: min(var(--wrap), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: .95rem; font-weight: 700; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-base) var(--ease); }
.btn svg { font-size: 1.05em; }
.btn:hover { border-color: color-mix(in oklch, var(--fg) 35%, transparent); }
.btn-hi { border-color: transparent; color: var(--on-hi); background: var(--hi); }
.btn-hi:hover { border-color: transparent; transform: translateY(-2px); }
.btn:active, .press:active { transform: scale(.96); transition-duration: var(--t-press); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--fg); font-size: .75rem; font-weight: 500; }
.tag svg { color: var(--hi); }
.meta { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.ext { display: inline-block; vertical-align: -.1em; font-size: .9em; transition: translate var(--t-base) var(--ease); }
a:hover > .ext, a:hover .ext { translate: 2px -2px; }
.link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-size: .9rem; font-weight: 500; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: color var(--t-fast), background-size var(--t-base) var(--ease); }
.link:hover { color: var(--fg); background-size: 100% 1px; }

/* セクション：大きな見出しと、右に数や外へのリンク */
.sec { position: relative; padding-block: clamp(72px, 10vw, 140px) 0; }
.sec-head, .sec { scroll-margin-top: calc(var(--bar-h) + 20px); }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 20px; margin-bottom: clamp(24px, 4vw, 44px); }
.feature-info h2, .spot-body h3, .release h3, .cover strong, .page-title, .reader h1, .news-body strong, .text-art strong { word-break: auto-phrase; }
.sec-head h2 { font-size: clamp(2.2rem, 6vw, 4.4rem); font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.sec-head .meta { padding-bottom: .4em; }
.sec-head .link { margin-left: auto; }

/* --- トップの最初の画面 --------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: clamp(32px, 6vw, 96px); min-height: min(100svh, 980px); padding-block: calc(var(--bar-h) + 48px) 48px; }
.hero-title { font-family: var(--font-logo); font-size: clamp(4.6rem, 12vw, 10.5rem); font-weight: 400; line-height: 1; letter-spacing: -.02em; }
.hero-title span { display: inline-block; animation: rise 1s var(--ease) calc(var(--i) * 90ms + 80ms) both; }
.hero-romaji { margin-top: 14px; color: var(--muted); font-size: clamp(.95rem, 1.4vw, 1.1rem); letter-spacing: .12em; text-transform: uppercase; animation: fade .9s var(--ease) .45s both; }
.hero-find { display: flex; align-items: center; gap: 12px; width: min(100%, 420px); height: 58px; margin-top: 36px; padding: 0 10px 0 22px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); background: color-mix(in oklch, var(--panel) 70%, transparent); text-align: left; animation: fade .9s var(--ease) .6s both; transition: border-color var(--t-fast), color var(--t-fast), transform var(--t-base) var(--ease); }
.hero-find:hover { border-color: color-mix(in oklch, var(--fg) 30%, transparent); color: var(--fg); transform: translateY(-2px); }
.hero-find > svg { font-size: 1.2rem; }
.hero-find span { flex: 1; }
.feature { animation: lift 1.1s var(--ease) .2s both; }
.feature-art { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-l); background: var(--panel-2); box-shadow: var(--shadow); transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .6s var(--ease); }
.feature-art.tilting { transition-duration: .12s; }
.feature-art img { width: 100%; height: 100%; object-fit: cover; }
.feature-art.text-art { display: grid; align-content: end; gap: 14px; padding: clamp(28px, 4vw, 48px); background: linear-gradient(150deg, color-mix(in oklch, var(--amb) 55%, var(--panel-2)), var(--panel)); }
.text-art svg { font-size: 2rem; color: var(--hi); }
.text-art strong { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 900; line-height: 1.3; }
.text-art span { color: var(--muted); }
.feature-info { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; }
.feature-info p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.feature-info h2 { margin-top: 8px; font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 700; line-height: 1.45; }

/* 新着：残りのジャンルの最新を1件ずつ */
.news { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; list-style: none; }
.news a { display: flex; align-items: center; gap: 16px; height: 100%; padding: 12px 18px 12px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: color-mix(in oklch, var(--panel) 80%, transparent); transition: border-color var(--t-fast), transform var(--t-base) var(--ease), background var(--t-fast); }
.news a:hover { border-color: color-mix(in oklch, var(--hi) 60%, transparent); transform: translateY(-3px); }
.news-thumb { display: grid; flex-shrink: 0; place-items: center; width: 76px; height: 76px; overflow: hidden; border-radius: 12px; color: var(--hi); background: var(--panel-2); font-size: 1.5rem; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-body { display: grid; flex: 1; gap: 3px; min-width: 0; }
.news-body > span:first-child { display: flex; align-items: center; gap: 8px; }
.news-body strong { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.news-body small { overflow: hidden; color: var(--muted); font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; }
.news a > svg { color: var(--muted); transition: translate var(--t-base) var(--ease), color var(--t-fast); }
.news a:hover > svg { color: var(--hi); translate: 3px 0; }

/* --- ショップ：主役の商品を大きく ----------------------------------------- */
.spot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 72px); padding: clamp(16px, 2vw, 24px); border: 1px solid var(--line); border-radius: calc(var(--r-l) + 8px); background: color-mix(in oklch, var(--panel) 70%, transparent); }
.spot-art { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-l); background: var(--panel-2); }
.spot-art img { width: 100%; height: 100%; object-fit: cover; transition: scale var(--t-slow) var(--ease); }
.spot:hover .spot-art img { scale: 1.04; }
.spot-state { position: absolute; top: 14px; left: 14px; padding: 4px 12px; border-radius: var(--r-pill); color: #fff; background: #000a; font-size: .8rem; }
.spot-body { display: grid; gap: 18px; padding-right: clamp(0px, 2vw, 24px); }
.spot-body h3 { font-size: clamp(1.5rem, 3vw, 2.4rem); font-weight: 900; line-height: 1.3; letter-spacing: -.01em; }
.spot-price { font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.spot-body .btn { justify-self: start; }
.goods-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 16px; list-style: none; }
.goods-more a { display: grid; gap: 10px; }
.goods-more img { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: var(--r-m); }
.goods-more strong { font-size: .9rem; line-height: 1.5; }

/* --- 音楽：ジャケットの棚 ------------------------------------------------- */
.shelf { --size: clamp(220px, 34vw, 400px); position: relative; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab; outline-offset: -2px; }
.shelf::-webkit-scrollbar { display: none; }
.shelf.dragging { scroll-snap-type: none; cursor: grabbing; }
.shelf-track { display: flex; gap: clamp(8px, 2vw, 24px); width: max-content; padding: 30px calc(50vw - var(--size) / 2); }
.disc { position: relative; flex-shrink: 0; width: var(--size); aspect-ratio: 1; overflow: hidden; border-radius: var(--r-m); background: var(--panel-2); box-shadow: var(--shadow); scroll-snap-align: center; transform: scale(.78); opacity: .45; transition: transform .5s var(--ease), opacity .5s var(--ease); }
.disc img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.disc.on { transform: scale(1); opacity: 1; }
/* 対応ブラウザでは、スクロールの位置に合わせて連続的に大きさが変わる */
@supports (animation-timeline: view()) {
  .disc, .disc.on { transform: none; opacity: 1; transition: none; animation: disc-focus linear both; animation-timeline: view(inline); }
}
@keyframes disc-focus { 0%, 100% { transform: scale(.72); opacity: .35; } 50% { transform: scale(1); opacity: 1; } }
.shelf-ctrl { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 4px; }
.shelf-ctrl .icon-btn { border: 1px solid var(--line); color: var(--fg); }
.shelf-ctrl .meta { min-width: 4.5em; text-align: center; }
.release { display: grid; justify-items: center; gap: 10px; max-width: 760px; margin: 28px auto 0; text-align: center; }
.release h3 { font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 900; line-height: 1.35; }
.release .en { color: var(--muted); font-size: .95rem; }
.release-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.player { width: 100%; margin-top: 12px; overflow: hidden; border-radius: var(--r-m); animation: lift .45s var(--ease) both; }
.player iframe { display: block; width: 100%; height: 352px; border: 0; }

/* --- ゲーム -------------------------------------------------------------- */
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2vw, 24px); }
.game-tile { display: grid; gap: 18px; padding: 12px 12px 22px; border: 1px solid var(--line); border-radius: calc(var(--r-l) + 6px); background: color-mix(in oklch, var(--panel) 70%, transparent); transition: border-color var(--t-fast), transform var(--t-base) var(--ease); }
.game-tile:hover { border-color: color-mix(in oklch, var(--hi) 55%, transparent); transform: translateY(-4px); }
.game-shot { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-l); background: #000; }
.game-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: 0; transition: opacity .45s; }
.game-shot img.on { opacity: 1; }
.game-tile-body { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-inline: 12px; }
.game-tile h3 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; }
.game-tile p { margin-top: 6px; color: var(--muted); font-size: .9rem; }
.game-tile .go { display: grid; flex-shrink: 0; place-items: center; width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 50%; font-size: 1.2rem; transition: background var(--t-fast), color var(--t-fast), rotate var(--t-base) var(--ease); }
.game-tile:hover .go { color: var(--on-hi); background: var(--hi); rotate: -45deg; }

/* --- イラスト（元画像が小さいので、小さめのタイルで並べる） --------------- */
.art { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 42vw), 1fr)); gap: 14px; list-style: none; }
.art a { display: block; }
.art-img { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-m); background: var(--panel-2); }
.art-img img { width: 100%; height: 100%; object-fit: cover; transition: scale var(--t-slow) var(--ease); }
.art a:hover .art-img img { scale: 1.06; }
.art-cap { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .9rem; }
.art-cap strong { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

/* --- 小説：題名で作った表紙 ----------------------------------------------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: clamp(14px, 2vw, 24px); list-style: none; }
.book { display: grid; gap: 16px; }
.cover { --h: 220; position: relative; display: grid; align-content: space-between; gap: 18px; aspect-ratio: 3 / 4; overflow: hidden; padding: 26px 24px; border-radius: 8px var(--r-m) var(--r-m) 8px; color: #fff; background: linear-gradient(160deg, hsl(var(--h) 45% 34%), hsl(calc(var(--h) + 40) 50% 14%)); box-shadow: var(--shadow), inset 10px 0 0 #0002; transition: transform var(--t-base) var(--ease); }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, #fff1 0 2%, transparent 6%); pointer-events: none; }
.book:hover .cover { transform: translateY(-6px) rotate(-1deg); }
.cover strong { font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 900; line-height: 1.4; text-wrap: balance; }
.cover small { color: #fffb; font-size: .8rem; }
.cover svg { font-size: 1.5rem; opacity: .85; }
.book-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* --- プロフィールとリンク ------------------------------------------------- */
.about { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
.about img { width: clamp(120px, 18vw, 200px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }
.about h3 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 900; line-height: 1.2; }
.about p { margin-top: 10px; color: var(--muted); }
.about dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin-top: 18px; font-size: .95rem; }
.about dt { color: var(--muted); font-size: .85rem; line-height: 1.75rem; }
.about dd .link { min-height: 0; padding-block: 9px; margin-block: -9px; color: var(--fg); }
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 40px; list-style: none; }
.links li { display: flex; }
.links a { flex: 1; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-m); transition: border-color var(--t-fast), background var(--t-fast); }
.links a:hover { border-color: color-mix(in oklch, var(--hi) 55%, transparent); background: color-mix(in oklch, var(--panel) 80%, transparent); }
.links .ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--hi); background: var(--panel-2); font-size: 1.1rem; }
.links strong { display: block; font-size: 1rem; }
.links small { color: var(--muted); font-size: .8rem; }
.links .ext { margin-left: auto; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: clamp(80px, 10vw, 140px); padding-block: 32px calc(40px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot .logo { color: var(--fg); font-size: 1rem; }

/* --- 下の階層のページ（ゲーム・小説） ------------------------------------ */
.page { padding-top: calc(var(--bar-h) + 48px); }
.back { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); font-size: .9rem; transition: color var(--t-fast), border-color var(--t-fast); }
.back:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 30%, transparent); }
.back svg { transition: translate var(--t-base) var(--ease); }
.back:hover svg { translate: -3px 0; }
.page-title { font-size: clamp(3rem, 9vw, 7rem); font-weight: 900; line-height: 1; letter-spacing: -.04em; }
.game-head { margin-bottom: clamp(24px, 3.5vw, 40px); }
.game-lead { margin-top: 14px; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); }
/* 画面写真（左・大）と、遊ぶための情報（右）。ダウンロードを最初の画面に入れる */
.game-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; gap: clamp(14px, 2vw, 24px); }
.game-hero .game-shot { border-radius: var(--r-l); box-shadow: var(--shadow); }
.game-hero .game-shot img { opacity: 1; }
.game-card { display: grid; gap: 24px; padding: clamp(22px, 2.4vw, 32px); border: 1px solid var(--line); border-radius: var(--r-l); background: color-mix(in oklch, var(--panel) 76%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.facts { display: flex; flex-wrap: wrap; gap: 14px 36px; list-style: none; }
.facts li { display: grid; gap: 2px; }
.facts small { color: var(--muted); font-size: .78rem; }
.facts strong { font-size: clamp(1.7rem, 2.6vw, 2.3rem); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.game-card > * + * { padding-top: 22px; border-top: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .95rem; font-weight: 700; }
.card-title svg { color: var(--hi); }
.game-card .plain-list { gap: 4px; font-size: .92rem; }
.dl { display: grid; gap: 10px; }
.dl .card-title { margin-bottom: 0; }
.dl-btn { justify-content: space-between; min-height: 66px; padding: 0 22px; text-align: left; white-space: normal; }
.dl-main { display: grid; line-height: 1.35; }
.dl-main strong { font-size: 1.08rem; font-weight: 800; }
.dl-main small { font-size: .78rem; font-weight: 500; opacity: .78; }
.dl .meta { margin-top: 2px; }
/* 画面写真の一覧：枚数に合わせて列を決め（4枚なら4列、6枚なら3列）、端が余らないように */
.gallery { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; list-style: none; }
.gallery button { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-m); background: #000; }
.gallery img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: scale var(--t-slow) var(--ease); }
.gallery button:hover img { scale: 1.05; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 64px); }
.cols h3, .sub-head { margin-bottom: 16px; font-size: 1.4rem; font-weight: 900; }
.plain-list { display: grid; gap: 8px; list-style: none; }
.plain-list li { padding-left: 1.1em; text-indent: -1.1em; }
.plain-list li::before { content: '・'; color: var(--hi); }
.controls { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 32px; max-width: 820px; }
.controls div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.controls dt { color: var(--muted); }
.page-bg { position: absolute; z-index: -1; inset: 0 0 auto; height: 70vh; background-size: cover; background-position: center top; opacity: .14; mask-image: linear-gradient(#000, transparent); -webkit-mask-image: linear-gradient(#000, transparent); }

/* 小説の目次 */
.novel-head { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); align-items: start; gap: clamp(28px, 5vw, 64px); }
.novel-head .page-title { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.25; letter-spacing: -.02em; }
.novel-desc { margin-top: 18px; color: var(--muted); white-space: pre-line; }
.novel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
.jump { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 6px 0 16px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); font-size: .9rem; }
.jump input { width: 4.2em; height: 40px; border: 0; border-radius: 10px; background: var(--panel-2); text-align: center; font-size: 1rem; }
.jump input:focus-visible { outline: 2px solid var(--hi); outline-offset: 0; }
.jump .btn { min-height: 40px; padding: 0 16px; }
.chapters { display: grid; gap: 10px; margin-top: 56px; }
.chapter { border: 1px solid var(--line); border-radius: var(--r-m); background: color-mix(in oklch, var(--panel) 65%, transparent); }
.chapter summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; cursor: pointer; list-style: none; font-weight: 700; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::after { content: ''; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); rotate: 45deg; translate: 0 -3px; transition: rotate var(--t-base) var(--ease); }
.chapter[open] summary::after { rotate: 225deg; translate: 0 3px; }
.chapter summary .meta { margin-left: auto; font-weight: 400; }
.chapter ol { list-style: none; padding: 0 10px 12px; }
.chapter li a { display: flex; align-items: baseline; gap: 16px; padding: 11px 12px; border-radius: var(--r-s); transition: background var(--t-fast), color var(--t-fast); }
.chapter li a:hover { color: var(--hi); background: var(--line); }
.chapter li .meta { min-width: 2.6em; text-align: right; }
.chapter li .here { margin-left: auto; padding: 0 10px; border-radius: var(--r-pill); color: var(--on-hi); background: var(--hi); font-size: .72rem; line-height: 1.8; }

/* 読書画面 -------------------------------------------------------------------
   紙：生成り・白・夜。「自動」はサイトの明るさに合わせる（明るい→生成り、暗い→夜）。
   紙のざらつきと繊維は、灰色のノイズを紙の色に overlay で重ねて出す（明るい紙でも暗い紙でも効く）。 */
.reader { --size: 1.06rem; --lead: 2.05; width: min(46rem, calc(100% - 20px)); margin-inline: auto; padding: calc(var(--bar-h) + 32px) 0 160px; }
.reader, .reader.tone-cream, [data-theme="light"] .reader.tone-auto { --paper: #f3ead6; --ink: #2e271d; --ink-muted: #847764; --paper-edge: #d6c7a9; }
.reader.tone-white { --paper: #fbf9f4; --ink: #1c1a17; --ink-muted: #7a7366; --paper-edge: #e1dace; }
.reader.tone-night, [data-theme="dark"] .reader.tone-auto { --paper: #23211e; --ink: #ddd5c6; --ink-muted: #968c7d; --paper-edge: #3c3833; }
.reader { --ink-line: color-mix(in oklch, var(--ink) 16%, transparent); }
.paper, .reader[data-mode="scroll"] .book {
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.28 0 0 0 .36 .28 0 0 0 .36 .28 0 0 0 .36 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cfilter id='f' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008 .42' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.16 0 0 0 .42 .16 0 0 0 .42 .16 0 0 0 .42 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"), radial-gradient(140% 110% at 50% 35%, #fff 55%, #d9d3c9 100%);
  background-size: 180px 180px, 520px 520px, 100% 100%;
  background-blend-mode: overlay, overlay, multiply;
}
.reader .flow { color: var(--ink); }
.reader-top { display: flex; align-items: center; gap: 10px; color: var(--ink-muted); font-size: .85rem; }
.reader-top a { overflow: hidden; padding-block: 10px; margin-block: -10px; text-overflow: ellipsis; white-space: nowrap; }
.reader-top a:hover { color: var(--ink); }
.reader .meta { color: var(--ink-muted); }
.reader h1 { margin-top: 18px; padding-bottom: 26px; border-bottom: 1px solid var(--ink-line); font-size: clamp(1.5rem, 4.6vw, 2.2rem); font-weight: 900; line-height: 1.45; }
.reader-body { margin-top: 36px; font-size: var(--size); line-height: var(--lead); overflow-wrap: anywhere; transform: translateX(var(--swipe, 0px)); transition: transform .35s var(--ease); }
.reader-body.swiping { transition: none; }
.reader-body.mincho { font-family: var(--font-mincho); }
.reader-body .blank { line-height: 1.5; }
.reader-body rt { font-size: .5em; color: var(--ink-muted); }
.reader-body .bouten { font-style: normal; text-emphasis: filled sesame; -webkit-text-emphasis: filled sesame; }
.reader-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 72px; }
.reader-pager .next:only-child { grid-column: 2; }
.reader-pager a { display: grid; gap: 4px; min-height: 84px; padding: 16px 20px; border: 1px solid var(--ink-line); border-radius: var(--r-m); color: var(--ink); transition: border-color var(--t-fast), transform var(--t-base) var(--ease), background var(--t-fast); }
.reader-pager a:hover { border-color: color-mix(in oklch, var(--ink) 40%, transparent); background: color-mix(in oklch, var(--ink) 4%, transparent); transform: translateY(-2px); }
.reader-pager .next { text-align: right; }
.reader-pager small { color: var(--ink-muted); font-size: .8rem; }
.reader-pager strong { line-height: 1.5; }

/* スクロールで読む：長い1枚の紙 */
.reader[data-mode="scroll"] .book { padding: clamp(26px, 6vw, 64px) clamp(20px, 6vw, 64px) clamp(30px, 6vw, 64px); border-radius: 6px; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .55), 0 2px 8px rgb(0 0 0 / .12); }

/* 紙の右下の折り返し：めくって次の話へ */
.reader[data-mode="scroll"] .book { position: relative; }
.dogear { position: absolute; right: 0; bottom: 0; width: 46px; height: 46px; border-bottom-right-radius: 6px; background: linear-gradient(to top left, var(--bg) 0 50%, transparent 50%); transition: width var(--t-base) var(--ease), height var(--t-base) var(--ease); }
.dogear::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top left, transparent 50%, var(--paper-edge) 50%, color-mix(in oklch, var(--paper-edge) 55%, #fff) 100%); filter: drop-shadow(-2px -2px 3px rgb(0 0 0 / .2)); }
.dogear:hover, .dogear:focus-visible { width: 76px; height: 76px; }
.reader[data-mode="page"] .dogear { display: none; }
/* 話を移るときの紙：次の話の紙は下に、前の話の紙は上に重ねる */
.sheet-layer { position: fixed; top: 0; left: 0; bottom: 0; overflow: hidden; pointer-events: none; }
.sheet-layer.under { z-index: 1; }
.sheet-layer.over { z-index: 50; }
.reader[data-mode="scroll"] .book.lifting { box-shadow: 0 46px 90px -34px rgb(0 0 0 / .62), 0 6px 18px rgb(0 0 0 / .18); will-change: transform; }

/* ページで読む：本。紙の大きさと位置は app.js が決めて --page-w などに入れる */
html.paged, html.paged body { overflow: hidden; overscroll-behavior: none; }
.reader[data-mode="page"] { position: fixed; inset: 0; z-index: 1; width: auto; margin: 0; padding: 0; }
.reader[data-mode="page"] .book { position: absolute; left: 50%; top: var(--book-top, 90px); width: var(--book-w, 0); height: var(--page-h, 0); translate: -50% 0; perspective: 3000px; touch-action: pinch-zoom; }
.reader[data-mode="page"] .viewport { position: absolute; inset: 0; z-index: 1; overflow: hidden; }
.reader[data-mode="page"] .flow { position: absolute; left: var(--pad); top: var(--pad-top); width: calc(var(--book-w) - var(--pad) * 2); height: calc(var(--page-h) - var(--pad-top) - var(--pad-bottom)); column-width: var(--col-w); column-gap: calc(var(--pad) * 2); column-fill: auto; orphans: 2; widows: 2; }
.reader[data-mode="page"] .reader-head { margin-bottom: 1.6em; }
.reader[data-mode="page"] h1 { margin-top: 12px; padding-bottom: 18px; font-size: clamp(1.25rem, 3.4vw, 1.75rem); }
.reader[data-mode="page"] .reader-body { margin-top: 0; transform: none; transition: none; }
.reader[data-mode="page"] .reader-pager { grid-template-columns: 1fr; margin-top: 2.6em; break-inside: avoid; }
.reader[data-mode="page"] .reader-pager .next:only-child { grid-column: auto; }
.sheet, .face { position: absolute; top: 0; left: 0; width: var(--page-w); height: var(--page-h); overflow: hidden; }
.sheet { z-index: 0; transition: box-shadow var(--t-base); }
.sheet.side-l, .face.side-l { border-radius: 7px 3px 3px 7px; }
.sheet.side-r, .face.side-r { border-radius: 3px 7px 7px 3px; }
.sheet.side-r, .face.cover.at-r { left: var(--page-w); }
.book[data-spread="false"] .sheet.side-r { display: none; }
.book[data-spread="false"] :is(.sheet, .face).side-l { border-radius: 3px 8px 8px 3px; }
/* とじ側の影（見開きは真ん中、1ページは左端） */
:is(.sheet, .face)::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.book[data-spread="true"] :is(.sheet, .face).side-l::before { background: linear-gradient(to left, rgb(0 0 0 / .16), rgb(0 0 0 / .05) 5%, transparent 13%); }
.book[data-spread="true"] :is(.sheet, .face).side-r::before { background: linear-gradient(to right, rgb(0 0 0 / .18), rgb(0 0 0 / .05) 5%, transparent 13%); }
.book[data-spread="false"] :is(.sheet, .face).side-l::before { background: linear-gradient(to right, rgb(0 0 0 / .12), transparent 4%); }
.folio { position: absolute; z-index: 2; bottom: calc(var(--pad-bottom) * .36); color: var(--ink-muted); font-size: .72rem; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.side-l .folio { left: var(--pad); }
.side-r .folio { right: var(--pad); }
.book[data-spread="false"] .side-l .folio { left: 50%; translate: -50% 0; }
/* めくっている紙 */
.face { z-index: 3; }
.face .flow { pointer-events: none; }
.leaf { position: absolute; top: 0; left: 0; z-index: 4; width: var(--page-w); height: var(--page-h); transform-origin: left center; transform-style: preserve-3d; will-change: transform; }
.leaf.at-r { left: var(--page-w); }
.leaf .face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf .back { transform: rotateY(180deg); }
.shade { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: linear-gradient(to right, rgb(0 0 0 / .32), rgb(0 0 0 / .06) 35%, transparent 60%, rgb(0 0 0 / .1)); }
.leaf .back .shade { background: linear-gradient(to left, rgb(0 0 0 / .3), transparent 55%); }
/* めくった紙が落とす影 */
.cast { position: absolute; top: 0; z-index: 2; width: var(--page-w); height: var(--page-h); pointer-events: none; opacity: 0; }
.book[data-spread="true"] .cast { left: var(--page-w); background: linear-gradient(to right, rgb(0 0 0 / .3), transparent 50%); border-radius: 3px 7px 7px 3px; }
.book[data-spread="false"] .cast { left: 0; background: linear-gradient(to right, rgb(0 0 0 / .32), rgb(0 0 0 / .08) 45%, transparent 75%); border-radius: 3px 8px 8px 3px; }
.progress { position: fixed; z-index: 150; top: 0; left: 0; width: 100%; height: 3px; background: var(--hi); transform: scaleX(var(--p, 0)); transform-origin: left; pointer-events: none; }
.reader-bar { position: fixed; z-index: 110; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: var(--r-pill); background: color-mix(in oklch, var(--bg) 78%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: var(--shadow); translate: -50% 0; transition: translate var(--t-base) var(--ease), opacity var(--t-base); }
.reader-bar.away { translate: -50% calc(100% + 40px); opacity: 0; }
.reader-bar a, .reader-bar button { display: grid; place-items: center; width: 50px; height: 48px; border-radius: var(--r-pill); font-size: 1.15rem; transition: background var(--t-fast), color var(--t-fast); }
.reader-bar a:hover, .reader-bar button:hover, .reader-bar [aria-expanded="true"] { color: var(--hi); background: var(--line); }
.reader-bar .off { opacity: .3; pointer-events: none; }
.reader-bar .pos { width: auto; min-width: 64px; padding: 0 8px; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.settings { position: fixed; z-index: 112; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); display: grid; gap: 4px; width: min(380px, calc(100% - 24px)); padding: 10px 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); box-shadow: var(--shadow); translate: -50% 0; animation: lift .3s var(--ease) both; }
.settings[hidden] { display: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; font-size: .9rem; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--panel-2); }
.seg button { min-width: 44px; height: 38px; padding: 0 14px; border-radius: var(--r-pill); font-size: .85rem; transition: background var(--t-fast), color var(--t-fast); }
.seg button[aria-pressed="true"] { color: var(--on-hi); background: var(--hi); font-weight: 700; }
.swipe-hint { position: fixed; z-index: 120; top: 50%; display: flex; align-items: center; gap: 8px; max-width: 70vw; padding: 10px 16px; border-radius: var(--r-pill); color: var(--fg); background: var(--panel); box-shadow: var(--shadow); font-size: .85rem; translate: 0 -50%; transition: background var(--t-fast), color var(--t-fast); }
.swipe-hint.next { right: 12px; }
.swipe-hint.prev { left: 12px; }
.swipe-hint.armed { color: var(--on-hi); background: var(--hi); }

/* --- 探す（Ctrl+K） ------------------------------------------------------- */
.palette { width: min(640px, calc(100% - 24px)); max-height: min(70vh, 640px); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--r-l); color: var(--fg); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.palette[open] { animation: pop .28s var(--ease) both; }
.palette::backdrop { background: #0008; backdrop-filter: blur(6px); }
.palette-box { display: flex; flex-direction: column; max-height: inherit; }
.palette-field { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); font-size: 1.2rem; color: var(--muted); }
.palette-field input { flex: 1; height: 64px; border: 0; background: none; font-size: 1.1rem; outline: none; color: var(--fg); }
.palette-field input::-webkit-search-cancel-button { display: none; }
.palette-list { flex: 1; overflow-y: auto; padding: 8px; list-style: none; overscroll-behavior: contain; }
.palette-list li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--r-s); cursor: pointer; }
.palette-list li[aria-selected="true"] { background: var(--line); }
.palette-list .p-thumb { display: grid; flex-shrink: 0; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: 9px; color: var(--hi); background: var(--panel-2); }
.palette-list .p-thumb img { width: 100%; height: 100%; object-fit: cover; }
.palette-list .p-text { display: grid; flex: 1; min-width: 0; }
.palette-list strong { overflow: hidden; font-size: .95rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.palette-list small { overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .empty { justify-content: center; padding: 28px; color: var(--muted); cursor: default; }
.palette-hint { display: flex; gap: 18px; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.palette-hint span { display: flex; align-items: center; gap: 4px; }

/* --- 画像を大きく見る ----------------------------------------------------- */
.lightbox { max-width: none; max-height: none; width: 100%; height: 100%; padding: 0; border: 0; background: #000d; color: #fff; }
.lightbox[open] { display: grid; place-items: center; animation: fade .25s both; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: min(92vw, 1100px); max-height: 82vh; border-radius: var(--r-m); image-rendering: pixelated; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; background: #fff1; font-size: 1.3rem; transition: background var(--t-fast); }
.lb-btn:hover { background: #fff3; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
.lb-next { right: 16px; top: 50%; translate: 0 -50%; }
.lb-count { position: absolute; bottom: 20px; left: 50%; translate: -50% 0; font-size: .85rem; opacity: .8; }

.toast { position: fixed; z-index: 200; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px); padding: 8px 8px 8px 18px; border-radius: var(--r-pill); color: var(--bg); background: var(--fg); box-shadow: var(--shadow); font-size: .85rem; translate: -50% 20px; opacity: 0; pointer-events: none; transition: translate var(--t-base) var(--ease), opacity var(--t-base); }
.toast.on { translate: -50% 0; opacity: 1; pointer-events: auto; }
.toast button { height: 34px; padding: 0 14px; border-radius: var(--r-pill); color: var(--fg); background: var(--bg); font-size: .8rem; font-weight: 700; }
.loading { display: grid; place-items: center; min-height: 100svh; color: var(--muted); }
.notfound { display: grid; gap: 20px; justify-items: start; padding-block: 30vh; }

/* --- 動き ---------------------------------------------------------------- */
@keyframes rise { from { transform: translateY(45%); opacity: 0; clip-path: inset(0 0 100% 0); } to { transform: none; opacity: 1; clip-path: inset(0 0 -20% 0); } }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lift { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ページの切り替え（View Transitions）。同じ名前の画像は、そのまま形を変えてつながる。 */
::view-transition-old(root) { animation: .22s ease both vt-out; }
::view-transition-new(root) { animation: .38s var(--ease) both vt-in; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease); }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* --- 移動の部品の切り替え ------------------------------------------------- */
.foot { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.page, .notfound { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) {
  .to-top { right: calc(18px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
}
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  /* 左の目次のぶん、左右の余白を広げる（狭いPCでも本文に重ならないように） */
  :root { --gutter: max(88px, 4vw); }
  .dock { display: none; }
  .page, .notfound { padding-bottom: 120px; }
  /* 上のバーは帯をやめ、ロゴと道具だけを浮かせる */
  .bar { width: min(var(--wrap), calc(100% - var(--gutter) * 2)); padding: 0; border-color: transparent; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
  .bar > * { pointer-events: auto; }
  .bar .logo, .bar-tools { height: 56px; border: 1px solid var(--line); border-radius: var(--r-pill); background: color-mix(in oklch, var(--bg) 72%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); }
  .bar .logo { padding: 0 26px; }
  .bar-tools { padding: 0 6px; }
  .rail { position: fixed; z-index: 101; left: 16px; top: 50%; display: block; width: 58px; overflow: hidden; padding: 6px 0; border: 1px solid var(--line); border-radius: 29px; background: color-mix(in oklch, var(--bg) 78%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); box-shadow: var(--shadow); translate: 0 -50%; transition: width .4s var(--ease) .22s; }
  .rail ol { padding-inline: 6px; width: 176px; }
  .rail:hover, .rail:has(:focus-visible) { width: 178px; transition-delay: .05s; }
  .rail:hover .rail-label, .rail:has(:focus-visible) .rail-label { opacity: 1; translate: 0 0; transition-delay: calc(.08s + var(--n) * 22ms); }
  .to-top { right: 24px; bottom: 24px; }
  [data-route="reader"] .rail { display: none; }
}
/* 横に余白がたっぷりある画面では、目次をいつも開いておく */
@media (min-width: 1680px) and (hover: hover) and (pointer: fine) {
  .rail, .rail:hover, .rail:has(:focus-visible) { left: 24px; width: 178px; }
  .rail .rail-label { opacity: 1; translate: 0 0; }
}

/* --- 狭い画面 ------------------------------------------------------------ */
@media (max-width: 1120px) {
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { width: 44px; padding: 0; justify-content: center; border: 0; font-size: 1.15rem; }
}
@media (max-width: 900px) {
  :root { --bar-h: 64px; }
  .bar { top: 8px; height: 56px; padding-left: 18px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: calc(var(--bar-h) + 40px); }
  .hero-find { width: 100%; }
  .shelf { --size: min(68vw, 320px); }
  .spot, .game-hero, .cols, .novel-head { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .novel-head .cover { max-width: 240px; }
  .games { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .feature-info { flex-direction: column; align-items: stretch; }
  .reader-bar { bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .dock a { width: 56px; }
  .controls { grid-template-columns: minmax(0, 1fr); }
  .controls div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* 動きを減らす設定では、すべて止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .disc { transform: none !important; opacity: 1 !important; }
}
