/* 场景：标题、开场、航海图、岛屿、雾团团、灯塔、手账、结局、菜单。 */

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 10px;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  opacity: 0.92;
}
.link-btn:hover { opacity: 1; text-decoration: underline; }

/* ---------------------------------------------------------------- 标题 */

.title-bg { animation: title-zoom 24s ease-in-out infinite alternate; }
/* 竖屏但不够细长（平板竖放）时，竖版标题图上下会被裁：保住顶上的书法标题 */
@media (max-aspect-ratio: 4/5) { .title-bg { object-position: 50% 0%; transform-origin: 50% 0%; } }
@keyframes title-zoom { from { transform: scale(1); } to { transform: scale(1.06) translateY(-1%); } }
.title-motes { position: absolute; inset: 0; pointer-events: none; }
.mote {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff6c9;
  box-shadow: 0 0 10px 4px rgba(255, 214, 102, 0.75);
  animation: mote 6s ease-in-out infinite;
  opacity: 0;
}
@keyframes mote {
  0% { opacity: 0; transform: translateY(10px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px) translateX(18px); }
}
.title-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(22px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.title-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.title-links { display: flex; gap: 6px; }
.title-note { background: rgba(255, 250, 240, 0.85); }

/* ---------------------------------------------------------------- 开场故事 */

.story-bg { transition: opacity 0.35s ease; }
.story-bg.fade { opacity: 0; }
.story-box {
  position: absolute;
  left: 0;
  right: 0;
  margin-inline: auto; /* 不用 transform 居中：pop-in 动画结束时 transform: none 会把居中冲掉 */
  bottom: calc(24px + var(--safe-bottom));
  width: min(820px, calc(100% - 24px));
  padding: 22px 26px 26px;
  cursor: pointer;
  animation: pop-in 0.4s ease both;
}
.story-box .who {
  position: absolute; top: -14px; left: 18px; padding: 2px 12px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.08em;
}
.story-text { margin: 0; font-family: var(--font-story); font-size: 1.35rem; line-height: 1.8; min-height: 3.6em; }
.story-box .more { position: absolute; right: 16px; bottom: 8px; font-size: 0.85rem; color: var(--ink-faint); animation: blink 1.2s ease-in-out infinite; }
.story-box.fox-line { border-color: #f3c28c; }
.skip-btn { position: absolute; top: calc(12px + var(--safe-top)); right: calc(12px + var(--safe-right)); z-index: 20; }

.setup-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 22, 15, 0.35);
  overflow: auto;
}
.setup {
  position: relative;
  width: min(560px, 100%);
  padding: 26px 24px 22px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  margin: auto;
}
.setup h2 { margin: 0; font-family: var(--font-story); font-size: 1.7rem; }
.setup-fox { position: absolute; left: -26px; top: -40px; width: 96px; }
.setup-fox-img { width: 100%; animation: float-y 3s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25)); }
.setup-label { display: grid; gap: 8px; justify-items: center; font-weight: 700; font-size: 1.05rem; width: 100%; }
.setup-name {
  width: min(260px, 100%);
  padding: 10px 14px;
  font-size: 1.2rem;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  text-align: center;
  font-family: inherit;
  user-select: text;
}
.setup-name:focus { outline: 3px solid var(--sky); outline-offset: 1px; }
.avatar-row { display: flex; gap: 14px; }
.avatar-card {
  appearance: none;
  width: 110px;
  height: 140px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--gold-soft));
  cursor: pointer;
  overflow: hidden;
  padding: 6px 0 0;
  transition: transform 0.15s, border-color 0.2s;
}
.avatar-card.on { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(240, 140, 46, 0.3); transform: translateY(-3px); }
.avatar-img { height: 100%; object-fit: contain; object-position: top; }
.grade-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(380px, 100%); }
.grade-btn {
  appearance: none;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 6px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.grade-btn.on { background: var(--accent); color: #fff; border-color: var(--accent-deep); }
.setup-tip { margin: 0; color: var(--ink-soft); min-height: 1.5em; }

/* ---------------------------------------------------------------- 全景（航海图、岛屿共用） */

.pano {
  position: absolute;
  inset: 0;
  overflow: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
  background: #6fb7c8;
}
.pano::-webkit-scrollbar { display: none; }
.pano-inner {
  position: relative;
  height: max(100%, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  min-width: 100%;
  overflow: hidden;
}
.pano-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: filter 1.2s ease; }

/* ---------------------------------------------------------------- 航海图 */

.map-title {
  position: absolute;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 6px 20px;
  border-radius: 999px;
  background: rgba(255, 245, 225, 0.88);
  font-family: var(--font-story);
  font-size: 1.15rem;
  font-weight: 700;
  color: #6b4a2a;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.map-isle {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 15%;
  aspect-ratio: 1.5;
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
.map-isle .isle-fog {
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 45%, rgba(235, 238, 242, 0.95), rgba(235, 238, 242, 0) 55%),
    radial-gradient(circle at 65% 55%, rgba(225, 229, 235, 0.95), rgba(225, 229, 235, 0) 58%),
    radial-gradient(circle at 50% 35%, rgba(245, 246, 248, 0.9), rgba(245, 246, 248, 0) 60%);
  filter: blur(4px);
  transition: opacity 1s ease;
  animation: fog-drift 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes fog-drift { from { transform: translateX(-3%) scale(1); } to { transform: translateX(3%) scale(1.04); } }
.isle-label {
  position: absolute;
  left: 50%;
  bottom: -14%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.95);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  font-size: 0.95rem;
}
.isle-label small { color: var(--ink-soft); }
.isle-status { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 0.85rem; color: var(--accent-deep); }
.isle-status.lit { color: var(--teal); }
.isle-ring svg { width: 20px; height: 20px; transform: rotate(-90deg); }
.isle-ring .ring-bg { fill: none; stroke: #eadcc4; stroke-width: 5; }
.isle-ring .ring-fg { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.map-isle.locked .isle-label { opacity: 0.85; }
.map-isle:hover .isle-label, .map-isle:focus-visible .isle-label { transform: translateX(-50%) scale(1.06); }
.map-isle.lit::after {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  box-shadow: 0 0 40px 16px rgba(255, 214, 102, 0.35);
  pointer-events: none;
  animation: breathe-glow 3s ease-in-out infinite;
}
@keyframes breathe-glow { 50% { opacity: 0.5; } }
.map-boat {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  transition: left 1.2s ease-in-out, top 1.2s ease-in-out;
  animation: boat-bob 2.4s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.3));
}
@keyframes boat-bob { 50% { transform: translate(-50%, -58%) rotate(-4deg); } }
.map-ending { position: absolute; left: calc(12px + var(--safe-left)); bottom: calc(14px + var(--safe-bottom)); z-index: 30; }

/* ---------------------------------------------------------------- 岛屿 */

.isle-name {
  position: absolute;
  top: calc(64px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  display: grid;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.86);
  box-shadow: var(--shadow-sm);
  z-index: 20;
  pointer-events: none;
}
.isle-name strong { font-family: var(--font-story); font-size: 1.3rem; }
.isle-name small { color: var(--ink-soft); }

.isle-fogs { position: absolute; inset: 0; pointer-events: none; transition: opacity 1.2s ease; }
.fog-layer {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(40% 30% at 20% 30%, rgba(236, 239, 243, 0.85), transparent 70%),
    radial-gradient(35% 25% at 70% 20%, rgba(230, 233, 238, 0.8), transparent 70%),
    radial-gradient(45% 30% at 55% 75%, rgba(240, 242, 245, 0.75), transparent 70%),
    radial-gradient(30% 25% at 90% 60%, rgba(228, 231, 236, 0.8), transparent 70%);
  filter: blur(6px);
}
.fog-layer.f1 { animation: fog-move 26s ease-in-out infinite alternate; }
.fog-layer.f2 { animation: fog-move 34s ease-in-out infinite alternate-reverse; opacity: 0.7; transform: scaleX(-1); }
@keyframes fog-move { from { transform: translateX(-4%); } to { transform: translateX(4%); } }

.spot {
  position: absolute;
  transform: translate(-50%, -50%);
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 5;
}
.spot-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: radial-gradient(circle at 40% 35%, #fff, #fff1cf);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(255, 207, 77, 0.55), 0 6px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
.spot:hover .spot-icon, .spot:focus-visible .spot-icon { transform: scale(1.1); }
.spot-label {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.95);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.spot.new .spot-icon { animation: spot-pulse 1.8s ease-in-out infinite; }
@keyframes spot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 207, 77, 0.55), 0 6px 14px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(255, 207, 77, 0.2), 0 6px 14px rgba(0, 0, 0, 0.3); }
}
.spot-bang {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rose);
  color: #fff;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  animation: float-y 1.6s ease-in-out infinite;
}
.spot-lighthouse .spot-icon { background: radial-gradient(circle at 40% 35%, #fff, #e3e7ee); filter: grayscale(0.4); }
.spot-lighthouse.ready .spot-icon { filter: none; background: radial-gradient(circle at 40% 35%, #fffbe6, #ffd76a); animation: spot-pulse 1.2s ease-in-out infinite; }
.spot-lighthouse.lit .spot-icon { filter: none; background: radial-gradient(circle at 40% 35%, #fffbe6, #ffe08a); box-shadow: 0 0 30px 12px rgba(255, 214, 102, 0.65), 0 6px 14px rgba(0, 0, 0, 0.3); }

.isle-beacon {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 3;
}
.isle-beacon::before {
  content: "";
  position: absolute;
  left: -80px;
  top: -80px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 230, 1) 0 9%, rgba(255, 220, 120, 0.7) 30%, rgba(255, 214, 102, 0) 70%);
  mix-blend-mode: screen;
  animation: breathe-glow 2.4s ease-in-out infinite;
}
.isle-beacon .beam {
  position: absolute;
  left: 0;
  top: -22px;
  width: 52vmin;
  height: 44px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 240, 180, 0.95), rgba(255, 240, 180, 0));
  clip-path: polygon(0 42%, 100% 0, 100% 100%, 0 58%);
  mix-blend-mode: screen;
  animation: beam-turn 8s linear infinite;
}
.isle-beacon .beam.back { animation-delay: -4s; }
@keyframes beam-turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.sprite {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(64px, 7%, 110px);
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  z-index: 4;
  animation: sprite-float 4.2s ease-in-out infinite;
  transition: opacity 1s ease, transform 1s ease;
}
.sprite-img { width: 100%; display: block; filter: drop-shadow(0 6px 8px rgba(40, 50, 70, 0.35)); }
@keyframes sprite-float {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(-44%, -58%) rotate(4deg); }
  75% { transform: translate(-56%, -44%) rotate(-4deg); }
}
.sprite.picked { animation: none; transform: translate(-50%, -50%) scale(1.15); }
.sprite.freed { animation: none; opacity: 0; transform: translate(-50%, -160%) scale(0.6); }
.sprite.escaped { animation: none; opacity: 0; transform: translate(60%, -80%) scale(0.8); }

/* ---------------------------------------------------------------- 雾团团的问题 */

.riddle {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(64px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  background: radial-gradient(circle at 50% 40%, rgba(200, 206, 216, 0.55), rgba(40, 46, 60, 0.6));
  backdrop-filter: blur(3px);
  overflow: auto;
  animation: scene-in 0.3s ease both;
}
.riddle.leaving { animation: scene-out 0.25s ease both; }
.riddle-card { position: relative; width: min(760px, 100%); display: grid; gap: 12px; justify-items: center; margin: auto; }
.riddle-top { display: flex; align-items: center; gap: 12px; width: 100%; }
.riddle-sprite { width: 120px; flex: none; animation: sprite-bob 2.6s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(30, 40, 60, 0.35)); transition: transform 0.8s ease, opacity 0.8s ease; }
@keyframes sprite-bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.riddle-sprite.freed { animation: freed 1.4s ease both; }
@keyframes freed { 0% { transform: scale(1); filter: brightness(1); } 40% { transform: scale(1.3) rotate(8deg); filter: brightness(1.6) drop-shadow(0 0 20px #ffd76a); } 100% { transform: scale(1.1); filter: brightness(1.15) drop-shadow(0 0 24px #ffd76a); } }
.riddle-sprite.escape { transform: translateX(40px) translateY(-20px) scale(0.85); opacity: 0.6; }
.riddle-say { flex: 1; font-size: 1.1rem; }
.riddle-body { width: 100%; display: grid; gap: 10px; justify-items: center; }
.riddle-note { width: 100%; padding: 14px 18px; border-radius: var(--radius); background: #fff8ec; border: 2px solid #f3c28c; box-shadow: var(--shadow); position: relative; display: grid; gap: 8px; justify-items: end; }
.riddle-note .who { position: absolute; top: -12px; left: 14px; padding: 2px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 800; }
.riddle-note p { margin: 4px 0 0; justify-self: stretch; line-height: 1.7; font-size: 1.05rem; }
.riddle-close { position: absolute; top: -8px; right: -4px; z-index: 2; }

/* ---------------------------------------------------------------- 灯塔 */

.lh-bg { filter: saturate(0.85); transition: filter 1.5s ease; }
.victory .lh-bg { filter: saturate(1.15) brightness(1.1); }
.lh-lamp {
  --glow: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46vmin;
  height: 46vmin;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 200, 0.95) 0 12%, rgba(255, 214, 102, 0.55) 30%, rgba(255, 214, 102, 0) 65%);
  opacity: var(--glow);
  transition: opacity 0.8s ease, transform 1.2s ease;
  pointer-events: none;
  mix-blend-mode: screen;
}
.victory .lh-lamp { transform: translate(-50%, -50%) scale(2.6); }
.lh-fog {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 80% 30%, rgba(160, 166, 178, 0.55), transparent 70%), radial-gradient(50% 50% at 15% 70%, rgba(170, 175, 186, 0.45), transparent 70%);
  pointer-events: none;
  transition: opacity 1.5s ease;
}
.victory .lh-fog { opacity: 0; }
.lh-boss {
  --s: 1;
  position: absolute;
  right: 3%;
  top: 8%;
  width: min(34vw, 380px);
  transform: scale(var(--s));
  transform-origin: 70% 30%;
  transition: transform 0.8s ease, opacity 0.8s ease;
  animation: boss-hover 5s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(40, 46, 60, 0.4));
  pointer-events: none;
}
@keyframes boss-hover { 50% { translate: 0 -10px; } }
.lh-boss.gone { opacity: 0 !important; transform: scale(0.2) translateX(60%); }
.lh-boss.rainbow { opacity: 1 !important; --s: 1; animation: boss-hover 4s ease-in-out infinite, rainbow-in 1.4s ease both; }
@keyframes rainbow-in { from { filter: brightness(2) blur(6px); } to { filter: drop-shadow(0 0 30px rgba(255, 214, 102, 0.6)); } }
.lh-ui {
  position: absolute;
  inset: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-right: min(30vw, 330px);
}
.lh-top { display: flex; align-items: center; gap: 12px; align-self: stretch; }
.lh-meter { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 250, 240, 0.9); box-shadow: var(--shadow-sm); }
.lh-meter-label { font-weight: 800; margin-right: 4px; }
.lh-pip { width: 22px; height: 22px; border-radius: 50%; background: #d9d3c8; box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.15); transition: background 0.4s, box-shadow 0.4s; }
.lh-pip.on { background: radial-gradient(circle, #fff 0 20%, var(--gold) 60%); box-shadow: 0 0 12px 3px rgba(255, 207, 77, 0.8); }
.lh-bubble { align-self: stretch; }
.lh-stage { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; padding-bottom: 80px; }
.lh-reward { padding: 22px 26px; display: grid; gap: 10px; justify-items: center; text-align: center; animation: pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.lh-reward p { margin: 0; }

/* ---------------------------------------------------------------- 手账 */

.scene-journal { background: var(--night); color: #f4ecd8; }
.jr-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1px 1px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 35%, #fff, transparent),
    radial-gradient(1px 1px at 75% 15%, #fff, transparent),
    radial-gradient(1px 1px at 88% 62%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 45% 88%, #fff, transparent),
    radial-gradient(120% 80% at 50% 0%, #2c3766, var(--night) 70%);
  background-size: 260px 260px, 300px 300px, 340px 340px, 280px 280px, 320px 320px, 360px 360px, 100% 100%;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { to { filter: brightness(1.25); } }
.jr-head {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.jr-title { margin: 0; font-family: var(--font-story); font-size: 1.7rem; color: #ffe7a8; }
.jr-stats { font-size: 0.95rem; opacity: 0.85; }
.jr-tabs { position: absolute; top: calc(66px + var(--safe-top)); left: 12px; right: 12px; display: grid; gap: 8px; }
.jr-grades, .jr-subjects { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.jr-tab, .jr-sub {
  appearance: none;
  border: 1.5px solid rgba(255, 231, 168, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #f4ecd8;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}
.jr-tab small { font-weight: 500; opacity: 0.7; font-size: 0.78rem; }
.jr-tab.on, .jr-sub.on { background: #ffe7a8; color: #3b2f2a; border-color: #ffe7a8; }
.jr-body {
  position: absolute;
  top: calc(150px + var(--safe-top));
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 14px;
  min-height: 0;
}
.jr-sky { position: relative; overflow: auto; border-radius: var(--radius); background: rgba(10, 14, 34, 0.35); border: 1px solid rgba(255, 231, 168, 0.15); scrollbar-width: thin; }
.jr-count { position: sticky; top: 0; z-index: 2; padding: 8px 14px; font-weight: 700; background: linear-gradient(180deg, rgba(20, 26, 54, 0.95), rgba(20, 26, 54, 0)); }
.starmap { width: 100%; height: auto; display: block; }
.starmap .band { fill: #ffe7a8; opacity: 0.55; font-size: 18px; font-weight: 700; letter-spacing: 4px; }
.starmap .chap { fill: #c7cde8; opacity: 0.7; font-size: 15px; }
.starmap .link { stroke: rgba(200, 210, 255, 0.28); stroke-width: 1.6; }
.starmap .link.on { stroke: rgba(255, 214, 120, 0.75); stroke-width: 2; }
.starmap .star { cursor: pointer; outline: none; }
.starmap .hit { fill: transparent; }
.starmap .dim .core { fill: #7d89bd; }
.starmap .seen .core { fill: #a8b2dc; animation: seen-pulse 2.4s ease-in-out infinite; }
.starmap .lit .core { fill: #ffd76a; filter: url(#glow); }
.starmap .bright .core { fill: #fff6cf; filter: url(#glow); }
.starmap .ray { stroke: rgba(255, 240, 190, 0.8); stroke-width: 1.4; stroke-linecap: round; }
.starmap .star.sel .core { stroke: #fff; stroke-width: 3; }
.starmap .star:focus-visible .hit { stroke: #8fd0ff; stroke-width: 2; }
@keyframes seen-pulse { 50% { opacity: 0.45; } }
.jr-side { overflow: auto; min-height: 0; }
.jr-hint { padding: 16px; color: var(--ink); display: grid; gap: 8px; justify-items: center; text-align: center; }
.jr-hint p { margin: 0; line-height: 1.7; }
.jr-hint-fox { width: 90px; }
.topic-card { padding: 16px; color: var(--ink); display: grid; gap: 8px; animation: pop-in 0.3s ease both; }
.tc-head { display: flex; gap: 10px; align-items: center; }
.tc-head small { display: block; color: var(--ink-soft); }
.tc-name { font-size: 1.15rem; }
.tc-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.tc-dot.dim { background: #b8bdd2; }
.tc-dot.seen { background: #8f9ac8; }
.tc-dot.lit { background: #ffcf4d; box-shadow: 0 0 8px #ffcf4d; }
.tc-dot.bright { background: #fff1b0; box-shadow: 0 0 12px #ffcf4d; }
.tc-desc { margin: 0; line-height: 1.7; }
.tc-mastery { margin: 0; padding-left: 1.2em; color: var(--ink-soft); line-height: 1.6; font-size: 0.95rem; }
.tc-status { margin: 0; font-weight: 700; color: var(--accent-deep); }
.tc-rel { display: grid; gap: 6px; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-chip { appearance: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 0.88rem; cursor: pointer; }
.tc-chip.lit, .tc-chip.bright { border-color: var(--gold); background: #fff6d6; }
.tc-chip.seen { border-color: #a8b2dc; }
.tc-link { color: var(--teal); font-weight: 700; }
.poem-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px; }
.poem-card { padding: 14px 16px; color: var(--ink); }
.pc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-head strong { font-family: var(--font-story); font-size: 1.2rem; }
.pc-head small { color: var(--ink-soft); }
.pc-text { margin: 8px 0 0; font-family: var(--font-story); font-size: 1.15rem; line-height: 1.9; }
.pc-text span { display: block; }
.poem-empty { margin: 30px auto; max-width: 420px; padding: 20px; color: var(--ink); text-align: center; display: grid; justify-items: center; gap: 8px; }
.poem-empty-img { width: 110px; }

/* ---------------------------------------------------------------- 结局 */

.ending-box { cursor: pointer; }
.ending-box .sum-actions { margin-top: 8px; }
.ending-small { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------------------------------------------------------------- 背包、设置 */

.bag { display: grid; gap: 10px; }
.bag h3 { margin: 6px 0 0; font-size: 1.05rem; }
.bag-coins { margin: 0; color: var(--ink-soft); }
.bag-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 2px solid var(--line); }
.bag-icon { font-size: 1.8rem; }
.bag-info { flex: 1; display: grid; }
.bag-info small { color: var(--ink-soft); }
.wear-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wear-cell { appearance: none; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
.wear-cell.on { border-color: var(--accent); background: #fff4e3; }
.wear-icon { font-size: 1.8rem; }
.wear-name { font-weight: 700; font-size: 0.92rem; }
.wear-price { font-size: 0.82rem; color: var(--ink-soft); }
.settings { display: grid; gap: 12px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row small { display: block; color: var(--ink-soft); }
.switch { appearance: none; border: 0; width: 56px; height: 32px; border-radius: 999px; background: #d9cfbf; position: relative; cursor: pointer; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left 0.2s; }
.switch.on { background: var(--teal); }
.switch.on::after { left: 27px; }
.parent-note { padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px dashed var(--line); line-height: 1.7; }
.parent-note p { margin: 6px 0 0; }
.parent-note a { color: var(--teal); font-weight: 700; }
.danger-link { justify-self: start; color: var(--danger); }
.modal-text { line-height: 1.7; }

/* ---------------------------------------------------------------- 小屏 */

@media (max-aspect-ratio: 1/1) {
  .map-title { display: none; }
  .story-text { font-size: 1.15rem; }
  .jr-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .jr-side { max-height: 42vh; }
  .lh-ui { padding-right: 0; padding-top: 0; }
  .lh-boss { width: 42vw; top: auto; bottom: 16%; right: 2%; opacity: 0.9; }
  .riddle-sprite { width: 84px; }
  .isle-name { top: calc(62px + var(--safe-top)); }
  .map-isle { width: 22%; }
  .spot-icon { width: 50px; height: 50px; font-size: 1.6rem; }
}
@media (max-width: 480px) {
  .encounter .hud-coins { display: none; }
  .enc-dots { padding: 6px 8px; gap: 4px; }
  .enc-dots .dot { width: 10px; height: 10px; }
  .enc-title { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 720px) {
  .hud-player span { display: none; }
  .hud-player { padding-right: 4px; }
  .hud { gap: 6px; }
  .pill { font-size: 0.88rem; padding: 0.3em 0.65em; }
  .icon-btn { width: 42px; height: 42px; font-size: 1.2rem; }
  .jr-title { font-size: 1.35rem; }
  .jr-stats { width: 100%; font-size: 0.85rem; }
  .jr-tabs { top: calc(92px + var(--safe-top)); }
  .jr-body { top: calc(174px + var(--safe-top)); }
}
