@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root{
  --ink:#f7efe0;
  --ink-dark:#2a1d13;
  --parchment:#ead5a9;
  --parchment-2:#cfae72;
  --gold:#d6a94a;
  --gold-bright:#f1ca69;
  --red:#9e3b2e;
  --blue:#234e7e;
  --deep:#061a18;
  --shadow:rgba(0,0,0,.38);
  --line:rgba(255,248,222,.54);
  --radius:22px;

  /* motif colors */
  --m-wander:#7c9a6d;
  --m-home:#c98a3a;
  --m-temptation:#9e3b2e;
  --m-fate:#5b6f9e;
  --m-xenia:#a8823f;
  --m-identity:#7a4a8c;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  color:var(--ink);
  font-family:'EB Garamond', Georgia, serif;
  background:var(--deep);
  overflow-x:hidden;
  -webkit-tap-highlight-color:transparent;
}
img{max-width:100%;display:block}

/* backdrop layers */
.bg{position:fixed; inset:0; z-index:-3; background:url('assets/scroll-bg.png') center/cover no-repeat; filter:saturate(.9) contrast(1.02);}
.veil{position:fixed; inset:0; z-index:-2; background:radial-gradient(circle at 52% 12%, rgba(255,234,183,.20), transparent 30%), linear-gradient(180deg, rgba(1,18,17,.44), rgba(4,15,14,.9));}
.grain{position:fixed; inset:0; z-index:-1; pointer-events:none; opacity:.26; background-image:radial-gradient(rgba(255,255,255,.2) 1px, transparent 1px); background-size:3px 3px; mix-blend-mode:overlay;}

.app{width:min(100%,1180px); margin:0 auto; padding:16px 16px max(34px, env(safe-area-inset-bottom, 0px));}

/* header — top safe area keeps the brand clear of the notch / dynamic island */
header{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; position:sticky; top:0; z-index:20; padding:max(56px, env(safe-area-inset-top, 0px)) 4px 10px; background:linear-gradient(180deg, rgba(6,26,24,.82), rgba(6,26,24,0)); backdrop-filter:blur(6px);}
/* Cover state: float the header over the artwork, out of the flow */
body.at-cover header{position:fixed; left:0; right:0; top:0; margin-bottom:0; padding:max(56px, env(safe-area-inset-top, 0px)) 20px 12px; background:linear-gradient(180deg, rgba(6,20,18,.55), transparent);}
body.at-cover .app{padding-top:0;}
body.at-cover .cover{margin-top:0;}
.brand{display:flex; align-items:center; gap:10px; min-width:0;}
.seal{width:42px;height:42px;border-radius:50%; background:radial-gradient(circle at 32% 28%, #ffe9a2, #b97824 58%, #5c2419); border:1px solid rgba(255,240,180,.55); box-shadow:0 0 22px rgba(214,169,74,.35); display:grid;place-items:center;font-family:Cinzel,serif;font-weight:700;color:#2b150c;}
.brand h1{font-family:'Cinzel',serif; font-size:20px; margin:0; letter-spacing:.08em; white-space:nowrap;}
.pill{border:1px solid rgba(255,232,170,.4); background:rgba(8,38,33,.55); color:#fff3d1; min-height:44px; border-radius:999px; padding:0 15px; font-size:13px; cursor:pointer; font-family:inherit; transition:background .2s;}
.pill:hover{background:rgba(214,169,74,.24);}

/* ===== 电影级全屏封面 ===== */
.cover{position:relative; height:100svh; min-height:560px; margin:-16px -16px 0; display:flex; align-items:flex-end; overflow:hidden;}
.cover-art{position:absolute; inset:0; z-index:0; background:url('assets/cyclops/01-shore.png') center 30%/cover no-repeat; transform:scale(1.08); animation:coverKB 22s ease-out forwards; will-change:transform;}
@keyframes coverKB{from{transform:scale(1.02) translateY(0)} to{transform:scale(1.16) translateY(-3%)}}
.cover-shade{position:absolute; inset:0; z-index:1; background:linear-gradient(180deg, rgba(6,20,18,.34) 0%, rgba(6,20,18,.06) 30%, rgba(6,18,16,.62) 68%, rgba(4,14,13,.96) 100%);}
.cover-inner{position:relative; z-index:2; width:100%; padding:0 22px calc(60px + env(safe-area-inset-bottom, 0px)); max-width:720px; margin:0 auto; text-align:center;}
.cover-kicker{opacity:0; animation:coverUp .9s ease .25s forwards;}
.cover-title{font-family:'Cinzel',serif; font-size:clamp(46px,15vw,84px); line-height:1; margin:0 0 4px; letter-spacing:.06em; text-shadow:0 4px 30px rgba(0,0,0,.7), 0 0 44px rgba(214,169,74,.28); opacity:0; animation:coverUp 1s ease .5s forwards;}
.cover-sub{font-family:'Cinzel',serif; font-size:clamp(18px,5.5vw,26px); color:var(--gold-bright); letter-spacing:.42em; margin:0 0 18px; padding-left:.42em; text-shadow:0 2px 18px rgba(0,0,0,.7); opacity:0; animation:coverUp 1s ease .78s forwards;}
.cover-line{font-size:14.5px; line-height:1.8; color:#f4ead0; max-width:30em; margin:0 auto 26px; text-shadow:0 2px 14px rgba(0,0,0,.85); opacity:0; animation:coverUp 1s ease 1.05s forwards;}
.cover-cta{display:flex; gap:12px; justify-content:center; flex-wrap:wrap; opacity:0; animation:coverUp 1s ease 1.3s forwards;}
.primary.big{min-height:56px; font-size:17px; padding:0 30px; box-shadow:0 12px 34px rgba(0,0,0,.4), 0 0 0 1px rgba(255,240,190,.25) inset;}
.primary.big{animation:pulseGlow 2.6s ease-in-out 2s infinite;}
@keyframes pulseGlow{0%,100%{box-shadow:0 12px 34px rgba(0,0,0,.4)} 50%{box-shadow:0 12px 34px rgba(0,0,0,.4), 0 0 26px rgba(241,202,105,.55)}}
@keyframes coverUp{from{opacity:0; transform:translateY(18px)} to{opacity:1; transform:translateY(0)}}
.cover-scrollcue{position:absolute; left:50%; bottom:max(16px, env(safe-area-inset-bottom, 0px)); z-index:2; transform:translateX(-50%); width:26px; height:42px; border:2px solid rgba(255,240,190,.5); border-radius:14px; opacity:0; animation:coverUp 1s ease 1.7s forwards;}
.cover-scrollcue span{position:absolute; left:50%; top:8px; width:4px; height:8px; margin-left:-2px; border-radius:2px; background:var(--gold-bright); animation:cueDrop 1.7s ease-in-out infinite;}
@keyframes cueDrop{0%{transform:translateY(0);opacity:1} 70%{transform:translateY(14px);opacity:0} 100%{opacity:0}}

/* 长卷区标题微调 */
.map-section{margin-top:26px;}
.kicker{font-family:Cinzel,serif; color:var(--gold-bright); font-size:12px; letter-spacing:.18em; text-transform:uppercase; margin:0 0 8px;}
button{font-family:inherit; cursor:pointer; border:0;}
.primary{background:linear-gradient(135deg,#f5d37a,#b76a2d); color:#24150d; border-radius:999px; padding:0 20px; min-height:48px; font-weight:700; font-size:15px; box-shadow:0 10px 28px rgba(0,0,0,.28); transition:transform .2s;}
.primary:hover{transform:translateY(-2px);}
.ghost{background:rgba(255,239,204,.1); color:#fff4d8; border:1px solid rgba(255,232,170,.42); border-radius:999px; padding:0 18px; min-height:48px; font-size:15px; transition:background .2s;}
.ghost:hover{background:rgba(255,239,204,.2);}

/* scroll shell + map strip —— 干净对称的羊皮卷托盘 */
.scroll-shell{position:relative; border-radius:26px; border:1px solid rgba(250,222,150,.42); background:linear-gradient(180deg, rgba(232,203,142,.92), rgba(190,138,72,.92)); box-shadow:0 22px 60px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.16); padding:16px 0 14px; overflow:hidden;}

.strip-hint{display:flex; align-items:center; justify-content:center; gap:10px; color:#6a4020; font-size:12px; letter-spacing:.12em; margin:12px 0 0; font-family:Cinzel,serif;}
.strip-hint .arrow{font-size:15px; color:#8a4a24; animation:nudge 1.6s ease-in-out infinite;}
@keyframes nudge{50%{transform:translateX(4px)}}

/* 卡片满托盘宽,一屏一张;用 calc 直接吃掉容器内边距,消除右侧空白 */
.map-strip{--pad:16px; display:flex; gap:var(--pad); overflow-x:auto; scroll-snap-type:x mandatory;
  padding:4px var(--pad) 8px; scrollbar-width:none;}
.map-strip::-webkit-scrollbar{display:none}
.chapter{scroll-snap-align:center; scroll-snap-stop:always; flex:0 0 100%; border-radius:22px; padding:12px; color:#2d1b10; background:#ead7aa; position:relative; overflow:hidden; box-shadow:inset 0 0 26px rgba(82,39,16,.2), 0 8px 18px rgba(62,28,12,.22); border:1px solid rgba(98,49,21,.35); cursor:pointer; text-align:left;}
.chapter:after{content:""; position:absolute; inset:0; pointer-events:none; background:radial-gradient(circle at 20% 8%, rgba(255,255,255,.28), transparent 22%), radial-gradient(circle at 80% 88%, rgba(80,35,14,.14), transparent 30%); mix-blend-mode:multiply;}
.chapter:focus-visible{outline:3px solid var(--gold); outline-offset:2px;}
.miniature{aspect-ratio:4/3; max-height:340px; border-radius:16px; overflow:hidden; border:3px double rgba(94,43,20,.42); background:#cba96c; margin-bottom:12px; position:relative;}
.miniature img{width:100%; height:100%; object-fit:cover; object-position:center 30%; filter:sepia(.05) saturate(.98);}
.num{position:absolute; top:10px; left:10px; min-width:34px; height:34px; padding:0 6px; border-radius:999px; background:#9e3b2e; color:#ffe8ad; display:grid; place-items:center; font-family:Cinzel,serif; z-index:2; border:1px solid #f3cc6d; font-size:14px;}
.chapter h3{font-family:'Cinzel',serif; font-size:22px; margin:2px 0 4px; color:#24150d;}
.chapter .place{font-family:Cinzel,serif; font-size:11px; letter-spacing:.08em; color:#8a5326; text-transform:uppercase; margin:0 0 8px;}
.tagrow{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px;}
.tag{font-size:11px; border:1px solid rgba(72,41,19,.32); color:#fff; border-radius:999px; padding:4px 9px; font-weight:600;}
.chapter .peek{font-size:12px; color:#7a4a2c; font-family:Cinzel,serif; letter-spacing:.04em;}

/* sections */
.section{margin-top:26px; border:1px solid rgba(250,224,159,.45); background:rgba(7,31,28,.74); backdrop-filter:blur(12px); border-radius:28px; padding:20px 18px; box-shadow:0 18px 48px rgba(0,0,0,.34);}
.section > h2{font-family:'Cinzel',serif; font-size:26px; margin:0 0 6px;}
.section > .lead{margin:0 0 4px; color:#f9e9c6; line-height:1.7; font-size:14px;}
.section-eyebrow{font-family:Cinzel,serif; color:var(--gold-bright); font-size:11px; letter-spacing:.16em; text-transform:uppercase; margin:0 0 6px;}

/* decision flaps —— 已下线 */

/* codex grid —— 人物图鉴缩略图网格 */
.codex-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:14px; margin-top:16px;}
.codex-thumb{text-align:left; padding:0; border-radius:20px; overflow:hidden; background:#ead7aa; color:#29180d; border:1px solid rgba(104,55,24,.42); box-shadow:0 10px 24px rgba(0,0,0,.28); cursor:pointer; display:flex; flex-direction:column;}
.codex-thumb:focus-visible{outline:3px solid var(--gold); outline-offset:2px;}
.thumb-art{aspect-ratio:4/5; overflow:hidden; position:relative; background:#cba96c; border-bottom:3px double rgba(94,43,20,.42);}
.thumb-art img{width:100%; height:100%; object-fit:cover; object-position:center 22%; filter:sepia(.05) saturate(.98);}
.thumb-art:after{content:""; position:absolute; inset:0; background:linear-gradient(180deg,transparent 55%,rgba(30,15,7,.42)); pointer-events:none;}
.thumb-meta{padding:11px 13px 14px;}
.thumb-meta h3{font-family:'Cinzel',serif; font-size:19px; margin:0 0 2px; color:#24150d;}
.thumb-meta p{font-family:Cinzel,serif; font-size:10.5px; letter-spacing:.05em; color:#8a5326; margin:0; line-height:1.4;}

/* codex 详情弹层内容 */
.sheet-body .epithet{font-family:Cinzel,serif; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:#8a5326; margin:0 0 4px;}
.sheet-body .intro{font-size:15px; line-height:1.8; margin:8px 0 0; color:#3a2214;}
.facts{display:grid; gap:10px; margin-top:16px;}
.fact{display:flex; gap:9px; align-items:flex-start; font-size:13.5px; line-height:1.55; color:#4b2d18;}
.dot{width:8px;height:8px;border-radius:50%;background:#9e3b2e;margin-top:7px;flex:0 0 auto;box-shadow:0 0 0 3px rgba(214,169,74,.25);}
.codex-jump{margin-top:18px; width:100%; min-height:52px; border-radius:16px; font-size:16px;}

.footer-note{text-align:center;color:rgba(255,242,211,.6);font-size:12px;margin:30px 0 0; line-height:1.7;}
.overlay{position:fixed; inset:0; z-index:60; background:rgba(4,12,11,.78); backdrop-filter:blur(6px); display:none; align-items:flex-end; justify-content:center; padding:0;}
.overlay.open{display:flex;}
.sheet{width:min(100%,640px); max-height:92svh; overflow-y:auto; background:linear-gradient(180deg,#efdcb0,#d9b479); color:#2b190d; border-radius:26px 26px 0 0; box-shadow:0 -18px 60px rgba(0,0,0,.5); border:1px solid rgba(255,231,167,.5); border-bottom:0; animation:rise .35s ease; position:relative;}
@keyframes rise{from{transform:translateY(40px);opacity:.4}to{transform:translateY(0);opacity:1}}
.sheet-grab{width:48px;height:5px;border-radius:999px;background:rgba(90,50,22,.4);margin:10px auto 4px;}
.sheet-close{position:absolute; top:12px; right:14px; width:38px;height:38px;border-radius:50%; background:rgba(158,59,46,.9); color:#ffe8ad; font-size:20px; z-index:5; border:1px solid #f3cc6d;}
.sheet-hero{position:relative;}
.sheet-hero img{width:100%; max-height:46svh; object-fit:contain; background:#cba96c;}
.sheet-body{padding:18px 20px max(34px, env(safe-area-inset-bottom, 0px));}
.sheet-body .numeral{font-family:Cinzel,serif; color:#9e3b2e; font-size:13px; letter-spacing:.16em;}
.sheet-body h3{font-family:'Cinzel',serif; font-size:30px; margin:4px 0 2px; color:#24150d;}
.sheet-body .place{font-family:Cinzel,serif; font-size:12px; letter-spacing:.08em; color:#8a5326; text-transform:uppercase; margin:0 0 14px;}
.sheet-body .story{font-size:15px; line-height:1.8; margin:0 0 16px; color:#3a2214;}
.motif-box{border-radius:16px; padding:15px; background:rgba(66,34,15,.08); border:1px solid rgba(120,68,30,.28);}
.motif-box .mlabel{display:inline-block; font-size:11px; font-weight:700; color:#fff; border-radius:999px; padding:3px 11px; margin-bottom:9px; letter-spacing:.05em;}
.motif-box .mtitle{font-family:'Cinzel',serif; font-size:15px; margin:0 0 6px; color:#7a2f22;}
.motif-box p{margin:0; font-size:13.5px; line-height:1.75; color:#4a2d1a;}
.quote{margin:16px 0 0; padding-left:14px; border-left:3px solid #9e3b2e; font-style:italic; color:#6b3a22; font-size:14px; line-height:1.6;}

/* progress dots */
.progress{display:flex; justify-content:center; gap:7px; margin-top:12px;}
.pdot{width:9px;height:9px;border-radius:50%;background:rgba(90,50,22,.35);transition:background .3s,transform .3s;}
.pdot.active{background:#9e3b2e;transform:scale(1.35);}

@media (min-width:720px){
  .app{padding:22px 28px 70px}
  .cover{margin:-22px -28px 0;}
  .cover-art{background-position:center 26%;}
  .chapter{padding:14px}
  .codex-grid{grid-template-columns:repeat(3,1fr); gap:16px;}
  .overlay{align-items:center; padding:24px;}
  .sheet{border-radius:26px; border-bottom:1px solid rgba(255,231,167,.5);}
  .sheet-hero{display:grid; grid-template-columns:1fr; }
}
@media (min-width:1020px){
  .brand h1{font-size:24px}
  .codex-grid{grid-template-columns:repeat(5,1fr);}
}

@media (prefers-reduced-motion:no-preference){
  .seal{animation:glow 4s ease-in-out infinite}
  .chapter{transition:transform .3s ease, box-shadow .3s ease}
  .chapter:hover{transform:translateY(-5px) rotate(-.4deg); box-shadow:inset 0 0 26px rgba(82,39,16,.2), 0 16px 30px rgba(62,28,12,.32);}
  @keyframes glow{50%{box-shadow:0 0 34px rgba(214,169,74,.58)}}
}
@media (prefers-reduced-motion:reduce){
  .strip-hint .arrow{animation:none}
  html{scroll-behavior:auto}
  .cover-art{animation:none; transform:scale(1.04)}
  .cover-kicker,.cover-title,.cover-sub,.cover-line,.cover-cta,.cover-scrollcue{animation:none; opacity:1}
  .primary.big{animation:none}
  .cover-scrollcue span{animation:none}
}
