/* 斗笠向海 一网千年 · 全课样式
   大屏（希沃 1920×1080）和安卓平板（横竖屏）共用；尺寸一律跟视口走 */
@font-face { font-family: "DLSerif"; src: url(../fonts/serif-title.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --deep: #062038; --navy: #0d3a66; --blue: #1667b0; --sea: #2a8fd0; --cyan: #5cc6e4; --foam: #e8f5fc;
  --gold: #e2b23c; --gold-d: #a87a12; --coral: #e8734a; --green: #2f9e6e;
  --ink: #15283a; --muted: #5b6e80; --line: rgba(13, 58, 102, .14);
  --paper: #f6efe1; --paper-ink: #3b2c1c;
  --u: min(1vw, 1.78vh);           /* 版面单位：横屏按宽、竖屏按高，取小 */
  --fs: calc(var(--u) * 1.6);      /* 正文 */
  --nav-h: 64px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--deep); }
body { font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif; color: var(--ink); font-size: max(15px, var(--fs)); -webkit-user-select: none; user-select: none; }
.serif { font-family: "DLSerif", "Noto Serif SC", "Source Han Serif SC", "STSong", serif; font-weight: 700; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { -webkit-user-drag: none; }

/* —— 幻灯片 —— */
#deck { position: fixed; inset: 0 0 var(--nav-h) 0; }
.slide { position: absolute; inset: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s .45s; background: var(--foam); }
.slide.on { opacity: 1; visibility: visible; transition: opacity .45s ease; }
.slide.modern { background: linear-gradient(180deg, #f3f9fd, #e3f1fa); }
.slide.ancient { background: var(--paper) url("../img/paper.svg"); color: var(--paper-ink); }
.slide .pad { position: absolute; inset: 0; padding: calc(var(--u) * 3.2) calc(var(--u) * 4); display: flex; flex-direction: column; }

/* 页眉：篇章 + 标题 */
.hd { display: flex; align-items: baseline; gap: calc(var(--u) * 1.4); margin-bottom: calc(var(--u) * 1.8); flex-wrap: wrap; }
.hd .chip { font-size: .78em; color: #fff; background: var(--navy); padding: .2em .8em; border-radius: 99px; letter-spacing: .1em; white-space: nowrap; }
.ancient .hd .chip { background: #8a5a2b; }
.hd h2 { font-size: calc(var(--u) * 3.2); color: var(--deep); letter-spacing: .06em; line-height: 1.2; }
.ancient .hd h2 { color: #4a2c12; }
.hd .sub { color: var(--muted); font-size: .95em; }
.ancient .hd .sub { color: #8a6a4a; }

.body { flex: 1; min-height: 0; display: flex; gap: calc(var(--u) * 3); }
.col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 1.4); overflow-y: auto; }
.col > .card, .col > .steps-nav, .col > .btn, .col > div:not(.view3d):not(.ph) { flex-shrink: 0; }
.card { background: #fff; border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 1.6) calc(var(--u) * 2); box-shadow: 0 4px 18px rgba(6, 32, 56, .08); border: 1px solid var(--line); line-height: 1.7; }
.ancient .card { background: rgba(255, 252, 244, .92); border-color: rgba(138, 90, 43, .2); }
.card h4 { font-size: 1.12em; color: var(--navy); margin-bottom: .35em; }
.ancient .card h4 { color: #7a4a1e; }
.tag { display: inline-block; font-size: .72em; padding: .1em .6em; border-radius: .4em; background: var(--foam); color: var(--blue); vertical-align: middle; margin-left: .4em; font-weight: 500; }
.tag.op { background: #e0f4ea; color: #1f7a4d; }
.tag.ai { background: #fff0e0; color: #c4600f; }
ul.dots { list-style: none; }
ul.dots li { position: relative; padding-left: 1.1em; margin: .25em 0; }
ul.dots li::before { content: ""; position: absolute; left: .2em; top: .72em; width: .4em; height: .4em; border-radius: 50%; background: var(--sea); }
.ancient ul.dots li::before { background: var(--gold-d); }
b.hl, .hl { color: var(--blue); font-weight: 700; }
.ancient .hl { color: #b0611a; }
.big-num { font-size: 2.4em; font-weight: 900; color: var(--blue); line-height: 1; font-family: "DIN Alternate", "Bahnschrift", sans-serif; }

/* 逐条点开 */
.reveal { opacity: 0; transform: translateY(8px); transition: .4s; pointer-events: none; }
.reveal.show { opacity: 1; transform: none; pointer-events: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 48px; padding: .45em 1.3em; border-radius: 99px; background: var(--blue); color: #fff; font-weight: 700; box-shadow: 0 4px 14px rgba(22, 103, 176, .3); transition: transform .15s, background .2s; }
.btn:active { transform: scale(.96); }
.btn.ghost { background: #fff; color: var(--blue); border: 2px solid var(--blue); box-shadow: none; }
.btn.gold { background: linear-gradient(180deg, #f0c24f, #d49c22); color: #4a2c00; box-shadow: 0 4px 14px rgba(168, 122, 18, .35); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* 图片位：没出图时显示占位 */
.ph { position: relative; background: linear-gradient(135deg, #bfe0f2, #7fb8de); overflow: hidden; }
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph.contain > img { object-fit: contain; }
.ph.missing::after { content: "待出图：" attr(data-name); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: rgba(255, 255, 255, .9); font-size: 1.1em; letter-spacing: .1em; border: 2px dashed rgba(255, 255, 255, .7); padding: .6em 1.2em; border-radius: .6em; white-space: nowrap; }

/* —— 封面 —— */
.cover .ph { position: absolute; inset: 0; background: linear-gradient(180deg, #0b2f55 0%, #1e6aa5 55%, #5cb4dc 100%); }
.cover .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 22, 42, .72) 0%, rgba(4, 22, 42, .35) 45%, transparent 70%); }
.cover .tt { position: absolute; left: calc(var(--u) * 7); top: 50%; transform: translateY(-55%); color: #fff; }
.cover .kicker { font-size: calc(var(--u) * 1.5); letter-spacing: .5em; color: var(--cyan); margin-bottom: calc(var(--u) * 1.6); }
.cover h1 { font-size: calc(var(--u) * 8.4); line-height: 1.12; letter-spacing: .14em; text-shadow: 0 4px 30px rgba(0, 0, 0, .35); }
.cover h1 span { display: block; }
.cover h1 span:nth-child(2) { padding-left: 1.1em; }
.cover .line { width: calc(var(--u) * 9); height: 3px; background: var(--gold); margin: calc(var(--u) * 2.4) 0 calc(var(--u) * 1.6); }
.cover .meta { font-size: calc(var(--u) * 1.7); letter-spacing: .2em; opacity: .92; }
.cover .waves { position: absolute; left: 0; bottom: 0; width: 100%; height: 18%; pointer-events: none; }
.sparkle { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 4px rgba(255, 255, 255, .7); animation: twinkle 3s infinite ease-in-out; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .9; transform: scale(1); } }

/* —— 篇章页 —— */
.chapter { background: radial-gradient(ellipse at 70% 120%, #1e6aa5 0%, #0b2f55 55%, #041829 100%); color: #fff; }
.chapter canvas.net { position: absolute; inset: 0; width: 100%; height: 100%; }
.chapter .ct { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; width: 90%; }
.chapter .no { font-size: calc(var(--u) * 2); letter-spacing: .6em; color: var(--cyan); }
.chapter h2 { font-size: calc(var(--u) * 7.6); letter-spacing: .3em; margin: calc(var(--u) * 1.5) 0 calc(var(--u) * 2); text-shadow: 0 4px 30px rgba(0, 0, 0, .4); }
.chapter .sub { display: inline-block; font-size: calc(var(--u) * 2.3); letter-spacing: .2em; padding: .35em 1.3em; border-top: 1px solid rgba(255, 255, 255, .5); border-bottom: 1px solid rgba(255, 255, 255, .5); }
.chapter .ic { font-size: calc(var(--u) * 2); margin-top: calc(var(--u) * 3.2); opacity: .8; letter-spacing: .15em; }

/* —— 第 2 页 渔女 —— */
.yunv .stage { position: relative; flex: 0 0 auto; height: 100%; aspect-ratio: 3 / 4; border-radius: calc(var(--u) * 1.4); background: #fbf6ec; box-shadow: 0 8px 30px rgba(74, 44, 18, .15); }
.yunv .stage .ph { position: absolute; inset: 0; border-radius: inherit; background: #fbf6ec; }
.yunv .stage .ph.missing::after { color: #b8925f; border-color: #d8bb92; }
.hot { position: absolute; width: calc(var(--u) * 5.2); height: calc(var(--u) * 5.2); min-width: 48px; min-height: 48px; transform: translate(-50%, -50%); border-radius: 50%; }
.hot::before, .hot::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: rgba(226, 178, 60, .95); box-shadow: 0 0 0 3px #fff; }
.hot::after { inset: 0; background: rgba(226, 178, 60, .35); box-shadow: none; animation: ping 1.8s infinite; }
.hot.seen::before { background: var(--green); }
.hot.seen::after { animation: none; opacity: 0; }
.hot span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font-size: .82em; font-weight: 700; color: #6a4214; background: rgba(255, 250, 240, .95); padding: .05em .55em; border-radius: .4em; margin-top: 2px; }
@keyframes ping { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.yunv .info { flex: 1; }
.item-card { min-height: 7em; }
.item-card .empty { color: #a08060; }
.item-card .k { font-size: .82em; color: #a07a4a; margin-top: .6em; }
.item-card .v { font-size: 1.15em; font-weight: 700; color: #4a2c12; }
.item-card .ask { margin-top: .7em; padding: .5em .8em; background: #fff4dd; border-radius: .5em; color: #8a5a1b; font-size: .95em; }
.answers { display: none; }
.answers.show { display: block; animation: pop .4s; }
.answers table { width: 100%; border-collapse: collapse; font-size: .95em; }
.answers td, .answers th { border-bottom: 1px dashed rgba(138, 90, 43, .25); padding: .35em .3em; text-align: left; }
.answers th { color: #8a6a4a; font-weight: 500; font-size: .85em; }
.answers td:last-child { color: #b0611a; font-weight: 700; }
.rhyme { text-align: center; font-size: 1.25em; letter-spacing: .25em; color: #7a4a1e; }
.secret { position: absolute; top: calc(var(--u) * 2); right: calc(var(--u) * 2.4); width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: .55; }
.secret svg { width: 34px; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* —— 地图页：镜头推进 —— */
.mapbox { position: relative; flex: 0 0 auto; height: 100%; border-radius: calc(var(--u) * 1.2); overflow: hidden; background: #dff0fa; box-shadow: 0 6px 24px rgba(6, 32, 56, .12); }
.mapbox .cam { position: absolute; inset: 0; transform-origin: 0 0; transition: transform 1.1s cubic-bezier(.6, 0, .2, 1); }
.mapbox .cam img { width: 100%; height: 100%; display: block; }
.mapbox svg.ov { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pin { fill: var(--coral); stroke: #fff; stroke-width: 3; }
.pulse { fill: none; stroke: var(--coral); stroke-width: 3; animation: pulse 1.6s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.ov .lbl { font-size: 30px; font-weight: 900; fill: #b8401a; paint-order: stroke; stroke: #fff; stroke-width: 7px; }
.ov .ring { fill: rgba(232, 115, 74, .12); stroke: var(--coral); stroke-width: 5; stroke-dasharray: 14 9; }
.ov g { transition: opacity .6s; }
.ov g.off { opacity: 0; }
.steps-nav { display: flex; gap: calc(var(--u) * .8); flex-wrap: wrap; }
.steps-nav button { flex: 1; min-height: 48px; border-radius: .6em; background: #fff; border: 2px solid var(--line); font-weight: 700; color: var(--navy); padding: .3em .5em; }
.steps-nav button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.ancient .steps-nav button { color: #7a4a1e; }
.ancient .steps-nav button.on { background: #8a5a2b; border-color: #8a5a2b; color: #fff; }

/* 航线高亮 */
.route { fill: none; stroke: #ff6a2b; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24 14; animation: flow 1.2s linear infinite; filter: drop-shadow(0 0 6px rgba(255, 106, 43, .7)); }
@keyframes flow { to { stroke-dashoffset: -38; } }

/* —— 第 4 页 煮盐 —— */
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: calc(var(--u) * 1.6); flex: 1; min-height: 0; }
.step-card { display: flex; flex-direction: column; background: rgba(255, 252, 244, .95); border-radius: calc(var(--u) * 1.2); overflow: hidden; box-shadow: 0 6px 20px rgba(74, 44, 18, .12); border: 1px solid rgba(138, 90, 43, .2); }
.step-card .ph { flex: 1; min-height: 0; background: linear-gradient(135deg, #e9d9bd, #cbb08a); }
.step-card .tx { padding: calc(var(--u) * 1.2) calc(var(--u) * 1.4); line-height: 1.6; }
.step-card .n { display: inline-flex; width: 1.7em; height: 1.7em; align-items: center; justify-content: center; border-radius: 50%; background: #8a5a2b; color: #fff; font-weight: 900; margin-right: .4em; }
.step-card h4 { font-size: 1.15em; color: #4a2c12; display: flex; align-items: center; margin-bottom: .3em; }
.step-card.reveal { opacity: .22; transform: none; filter: grayscale(1); }
.step-card.reveal .tx { visibility: hidden; }
.step-card.reveal.show { opacity: 1; filter: none; }
.step-card.reveal.show .tx { visibility: visible; }
.sumbar { margin-top: calc(var(--u) * 1.6); display: flex; gap: calc(var(--u) * 1.4); align-items: center; }

/* 3D 画布 */
.view3d { position: relative; flex: 1; min-height: 0; border-radius: calc(var(--u) * 1.2); overflow: hidden; background: linear-gradient(180deg, #a9d8f2, #eaf6fc); box-shadow: 0 6px 24px rgba(6, 32, 56, .12); }
.view3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.view3d .hint { position: absolute; left: 12px; bottom: 10px; font-size: .78em; color: rgba(13, 58, 102, .7); background: rgba(255, 255, 255, .7); padding: .15em .7em; border-radius: 99px; pointer-events: none; }
.view3d .tip3d { position: absolute; max-width: 18em; background: rgba(255, 255, 255, .96); border-radius: .8em; padding: .7em 1em; box-shadow: 0 6px 24px rgba(6, 32, 56, .2); line-height: 1.6; font-size: .92em; pointer-events: none; transform: translate(-50%, calc(-100% - 18px)); transition: opacity .25s; }
.view3d .tip3d b { color: var(--navy); font-size: 1.1em; }
.view3d .lab3d { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: .85em; color: #fff; background: rgba(13, 58, 102, .85); padding: .15em .6em; border-radius: 99px; white-space: nowrap; cursor: pointer; border: 2px solid rgba(255, 255, 255, .9); }
.view3d .lab3d.on { background: var(--coral); }

/* 滑块 */
.slider { display: grid; grid-template-columns: 4.6em 1fr 4.2em; align-items: center; gap: .8em; }
.slider label { font-weight: 700; color: var(--navy); }
.slider output { text-align: right; font-weight: 700; color: var(--blue); font-size: .92em; }
.slider .ends { grid-column: 2; display: flex; justify-content: space-between; font-size: .7em; color: var(--muted); margin-top: -.8em; line-height: 1.2; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #cfe6f5, var(--sea)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
input[type=range]::-moz-range-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #cfe6f5, var(--sea)); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); }

/* 弹窗（盐场小百科、大屏汇总等） */
.modal { position: fixed; inset: 0 0 var(--nav-h) 0; background: rgba(4, 22, 42, .55); display: none; align-items: center; justify-content: center; z-index: 50; padding: 3vmin; }
.modal.show { display: flex; animation: pop .25s; }
.modal .box { background: #fff; border-radius: 18px; width: min(980px, 100%); max-height: 100%; overflow: auto; padding: 26px 30px; position: relative; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal .x { position: absolute; right: 12px; top: 10px; width: 48px; height: 48px; font-size: 28px; color: var(--muted); }
.modal h3 { font-size: 1.4em; color: var(--deep); margin-bottom: .6em; }

/* —— 底部导航 —— */
#nav { position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); background: var(--deep); color: #fff; display: flex; align-items: center; padding: 0 10px; gap: 6px; z-index: 60; }
#nav button { height: 48px; min-width: 48px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; color: #d6e8f6; }
#nav button:active { background: rgba(255, 255, 255, .12); }
#nav .ttl { flex: 1; text-align: center; font-size: 16px; letter-spacing: .05em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#nav .ttl b { color: var(--gold); margin-right: .6em; }
#nav .arrow { font-size: 22px; background: rgba(255, 255, 255, .08); }
#nav svg { width: 22px; height: 22px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.menu-grid button { text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--foam); line-height: 1.4; min-height: 64px; }
.menu-grid button b { display: block; color: var(--blue); font-size: .85em; }
.menu-grid button.cur { background: var(--navy); color: #fff; }
.menu-grid button.cur b { color: var(--gold); }
.menu-grid .sec { grid-column: 1 / -1; font-weight: 700; color: var(--navy); margin-top: 6px; }
.qr-wrap { text-align: center; }
.qr-wrap #qr { display: inline-block; padding: 14px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr-wrap #qr img, .qr-wrap #qr svg { width: min(52vmin, 420px); height: auto; display: block; }
.qr-wrap .url { margin-top: 14px; font-size: 1.3em; font-weight: 700; color: var(--navy); word-break: break-all; }

/* 古今对比表 */
table.cmp { width: 100%; border-collapse: separate; border-spacing: 0 .5em; }
table.cmp th, table.cmp td { text-align: left; padding: .45em .7em; }
table.cmp tr:first-child th { color: var(--muted); font-weight: 500; font-size: .85em; }
table.cmp tr th:first-child { color: var(--navy); white-space: nowrap; }
table.cmp td { background: var(--foam); }
table.cmp td:last-child { background: #e3f3ea; color: #1f6a45; font-weight: 700; }
table.cmp tr.reveal { display: table-row; }
/* 结尾三张网 */
.nets3 > div { font-size: 1.15em; margin: .45em 0; padding: .35em .9em; border-left: 4px solid var(--gold); background: rgba(255, 255, 255, .1); border-radius: 0 .5em .5em 0; }
.nets3 b { color: var(--gold); letter-spacing: .2em; }
.ending .kicker { letter-spacing: .4em; }

/* —— 竖屏（平板竖着拿）：上下排 —— */
@media (orientation: portrait) {
  :root { --u: min(1.5vw, 1vh); }
  .body { flex-direction: column; }
  .yunv .stage { height: auto; width: min(100%, 52vh); aspect-ratio: 3 / 4; align-self: center; }
  .mapbox { height: auto; width: 100%; align-self: center; }
  .four { grid-template-columns: repeat(2, 1fr); }
  .cover .tt { left: 6vw; top: 18%; transform: none; }
  .cover .shade { background: linear-gradient(180deg, rgba(4, 22, 42, .75) 0%, rgba(4, 22, 42, .3) 50%, transparent 75%); }
  .slide .pad { overflow-y: auto; }
  #nav .ttl span { display: none; }
}
@media (max-width: 760px) { #nav .lab { display: none; } }
