/* ============================================================
   化工 2602 · 班徽济海  —— 样式
   ============================================================ */
:root {
  --paper:      #eef3f6;
  --paper-2:    #dce7ee;
  --ink:        #12161c;
  --sea-1:      #0d5aa7;
  --sea-2:      #06285c;
  --sea-3:      #020a1d;
  --star:       #cfefff;
  --gold:       #f5d089;
  --red:        #e01e24;
  --teal:       #14b8a6;

  --unit: 1px;               /* 由 JS 写入：地图 1 单位 = 多少 CSS 像素 */
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05080f;
  color: #eaf2ff;
  font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans SC", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 30%, #ffffff 0%, #f4f8fb 55%, #e2ecf2 100%);
  transition: background 900ms var(--ease);
  /* 长按加水时不要触发系统菜单 / 文字选择 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- 镜头层 ---------- */
.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  will-change: transform, filter;
  transform-origin: 0 0;
  backface-visibility: hidden;
  touch-action: manipulation;
}

#mapGroup { will-change: transform; }

.emblem-raster {
  image-rendering: auto;
  transform-origin: 900px 900px;
}

/* 容量瓶点击热区 */
.hit {
  pointer-events: all;
  cursor: pointer;
  /* 长按加水：别让浏览器把长按当成选中文字 / 弹出菜单 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.hit path { fill: transparent; }
/* 点击后浏览器不要给 SVG 画焦点轮廓（之前那圈黄绿线就是它） */
#hitFlask:focus, #hitFlask path:focus { outline: none; }
#hitFlask { outline: none; }

/* 海面（贴住容量瓶内部那条浪线） */
.sea-outer { stroke: #12141c; stroke-linecap: round; }
.sea-fill  { stroke: #2b4ae0; stroke-linecap: round; }
.sea-foam  { stroke: #ffffff; stroke-linecap: round; opacity: .85; }

/* ---------- 屏幕层 ---------- */
.screen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}



@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(.7); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

.horizon {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%, rgba(190,235,255,.75) 50%, rgba(255,255,255,0) 100%);
  opacity: 0;
  filter: blur(1px);
}

/* ---------- 船 ---------- */
/* 定位只用 --bx/--by/--bs 三个变量（left/top 定位、transform 缩放），
   而“摇晃”动画只动 transform —— 两者互不覆盖 */
@keyframes bob {
  0%, 100% { transform: translate3d(var(--bx, -9999px), var(--by, -9999px), 0)
                        scale(var(--bs, 1)) rotate(-1.1deg); }
  50%      { transform: translate3d(var(--bx, -9999px), var(--by, -9999px), 0)
                        scale(var(--bs, 1)) translateY(-9px) rotate(1.2deg); }
}
.flag { transform-origin: 152px 33px; animation: flagWave 2.2s ease-in-out infinite; }
@keyframes flagWave {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50%      { transform: skewY(-7deg) scaleX(.92); }
}
.flag-text {
  fill: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
}
.crew-arm { transform-origin: 140px 126px; animation: waveArm 1.9s ease-in-out infinite; }
@keyframes waveArm {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-24deg); }
}

/* ---------- 诗行 ---------- */



/* 横排：一行一句，压在海面下方的大字 */




/* ---------- 信息卡 ---------- */
.card {
  position: relative;
  box-sizing: border-box;
  width: min(92vw, 560px);
  padding: clamp(20px, 2.6vw, 30px) clamp(20px, 3vw, 34px);
  border-radius: 20px;
  background:
    linear-gradient(160deg, rgba(9, 34, 74, .93), rgba(4, 15, 38, .96));
  border: 1px solid rgba(140, 205, 255, .34);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .05) inset,
    0 30px 70px rgba(0, 8, 22, .6),
    0 0 90px rgba(40, 130, 220, .28);
  opacity: 0;
  transform: translateY(26px) scale(.94);
  transition: opacity .5s var(--ease), transform .6s var(--ease);
  backdrop-filter: blur(6px);
}








@keyframes pulseSoft { 0%,100% { opacity: .55 } 50% { opacity: 1 } }

/* ---------- 提示 / 提示条 ---------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(30px, 7vh, 70px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .2em;
  color: #123046;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(20, 60, 90, .14);
  box-shadow: 0 12px 30px rgba(20, 60, 90, .16);
  animation: floatHint 2.8s ease-in-out infinite;
  transition: opacity .6s var(--ease), background .8s var(--ease), color .8s var(--ease);
}
@keyframes floatHint {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, -7px); }
}
.hint-sea {
  color: #d8ecff;
  background: rgba(8, 30, 64, .6);
  border-color: rgba(140, 205, 255, .32);
}
.hint[hidden] { display: none; }

.toast {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: .24em;
  color: #06213f;
  background: rgba(245, 208, 137, .94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .3);
  transition: opacity .5s var(--ease);
}
.toast[hidden] { display: none; }

/* ---------- 角落 ---------- */
.brand {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  top: clamp(16px, 3vh, 34px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity .7s var(--ease);
}
.brand-main {
  font-size: clamp(15px, 1.5vw, 20px);
  font-weight: 700;
  letter-spacing: .22em;
  color: #14324c;
  transition: color .8s var(--ease);
}
.brand-sub {
  font-size: 11px;
  letter-spacing: .3em;
  color: #4a6b85;
  transition: color .8s var(--ease);
}
body.scene-deep .brand-main { color: #eaf6ff; }
body.scene-deep .brand-sub  { color: #8fb6dc; }

.controls {
  position: absolute;
  right: clamp(16px, 3vw, 40px);
  top: clamp(16px, 3vh, 34px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transition: opacity .4s var(--ease);
}
.brand { transition: opacity .4s var(--ease); }
.btn {
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  letter-spacing: .18em;
  color: #08243d;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(15, 50, 80, .16);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .25s var(--ease), background .4s var(--ease),
              color .4s var(--ease), opacity .4s var(--ease);
}
.btn:hover { transform: translateY(-2px); background: #fff; }
.btn:active { transform: translateY(0); }
.btn[hidden] { display: none; }
.btn-ghost {
  color: #cfe6ff;
  background: rgba(8, 30, 62, .5);
  border-color: rgba(140, 205, 255, .3);
}
.btn-ghost:hover { background: rgba(10, 40, 80, .8); }

.progress {
  width: 130px; height: 3px;
  border-radius: 3px;
  background: rgba(120, 180, 230, .25);
  overflow: hidden;
}
.progress[hidden] { display: none; }
.progress i {
  display: block;
  width: 0; height: 100%;
  background: linear-gradient(90deg, #7fe6ff, #f5d089);
  transition: width .4s var(--ease);
}

/* ---------- 瓶身上的刻度（容量瓶 = 目录） ---------- */

.mark { cursor: pointer; pointer-events: all; }
/* 刻度线画在瓶内壁上：一小段横向刻痕 */
.mark-tick {
  stroke: #1f6fb2;
  stroke-width: 3.2;
  stroke-linecap: round;
  opacity: .9;
  transition: opacity .25s var(--ease), stroke .25s var(--ease);
}
.mark-num {
  fill: #0a2b4a;
  font-size: 30px;
  font-weight: 700;
  font-family: "Songti SC", "STSong", serif;
  text-anchor: middle;
  dominant-baseline: middle;
}
.mark-chip {
  fill: rgba(160, 212, 245, .95);
  stroke: rgba(120, 190, 240, .9);
  stroke-width: 2;
  transition: fill .25s var(--ease);
}
.mark-label {
  fill: #10314f;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: "Songti SC", "STSong", "Source Han Serif SC", serif;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 6;
  stroke-linejoin: round;
}
.mark-cap {
  fill: #4a7396;
  font-size: 19px;
  letter-spacing: 4px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  dominant-baseline: middle;
  opacity: .95;
  transition: opacity .25s var(--ease), fill .25s var(--ease);
}
.mark:hover .mark-cap { opacity: .95; }
.mark.on .mark-cap { opacity: 1; fill: #b06a00; }
.mark.on .mark-label { fill: #12324a; stroke: rgba(255, 226, 160, .95); }
.mark:hover .mark-tick { opacity: 1; stroke: #d98a00; stroke-width: 3.2; }
.mark:hover .mark-chip { fill: #ffe6a8; }
.mark.on .mark-tick { opacity: 1; stroke: #b87000; stroke-width: 3.2; }
.mark.on .mark-chip { fill: #ffd977; }
.mark.on .mark-label { fill: #12324a; stroke: rgba(255, 226, 160, .95); }

/* ---------- 页面（三个刻度对应三页） ---------- */
.page {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  justify-content: center;
  padding: clamp(64px, 10vh, 104px) clamp(16px, 3vw, 46px) clamp(20px, 4vh, 40px);
  background:
    radial-gradient(120% 80% at 85% 12%, rgba(24, 62, 116, .55) 0%, rgba(4, 12, 28, 0) 62%),
    linear-gradient(160deg, #0a1a34 0%, #061229 48%, #030a18 100%);
  overflow: hidden;
  /* 面板本身就是页面，不用透明度过渡（内容做位移过渡即可，更稳） */
  opacity: 1;
}
.page[hidden] { display: none; }
.page.show { opacity: 1; }
.page[hidden] { display: none; }

.page-inner {
  width: min(1180px, 94vw);
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;      /* 名册要一屏放下，不出现滚动条 */
  overscroll-behavior: contain;
  padding: 0 10px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.page.show .page-inner { opacity: 1; transform: none; }
.page-inner::-webkit-scrollbar { width: 6px; }
.page-inner::-webkit-scrollbar-thumb {
  background: rgba(140, 200, 255, .35); border-radius: 3px;
}

/* 页面打开时，角落的品牌与按钮让位（避免和「回到容量瓶」叠在一起） */
body.page-open .brand { opacity: 0; visibility: hidden; pointer-events: none; }
body.page-open .controls { opacity: 0; pointer-events: none; }

.page-back {
  position: absolute;
  left: clamp(14px, 3vw, 40px);
  top: clamp(14px, 3vh, 30px);
  z-index: 3;
  padding: 10px 20px;
  font: inherit;
  font-size: 13px;
  letter-spacing: .16em;
  color: #eaf6ff;
  background: rgba(8, 30, 62, .78);
  border: 1px solid rgba(150, 210, 255, .42);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .25s var(--ease), background .3s var(--ease);
}
.page-back:hover { transform: translateY(-2px); background: rgba(12, 44, 88, .95); }

/* 页头 */
.pg-head { margin-bottom: 22px; }
.pg-kicker {
  font-size: 12px;
  letter-spacing: .34em;
  color: #7fc4ff;
}
.pg-title {
  margin: .18em 0 .1em;
  font-family: "Songti SC", "STSong", "Source Han Serif SC", serif;
  font-size: clamp(30px, 3.4vw, 50px);
  font-weight: 700;
  letter-spacing: .14em;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(120, 200, 255, .45);
}
.pg-lead {
  margin: 0;
  font-size: clamp(13px, 1.3vw, 16px);
  line-height: 1.9;
  color: #a8c6e4;
}
.pg-rule {
  height: 1px; margin: 18px 0 22px;
  background: linear-gradient(90deg,
    rgba(140, 205, 255, .55), rgba(140, 205, 255, .06));
}

/* 名册：一人一格，像实验台上的样品架 */

/* 空页 */
.pg-empty {
  display: grid;
  place-items: center;
  margin-top: 8vh;
  padding: clamp(40px, 8vh, 90px) 20px;
  border: 1px dashed rgba(140, 205, 255, .32);
  border-radius: 22px;
  background: rgba(8, 24, 48, .55);
  text-align: center;
}
.pg-empty .big {
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(34px, 4.2vw, 62px);
  font-weight: 700;
  letter-spacing: .2em;
  color: rgba(226, 240, 255, .92);
  text-shadow: 0 0 40px rgba(120, 200, 255, .4);
}
.pg-empty .sub {
  margin-top: 14px;
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: .3em;
  color: #8fb6dc;
}
.pg-empty .dashed {
  margin: 26px auto 0;
  width: min(300px, 60%);
  height: 1px;
  background: repeating-linear-gradient(90deg,
    rgba(150, 205, 255, .6) 0 8px, transparent 8px 18px);
}

/* 只在 ?debug=1 时显示 */
#dbg {
  display: none;
  position: absolute;
  left: 8px; bottom: 8px; z-index: 99;
  margin: 0; padding: 8px 10px;
  font: 12px/1.5 Consolas, monospace;
  color: #0f0; background: rgba(0, 0, 0, .88);
  white-space: pre;
}

/* 页面打开时，整块舞台交给页面 */
body.page-open .hint { opacity: 0; pointer-events: none; }

/* ---------- 净瓶场景：只剩扣好的容量瓶 ---------- */
#pourFlask { will-change: opacity; }
#pourWater { mix-blend-mode: normal; }

/* 切到净瓶时，舞台变成干净的实验台 */
body.pour .stage {
  background:
    radial-gradient(78% 62% at 50% 46%, #ffffff 0%, #f2f7fa 52%, #dde8ef 100%);
}
body.pour .brand-main { color: #12324a; }
body.pour .brand-sub { color: #4a6b85; }

/* ---------- 状态 ---------- */
/* 需要“点空白处继续”的几幕：海、卡片、深海 */
body.scene-sea  .tap-layer,
body.scene-deep .tap-layer,

body.scene-sea .hint-home,
body.scene-deep .hint-home,
body.scene-water .hint-home { opacity: 0; pointer-events: none; }

body.scene-deep .stage,
body.scene-water .stage { background: radial-gradient(120% 90% at 50% 20%,
  #0a2b57 0%, #051b3c 45%, #01060f 100%); }

/* 加水完成后，把红色叠字轻轻隐去，让瓶子自己说话 */
body.water-full #flask-monogram { opacity: .12; transition: opacity 1.6s var(--ease); }

/* 移动端 */
@media (max-width: 620px) {

  .hint { font-size: 13px; padding: 10px 18px; }
  .progress { width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
}


.marks-layer.pop .mark:nth-child(2) .mark-tick { animation-delay: .10s; }
.marks-layer.pop .mark:nth-child(3) .mark-tick { animation-delay: .20s; }
@keyframes tickPop {
  0%   { opacity: 0; stroke-width: 1; }
  55%  { opacity: 1; stroke-width: 9; }
  100% { opacity: .9; stroke-width: 5; }
}
