:root {
  --bg: #07060a;
  --panel: #0d0b11;
  --panel-soft: #141019;
  --line: rgba(218, 198, 157, 0.22);
  --line-bright: rgba(236, 214, 168, 0.52);
  --ivory: #eee7da;
  --muted: #a59b91;
  --gold: #c8a86a;
  --gold-bright: #f1d497;
  --blood: #9c3e44;
  --pink: #d668a0;
  --pink-dark: #5f2748;
  --green: #7ea78e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ivory);
  background:
    radial-gradient(circle at 52% -15%, rgba(90, 65, 77, 0.3), transparent 38%),
    #050407;
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

button { font: inherit; }
button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: 0.42; }

.app-shell {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.ambient-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  z-index: 20;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.33'/%3E%3C/svg%3E");
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  padding: 0 34px;
  border-bottom: 1px solid rgba(221, 202, 168, 0.14);
  background: linear-gradient(180deg, rgba(8, 7, 10, 0.98), rgba(8, 7, 10, 0.82));
  backdrop-filter: blur(14px);
}

.topbar-lead {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  flex-shrink: 1;
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  color: var(--ivory);
  border: 0;
  background: transparent;
  cursor: default;
  text-align: left;
}

.brand-button strong { display: block; font-family: Georgia, "Songti SC", serif; letter-spacing: 0.2em; }
.brand-button small { display: block; margin-top: 2px; color: #82786f; font-size: calc(8px * var(--fs, 1)); letter-spacing: 0.18em; }
.brand-mark { color: var(--gold); font-size: calc(28px * var(--fs, 1)); transform: rotate(45deg); }

.run-summary { display: flex; height: 72px; margin-left: auto; }
.summary-item {
  min-width: 100px;
  display: grid;
  place-content: center;
  padding: 0 20px;
  border-left: 1px solid rgba(221, 202, 168, 0.1);
  text-align: center;
}
.summary-item:last-child { border-right: 1px solid rgba(221, 202, 168, 0.1); }
.summary-item small { color: #756e68; font-size: calc(10px * var(--fs, 1)); letter-spacing: 0.22em; }
.summary-item b { margin-top: 2px; color: #ddd2c1; font-family: Georgia, serif; font-size: calc(14px * var(--fs, 1)); font-weight: 500; }
.summary-item.fog-summary { min-width: 132px; }
.fog-summary b { color: #e1b0ca; }
.top-fog-track { display: block; width: 88px; height: 3px; margin: 5px auto 0; overflow: hidden; background: rgba(215, 106, 163, .13); }
.top-fog-track > i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #8c3c68, #e883b8); box-shadow: 0 0 10px #d66aa3; transition: width .35s ease; }

.top-actions { display: flex; gap: 8px; margin-left: 18px; }
.icon-button, .text-button {
  color: #b9aea2;
  border: 1px solid rgba(220, 198, 160, 0.2);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}
.icon-button { min-width: 56px; padding: 9px 13px; font-size: calc(12px * var(--fs, 1)); letter-spacing: 0.12em; }
.return-title-button { min-width: 106px; color: #d2c5b7; border-color: rgba(220, 198, 160, .3); }
.icon-button:not(:disabled):hover, .text-button:not(:disabled):hover { color: var(--gold-bright); border-color: rgba(220, 188, 130, 0.48); }
.text-button { padding: 8px 15px; }

.screen-stack { min-height: 100vh; }
.screen { display: none; min-height: 100vh; padding-top: 72px; }
.screen.is-active { display: flex; }

.title-screen {
  position: relative;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(4, 4, 6, 0.99) 0%, rgba(7, 6, 9, 0.89) 42%, rgba(9, 6, 10, 0.38) 75%, rgba(5, 4, 7, 0.7) 100%),
    radial-gradient(ellipse at 76% 40%, rgba(205, 106, 160, 0.24), transparent 22%),
    linear-gradient(145deg, #0b0a0e, #17111a 45%, #08070b 46%);
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: 0 0 0 43%;
  opacity: 0.66;
  background:
    linear-gradient(90deg, transparent, rgba(10, 8, 12, 0.12)),
    repeating-linear-gradient(90deg, transparent 0 90px, rgba(195, 173, 139, 0.08) 91px 93px),
    repeating-linear-gradient(0deg, transparent 0 110px, rgba(195, 173, 139, 0.06) 111px 113px);
  clip-path: polygon(20% 0, 100% 0, 100% 100%, 0 100%, 13% 78%, 3% 58%, 18% 34%);
}

.title-screen::after {
  content: "";
  position: absolute;
  right: 10%;
  bottom: -10%;
  width: min(38vw, 560px);
  aspect-ratio: .62;
  border-radius: 50% 50% 0 0;
  opacity: 0.25;
  filter: blur(2px);
  background: linear-gradient(90deg, transparent, #000 22% 78%, transparent);
  box-shadow: 0 -130px 130px rgba(0, 0, 0, 0.85);
}

.title-content {
  width: min(620px, 50vw);
  margin-left: clamp(7vw, 10vw, 150px);
  position: relative;
  z-index: 3;
}

.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: calc(11px * var(--fs, 1)); letter-spacing: 0.32em; text-transform: uppercase; }
.title-content h1 {
  margin: 0;
  font-family: Georgia, "STSong", serif;
  font-size: calc(clamp(62px, 7.6vw, 116px) * var(--fs, 1));
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 0.96;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}
.title-content h1 span { color: var(--gold-bright); }
.title-subtitle { margin: 30px 0 38px; color: #b4aaa0; font-family: "STSong", serif; font-size: calc(17px * var(--fs, 1)); line-height: 1.9; letter-spacing: 0.08em; }
.title-menu { width: min(390px, 100%); display: grid; gap: 10px; }

.dev-shortcuts {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(218, 198, 157, 0.16);
  display: grid;
  gap: 6px;
}
.dev-shortcuts-label {
  color: #6a625a;
  font-size: calc(10px * var(--fs, 1));
  letter-spacing: 0.22em;
}
.dev-shortcut-button {
  min-height: 40px;
  padding: 8px 14px;
  color: #9a9084;
  border: 1px solid rgba(218, 198, 157, 0.16);
  background: rgba(8, 7, 10, 0.55);
  cursor: pointer;
  text-align: left;
  font-size: calc(12px * var(--fs, 1));
  letter-spacing: 0.08em;
}
.dev-shortcut-button:hover {
  color: var(--gold-bright);
  border-color: rgba(220, 188, 130, 0.4);
}
.icon-button.dev-header-debug {
  min-width: 48px;
  color: #8a8176;
  border-color: rgba(218, 198, 157, 0.18);
}


.primary-button, .secondary-button {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 14px 24px;
  cursor: pointer;
  text-align: left;
}
.primary-button {
  color: #17110a;
  border: 1px solid #e3c989;
  background: linear-gradient(110deg, #d8bc7e, #a7854b);
  box-shadow: 0 12px 30px rgba(160, 120, 61, 0.18);
}
.secondary-button { color: #c9bba9; border: 1px solid var(--line); background: rgba(12, 10, 14, 0.72); }
.primary-button span, .secondary-button span { font-family: "STSong", serif; font-size: calc(18px * var(--fs, 1)); letter-spacing: 0.16em; }
.primary-button small, .secondary-button small { max-width: 140px; opacity: 0.68; font-size: calc(10px * var(--fs, 1)); text-align: right; }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button:not(:disabled):hover { border-color: var(--gold); color: var(--gold-bright); }
.secondary-button.is-coming-soon { opacity: 0.72; }
.secondary-button.is-coming-soon:hover { opacity: 1; border-color: var(--gold); color: var(--gold-bright); }
.version-stamp { position: absolute; right: 28px; bottom: 24px; z-index: 3; color: #5e5651; font-size: calc(9px * var(--fs, 1)); letter-spacing: 0.18em; }

.title-mist { position: absolute; border-radius: 50%; filter: blur(60px); background: rgba(201, 92, 151, 0.22); animation: breathe 8s ease-in-out infinite alternate; }
.title-mist-a { width: 480px; height: 170px; right: -80px; bottom: 15%; }
.title-mist-b { width: 300px; height: 110px; right: 25%; top: 30%; animation-delay: -3s; }
@keyframes breathe { to { transform: translate(-42px, 18px) scale(1.13); opacity: .54; } }

.slot-screen, .character-screen {
  flex-direction: column;
  padding: 118px clamp(28px, 8vw, 120px) 46px;
  overflow: auto;
  background:
    radial-gradient(circle at 80% 20%, rgba(125, 69, 103, 0.13), transparent 30%),
    linear-gradient(130deg, #09080c, #110d14 55%, #070609);
}

/* itch iframe: overflow:auto alone does not scroll if the screen grows with content
   past min-height: 100vh; bind the active title screens to the viewport. */
.slot-screen.is-active,
.character-screen.is-active {
  height: 100vh;
  height: 100dvh;
  max-height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.character-screen {
  background:
    radial-gradient(circle at 50% 24%, rgba(159, 124, 91, .12), transparent 30%),
    radial-gradient(circle at 82% 60%, rgba(126, 55, 94, .12), transparent 34%),
    linear-gradient(130deg, #09080c, #100d13 55%, #070609);
}

.character-select-grid {
  flex: 1;
  min-height: 470px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.character-card {
  min-width: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a090c;
  box-shadow: var(--shadow);
  color: var(--ivory);
  text-align: left;
}

button.character-card { padding: 0; cursor: pointer; }
.character-card.available:hover { border-color: var(--gold); transform: translateY(-3px); }
.character-card.available::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 45%, rgba(255,255,255,.09) 50%, transparent 55%);
  transform: translateX(-120%);
  transition: transform .7s ease;
}
.character-card.available:hover::after { transform: translateX(120%); }
.character-card img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 20%; filter: saturate(.82) contrast(1.08); }
.character-card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(4,3,5,.96) 96%); }
.character-number { position: absolute; left: 18px; top: 18px; z-index: 3; color: var(--gold); font-family: Georgia, serif; font-size: calc(10px * var(--fs, 1)); letter-spacing: .2em; }
.character-card-copy { position: absolute; z-index: 3; left: 22px; right: 22px; bottom: 25px; border-left: 2px solid var(--gold); padding-left: 12px; }
.character-card-copy small, .character-card-copy strong, .character-card-copy em { display: block; }
.character-card-copy small { color: #9d9185; font-size: calc(9px * var(--fs, 1)); letter-spacing: .13em; }
.character-card-copy strong { margin: 5px 0 8px; font-family: Georgia, "STSong", serif; font-size: calc(clamp(24px, 2.6vw, 38px) * var(--fs, 1)); font-weight: 400; letter-spacing: .1em; }
.character-card-copy em { color: #9f9388; font-size: calc(10px * var(--fs, 1)); font-style: normal; }
.select-callout { position: absolute; z-index: 4; right: 20px; top: 17px; color: #e5c98d; font-size: calc(10px * var(--fs, 1)); letter-spacing: .12em; }
.character-card.locked { filter: saturate(.4); }
.character-card.locked::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.8)); }
.character-card.locked.knight-coming {
  filter: none;
  background:
    radial-gradient(circle at 50% 36%, #2c272f 0 34%, #0a090c 68%);
}
.character-card.locked.knight-coming img.character-silhouette {
  object-fit: contain;
  object-position: 50% 36%;
  filter: none;
  padding: 8% 6% 22%;
}
.character-card.locked.knight-coming::after {
  background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.78) 86%);
}
.character-card.locked.knight-coming .lock-seal { letter-spacing: .16em; }
.character-card.locked.nidhogg-coming {
  filter: none;
}
.character-card.locked.nidhogg-coming img {
  object-fit: cover;
  object-position: 50% 18%;
  filter: saturate(.82) contrast(1.08);
}
.character-card.locked.nidhogg-coming::after {
  background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.76) 86%);
}
.character-card.locked.nidhogg-coming .lock-seal { letter-spacing: .16em; }
.character-card.available.nidhogg-available img {
  object-fit: cover;
  object-position: 50% 18%;
  filter: saturate(.82) contrast(1.08);
}

.character-card.locked.platinum-locked {
  filter: none;
  cursor: pointer;
}
.character-card.locked.platinum-locked img {
  object-fit: cover;
  object-position: 50% 20%;
  filter: saturate(.82) contrast(1.08);
}
.character-card.locked.platinum-locked::after {
  background: linear-gradient(180deg, rgba(0,0,0,.16), rgba(0,0,0,.78) 86%);
}
.character-card.locked.platinum-locked .lock-seal {
  letter-spacing: .12em;
  white-space: normal;
  text-align: center;
  line-height: 1.55;
  max-width: calc(100% - 36px);
  padding: 10px 14px;
  color: #e5c98d;
  border-color: rgba(197, 161, 98, .75);
  background: rgba(18, 14, 16, .92);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.character-card.locked.platinum-locked:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.character-card.locked.platinum-locked:hover .lock-seal {
  color: #f4ddb0;
  border-color: var(--gold);
}
.locked-silhouette { position: absolute; left: 50%; bottom: 0; width: 74%; height: 88%; transform: translateX(-50%); background: radial-gradient(circle at 50% 15%, #17151a 0 10%, transparent 10.5%), linear-gradient(90deg, transparent 8%, #111014 24% 76%, transparent 92%); clip-path: polygon(30% 0, 70% 0, 78% 14%, 72% 22%, 94% 42%, 100% 100%, 0 100%, 6% 42%, 28% 22%, 22% 14%); filter: blur(1px); }
.locked-silhouette.alternate { width: 62%; height: 82%; clip-path: polygon(37% 0, 63% 0, 70% 18%, 91% 41%, 78% 100%, 22% 100%, 9% 41%, 30% 18%); }
.chain { position: absolute; z-index: 5; left: -18%; top: 44%; width: 140%; height: 15px; opacity: .72; transform: rotate(28deg); background: repeating-linear-gradient(90deg, #2a272c 0 8px, #797077 8px 10px, #18171a 10px 20px); border: 1px solid #0b0a0d; box-shadow: 0 4px 8px #000; }
.chain-b { top: 58%; transform: rotate(-24deg); }
.lock-seal { position: absolute; z-index: 7; left: 50%; top: 49%; transform: translate(-50%, -50%) rotate(-3deg); padding: 9px 18px; color: #8f8580; border: 1px solid #5c5555; background: #151316; font-size: calc(10px * var(--fs, 1)); letter-spacing: .24em; white-space: nowrap; }
.character-card.locked .character-card-copy { z-index: 7; border-color: #5f5754; }
.character-select-note { padding-top: 20px; color: #756d67; font-size: calc(10px * var(--fs, 1)); letter-spacing: .1em; text-align: center; }
.character-select-note span { margin-right: 8px; color: var(--gold); }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.panel-heading-actions { display: flex; gap: 8px; }
.panel-heading h2 { margin: 0; font-family: Georgia, "STSong", serif; font-size: calc(34px * var(--fs, 1)); font-weight: 400; letter-spacing: 0.12em; }
.panel-intro { margin: 18px 0 30px; color: var(--muted); font-size: calc(13px * var(--fs, 1)); }
.save-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.save-card {
  position: relative;
  min-height: 236px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(29, 24, 32, .88), rgba(10, 9, 12, .96));
  box-shadow: var(--shadow);
}
.save-card::after { content: ""; position: absolute; width: 140px; height: 140px; top: -70px; right: -70px; transform: rotate(45deg); border: 1px solid rgba(213, 183, 126, 0.12); }
.save-card:hover { border-color: rgba(221, 191, 134, 0.5); transform: translateY(-2px); }
.save-index { color: var(--gold); font-family: Georgia, serif; font-size: calc(11px * var(--fs, 1)); letter-spacing: 0.2em; }
.save-card h3 { margin: 36px 0 8px; font-family: Georgia, "STSong", serif; font-size: calc(24px * var(--fs, 1)); font-weight: 400; }
.save-card p { min-height: 42px; margin: 0; color: #8e8379; font-size: calc(12px * var(--fs, 1)); line-height: 1.7; }
.save-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 22px 0; background: rgba(230, 205, 163, 0.12); }
.save-stats div { padding: 10px; background: #0d0b10; text-align: center; }
.save-stats small { display: block; color: #706861; font-size: calc(9px * var(--fs, 1)); }
.save-stats b { display: block; margin-top: 4px; color: #cbbfb0; font-size: calc(12px * var(--fs, 1)); font-weight: 500; }
.save-actions { display: flex; gap: 8px; }
.save-actions button { flex: 1; padding: 10px; cursor: pointer; }
.load-slot { color: #16110a; border: 1px solid #c3a15f; background: #c3a15f; }
.export-slot { color: #c7b79e; border: 1px solid var(--line); background: transparent; }
.export-slot:hover { color: var(--gold-bright); border-color: var(--gold); }
.delete-slot { flex: 0 0 42px !important; color: #9f8d82; border: 1px solid var(--line); background: transparent; }
.empty-slot-note { padding: 11px; color: #5f5853; border: 1px dashed rgba(220,197,157,.13); font-size: calc(9px * var(--fs, 1)); letter-spacing: .16em; text-align: center; }
.archive-footer { display: flex; justify-content: flex-end; gap: 50px; margin-top: auto; padding-top: 32px; color: #746b65; font-size: calc(11px * var(--fs, 1)); }
.archive-footer span, .archive-footer b { display: block; }
.archive-footer b { margin-top: 5px; color: #bbb0a5; font-size: calc(13px * var(--fs, 1)); font-weight: 500; }

.game-screen { flex-direction: column; height: 100vh; height: 100dvh; max-height: 100%; min-height: 0; overflow: hidden; background: #07060a; }
.dungeon-stage { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 92px minmax(0, 1fr) 310px; overflow: hidden; background: linear-gradient(180deg, #17131a 0%, #0b090d 100%); }
.dungeon-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.92;
  background:
    linear-gradient(180deg, rgba(6, 5, 8, .2), rgba(6, 5, 8, .78)),
    radial-gradient(ellipse at 50% 100%, rgba(112, 86, 69, .24), transparent 55%),
    repeating-linear-gradient(90deg, transparent 0 138px, rgba(167, 145, 116, .04) 139px 141px),
    repeating-linear-gradient(0deg, transparent 0 92px, rgba(167, 145, 116, .035) 93px 95px);
}
.dungeon-stage[data-room="safe"] { background: linear-gradient(180deg, #1e1a18, #0b0a0b); }
.dungeon-stage[data-room="altar"] { background: radial-gradient(circle at 50% 42%, rgba(92,24,43,.18), transparent 34%), linear-gradient(180deg, #181219, #08070a); }
.dungeon-stage[data-room="event"] { background: linear-gradient(180deg, #151927, #09090c); }
.dungeon-stage[data-room="battle"] { background: linear-gradient(180deg, #1b1115, #08070a); }
.stage-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 7; box-shadow: inset 0 0 160px rgba(0, 0, 0, .92); }

.route-rail { position: relative; z-index: 9; display: flex; flex-direction: column; align-items: center; padding-top: 24px; border-right: 1px solid rgba(218, 198, 157, .14); background: rgba(8, 7, 10, .76); }
.floor-emblem { width: 55px; height: 64px; display: grid; place-content: center; border: 1px solid rgba(215, 185, 127, .28); clip-path: polygon(50% 0, 100% 22%, 90% 83%, 50% 100%, 10% 83%, 0 22%); text-align: center; }
.floor-emblem span { color: var(--gold-bright); font-family: Georgia, serif; font-size: calc(18px * var(--fs, 1)); }
.floor-emblem small { color: #776d63; font-size: calc(8px * var(--fs, 1)); letter-spacing: .18em; }
.route-track { position: relative; flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 3px; padding: 12px 0 18px; }
.route-track::before { content: ""; position: absolute; top: 13%; bottom: 13%; left: 50%; width: 1px; background: rgba(204, 174, 117, .24); }
.route-dot { position: relative; z-index: 1; width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid #62584e; background: #0c0a0e; }
.route-dot.passed { border-color: #a68957; background: #7e633a; }
.route-dot.current { width: 15px; height: 15px; border-color: var(--gold-bright); background: var(--gold); box-shadow: 0 0 18px rgba(235, 202, 130, .45); }

.scene-area { position: relative; z-index: 8; min-width: 0; display: flex; flex-direction: column; padding: 24px clamp(26px, 4vw, 66px) 22px; }
.dungeon-stage.intro-chamber .scene-area {
  background:
    linear-gradient(180deg, rgba(4, 4, 7, .16), rgba(4, 3, 6, .08) 44%, rgba(4, 3, 6, .58)),
    url("场景/初始房间-召唤大厅.png") center 53% / cover no-repeat;
}
.dungeon-stage:not(.intro-chamber) .scene-area {
  background:
    linear-gradient(180deg, rgba(4, 4, 7, .28), rgba(4, 3, 6, .12) 44%, rgba(4, 3, 6, .66)),
    var(--room-bg, none) center / cover no-repeat;
}

.scene-area.has-bg-video { isolation: isolate; }
.scene-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
.scene-bg-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 4, 7, .28), rgba(4, 3, 6, .12) 44%, rgba(4, 3, 6, .66));
}
.scene-area.has-bg-video > .scene-header,
.scene-area.has-bg-video > .choice-layer,
.scene-area.has-bg-video > .scene-object,
.scene-area.has-bg-video > .combat-layer {
  position: relative;
  z-index: 4;
}
.scene-area.has-bg-video > .festival-spring-rig,
.scene-area.has-bg-video > .festival-pending-rig,
.scene-area.has-bg-video > .festival-impact-rig {
  z-index: 8;
}

.dungeon-stage:not(.intro-chamber)[data-room="battle"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="event"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="altar"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="safe"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="threshold"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="rustCasket"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="mistSpring"] .scene-header,
.dungeon-stage:not(.intro-chamber)[data-room="darkReedPassage"] .scene-header { position: relative; z-index: 5; text-shadow: 0 2px 16px #000; }
.dungeon-stage.intro-chamber::before { opacity: .18; }
.dungeon-stage.intro-chamber .scene-header { position: relative; z-index: 5; text-shadow: 0 2px 16px #000; }
.scene-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.scene-kicker { margin: 0 0 6px; color: var(--gold); font-size: calc(9px * var(--fs, 1)); letter-spacing: .25em; }
.scene-header h2 { margin: 0; font-family: Georgia, "STSong", serif; font-size: clamp(16px, 1.9vw, 26px); font-weight: 400; letter-spacing: .08em; }
.dice-history-rail { position: relative; z-index: 9; min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-left: 1px solid rgba(218, 198, 157, .14); background: linear-gradient(180deg, rgba(8, 7, 10, .92), rgba(8, 6, 10, .78)); }
.dice-history-heading { flex: 0 0 auto; padding: 18px 18px 14px; border-bottom: 1px solid rgba(218, 198, 157, .12); }
.dice-history-heading span, .dice-history-heading small { display: block; }
.dice-history-heading span { color: #d8cbbd; font: 500 calc(12px * var(--fs, 1)) Georgia, "Songti SC", serif; letter-spacing: .12em; }
.dice-history-heading small { margin-top: 4px; color: #665d58; font-size: calc(8px * var(--fs, 1)); letter-spacing: .2em; }
.dice-readout { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: #5f4452 rgba(255,255,255,.03); }
.dice-readout:empty::before { content: "尚无判定记录\A你的每一次投掷都会留在这里。"; display: block; padding: 24px 10px; color: #615954; font-size: calc(9px * var(--fs, 1)); line-height: 1.8; white-space: pre-line; text-align: center; }
.dice-action-group { position: relative; margin-bottom: 12px; padding: 0 0 12px; border-bottom: 1px solid rgba(218, 190, 138, .18); }
.dice-action-group:last-child { margin-bottom: 0; }
.dice-action-heading { display: flex; justify-content: space-between; gap: 8px; margin: 1px 2px 8px; color: #9b8e82; font-size: calc(8px * var(--fs, 1)); letter-spacing: .12em; }
.dice-action-heading b { color: #c8b9aa; font-size: calc(9px * var(--fs, 1)); font-weight: 500; }
.dice-action-heading span { color: #625956; white-space: nowrap; }
.dice-entry { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 6px; padding: 8px 8px; border: 1px solid rgba(218, 190, 138, .2); background: rgba(12, 9, 13, .78); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.dice-face { flex: 0 0 29px; height: 29px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid var(--gold); color: var(--gold-bright); background: #171117; font: 700 calc(12px * var(--fs, 1)) Georgia, serif; }
.dice-face b { transform: rotate(-45deg); }
.dice-face.enemy { border-color: #9a5969; color: #e0a1af; }
.dice-versus { color: #5f5753; font: calc(8px * var(--fs, 1)) Georgia, serif; }
.dice-copy { min-width: 0; }
.dice-copy b, .dice-copy small { display: block; overflow: hidden; }
.dice-copy b { color: #d9cdc0; font-size: calc(9px * var(--fs, 1)); font-weight: 500; letter-spacing: .06em; }
.dice-copy small { margin-top: 3px; color: #827871; font-size: calc(8px * var(--fs, 1)); line-height: 1.45; }
.dice-entry.success .dice-face { border-color: #87b696; color: #b5d8bf; box-shadow: 0 0 14px rgba(100,180,127,.2); }
.dice-entry.failure .dice-face { border-color: #b05a67; color: #e49aa6; box-shadow: 0 0 14px rgba(190,74,94,.22); }
.dice-entry.critical .dice-face { border-color: #f0d18a; color: #fff1bf; box-shadow: 0 0 18px rgba(238,195,101,.38); }

.fog-wall { position: absolute; z-index: 6; left: -26%; top: 0; bottom: 0; width: 42%; pointer-events: none; opacity: .13; filter: blur(18px); transition: left .55s ease, opacity .55s ease; }
.fog-wall i { position: absolute; border-radius: 50%; background: rgba(218, 88, 158, .88); animation: fogFloat 5s ease-in-out infinite alternate; }
.fog-wall i:nth-child(1) { width: 88%; height: 40%; left: 0; top: 4%; }
.fog-wall i:nth-child(2) { width: 70%; height: 48%; left: 12%; top: 30%; animation-delay: -1.5s; }
.fog-wall i:nth-child(3) { width: 92%; height: 44%; left: -8%; bottom: -6%; animation-delay: -3s; }
.fog-wall i:nth-child(4) { width: 52%; height: 30%; right: -8%; top: 20%; animation-delay: -2s; }
@keyframes fogFloat { to { transform: translate(22px, 15px) scale(1.1); } }

.scene-object { flex: 1; min-height: 170px; min-width: 0; position: relative; display: grid; place-items: center; overflow-x: hidden; overflow-y: auto; padding: 8px 0 12px; }
.intro-hotspots { position: absolute; z-index: 6; inset: 0; }
.scene-hotspot { position: absolute; min-width: 120px; padding: 12px 14px; color: #d9c8b2; border: 1px solid rgba(220, 187, 129, .25); background: rgba(5, 4, 7, .72); box-shadow: 0 12px 32px rgba(0,0,0,.48), inset 0 0 20px rgba(120,83,55,.08); cursor: pointer; backdrop-filter: blur(4px); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.scene-hotspot:hover, .scene-hotspot:focus-visible { transform: translateY(-3px); color: #f0dba7; border-color: rgba(238, 205, 142, .72); background: rgba(20, 12, 17, .88); outline: none; }
.scene-hotspot span, .scene-hotspot small { display: block; }
.scene-hotspot span { font: 500 calc(13px * var(--fs, 1)) Georgia, "Songti SC", serif; letter-spacing: .12em; }
.scene-hotspot small { margin-top: 5px; color: #8f7f73; font-size: calc(8px * var(--fs, 1)); letter-spacing: .08em; }
.altar-hotspot { left: 21%; top: 42%; }
.door-hotspot { right: 13%; top: 35%; }
.door-hotspot.unlocked { border-color: rgba(186, 120, 144, .58); box-shadow: 0 0 26px rgba(172, 72, 119, .2); }

.breeding-hotspots { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.breeding-hotspots .scene-hotspot { pointer-events: auto; }
.breeding-cavity-hotspot {
  left: 70%;
  top: 57%;
  transform: translate(-50%, -50%);
  text-align: center;
  border-color: rgba(186, 120, 144, .52);
  box-shadow: 0 12px 32px rgba(0,0,0,.48), 0 0 24px rgba(172, 72, 119, .22), inset 0 0 20px rgba(120,83,55,.08);
}
.breeding-cavity-hotspot:hover, .breeding-cavity-hotspot:focus-visible {
  transform: translate(-50%, calc(-50% - 3px));
  border-color: rgba(238, 180, 200, .8);
  background: rgba(28, 12, 20, .9);
}
.door-silhouette { position: relative; width: 120px; height: 190px; border: 1px solid rgba(203, 177, 132, .15); border-bottom: 0; border-radius: 60px 60px 0 0; background: linear-gradient(90deg, #08070a, #161119 50%, #08070a); box-shadow: 0 0 70px rgba(0, 0, 0, .9), inset 0 0 40px #000; }
.door-rune { position: absolute; left: 50%; top: 38%; width: 26px; height: 26px; transform: translateX(-50%) rotate(45deg); border: 1px solid rgba(218, 189, 132, .35); box-shadow: inset 0 0 12px rgba(219, 188, 125, .13); }

.enemy-figure { position: relative; width: 200px; height: 245px; overflow: visible; animation: enemyIdle 2.8s ease-in-out infinite alternate; }
.enemy-figure:not(.has-portrait) .enemy-head,
.enemy-figure:not(.has-portrait) .enemy-body,
.enemy-figure:not(.has-portrait) .enemy-weapon { filter: drop-shadow(0 25px 22px rgba(0, 0, 0, .75)); }
@keyframes enemyIdle { to { transform: translateY(-4px); } }
.enemy-aura { position: absolute; inset: 5% 5% 12%; border-radius: 50%; background: radial-gradient(circle, rgba(166, 59, 91, .2), transparent 65%); filter: blur(10px); }
.enemy-head { position: absolute; z-index: 2; left: 69px; top: 12px; width: 62px; height: 70px; clip-path: polygon(50% 0, 95% 28%, 80% 100%, 20% 100%, 5% 28%); background: linear-gradient(135deg, #2f2a31, #09080a 60%); border: 1px solid #5c4c4f; }
.enemy-head i { position: absolute; top: 35px; width: 12px; height: 3px; background: #dc4a6c; box-shadow: 0 0 10px #ec416c; }
.enemy-head i:first-child { left: 13px; transform: rotate(8deg); }
.enemy-head i:last-child { right: 13px; transform: rotate(-8deg); }
.enemy-body { position: absolute; z-index: 1; left: 39px; top: 70px; width: 122px; height: 142px; clip-path: polygon(21% 0, 79% 0, 100% 28%, 84% 100%, 16% 100%, 0 28%); background: linear-gradient(110deg, #0b090c 0 28%, #30292f 48%, #0b090c 77%); border: 1px solid #51444a; }
.enemy-weapon { position: absolute; z-index: 3; right: 13px; top: 66px; width: 5px; height: 170px; transform: rotate(16deg); transform-origin: bottom; background: linear-gradient(90deg, #3b3437, #a18a75, #332c31); box-shadow: 0 0 0 1px #1a171a; }
.enemy-nameplate { position: absolute; z-index: 4; left: 50%; bottom: -9px; width: 220px; transform: translateX(-50%); text-align: center; }
.enemy-nameplate span { display: block; margin-bottom: 5px; font-family: "STSong", serif; letter-spacing: .16em; }
.enemy-hp { height: 5px; background: #251015; border: 1px solid rgba(189, 90, 104, .35); }
.enemy-hp i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #7d2737, #c8495b); transition: width .25s ease; }
.enemy-nameplate small { color: #9f8585; font-size: calc(9px * var(--fs, 1)); }
.enemy-portrait { display: none; }
.enemy-figure.has-portrait { position: absolute; z-index: 3; left: 50%; top: 8px; bottom: 20px; width: clamp(180px, 24vw, 310px); max-width: 92%; margin-left: calc(clamp(180px, 24vw, 310px) / -2); height: auto; max-height: calc(100% - 28px); }
.enemy-figure.has-portrait.boss-portrait { width: clamp(210px, 29vw, 360px); margin-left: calc(clamp(210px, 29vw, 360px) / -2); }
.enemy-figure.has-portrait .enemy-head,
.enemy-figure.has-portrait .enemy-body,
.enemy-figure.has-portrait .enemy-weapon { display: none; }
.enemy-figure.has-portrait .enemy-portrait { display: block; position: absolute; z-index: 2; left: 0; top: 0; width: 100%; height: calc(100% - 42px); object-fit: contain; object-position: center bottom; pointer-events: none; user-select: none; filter: drop-shadow(0 25px 22px rgba(0, 0, 0, .75)); }
/* 失落英雄二阶段立绘暂为 怪物/失落英雄_PLACEHOLDER.svg；正式图替换该文件或改 MONSTER_PORTRAITS */
.enemy-figure.has-portrait .enemy-aura { inset: 8% 8% 14%; }
.enemy-figure.acting-attack:not(.hit):not(.dying):not(.dead),
.enemy-figure.acting-melee:not(.hit):not(.dying):not(.dead),
.enemy-figure.acting-status:not(.hit):not(.dying):not(.dead),
.enemy-figure.acting-grapple:not(.hit):not(.dying):not(.dead) {
  animation-iteration-count: 1;
  animation-fill-mode: both;
}
.enemy-figure.acting-attack:not(.hit):not(.dying):not(.dead) {
  animation-name: enemyActAttack;
  animation-duration: .6s;
  animation-timing-function: cubic-bezier(.2, .7, .2, 1);
}
@keyframes enemyActAttack {
  0% { transform: translate(0, 0); filter: brightness(1); }
  16% { transform: translate(-10px, 2px) rotate(-2deg); filter: brightness(1.06); }
  36% { transform: translate(-26px, 5px) rotate(-5deg); filter: brightness(1.12); }
  52% { transform: translate(-14px, 3px) rotate(-2deg); }
  72% { transform: translate(6px, -1px) rotate(1deg); filter: brightness(1.04); }
  100% { transform: translate(0, 0); filter: brightness(1); }
}
.enemy-figure.acting-melee:not(.hit):not(.dying):not(.dead) {
  animation-name: enemyActMelee;
  animation-duration: .7s;
  animation-timing-function: ease-in-out;
}
@keyframes enemyActMelee {
  0% { transform: translate(0, 0); }
  18% { transform: translate(-18px, 7px) rotate(-3deg); }
  30% { transform: translate(-8px, 5px) rotate(-1deg); }
  48% { transform: translate(-24px, 9px) rotate(-4deg); }
  64% { transform: translate(-10px, 6px) rotate(-1deg); }
  100% { transform: translate(0, 0); }
}
.enemy-figure.acting-status:not(.hit):not(.dying):not(.dead) {
  animation-name: enemyActStatus;
  animation-duration: .65s;
  animation-timing-function: ease-in-out;
}
@keyframes enemyActStatus {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  24% { transform: translateY(-7px) scale(1.025); filter: brightness(1.22); }
  50% { transform: translateY(-3px) scale(1.01); filter: brightness(1.38); }
  74% { transform: translateY(-6px) scale(1.015); filter: brightness(1.14); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
.enemy-figure.acting-grapple:not(.hit):not(.dying):not(.dead) {
  animation-name: enemyActGrapple;
  animation-duration: .75s;
  animation-timing-function: ease-in-out;
}
@keyframes enemyActGrapple {
  0% { transform: translate(0, 0) scale(1); }
  28% { transform: translate(-30px, 9px) rotate(-5deg) scale(1.035); }
  50% { transform: translate(-28px, 11px) rotate(-4deg) scale(1.04); }
  72% { transform: translate(-16px, 5px) rotate(-2deg) scale(1.015); }
  100% { transform: translate(0, 0) scale(1); }
}
.enemy-figure.hit { animation: enemyHit .5s ease-in-out; }
@keyframes enemyHit {
  0%, 100% { transform: translate(0, 0); opacity: 1; filter: brightness(1); }
  10% { transform: translate(-12px, 2px); opacity: .28; filter: brightness(1.65); }
  22% { transform: translate(11px, -2px); opacity: 1; filter: brightness(1.25); }
  34% { transform: translate(-9px, 3px); opacity: .38; filter: brightness(1.5); }
  48% { transform: translate(8px, -1px); opacity: 1; filter: brightness(1.2); }
  62% { transform: translate(-6px, 2px); opacity: .45; }
  76% { transform: translate(4px, 0); opacity: 1; }
}
.enemy-figure.dying {
  pointer-events: none;
  animation: enemyDeath .92s ease-out forwards;
}
@keyframes enemyDeath {
  0% { opacity: 1; transform: translate(0, 0); filter: none; }
  10% { opacity: .12; }
  18% { opacity: 1; }
  28% { opacity: .08; }
  36% { opacity: 1; }
  46% { opacity: .1; }
  54% { opacity: .85; }
  64% { opacity: .06; }
  74% { opacity: .45; }
  100% { opacity: 0; transform: translate(0, 8px); filter: grayscale(1) brightness(.55); }
}
.enemy-figure.dead {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
  animation: none;
  filter: none;
}

.enemy-party { position: absolute; z-index: 4; inset: 6px 0 18px; display: flex; align-items: stretch; justify-content: center; gap: clamp(4px, 1vw, 14px); overflow: visible; }
.enemy-party[hidden] { display: none; }
.enemy-party .enemy-figure { position: relative; inset: auto; flex: 0 1 clamp(150px, 22vw, 260px); width: clamp(150px, 22vw, 260px); max-width: 31%; height: 100%; max-height: 100%; margin: 0; padding: 0; color: inherit; border: 1px solid transparent; background: transparent; cursor: pointer; overflow: visible; }
.enemy-party .enemy-figure:hover,
.enemy-party .enemy-figure.targeted { border-color: rgba(224, 187, 115, .6); background: radial-gradient(circle at 50% 60%, rgba(104, 70, 38, .18), transparent 64%); }
.enemy-party .enemy-figure.acting,
.enemy-figure.acting { border-color: rgba(218, 83, 112, .82); box-shadow: inset 0 0 26px rgba(174, 42, 76, .2), 0 0 20px rgba(174, 42, 76, .22); }
.enemy-party .enemy-figure.defeated:not(.dying):not(.dead) { opacity: .28; filter: grayscale(1); pointer-events: none; }
.enemy-party .enemy-figure.is-territory-kneeling,
.enemy-party .enemy-figure.is-territory-kneeling:hover,
.enemy-party .enemy-figure.is-territory-kneeling.targeted,
.enemy-party .enemy-figure.is-territory-kneeling.acting,
.enemy-figure.is-territory-kneeling,
.enemy-figure.is-territory-kneeling:hover,
.enemy-figure.is-territory-kneeling.targeted,
.enemy-figure.is-territory-kneeling.acting {
  pointer-events: none;
  cursor: default;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  animation: none;
  outline: none;
}
.enemy-party .enemy-figure.is-territory-kneeling .enemy-nameplate,
.enemy-figure.is-territory-kneeling .enemy-nameplate { opacity: .72; }
.enemy-party .enemy-figure .enemy-nameplate { bottom: 2px; width: min(210px, 96%); }
.enemy-party .enemy-figure .enemy-nameplate span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(10px * var(--fs, 1)); letter-spacing: .06em; }
.enemy-party .enemy-figure .enemy-nameplate em { display: block; margin-bottom: 3px; color: #b99a69; font-size: calc(8px * var(--fs, 1)); font-style: normal; }
.enemy-party .enemy-figure .enemy-portrait { height: calc(100% - 58px); }
/* t454u: speaking bubble must paint above sibling portrait frames */
.enemy-figure.is-speaking,
.enemy-figure:has(> .enemy-speech.is-visible),
.enemy-party .enemy-figure.is-speaking,
.enemy-party .enemy-figure:has(> .enemy-speech.is-visible) { z-index: 8; }
.enemy-party .enemy-speech { max-width: min(360px, 280%); overflow: visible; }

.event-story { display: grid; gap: 10px; max-height: min(46vh, 420px); overflow-y: auto; padding-right: 6px; }
.event-story p { margin: 0; color: #c8bdb2; line-height: 1.8; }
.event-adult-note { padding: 8px 10px; color: #d3a5b9; border-left: 2px solid var(--pink); background: rgba(117,42,79,.14); font-size: calc(9px * var(--fs, 1)); }

.object-card { position: relative; z-index: 2; width: min(560px, 94%); max-width: 100%; max-height: min(46vh, 340px); overflow-x: hidden; overflow-y: auto; padding: 18px 20px; border: 1px solid var(--line-bright); background: rgba(13, 11, 16, .86); box-shadow: var(--shadow); text-align: center; box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(220,190,138,.34) rgba(255,255,255,.025); }
.object-glyph { display: block; color: var(--gold-bright); font-size: calc(28px * var(--fs, 1)); }
.object-card h3 { margin: 8px 0 6px; font-family: "STSong", serif; font-size: clamp(15px, 2.1vw, 19px); font-weight: 400; letter-spacing: .06em; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.object-card p { margin: 0; color: var(--muted); font-size: calc(12px * var(--fs, 1)); line-height: 1.7; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }

.choice-layer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(820px, 100%); margin: 0 auto; position: relative; z-index: 4; max-height: min(48vh, 420px); overflow-x: hidden; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(220,190,138,.34) rgba(255,255,255,.025); }
.choice-card {
  position: relative;
  min-width: 0;
  width: 100%;
  min-height: 78px;
  height: auto;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  padding: 13px 16px;
  overflow: hidden;
  color: var(--ivory);
  border: 1px solid var(--line);
  background: rgba(10, 9, 12, .86);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
.choice-card:hover { border-color: var(--gold); background: rgba(26, 21, 26, .94); transform: translateY(-1px); }
.choice-card::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0; }
.choice-card:hover::after { opacity: .72; }
.choice-index { width: 34px; height: 34px; margin-top: 2px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid rgba(214, 183, 127, .3); color: var(--gold-bright); font-family: Georgia, serif; flex-shrink: 0; }
.choice-index i { transform: rotate(-45deg); font-style: normal; }
.choice-copy { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.choice-copy b, .choice-copy small { display: block; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.choice-copy b { margin-bottom: 5px; font-family: "STSong", serif; font-size: calc(15px * var(--fs, 1)); font-weight: 400; letter-spacing: .06em; line-height: 1.4; }
.choice-copy small { color: #8f847b; font-size: calc(10px * var(--fs, 1)); line-height: 1.55; }
.route-reveal { display: block; margin-top: 5px; color: #d8bd83; font-style: normal; letter-spacing: .08em; }
.choice-arrow { align-self: center; color: #6f635b; font-size: calc(18px * var(--fs, 1)); }

.combat-layer { width: min(820px, 100%); margin: 0 auto; position: relative; z-index: 16; overflow: visible; }
.combat-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; overflow: visible; }
.combat-skill-bar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; position: relative; overflow: visible; }
.combat-menu-slot { position: relative; overflow: visible; min-width: 0; }
.combat-button { min-height: 64px; width: 100%; padding: 11px; color: #d8cec2; border: 1px solid var(--line); background: rgba(10, 9, 12, .9); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.combat-button:hover { border-color: #b89255; color: var(--gold-bright); }
.combat-button.energy { border-color: rgba(207,171,92,.3); background: rgba(58,43,17,.32); }
.combat-button.status { border-color: rgba(118,112,165,.3); background: rgba(31,28,55,.32); }
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.energy,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.status {
  border-color: rgba(90, 210, 230, .55);
  background: rgba(18, 72, 88, .58);
  color: #d8f6ff;
  box-shadow: 0 0 10px rgba(70, 190, 210, .22);
}
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill small { color: #9ad4e4; }
/* t226: qi-cost combat flyout buttons match preselect .is-qi red fill (cost color wins over spear aqua). */
body.is-nidhogg-player .combat-button.is-qi,
body.is-nidhogg-player .combat-button.is-qi.energy,
body.is-nidhogg-player .combat-button.is-qi.status,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.energy,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.status {
  border-color: #c45a5a;
  color: #f3e4e0;
  background: rgba(110, 28, 28, .88);
  box-shadow: inset 0 0 0 1px rgba(196, 70, 70, .45), 0 0 8px rgba(180, 50, 50, .28);
}
body.is-nidhogg-player .combat-button.is-qi:hover,
body.is-nidhogg-player .combat-button.is-qi.energy:hover,
body.is-nidhogg-player .combat-button.is-qi.status:hover,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi:hover,
body.is-nidhogg-player .combat-button.is-open.is-qi {
  border-color: #e08a8a;
  color: #eef6ff;
  background: rgba(132, 34, 34, .92);
}
body.is-nidhogg-player .combat-button.is-qi small,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi small {
  color: #e0b4b0;
}
body.is-nidhogg-player .combat-button.is-qi.is-mp,
body.is-nidhogg-player .combat-button.is-qi.is-mp.energy,
body.is-nidhogg-player .combat-button.is-qi.is-mp.status,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.is-mp,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.is-mp.energy,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.is-mp.status {
  border-color: transparent;
  color: #f0ece8;
  box-shadow: none;
  background-color: transparent;
  background-image: linear-gradient(90deg, rgba(110, 28, 28, .88) 0 50%, rgba(22, 56, 96, .88) 50% 100%), linear-gradient(90deg, #c45a5a 0 50%, #4a8ec8 50% 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
body.is-nidhogg-player .combat-button.is-qi.is-mp:hover,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.is-mp:hover,
body.is-nidhogg-player .combat-button.is-open.is-qi.is-mp {
  border-color: transparent;
  background-color: transparent;
  color: #eef6ff;
}
body.is-nidhogg-player .combat-button.is-qi.is-mp small,
body.is-nidhogg-player .combat-button.is-nidhogg-spear-skill.is-qi.is-mp small {
  color: #d4c8c4;
}
body.is-nidhogg-player .combat-button.is-qi.is-unavailable,
body.is-nidhogg-player .combat-button.is-qi:disabled {
  filter: grayscale(.35) brightness(.88);
}
.combat-button.bag { border-color: rgba(180,160,120,.28); background: rgba(28,24,18,.4); }
.combat-button.ejaculate { border-color: rgba(232,120,170,.6); background: linear-gradient(145deg, rgba(140,36,88,.62), rgba(72,18,52,.78)); color: #f6c6da; }
.combat-button.ejaculate:hover { border-color: #f0a8c4; color: #ffe4f0; }
.combat-button.ejaculate small { color: #d090ae; }
.combat-button.counter { border-color: rgba(111,157,137,.3); }
.combat-button.is-open { border-color: #b89255; color: var(--gold-bright); }
.combat-button:disabled { filter: grayscale(.7); }
.combat-button b, .combat-button small { display: block; }
.combat-button b { margin-bottom: 0; font-family: "STSong", serif; font-weight: 400; }
.combat-button small { margin-top: 5px; color: #7e746d; font-size: calc(9px * var(--fs, 1)); }
.combat-flyout { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 24; display: grid; gap: 6px; min-width: 100%; width: max(100%, min(260px, 72vw)); max-height: min(42vh, 280px); overflow-x: hidden; overflow-y: auto; padding: 6px; border: 1px solid var(--line); background: rgba(10, 9, 12, .96); box-shadow: 0 14px 32px rgba(0, 0, 0, .55); }
.combat-actions.has-nidhogg-preselect .combat-skill-bar { position: relative; z-index: 20; }

body.is-nidhogg-player .scene-area { --scene-pad-x: clamp(26px, 4vw, 66px); }
body.is-nidhogg-player .combat-layer:not([hidden]) {
  width: calc(100% + var(--scene-pad-x) - 8px);
  max-width: none;
  margin-left: calc(8px - var(--scene-pad-x));
  margin-right: 0;
}
.combat-actions.has-nidhogg-preselect {
  --nidhogg-action-w: 110px;
  --nidhogg-action-h: 64px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center; /* fog-embers-t250: center the whole skill/action row */
  gap: 8px;
  width: 100%;
}
.combat-actions.has-nidhogg-preselect > .combat-button.ejaculate,
.combat-actions.has-nidhogg-preselect .combat-skill-bar > .combat-menu-slot,
.combat-actions.has-nidhogg-preselect .combat-skill-bar > .combat-button,
.combat-actions.has-nidhogg-preselect .nidhogg-preselect-slot,
.combat-actions.has-nidhogg-preselect .nidhogg-preselect-submit,
.combat-actions.has-nidhogg-preselect .nidhogg-breath-button {
  flex: 0 0 var(--nidhogg-action-w);
  width: var(--nidhogg-action-w);
  min-width: var(--nidhogg-action-w);
  max-width: var(--nidhogg-action-w);
  height: var(--nidhogg-action-h);
  min-height: var(--nidhogg-action-h);
  max-height: var(--nidhogg-action-h);
  box-sizing: border-box;
}
.combat-actions.has-nidhogg-preselect > .combat-button.ejaculate { order: 2; }
.combat-actions.has-nidhogg-preselect .combat-skill-bar {
  grid-column: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  order: 1;
}
.combat-actions.has-nidhogg-preselect .nidhogg-preselect-bar {
  grid-column: auto;
  flex: 0 0 auto;
  min-width: 0;
  height: var(--nidhogg-action-h);
  min-height: var(--nidhogg-action-h);
  padding: 0;
  gap: 8px;
  order: 4; /* fog-embers-t249 */
  border: 1px solid rgba(196, 168, 118, .42);
  background: linear-gradient(180deg, rgba(28, 22, 16, .88), rgba(10, 9, 11, .92));
  box-shadow: inset 0 0 0 1px rgba(70, 54, 36, .35), 0 0 10px rgba(0, 0, 0, .25);
  box-sizing: content-box;
}
.combat-actions.has-nidhogg-preselect .nidhogg-breath-button { order: 3; } /* fog-embers-t249 */
.combat-actions.has-nidhogg-preselect .nidhogg-breath-button.is-selected {
  border-color: rgba(255, 255, 255, .7);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 0 10px rgba(255, 255, 255, .28);
}
.bar.hp-bar,
.bar.nidhogg-mp-bar,
.bar.has-nidhogg-reserve-host { position: relative; overflow: hidden; }
.bar.has-nidhogg-reserve-host > i { position: relative; z-index: 1; }
.nidhogg-cost-reserve {
  display: block;
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .55), #ffffff 55%, #e8e8e8);
  box-shadow: 0 0 10px rgba(255, 255, 255, .9);
  pointer-events: none;
  animation: nidhoggCostFlash .8s ease-in-out infinite;
}
@keyframes nidhoggCostFlash {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: .35; filter: brightness(1.7); }
}
.nidhogg-qi-ticks i.is-reserved {
  background: linear-gradient(180deg, #ffffff, #d0d0d0);
  border-color: #f4f4f4;
  box-shadow: 0 0 8px rgba(255, 255, 255, .7);
  animation: nidhoggCostFlash .8s ease-in-out infinite;
}
.vital-row.is-nidhogg-cost-flash span,
.vital-row.is-nidhogg-cost-flash b,
.resource-row.is-nidhogg-cost-flash > span,
.resource-row.is-nidhogg-cost-flash > b {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, .55);
  animation: nidhoggCostFlash .8s ease-in-out infinite;
}
.bar.is-nidhogg-cost-flash {
  outline: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 0 8px rgba(255, 255, 255, .45);
}
@media (prefers-reduced-motion: reduce) {
  .nidhogg-cost-reserve,
  .nidhogg-qi-ticks i.is-reserved,
  .vital-row.is-nidhogg-cost-flash span,
  .vital-row.is-nidhogg-cost-flash b,
  .resource-row.is-nidhogg-cost-flash > span,
  .resource-row.is-nidhogg-cost-flash > b {
    animation-duration: .8s !important;
    animation-iteration-count: infinite !important;
  }
}
.nidhogg-preselect-bar { grid-column: 1 / -1; position: relative; z-index: 8; display: flex; align-items: stretch; gap: 8px; height: var(--nidhogg-action-h, 64px); min-height: var(--nidhogg-action-h, 64px); padding: 0; }
.nidhogg-preselect-label { flex: 0 0 auto; align-self: center; color: #8f847b; font-size: calc(10px * var(--fs, 1)); letter-spacing: .12em; writing-mode: horizontal-tb; }
.nidhogg-preselect-track { flex: 0 0 auto; display: flex; align-items: stretch; gap: 8px; min-width: 0; overflow: hidden; padding: 0; }
.nidhogg-preselect-slot { display: flex; align-items: stretch; border: 1px dashed rgba(160, 146, 124, .38); background: rgba(8, 8, 10, .45); }
.nidhogg-preselect-slot.is-empty { background: rgba(8, 8, 10, .28); cursor: pointer; }
/* fog-embers-t251：空栏提示改为缓慢、低对比的闪动，避免抢眼。 */
@keyframes nidhoggHintPulse {
  0%, 100% { opacity: .32; }
  50% { opacity: .7; }
}
.nidhogg-preselect-empty {
  display: block;
  width: 100%;
  align-self: center;
  padding: 4px 6px;
  color: rgba(168, 158, 148, .85);
  font-size: calc(10px * var(--fs, 1));
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  text-shadow: none;
  animation: nidhoggHintPulse 3.6s ease-in-out infinite;
  pointer-events: none;
}
.nidhogg-preselect-chip { flex: 1 1 auto; display: flex; align-items: center; gap: 4px; width: 100%; height: 100%; max-width: none; min-height: 0; padding: 4px 6px; color: #d8cec2; border: 1px solid rgba(140, 130, 118, .35); background: rgba(12, 22, 32, .92); cursor: pointer; text-align: left; box-sizing: border-box; }
/* fog-embers-t251：蓄气回复填入预选栏时沿用蓄气回复按钮的底色。 */
.nidhogg-preselect-chip.is-breath {
  border-color: var(--line);
  color: #d8cec2;
  background: rgba(10, 9, 12, .9);
  box-shadow: none;
}
.nidhogg-preselect-chip.is-qi { border-color: #c45a5a; color: #f3e4e0; background: rgba(110, 28, 28, .88); box-shadow: inset 0 0 0 1px rgba(196, 70, 70, .45), 0 0 8px rgba(180, 50, 50, .28); }
.nidhogg-preselect-chip.is-mp { border-color: #4a8ec8; color: #e4eef8; background: rgba(22, 56, 96, .88); box-shadow: inset 0 0 0 1px rgba(70, 140, 210, .5), 0 0 8px rgba(70, 140, 210, .28); }
.nidhogg-preselect-chip.is-qi.is-mp {
  border-color: transparent;
  color: #f0ece8;
  box-shadow: none;
  background-color: transparent;
  background-image: linear-gradient(90deg, rgba(110, 28, 28, .88) 0 50%, rgba(22, 56, 96, .88) 50% 100%), linear-gradient(90deg, #c45a5a 0 50%, #4a8ec8 50% 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.nidhogg-preselect-chip:hover { color: #eef6ff; }
.nidhogg-preselect-chip.is-qi:hover { border-color: #e08a8a; background: rgba(132, 34, 34, .92); }
.nidhogg-preselect-chip.is-mp:hover { border-color: #7eb6e6; background: rgba(28, 68, 112, .92); }
.nidhogg-preselect-chip.is-qi.is-mp:hover { border-color: transparent; background-color: transparent; }
.nidhogg-preselect-chip.is-qi small { color: #e0b4b0; }
.nidhogg-preselect-chip.is-mp small { color: #9fc0dc; }
.nidhogg-preselect-chip.is-qi.is-mp small { color: #d4c8c4; }
.nidhogg-preselect-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; overflow: hidden; }
.nidhogg-preselect-chip b, .nidhogg-preselect-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nidhogg-preselect-chip b { font-family: "STSong", serif; font-weight: 400; font-size: calc(12px * var(--fs, 1)); }
.nidhogg-preselect-chip small { color: #8aa7b8; font-size: calc(9px * var(--fs, 1)); line-height: 1.3; }
.nidhogg-preselect-remove { margin-left: auto; flex: 0 0 auto; color: #b9c8d2; font-size: 14px; line-height: 1; }
.nidhogg-preselect-submit { padding: 0; }
.nidhogg-preselect-submit:disabled,
.nidhogg-preselect-submit[aria-disabled="true"] {
  opacity: .42;
  filter: grayscale(.65);
  cursor: not-allowed;
  pointer-events: none;
}
.combat-button.is-unavailable { filter: grayscale(.7); cursor: pointer; }
.combat-flyout.is-bag { left: auto; right: 0; width: min(320px, 78vw); }
.combat-flyout .combat-button { min-height: 54px; }
.combat-bag-section { display: grid; gap: 4px; }
.combat-bag-section + .combat-bag-section { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(223, 199, 154, .16); }
.combat-bag-label { margin: 0 2px 2px; color: #8f847b; font-size: calc(9px * var(--fs, 1)); letter-spacing: .08em; }
.combat-bag-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; color: #d8cec2; border: 1px solid var(--line); background: rgba(10, 9, 12, .9); }
.combat-bag-copy { min-width: 0; }
.combat-bag-copy b, .combat-bag-copy small { display: block; overflow-wrap: anywhere; word-break: break-word; }
.combat-bag-copy b { margin-bottom: 3px; font-family: "STSong", serif; font-size: calc(12px * var(--fs, 1)); font-weight: 400; }
.combat-bag-copy small { color: #7e746d; font-size: calc(9px * var(--fs, 1)); line-height: 1.45; }
.combat-bag-row .equipment-action { min-width: 64px; text-align: center; }
.combat-bag-empty { margin: 0; padding: 8px 6px; color: #7e746d; font-size: calc(10px * var(--fs, 1)); line-height: 1.55; }

.hud-panel { --hud-scale: 0.84; flex: 0 0 calc(350px * var(--hud-scale)); min-height: calc(350px * var(--hud-scale)); height: calc(350px * var(--hud-scale)); position: relative; z-index: 15; overflow: visible; border-top: 1px solid rgba(223, 199, 154, .25); background: linear-gradient(180deg, #0e0c11, #09080b); box-shadow: 0 -20px 50px rgba(0, 0, 0, .48); }
.hud-panel-inner { position: absolute; left: 0; top: 0; width: calc(100% / var(--hud-scale)); height: 350px; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: 270px 202px minmax(0, 1fr) 170px 170px; transform: scale(var(--hud-scale)); transform-origin: top left; }
.portrait-frame { position: relative; overflow: hidden; padding: 0; color: inherit; border: 0; border-right: 1px solid rgba(220, 197, 157, .2); background: #17141a; cursor: pointer; text-align: left; }
.portrait-frame img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; filter: saturate(.78) contrast(1.06); transition: filter .2s ease; }
.portrait-frame:hover img { filter: saturate(.9) contrast(1.04) brightness(1.08); }
.portrait-frame.is-hit img { animation: portraitHit .32s ease; }
@keyframes portraitHit { 45% { transform: translateX(-7px); filter: saturate(.65) contrast(1.3) sepia(.25); } }
.portrait-frame.is-attack img { animation: portraitAttack .4s ease; }
@keyframes portraitAttack { 35% { transform: scale(1.07) translateY(-5px); filter: saturate(.95) contrast(1.08) brightness(1.06); } }
.portrait-frame.fog-engulfed { box-shadow: inset 0 0 28px rgba(239,74,159,.72), 0 0 24px rgba(216,54,137,.3); }
.portrait-frame.fog-engulfed::before { content: ""; position: absolute; z-index: 2; inset: -15% -35%; pointer-events: none; background: radial-gradient(ellipse at 8% 20%, rgba(244,94,174,.64), transparent 27%), radial-gradient(ellipse at 92% 46%, rgba(220,61,151,.56), transparent 31%), radial-gradient(ellipse at 25% 92%, rgba(246,128,191,.5), transparent 30%); filter: blur(11px); animation: portraitFogDrift 3.8s ease-in-out infinite alternate; }
.portrait-frame.fog-engulfed::after { content: ""; position: absolute; z-index: 3; inset: 0; pointer-events: none; border: 1px solid rgba(255,111,189,.64); box-shadow: inset 0 0 20px rgba(232,70,157,.7); animation: portraitFogPulse 2.2s ease-in-out infinite alternate; }
@keyframes portraitFogDrift { to { transform: translateX(12%) translateY(-4%) scale(1.08); opacity: .72; } }
@keyframes portraitFogPulse { to { border-color: rgba(255,164,211,.86); box-shadow: inset 0 0 34px rgba(232,70,157,.88); } }
.portrait-fade { position: absolute; z-index: 4; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(7, 6, 9, .97)); }
.portrait-open-hint { position: absolute; z-index: 5; left: 0; right: 0; top: 0; padding: 8px 10px; color: #e0c58b; background: linear-gradient(180deg, rgba(5,4,6,.88), transparent); opacity: 0; font-size: calc(8px * var(--fs, 1)); letter-spacing: .12em; text-align: center; transition: opacity .2s ease; }
.portrait-frame:hover .portrait-open-hint, .portrait-frame:focus-visible .portrait-open-hint { opacity: 1; }
.portrait-name { position: absolute; z-index: 5; left: 14px; right: 14px; bottom: 14px; border-left: 2px solid var(--gold); padding-left: 9px; }
.portrait-name small, .portrait-name b { display: block; }
.portrait-name small { color: #8f8378; font-size: calc(8px * var(--fs, 1)); letter-spacing: .14em; }
.portrait-name b { margin-top: 0; font-family: "STSong", serif; font-weight: 400; letter-spacing: .12em; }
.portrait-name small + b { margin-top: 2px; }

.status-column { display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid rgba(220, 197, 157, .18); }
.data-slot { padding: 12px 17px; }
.data-slot { border-bottom: 1px solid rgba(220, 197, 157, .13); }
.vital-row { display: flex; justify-content: space-between; align-items: baseline; color: #8f857c; font-size: calc(10px * var(--fs, 1)); }
.vital-row b { color: #d8cbc0; font-family: Georgia, serif; font-size: calc(13px * var(--fs, 1)); font-weight: 500; }
.vital-row.compact { margin-top: 13px; }
.vital-row.compact span { display: flex; align-items: center; gap: 6px; }
.bar { height: 5px; margin-top: 8px; background: #261015; }
.bar i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #7d2b36, #bd4e58); transition: width .3s ease; }
.resource-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; color: #817872; font-size: calc(8px * var(--fs, 1)); }
.resource-row b { color: #cfc4b8; font: 500 calc(9px * var(--fs, 1)) Georgia, serif; }
.resource-row + .bar { height: 4px; margin-top: 4px; position: relative; overflow: hidden; }
.desire-bar { background: #21101b; }
.desire-bar i { background: linear-gradient(90deg, #7e2e5c, #d467a5); }
.sanity-bar { background: #111728; }
.sanity-bar i { background: linear-gradient(90deg, #516d9f, #9bb2d9); }
.energy-bar { background: #1c180e; }
.energy-bar i { position: relative; z-index: 1; background: linear-gradient(90deg, #a67d31, #f1d497); }
.energy-bar em { position: absolute; z-index: 2; top: 0; right: 0; bottom: 0; width: 0; background: repeating-linear-gradient(135deg, rgba(38,20,27,.96) 0 4px, rgba(117,43,76,.88) 4px 7px); border-left: 1px solid #e073aa; transition: width .3s ease; }
.attribute-slot { min-width: 0; min-height: 0; padding: 12px 15px 10px; overflow: visible; }
.attribute-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.attribute-heading span { color: #8e8378; font-size: calc(9px * var(--fs, 1)); letter-spacing: .18em; }
.attribute-heading small { color: #554e4a; font-size: calc(7px * var(--fs, 1)); }
.attribute-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; }
.attribute-chip { position: relative; display: flex; justify-content: space-between; gap: 5px; padding: 5px 6px; color: #817873; border: 1px solid rgba(220,197,157,.1); background: rgba(255,255,255,.018); font-size: calc(9px * var(--fs, 1)); cursor: help; }
.attribute-chip:first-child { grid-column: 1 / -1; }
.attribute-level-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}
.attribute-level-split .attribute-chip-half {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 6px;
  color: #817873;
  border: 1px solid rgba(220,197,157,.1);
  background: rgba(255,255,255,.018);
  font-size: calc(9px * var(--fs, 1));
  cursor: help;
  min-width: 0;
}
.attribute-level-split .attribute-chip-half b {
  color: #eee7da;
  font: 500 calc(10px * var(--fs, 1)) Georgia, serif;
}
.attribute-level-split .attribute-chip-half.is-hybrid {
  color: #e0c8f0;
  border-color: rgba(158, 92, 196, .4);
  background: rgba(72, 28, 96, .22);
}
.attribute-level-split .attribute-chip-half.is-hybrid b { color: #e8d6f6; }
.attribute-level-split .attribute-chip-half:hover .attribute-tooltip,
.attribute-level-split .attribute-chip-half:focus-visible .attribute-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.attribute-chip b { color: #eee7da; font: 500 calc(10px * var(--fs, 1)) Georgia, serif; }
.attribute-chip.increased b { color: #84c79a; }
.attribute-chip.decreased b { color: #db747c; }
.attribute-tooltip, .equipment-tooltip { position: absolute; z-index: 60; left: 50%; bottom: calc(100% + 9px); width: 220px; transform: translate(-50%, 6px); padding: 10px 12px; color: #bdb1a7; border: 1px solid rgba(220,190,138,.34); background: rgba(12,10,14,.98); box-shadow: 0 12px 34px #000; opacity: 0; visibility: hidden; pointer-events: none; font-size: calc(9px * var(--fs, 1)); line-height: 1.6; transition: .18s ease; }
.attribute-tooltip::after, .equipment-tooltip::after { content: ""; position: absolute; left: 50%; top: 100%; width: 8px; height: 8px; transform: translate(-50%,-4px) rotate(45deg); border-right: 1px solid rgba(220,190,138,.34); border-bottom: 1px solid rgba(220,190,138,.34); background: #0c0a0e; }
.attribute-chip:hover .attribute-tooltip, .attribute-chip:focus-visible .attribute-tooltip, .equipment-card:hover .equipment-tooltip, .equipment-card:focus-within .equipment-tooltip { opacity: 1; visibility: visible; transform: translate(-50%,0); }
.attribute-chip:nth-child(even) .attribute-tooltip { left: 0; transform: translate(0,6px); }
.attribute-chip:nth-child(odd):not(:first-child) .attribute-tooltip { left: auto; right: 0; transform: translate(0,6px); }
.attribute-chip:nth-child(even):hover .attribute-tooltip, .attribute-chip:nth-child(even):focus-visible .attribute-tooltip,
.attribute-chip:nth-child(odd):not(:first-child):hover .attribute-tooltip, .attribute-chip:nth-child(odd):not(:first-child):focus-visible .attribute-tooltip { transform: translate(0,0); }
.status-list { display: flex; flex-wrap: wrap; gap: 6px; }
.status-chip { width: 100%; padding: 6px 7px; color: #cdbbc2; border: 1px solid rgba(208, 107, 160, .28); background: rgba(107, 40, 76, .16); font-size: calc(8px * var(--fs, 1)); line-height: 1.35; }
.status-chip[data-status-tip] { cursor: help; }
.status-chip.positive { color: #b8ccb9; border-color: rgba(122, 170, 138, .3); background: rgba(48, 92, 64, .14); }
.status-chip.negative { color: #e07070; border-color: rgba(200, 55, 55, .45); background: rgba(120, 28, 28, .24); }
.status-chip.has-durability { position: relative; display: flex; flex-direction: column; box-sizing: border-box; padding-bottom: 8px; overflow: hidden; }
.status-chip .status-dura-bar { display: block; width: 100%; height: 3px; margin-top: 5px; background: rgba(0, 0, 0, .45); overflow: hidden; pointer-events: none; }
.status-chip .status-dura-fill { display: block; height: 100%; width: 0; }
.status-chip .status-dura-fill.high { background: #f2f2f2; }
.status-chip .status-dura-fill.mid { background: #e6c84a; }
.status-chip .status-dura-fill.low { background: #d4554a; }
.empty-status { color: #5f5854; font-size: calc(10px * var(--fs, 1)); }

.dialogue-box { position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 26px 30px 18px; background: linear-gradient(110deg, rgba(19, 16, 22, .96), rgba(9, 8, 11, .96)); }
.dialogue-box::before { content: ""; position: absolute; left: 0; top: 26px; bottom: 26px; width: 1px; background: linear-gradient(transparent, var(--gold), transparent); }
.speaker-line { display: flex; align-items: center; gap: 12px; color: var(--gold-bright); font-family: "STSong", serif; font-size: calc(13px * var(--fs, 1)); letter-spacing: .15em; }
.speaker-line i { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(204, 171, 110, .34), transparent); }
.dialogue-box > p { white-space: normal; min-height: 70px; flex: 1 1 auto; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(204,171,110,.4) transparent; margin: 19px 0 16px; color: #d3c9bf; font-family: "STSong", serif; font-size: calc(clamp(14px, 1.25vw, 17px) * var(--fs, 1)); line-height: 1.8; letter-spacing: .04em; }
.dialogue-line { display: block; color: #d3c9bf; }
.dialogue-line + .dialogue-line { margin-top: .22em; }
.dialogue-line.dialogue-enemy { color: #9fd1df; text-shadow: 0 0 10px rgba(76, 153, 180, .13); }
.dialogue-line.dialogue-intimate { color: #efa0d5; font-family: "STKaiti", "KaiTi", "FangSong", serif; font-style: italic; font-weight: 500; letter-spacing: .065em; text-shadow: 0 0 12px rgba(222, 83, 170, .22); }
.dialogue-line.dialogue-relic-obtain,
.dialogue-box.is-relic-obtain > p .dialogue-line.dialogue-relic-obtain {
  color: #f0a3cc;
  font-weight: 650;
  letter-spacing: .05em;
  text-shadow: 0 0 14px rgba(214, 104, 160, .42), 0 0 1px rgba(242, 170, 210, .7);
}
.dialogue-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.dialogue-footer > span { color: #665f5a; font-size: calc(9px * var(--fs, 1)); letter-spacing: .08em; }
#contextHint.dialogue-relic-obtain,
.dialogue-footer > span.dialogue-relic-obtain {
  color: #e389b8;
  font-weight: 650;
  letter-spacing: .1em;
  text-shadow: 0 0 10px rgba(214, 104, 160, .35);
}
.advance-button { min-width: 92px; padding: 9px 14px; color: #cfbd9e; border: 1px solid rgba(214, 183, 127, .3); background: rgba(203, 165, 95, .05); cursor: pointer; }
.advance-button:hover { color: #16110a; background: var(--gold); }
.advance-button[hidden] { display: none; }

.quick-status-rail, .body-monitor-rail { min-width: 0; min-height: 0; overflow: hidden; padding: 13px 10px 10px; display: flex; flex-direction: column; border-left: 1px solid rgba(220,197,157,.16); background: rgba(7,6,9,.48); }
.quick-status-heading, .body-monitor-heading { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 9px; margin-bottom: 9px; border-bottom: 1px solid rgba(220,197,157,.12); }
.quick-status-heading span, .body-monitor-heading span { color: #a99b8d; font-family: "STSong", serif; font-size: calc(12px * var(--fs, 1)); letter-spacing: .16em; }
.quick-status-heading small, .body-monitor-heading small { color: #514b47; font-size: calc(7px * var(--fs, 1)); letter-spacing: .12em; }
.quick-status-rail > .status-list { flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; align-content: flex-start; align-items: flex-start; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(196, 164, 110, .55) rgba(255,255,255,.04); }
.quick-status-rail > .status-list::-webkit-scrollbar { width: 6px; }
.quick-status-rail > .status-list::-webkit-scrollbar-thumb { background: rgba(196, 164, 110, .45); border-radius: 99px; }
.quick-status-rail .status-chip { flex: 0 0 auto; }

.body-monitor { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border: 1px solid rgba(101, 210, 132, .22); background: radial-gradient(circle at 50% 34%, rgba(39, 96, 59, .16), rgba(5, 13, 9, .7) 67%, rgba(2, 6, 4, .9)); box-shadow: inset 0 0 24px rgba(43, 117, 65, .11); }
.body-monitor::before, .body-monitor::after { content: ""; position: absolute; z-index: 0; pointer-events: none; }
.body-monitor::before { inset: 7px; border: 1px solid rgba(109, 209, 137, .08); }
.body-monitor::after { left: 12%; right: 12%; top: 12px; height: 1px; background: linear-gradient(90deg, transparent, rgba(123, 230, 151, .42), transparent); animation: bodyScan 4.8s linear infinite; }
@keyframes bodyScan { 0% { transform: translateY(0); opacity: .2; } 45% { opacity: .75; } 100% { transform: translateY(160px); opacity: .12; } }
.body-monitor-svg { position: relative; z-index: 1; display: block; width: 100%; height: calc(100% - 20px); }
.body-grid path { fill: none; stroke: rgba(108, 192, 130, .065); stroke-width: 4; }
.body-lineart-raster { opacity: .9; filter: url(#bodyLineGreen); }
.body-eye-glow { display: none; fill: #ff76bd; opacity: var(--eye-glow-intensity, .45); filter: url(#bodyPinkGlow) drop-shadow(0 0 18px rgba(255, 92, 184, .98)); transform-box: fill-box; transform-origin: center; animation: bodyEyePulse 3.4s ease-in-out infinite; }
.body-monitor.sanity-low .body-eye-glow { display: inline; }
.body-mouth-mist { display: none; fill: none; stroke: #f778bb; stroke-width: 12; stroke-linecap: round; opacity: .22; filter: url(#bodyPinkGlow); transform-box: fill-box; transform-origin: left center; animation: bodyBreathMist 4.2s ease-in-out infinite; }
.body-monitor.desire-high .body-mouth-mist { display: inline; }
.body-mouth-mist path:nth-child(2) { opacity: .64; }
.body-mouth-mist path:nth-child(3) { opacity: .32; }
.body-negative-accessory { display: none; fill: none; stroke: #ff78bd; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 6px rgba(246, 67, 165, .9)); animation: invasiveEquipmentPulse 2.8s ease-in-out infinite; }
.body-negative-accessory.is-visible { display: inline; }
.body-invasion { display: none; fill: #df3e8b; opacity: .32; filter: url(#bodyInvasionGlow); transform-box: fill-box; transform-origin: center; }
.body-invasion.is-visible { display: inline; animation: bodyInvasionPulse 3.3s ease-in-out infinite; }
.body-curse-glow { display: none; fill: #209553; opacity: .42; filter: url(#bodyCurseGlow); transform-box: fill-box; transform-origin: center; }
.body-curse-glow.is-visible { display: inline; animation: bodyCursePulse 3.8s ease-in-out infinite; }
.body-parasite { display: none; fill: rgba(255, 140, 40, .14); stroke: #ff9a2e; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform-box: fill-box; }
.body-parasite * { vector-effect: non-scaling-stroke; }
.body-parasite path:not([class]), .body-parasite circle:not([class]), .body-parasite ellipse:not([class]) { fill: rgba(255, 140, 40, .16); }
.body-parasite .body-parasite-thin { stroke-width: 1.1; fill: none; opacity: .85; }
.body-parasite .body-parasite-dot { fill: #ffb25c; stroke: none; }
.body-parasite.is-visible { display: inline; animation: bodyParasiteGlow 5.2s ease-in-out infinite; }
@keyframes bodyParasiteGlow { 0%, 100% { opacity: .55; filter: drop-shadow(0 0 3px rgba(255, 140, 40, .55)); } 50% { opacity: 1; filter: drop-shadow(0 0 11px rgba(255, 150, 50, .98)); } }
@keyframes bodyInvasionPulse { 0%, 100% { opacity: .2; transform: scale(.82); } 50% { opacity: .62; transform: scale(1.12); } }
@keyframes bodyCursePulse { 0%, 100% { opacity: .26; transform: scale(.86); } 50% { opacity: .78; transform: scale(1.1); } }
@keyframes invasiveEquipmentPulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@keyframes bodyEyePulse { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1.08); } }
@keyframes bodyBreathMist { 0%, 100% { opacity: 0; transform: translateX(-12px) scale(.72); } 24% { opacity: .2; } 58% { opacity: .58; transform: translateX(20px) scale(1.04); } 82% { opacity: 0; transform: translateX(46px) scale(1.22); } }

.modal.character-sheet-modal { width: min(930px, 94vw); min-height: min(600px, 88vh); padding: 26px; }
.character-sheet-head { display: grid; grid-template-columns: 96px 1fr auto; gap: 15px; align-items: center; padding: 18px 0 30px; border-bottom: 1px solid var(--line); overflow: visible; }
.sheet-level {
  position: relative;
  width: 80px;
  height: 80px;
  display: grid;
  place-content: center;
  border: none;
  transform: none;
  text-align: center;
  overflow: visible;
  flex: 0 0 auto;
}
.sheet-level::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  pointer-events: none;
  box-sizing: border-box;
}
.sheet-level span { position: relative; z-index: 1; transform: none; color: var(--gold-bright); font: calc(18px * var(--fs, 1)) Georgia, serif; }
.sheet-level small { display: block; font-size: calc(7px * var(--fs, 1)); }
.sheet-title small, .sheet-title strong { display: block; }
.sheet-title small { color: #8c8177; font-size: calc(9px * var(--fs, 1)); letter-spacing: .14em; }
.sheet-title strong { margin-top: 5px; font-family: Georgia,"STSong",serif; font-size: calc(27px * var(--fs, 1)); font-weight: 400; letter-spacing: .12em; }
.sheet-identity { display: flex; align-items: center; gap: 18px; min-width: 0; }
.sheet-hybrid-level { border-color: transparent; flex: 0 0 auto; }
.sheet-hybrid-level::before { border-color: rgba(196, 140, 220, .85); }
.sheet-hybrid-level span { color: #e8d6f6; }
.sheet-hybrid-level small.sheet-cap-note {
  display: block;
  margin-top: 2px;
  color: #c4a0d8;
  font-size: calc(7px * var(--fs, 1));
  letter-spacing: .04em;
}
.sheet-summary { color: #8f857d; font-size: calc(10px * var(--fs, 1)); text-align: right; line-height: 1.7; }
.sheet-tabs { display: flex; gap: 4px; margin: 18px 0 14px; }
.sheet-tab { padding: 8px 14px; color: #8e8379; border: 1px solid rgba(220,197,157,.13); background: transparent; cursor: pointer; font-size: calc(10px * var(--fs, 1)); }
.sheet-tab.active { color: #1a130b; border-color: var(--gold); background: var(--gold); }
.sheet-body { min-height: 300px; max-height: 48vh; overflow-y: auto; padding: 4px 2px 10px; }
.sheet-tabs { flex-wrap: wrap; }
.character-sheet-modal.is-skill-tree {
  display: flex;
  flex-direction: column;
  width: min(1080px, 96vw);
  height: min(92vh, calc(100vh - 48px));
  max-height: min(92vh, calc(100vh - 48px));
  min-height: 0;
  overflow: hidden;
}
.character-sheet-modal.is-skill-tree > #modalContent {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.character-sheet-modal.is-skill-tree > .eyebrow,
.character-sheet-modal.is-skill-tree > h2 {
  flex: 0 0 auto;
}
.character-sheet-modal.is-skill-tree .character-sheet-head { padding: 14px 0 22px; flex: 0 0 auto; overflow: visible; }
.character-sheet-modal.is-skill-tree .sheet-tabs { margin: 10px 0 8px; flex: 0 0 auto; }
.character-sheet-modal.is-skill-tree .modal-actions { margin-top: 12px; flex: 0 0 auto; }
.character-sheet-modal.is-skill-tree .sheet-body,
.sheet-body.is-skill-tree {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 2px 8px;
}
.platinum-skill-tree-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.platinum-skill-tree-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  container-type: size;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 14px 16px;
  box-sizing: border-box;
  overflow: visible;
}
.platinum-skill-tree {
  position: relative;
  box-sizing: border-box;
  width: min(100%, calc(100cqh * 16 / 9));
  height: min(100%, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: visible;
  background-color: #07060b;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border: 1px solid rgba(220, 197, 157, .22);
  box-shadow: inset 0 0 40px rgba(12, 9, 6, .45), 0 0 28px rgba(200, 168, 106, .08);
}
.skill-tree-node {
  position: absolute;
  z-index: 2;
  width: 132px;
  min-height: 36px;
  padding: 6px 8px;
  color: var(--gold-bright);
  border: 1px solid rgba(241, 212, 151, .72);
  background: radial-gradient(circle at 50% 30%, rgba(48, 38, 18, .92), rgba(14, 11, 8, .92));
  box-shadow: 0 0 12px rgba(200, 168, 106, .22);
  transform: translate(-50%, -50%);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.skill-tree-node-label {
  display: block;
  text-align: center;
  font-size: calc(11px * var(--fs, 1));
  letter-spacing: .04em;
  text-shadow: 0 0 8px rgba(0, 0, 0, .85);
}
.skill-tree-node-label b,
.skill-tree-node-label small {
  display: block;
}
.skill-tree-node-label small {
  margin-top: 2px;
  font-size: calc(10px * var(--fs, 1));
  letter-spacing: .02em;
}
.skill-tree-node-popup {
  position: fixed;
  z-index: 9999;
  width: min(280px, 72vw);
  padding: 10px 12px;
  color: #efe6d8;
  text-align: left;
  border: 1px solid rgba(241, 212, 151, .45);
  background: rgba(10, 8, 12, .88);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  pointer-events: auto;
}
.skill-tree-node-popup b {
  display: block;
  color: var(--gold-bright);
  font-size: calc(14px * var(--fs, 1));
  font-weight: 500;
  letter-spacing: .08em;
}
.skill-tree-node-popup small {
  display: block;
  margin-top: 4px;
  color: #9a8f82;
  font-size: calc(10px * var(--fs, 1));
}
.skill-tree-node-popup p {
  margin: 8px 0 0;
  color: #d3c9bf;
  font-size: calc(12px * var(--fs, 1));
  line-height: 1.7;
}
.skill-tree-node.is-learned {
  color: #fff4d4;
  border-color: var(--gold-bright);
  box-shadow: 0 0 16px rgba(241, 212, 151, .42), inset 0 0 10px rgba(200, 168, 106, .2);
}
.skill-tree-node.is-locked {
  color: #8a837b;
  border-color: rgba(138, 131, 123, .45);
  background: radial-gradient(circle at 50% 30%, rgba(30, 28, 26, .9), rgba(10, 9, 9, .92));
  box-shadow: none;
  opacity: .78;
}
.nidhogg-skill-tree .skill-tree-node.is-level-hidden,
body.is-nidhogg-player .nidhogg-skill-tree .skill-tree-node.is-level-hidden {
  cursor: default;
  pointer-events: none;
  letter-spacing: .12em;
}
.skill-tree-node.is-selected {
  z-index: 5;
  outline: 1px solid var(--gold-bright);
  outline-offset: 2px;
}
.skill-tree-node.is-learned.is-selected {
  box-shadow: 0 0 20px rgba(241, 212, 151, .62), inset 0 0 12px rgba(200, 168, 106, .28);
}
@media (max-width: 720px) {
  .character-sheet-modal.is-skill-tree { width: min(1000px, 96vw); padding: 16px; }
  .character-sheet-modal.is-skill-tree .sheet-body,
  .sheet-body.is-skill-tree {
    max-height: none;
    min-height: 0;
    overflow: hidden;
  }
  .platinum-skill-tree-stage { padding: 14px 14px; }
  .skill-tree-node { width: 116px; min-height: 32px; padding: 5px 6px; }
  .skill-tree-node-label { font-size: calc(10px * var(--fs, 1)); }
}
.portrait-charge-badge {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 50%;
  padding: 4px 10px;
  color: #1a130b;
  border: 1px solid var(--gold-bright);
  background: linear-gradient(180deg, #f4e0a8, var(--gold));
  box-shadow: 0 0 16px rgba(241, 212, 151, .55);
  transform: translateX(-50%);
  font-size: calc(10px * var(--fs, 1));
  letter-spacing: .18em;
  pointer-events: none;
}
.portrait-frame.is-charging {
  box-shadow: inset 0 0 28px rgba(241, 212, 151, .28), 0 0 18px rgba(200, 168, 106, .2);
}
.portrait-frame.is-charging img {
  filter: saturate(.9) contrast(1.08) brightness(1.06);
}

.sheet-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-stat-card { padding: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.018); }
.sheet-stat-card span, .sheet-stat-card b, .sheet-stat-card small { display: block; }
.sheet-stat-card span { color: #8e837b; font-size: calc(9px * var(--fs, 1)); letter-spacing: .12em; }
.sheet-stat-card b { margin: 7px 0 5px; color: #eee6d9; font: calc(24px * var(--fs, 1)) Georgia, serif; }
.sheet-stat-card b.increased { color: #84c79a; }
.sheet-stat-card b.decreased { color: #db747c; }
.sheet-stat-card small { color: #665f5a; font-size: calc(8px * var(--fs, 1)); line-height: 1.55; }
.resource-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.resource-detail-grid article { padding: 12px; border: 1px solid rgba(220,197,157,.16); background: rgba(255,255,255,.02); }
.resource-detail-grid span, .resource-detail-grid b, .resource-detail-grid small { display: block; }
.resource-detail-grid span { color: #8c8178; font-size: calc(8px * var(--fs, 1)); letter-spacing: .12em; }
.resource-detail-grid b { margin: 6px 0; color: var(--gold-bright); font: calc(18px * var(--fs, 1)) Georgia,serif; }
.resource-detail-grid small { color: #6f6660; font-size: calc(8px * var(--fs, 1)); line-height: 1.5; }
.equipment-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.equipment-card.is-broken { opacity: .64; filter: grayscale(.25); }
.equipment-card { position: relative; display: grid; grid-template-columns: 45px 1fr auto; gap: 12px; align-items: center; min-height: 88px; padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.018); }
.equipment-icon { width: 42px; height: 42px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid rgba(220,190,138,.35); color: var(--gold-bright); }
.equipment-icon span { transform: rotate(-45deg); font-size: calc(19px * var(--fs, 1)); }
.equipment-copy small, .equipment-copy b { display: block; }
.equipment-copy small { color: #766d66; font-size: calc(8px * var(--fs, 1)); letter-spacing: .12em; }
.equipment-copy b { margin-top: 5px; font-family: "STSong",serif; font-size: calc(14px * var(--fs, 1)); font-weight: 400; }
.equipment-action { padding: 7px 10px; color: #b9aa99; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: calc(9px * var(--fs, 1)); }
.equipment-action:hover { color: #16110a; border-color: var(--gold); background: var(--gold); }
.equipment-action.locked, .equipment-action.locked:hover { color: #bc758e; border-color: rgba(190,73,104,.34); background: rgba(100,31,54,.14); cursor: not-allowed; }
.equipment-card.empty { border-style: dashed; opacity: .75; }
.equipment-tooltip { left: auto; right: 10px; width: min(320px,80vw); transform: translate(0,6px); }
.equipment-card:hover .equipment-tooltip, .equipment-card:focus-within .equipment-tooltip { transform: translate(0,0); }
.character-sheet-modal .equipment-card:hover .equipment-tooltip,
.character-sheet-modal .equipment-card:focus-within .equipment-tooltip { opacity: 0; visibility: hidden; }
.floating-equipment-tooltip { position: fixed; z-index: 200; left: 0; top: 0; width: min(320px,80vw); padding: 10px 12px; color: #bdb1a7; border: 1px solid rgba(220,190,138,.34); background: rgba(12,10,14,.98); box-shadow: 0 12px 34px #000; font-size: calc(9px * var(--fs, 1)); line-height: 1.6; pointer-events: none; opacity: 0; visibility: hidden; }
.floating-equipment-tooltip.is-visible { opacity: 1; visibility: visible; }
.floating-equipment-tooltip::after { content: ""; position: absolute; left: var(--arrow-left, 78%); top: 100%; width: 8px; height: 8px; transform: translate(-50%,-4px) rotate(45deg); border-right: 1px solid rgba(220,190,138,.34); border-bottom: 1px solid rgba(220,190,138,.34); background: #0c0a0e; }
.floating-equipment-tooltip.is-below::after { top: 0; transform: translate(-50%,-4px) rotate(45deg); border-right: 0; border-bottom: 0; border-left: 1px solid rgba(220,190,138,.34); border-top: 1px solid rgba(220,190,138,.34); }
.floating-status-tooltip { position: fixed; z-index: 220; left: 0; top: 0; width: min(280px,78vw); padding: 10px 12px; color: #bdb1a7; border: 1px solid rgba(220,190,138,.34); background: rgba(12,10,14,.98); box-shadow: 0 12px 34px #000; font-size: calc(9px * var(--fs, 1)); line-height: 1.6; pointer-events: none; opacity: 0; visibility: hidden; white-space: normal; }
.floating-status-tooltip.is-visible { opacity: 1; visibility: visible; }
.floating-status-tooltip::after { content: ""; position: absolute; left: var(--arrow-left, 50%); top: 100%; width: 8px; height: 8px; transform: translate(-50%,-4px) rotate(45deg); border-right: 1px solid rgba(220,190,138,.34); border-bottom: 1px solid rgba(220,190,138,.34); background: #0c0a0e; }
.floating-status-tooltip.is-below::after { top: 0; transform: translate(-50%,-4px) rotate(45deg); border-right: 0; border-bottom: 0; border-left: 1px solid rgba(220,190,138,.34); border-top: 1px solid rgba(220,190,138,.34); }
.equipment-tooltip::after { left: 78%; }
.inventory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.inventory-item { min-height: 92px; padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.018); display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.inventory-item-main { display: flex; align-items: flex-start; gap: 10px; }
.inventory-item-icon { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid rgba(220,190,138,.35); color: var(--gold-bright); }
.inventory-item-icon span { transform: rotate(-45deg); font-size: calc(16px * var(--fs, 1)); line-height: 1; }
.inventory-item-copy { min-width: 0; flex: 1; }
.inventory-item b, .inventory-item small { display: block; }
.inventory-item b { margin-bottom: 7px; color: #d8cbbb; font-size: calc(12px * var(--fs, 1)); font-weight: 500; }
.inventory-item small { color: #716962; font-size: calc(8px * var(--fs, 1)); line-height: 1.55; }
.inventory-item-action { min-height: 32px; display: flex; justify-content: flex-end; align-items: flex-end; }
.inventory-item-action .equipment-action { min-width: 64px; text-align: center; }
.inventory-item.is-equipped { border-color: rgba(220,190,138,.34); background: rgba(220,190,138,.05); }
.sheet-status-list { display: grid; gap: 8px; }
.sheet-status-row { display: grid; grid-template-columns: 150px 1fr; gap: 15px; padding: 12px 14px; border: 1px solid var(--line); background: rgba(255,255,255,.018); }
.sheet-status-row b { color: #d1bec5; font-size: calc(11px * var(--fs, 1)); font-weight: 500; }
.sheet-status-row span { color: #817670; font-size: calc(9px * var(--fs, 1)); line-height: 1.6; }
.sheet-status-row.positive { border-color: rgba(111,167,126,.27); background: rgba(43,84,56,.1); }
.sheet-status-row.positive b { color: #a9d2b2; }
.sheet-status-row.negative { border-color: rgba(200,55,55,.42); background: rgba(120,28,28,.18); }
.sheet-status-row.negative b { color: #e07070; }
.sheet-status-row.negative span { color: #c88888; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(3, 3, 5, .78); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 30px; border: 1px solid var(--line-bright); background: linear-gradient(145deg, #17131a, #0b090d); box-shadow: 0 35px 100px #000; scrollbar-width: thin; scrollbar-color: rgba(220,190,138,.34) rgba(255,255,255,.025); }
.modal h2 { margin: 0 0 18px; font-family: Georgia, "STSong", serif; font-size: calc(28px * var(--fs, 1)); font-weight: 400; }
.modal-close { position: absolute; right: 14px; top: 12px; color: #80756e; border: 0; background: transparent; font-size: calc(25px * var(--fs, 1)); cursor: pointer; }
.modal-copy { color: #aaa097; font-size: calc(13px * var(--fs, 1)); line-height: 1.8; }
.modal-copy strong { color: #dfd1bf; }
.modal-warning { padding: 12px 14px; color: #cda9b9; border-left: 2px solid var(--pink); background: rgba(117, 42, 79, .14); font-size: calc(11px * var(--fs, 1)); line-height: 1.6; }
.offering-grid { display: grid; gap: 8px; margin-top: 16px; }
.offering-card { padding: 13px 14px; border: 1px solid rgba(190,73,104,.24); background: linear-gradient(90deg, rgba(104,31,55,.13), rgba(255,255,255,.012)); }
.offering-card small, .offering-card b, .offering-card p, .offering-card em { display: block; }
.offering-card small { color: #9c6679; font-size: calc(8px * var(--fs, 1)); letter-spacing: .16em; }
.offering-card b { margin-top: 4px; color: #dfc1cb; font: 500 calc(13px * var(--fs, 1)) Georgia, "Songti SC", serif; }
.offering-card p { margin: 6px 0 3px; color: #9b8f88; font-size: calc(10px * var(--fs, 1)); }
.offering-card em { color: #766b66; font-size: calc(9px * var(--fs, 1)); font-style: normal; line-height: 1.55; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.modal-actions button { padding: 10px 17px; cursor: pointer; }
.modal-primary { color: #1a130a; border: 1px solid var(--gold); background: var(--gold); }
.modal-secondary { color: #b8aca0; border: 1px solid var(--line); background: transparent; }

.modal.platinum-intro-modal,
.modal.nidhogg-intro-modal { width: min(640px, 100%); }
.platinum-intro-modal .platinum-intro-story,
.nidhogg-intro-modal .platinum-intro-story,
.nidhogg-intro-modal .nidhogg-intro-story {
  max-height: min(58vh, 58dvh, 520px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
}
.platinum-intro-modal .platinum-intro-bio-title,
.nidhogg-intro-modal .platinum-intro-bio-title {
  margin: 8px 0 0;
  color: #dfd1bf;
  font-family: "STSong", Georgia, serif;
  font-size: calc(16px * var(--fs, 1));
  font-weight: 400;
  letter-spacing: .08em;
}
.platinum-intro-modal .platinum-intro-bio,
.nidhogg-intro-modal .platinum-intro-bio { display: grid; gap: 4px; margin-top: 4px; }
.platinum-intro-modal .platinum-intro-bio-line,
.nidhogg-intro-modal .platinum-intro-bio-line {
  margin: 0;
  color: #aaa097;
  font-size: calc(12px * var(--fs, 1));
  line-height: 1.7;
}
.modal.difficulty-modal { overflow: visible; }
.difficulty-modal .difficulty-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
.difficulty-modal .difficulty-mode-btn {
  position: relative;
  min-width: 132px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: calc(13px * var(--fs, 1));
  letter-spacing: .04em;
}
.difficulty-modal .difficulty-mode-btn-simple {
  color: #b8aca0;
  border: 1px solid var(--line);
  background: transparent;
}
.difficulty-modal .difficulty-mode-btn-simple:hover,
.difficulty-modal .difficulty-mode-btn-simple:focus-visible {
  color: #dfd1bf;
  border-color: rgba(220,190,138,.45);
}
.difficulty-modal .difficulty-mode-btn-hard {
  color: #1a130a;
  border: 1px solid var(--gold);
  background: var(--gold);
}
.difficulty-modal .difficulty-mode-btn-hard:hover,
.difficulty-modal .difficulty-mode-btn-hard:focus-visible {
  filter: brightness(1.05);
}
.difficulty-modal .difficulty-hard-tooltip {
  position: absolute;
  z-index: 70;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max(220px, 100%);
  transform: translate(-50%, 6px);
  padding: 10px 12px;
  color: #ffb6d2;
  border: 1px solid rgba(214, 104, 160, .62);
  background: rgba(42, 12, 28, .98);
  box-shadow: 0 12px 34px #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: calc(11px * var(--fs, 1));
  line-height: 1.65;
  letter-spacing: .02em;
  transition: .18s ease;
  text-align: left;
  white-space: normal;
}
.difficulty-modal .difficulty-hard-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -4px) rotate(45deg);
  border-right: 1px solid rgba(214, 104, 160, .62);
  border-bottom: 1px solid rgba(214, 104, 160, .62);
  background: rgba(42, 12, 28, .98);
}
.difficulty-modal .difficulty-mode-btn-hard:hover .difficulty-hard-tooltip,
.difficulty-modal .difficulty-mode-btn-hard:focus-visible .difficulty-hard-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast { position: fixed; z-index: 120; left: 50%; bottom: 28px; transform: translate(-50%, 24px); padding: 11px 18px; color: #e4d7c7; border: 1px solid rgba(218, 188, 132, .35); background: rgba(12, 10, 14, .94); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s ease; font-size: calc(11px * var(--fs, 1)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .topbar { padding: 0 18px; }
  .run-summary { margin-left: auto; }
  .summary-item { min-width: 74px; padding: 0 10px; }
  .summary-item.fog-summary { min-width: 98px; }
  .top-fog-track { width: 62px; }
  .top-actions { margin-left: 8px; gap: 5px; }
  .return-title-button { min-width: 88px; padding-inline: 9px; }
  .title-content { width: 76vw; margin-left: 9vw; }
  .save-grid { grid-template-columns: 1fr; }
  .character-select-grid { min-height: 420px; }
  .save-card { min-height: 240px; }
  .save-card h3 { margin-top: 22px; }
  .slot-screen, .character-screen { overflow: auto; }
  .hud-panel { flex-basis: calc(350px * var(--hud-scale)); }
  .hud-panel-inner { grid-template-columns: 230px 150px minmax(0, 1fr) 145px 145px; }
  .dialogue-box { padding: 20px 22px 14px; }
  .portrait-name b { font-size: calc(13px * var(--fs, 1)); }
  .quick-status-rail, .body-monitor-rail { padding: 11px 7px 8px; }
  .dungeon-stage { grid-template-columns: 72px minmax(0, 1fr) 250px; }
  .dice-history-heading { padding-inline: 13px; }
  .dice-readout { padding: 9px; }
}

@media (max-width: 680px) {
  body { overflow: auto; }
  .topbar { height: 60px; }
  .screen { padding-top: 60px; }
  .brand-button small { display: none; }
  .brand-button strong { font-size: calc(13px * var(--fs, 1)); }
  .soul-core-chip { height: 60px; min-width: 72px; padding: 0 10px; }
  .soul-core-chip small { display: none; }
  .soul-shard-chip { height: 60px; min-width: 72px; padding: 0 10px; }
  .soul-shard-chip small { display: none; }
  .run-summary { height: 60px; }
  .summary-item { min-width: 60px; padding: 0 6px; }
  .summary-item.fog-summary { min-width: 72px; }
  .summary-item small { display: none; }
  .top-fog-track { width: 50px; }
  .top-actions .icon-button { min-width: 44px; padding: 7px; }
  .return-title-button { font-size: calc(10px * var(--fs, 1)); }
  .panel-heading { align-items: flex-start; gap: 12px; }
  .panel-heading-actions { flex-direction: column; }
  .character-screen { padding: 90px 18px 30px; }
  .character-select-grid { grid-template-columns: 1fr; min-height: 1180px; }
  .character-card { min-height: 360px; }
  .game-screen {
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .slot-screen { padding: 90px 18px 30px; }
  .dungeon-stage { min-height: 1040px; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: 800px 240px; }
  .route-rail { grid-column: 1; grid-row: 1; }
  .scene-area { grid-column: 2; grid-row: 1; }
  .dice-history-rail { grid-column: 1 / -1; grid-row: 2; border-left: 0; border-top: 1px solid rgba(218, 198, 157, .14); }
  .dice-history-heading { padding: 11px 14px 9px; }
  .dice-readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .dice-action-group { margin: 0; padding: 0 8px 0 0; border-bottom: 0; border-right: 1px solid rgba(218,190,138,.18); }
  .scene-area { padding: 18px 14px; }
  .scene-header { gap: 10px; }
  .altar-hotspot { left: 9%; }
  .door-hotspot { right: 5%; }
  .breeding-cavity-hotspot { left: 76%; top: 56%; min-width: 108px; padding: 10px 12px; }
  .choice-layer { grid-template-columns: 1fr; }
  .scene-object { min-height: 200px; }
  .combat-actions { grid-template-columns: repeat(2, 1fr); }
  .combat-skill-bar { grid-template-columns: repeat(3, 1fr); }
  .combat-actions.has-nidhogg-preselect { --nidhogg-action-w: 88px; --nidhogg-action-h: 50px; }
  .combat-button { min-height: 50px; }
  .hud-panel { height: calc(790px * var(--hud-scale)); min-height: calc(790px * var(--hud-scale)); flex-basis: calc(790px * var(--hud-scale)); }
  .hud-panel-inner { height: 790px; grid-template-columns: 185px 1fr; grid-template-rows: 340px auto 240px; }
  .status-column { grid-row: 1; grid-column: 1; }
  .portrait-frame { grid-row: 1; grid-column: 2; }
  .dialogue-box { grid-column: 1 / -1; grid-row: 2; min-height: 170px; border-top: 1px solid var(--line); }
  .body-monitor-rail { grid-column: 1; grid-row: 3; min-height: 230px; border-left: 0; border-top: 1px solid var(--line); }
  .quick-status-rail { grid-column: 2; grid-row: 3; min-height: 230px; border-top: 1px solid var(--line); }
  .quick-status-rail .status-list { display: grid; grid-template-columns: 1fr; align-content: start; }
  .dialogue-box > p { min-height: 52px; }
  .sheet-stat-grid, .equipment-grid { grid-template-columns: 1fr; }
  .resource-detail-grid { grid-template-columns: repeat(2,1fr); }
  .inventory-grid { grid-template-columns: repeat(2,1fr); }
  .character-sheet-head { grid-template-columns: 58px 1fr; }
  .sheet-summary { grid-column: 1 / -1; text-align: left; }
  .archive-footer { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.choice-copy small .curse-flavor, .choice-copy small .curse-effect, .choice-copy small .curse-hint { display: block; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.choice-copy small .curse-flavor { color: #a89c92; line-height: 1.6; }
.choice-copy small .curse-effect { margin-top: 6px; color: #d8bd83; }
.choice-copy small .curse-hint { margin-top: 4px; color: #8f847b; }

/* 祭坛三选一诅咒：单列完整展示 flavor/effect，避免卡片内裁切 */
.choice-layer.altar-curse-picks {
  grid-template-columns: 1fr;
  max-height: min(42vh, 360px);
  align-content: start;
}
.choice-layer.altar-curse-picks .choice-card {
  min-height: 0;
  padding: 10px 12px;
}
.choice-layer.altar-curse-picks .choice-copy small {
  font-size: calc(10.5px * var(--fs, 1));
  line-height: 1.55;
}

.story-overlay { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; box-sizing: border-box; height: 100vh; height: 100dvh; max-height: 100%; min-height: 0; overflow: hidden; padding: 56px clamp(24px, 8vw, 140px) 28px; background: radial-gradient(ellipse at 50% 30%, #1d1219 0%, #0a070b 70%, #050305 100%); animation: storyFade .6s ease; }
.scene-fade-overlay { position: fixed; inset: 0; z-index: 400; background: #000; opacity: 0; pointer-events: none; transition: opacity .48s ease; }
.scene-fade-overlay.is-visible { opacity: 1; pointer-events: auto; }
@keyframes storyFade { from { opacity: 0; } to { opacity: 1; } }
.story-close { position: absolute; right: 22px; top: 16px; color: #8d8179; border: 0; background: transparent; font-size: calc(34px * var(--fs, 1)); line-height: 1; cursor: pointer; }
.story-close:hover { color: var(--gold-bright, #e6c98c); }
.story-page { flex: 1; min-height: 0; max-height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; max-width: 860px; width: 100%; margin: 0 auto; padding-right: 10px; cursor: pointer; scrollbar-width: thin; }
.story-kicker { margin: 0 0 6px; color: #8a6b78; font-size: calc(11px * var(--fs, 1)); letter-spacing: .3em; }
.story-title { margin: 0 0 26px; color: #d8bd83; font-family: "STSong", Georgia, serif; font-size: calc(30px * var(--fs, 1)); font-weight: 400; letter-spacing: .14em; }
.story-body p { margin: 0 0 20px; color: #cfc4b8; font-family: "STSong", "Songti SC", Georgia, serif; font-size: calc(17px * var(--fs, 1)); line-height: 2; text-indent: 2em; text-align: justify; min-height: 2em; }
.story-body p.story-quote { color: #e6d3c0; text-indent: 0; }
.story-foot { display: flex; align-items: center; justify-content: space-between; max-width: 860px; width: 100%; margin: 14px auto 0; }
.story-hint { color: #6f635b; font-size: calc(11px * var(--fs, 1)); }
.story-continue { margin-left: auto; padding: 10px 26px; color: #1a130a; border: 1px solid var(--gold, #cfab5c); background: var(--gold, #cfab5c); cursor: pointer; }


/* —— 暗精灵祭司战败：视频剧情弹窗（仅 .story-overlay--video；纯文字弹窗样式不变） —— */
.story-overlay.story-overlay--video {
  flex-direction: row;
  padding: 56px 56px 0 0; /* 右侧留出关闭按钮安全带，避免压视频 */
}
.story-overlay.story-overlay--video .story-main {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.story-overlay.story-overlay--video .story-page {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 24px 28px 20px;
  cursor: default;
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 190, 138, .35) transparent;
}
.story-overlay.story-overlay--video .story-kicker {
  margin: 0 0 6px;
  font-size: calc(11px * var(--fs, 1)); /* 与纯文字战败弹窗一致 */
  letter-spacing: .3em;
}
.story-overlay.story-overlay--video .story-title {
  margin: 0 0 26px;
  font-size: calc(30px * var(--fs, 1));
}
.story-overlay.story-overlay--video .story-body p {
  margin: 0 0 20px;
  font-size: calc(17px * var(--fs, 1));
  line-height: 2;
}
.story-overlay.story-overlay--video .story-video-anchor {
  display: block;
  width: 100%;
  height: 2px;
  margin: 1.2em 0 1.6em;
  padding: 0;
  border: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
.story-overlay.story-overlay--video .story-video-col {
  flex: 0 0 auto;
  --stage-h: calc(100vh - 80px);
  width: min(42vw, calc(var(--stage-h) * 9 / 16));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 20px 4px;
  position: sticky;
  top: 0;
  align-self: stretch;
}
.story-overlay.story-overlay--video .story-video-stage {
  position: relative;
  width: 100%;
  height: var(--stage-h);
  max-height: var(--stage-h);
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
.story-overlay.story-overlay--video .story-video-stage video {
  position: absolute;
  inset: 0;
  margin: auto;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.story-overlay.story-overlay--video .story-video-stage video.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.story-overlay.story-overlay--video .story-video-stage.is-playing {
  box-shadow: 0 0 0 1px rgba(216, 189, 131, .28);
}
.story-overlay.story-overlay--video .story-video-mute-tip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(10, 7, 9, .78);
  color: #c9b8a4;
  font-size: 11px;
  letter-spacing: .04em;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.story-overlay.story-overlay--video .story-video-stage.is-muted-fallback .story-video-mute-tip {
  opacity: 1;
}
.story-overlay.story-overlay--video .story-foot--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: none;
  width: auto;
  margin: 32px 0 0;
  padding-top: 16px;
  padding-bottom: 8px;
  border-top: 1px solid rgba(180, 140, 100, .12);
}
.story-overlay.story-overlay--video .story-foot--inline .story-hint {
  font-size: calc(11px * var(--fs, 1));
}
.story-overlay.story-overlay--video .story-foot--inline .story-continue {
  margin-left: auto;
  flex-shrink: 0;
}
.story-overlay.story-overlay--video .story-close {
  z-index: 30;
  right: 10px;
  top: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(8, 6, 10, .78);
  border: 1px solid rgba(220, 190, 138, .22);
  font-size: calc(28px * var(--fs, 1)); /* 略小于纯文字 34，避免抢画面 */
  line-height: 1;
}
@media (max-width: 820px) {
  .story-overlay.story-overlay--video { flex-direction: column; padding-top: 44px; }
  .story-overlay.story-overlay--video .story-main { flex-direction: column; }
  .story-overlay.story-overlay--video .story-page {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    height: 55%;
    padding-left: 16px;
    padding-right: 16px;
  }
  .story-overlay.story-overlay--video .story-video-col {
    flex: 0 0 42%;
    width: 100%;
    max-width: 100%;
    height: 42%;
    padding: 4px 16px 16px;
  }
  .story-overlay.story-overlay--video .story-video-stage {
    max-height: none;
    height: 100%;
  }
}

.hero-speech { position: absolute; z-index: 6; padding: 7px 10px; color: #1b1418; border-radius: 9px; background: rgba(244, 236, 226, .96); box-shadow: 0 4px 14px rgba(0,0,0,.55); font-size: calc(12px * var(--fs, 1)); font-weight: 700; line-height: 1.45; letter-spacing: .02em; pointer-events: none; opacity: 0; transform: translateY(6px) scale(.92); transition: opacity .18s ease, transform .18s ease; width: max-content; }
.hero-speech.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.hero-speech::before { content: ""; position: absolute; top: -7px; left: var(--tail-x, 50%); margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom: 8px solid rgba(244, 236, 226, .96); }
.hero-speech[data-mood="anger"] { color: #3a0d0d; background: rgba(255, 226, 214, .97); }
.hero-speech[data-mood="anger"]::before { border-bottom-color: rgba(255, 226, 214, .97); }
.hero-speech[data-mood="lost"] { color: #4a1230; background: rgba(255, 214, 234, .97); }
.hero-speech[data-mood="lost"]::before { border-bottom-color: rgba(255, 214, 234, .97); }

/* 安全房间的“自慰”选项：粉色诱惑框 */
.choice-card.choice-lust { border-color: rgba(255, 105, 180, .65); background: linear-gradient(90deg, rgba(150, 30, 90, .45), rgba(60, 14, 44, .88)); box-shadow: 0 0 14px rgba(255, 105, 180, .25), inset 0 0 18px rgba(255, 105, 180, .1); }
.choice-card.choice-lust:hover { border-color: #ff8fc7; background: linear-gradient(90deg, rgba(180, 40, 110, .55), rgba(76, 18, 56, .92)); }
.choice-card.choice-lust .choice-copy b { color: #ffb3d9; }
.choice-card.choice-lust .choice-copy small { color: #e7a6c8; }
.choice-card.choice-lust .choice-index { border-color: rgba(255, 140, 200, .6); color: #ff9ed0; }
.choice-card.is-disabled { opacity: .5; filter: grayscale(.5); cursor: not-allowed; }

/* 放大字号后场景区内容变高时，允许场景区自己上下滚动，避免选项被截断 */
.dungeon-stage { grid-template-rows: minmax(0, 1fr); }
.scene-area { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(220, 190, 138, .35) transparent; }

/* 左侧状态栏：顶部生命/欲望/理智/精能区更紧凑，被动属性栏整体上移，避免 125% 字号下超出显示 */
.status-column .data-slot:first-child { padding: 8px 17px 6px; }
.status-column .vital-row.compact { margin-top: 8px; }
.attribute-slot { padding: 7px 12px 6px; overflow: visible; }
.attribute-heading { margin-bottom: 5px; }
.attribute-list { gap: 4px; width: 100%; }
.attribute-chip { min-width: 0; padding: 4px 6px; }

/* 选人界面：桌面窗口下整页一屏显示，卡片高度随窗口自适应，不再需要滚动 */
@media (min-width: 901px) {
  .character-screen.is-active {
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    min-height: 0;
    padding-top: 84px;
    padding-bottom: 20px;
    overflow: hidden; /* keep heading fixed; grid below can scroll if cards overflow */
  }
  .character-screen .panel-heading { padding-bottom: 12px; }
  .character-screen .panel-intro { margin: 12px 0 16px; }
  .character-screen .character-select-grid {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .character-screen .character-select-note { padding-top: 12px; }
}

.enemy-speech { position: absolute; z-index: 12; left: 50%; top: 36%; width: max-content; max-width: min(360px, 180%); padding: 7px 11px; color: #f1dede; border: 1px solid rgba(200, 73, 91, .65); border-radius: 9px; background: rgba(38, 10, 18, .94); box-shadow: 0 4px 14px rgba(0,0,0,.6); font-size: calc(12px * var(--fs, 1)); font-weight: 700; line-height: 1.5; letter-spacing: .02em; pointer-events: none; opacity: 0; overflow: visible; transform: translate(-50%, 6px) scale(.94); transition: opacity .2s ease, transform .2s ease; }
.enemy-speech.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.enemy-speech::after { content: ""; position: absolute; top: -8px; left: var(--tail-x, 50%); margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom: 8px solid rgba(38, 10, 18, .94); }
/* fog-embers-t279 · 黑龙守卫剧情气泡内的选项 */
.enemy-speech.has-choices,
.enemy-speech.is-story {
  pointer-events: auto;
  z-index: 24;
  width: max-content;
  max-width: min(320px, 180%);
  padding: 10px 12px 12px;
  white-space: normal;
  text-align: left;
}
.enemy-party .enemy-speech.has-choices,
.enemy-party .enemy-speech.is-story { max-width: min(320px, 190%); }
.enemy-speech.has-choices .enemy-speech-text,
.enemy-speech.is-story .enemy-speech-text {
  display: block;
  margin-bottom: 10px;
}
.enemy-speech-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.enemy-speech-choice {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  color: #2a1208;
  font: inherit;
  font-size: calc(12px * var(--fs, 1));
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .04em;
  text-align: center;
  cursor: pointer;
  border: 1px solid rgba(232, 180, 110, .7);
  border-radius: 3px;
  background: linear-gradient(180deg, #f0c888, #c47a3a);
  box-shadow: 0 0 12px rgba(220, 140, 60, .28);
  pointer-events: auto;
}
.enemy-speech-choice:hover,
.enemy-speech-choice:focus {
  filter: brightness(1.08);
  outline: none;
}
.enemy-speech-choice:active { filter: brightness(.96); }

/* 缠茎藤图标较小，描边相应变细 */
.body-parasite[data-parasite-id="stemVine"] { stroke-width: .9; }
.body-parasite[data-parasite-id="stemVine"] .body-parasite-thin { stroke-width: .6; }
.body-parasite[data-parasite-id="urethralParasite"] { stroke: #f0a0b8; fill: rgba(232, 120, 150, .22); stroke-width: 1; }
.body-parasite[data-parasite-id="urethralParasite"] .body-parasite-thin { stroke-width: .7; }
.body-parasite[data-parasite-id="urethralParasite"] .body-parasite-dot { fill: #ffc0d0; }
.body-parasite[data-parasite-id="urethralParasite"].is-visible { animation: bodyUrethralGlow 3.8s ease-in-out infinite; }
@keyframes bodyUrethralGlow { 0%, 100% { opacity: .6; filter: drop-shadow(0 0 3px rgba(232, 120, 150, .5)); } 50% { opacity: 1; filter: drop-shadow(0 0 10px rgba(255, 160, 184, .95)); } }
/* 第一次屈服献祭后出现的另一侧（左胸）欲根蛭图标：以画布原点为变换基准，便于左右对称。 */
.body-parasite[data-parasite-id="desireLeech"] { transform-box: view-box; transform-origin: 0 0; stroke-width: 1.2; }
.body-parasite[data-parasite-id="desireLeech"] .body-parasite-thin { stroke-width: .8; }

/* 回响之虫：魅惑低语的回答气泡（粉紫色） */
.hero-speech[data-mood="echo"] { color: #3c0f55; background: rgba(228, 186, 255, .97); box-shadow: 0 0 16px rgba(214, 120, 255, .65), 0 4px 14px rgba(0,0,0,.55); }
.hero-speech[data-mood="echo"]::before { border-bottom-color: rgba(228, 186, 255, .97); }
.body-parasite[data-parasite-id="echoWorm"] { stroke: #e08cff; fill: rgba(214, 120, 255, .16); stroke-width: 1; }
.body-parasite[data-parasite-id="echoWorm"] .body-parasite-dot { fill: #f0b8ff; }
.body-parasite[data-parasite-id="echoWorm"].is-visible { animation: bodyEchoGlow 3.6s ease-in-out infinite; }
@keyframes bodyEchoGlow { 0%, 100% { opacity: .55; filter: drop-shadow(0 0 3px rgba(214, 120, 255, .55)); } 50% { opacity: 1; filter: drop-shadow(0 0 11px rgba(226, 140, 255, .98)); } }

/* 释放完毕界面：粉色羞辱文字；有剧情弹窗时，卡片等弹窗关闭后才淡入 */
.object-card p.lust-mockery { color: #ff8fc4; font-size: calc(14px * var(--fs, 1)); line-height: 1.9; text-shadow: 0 0 10px rgba(255, 105, 180, .35); }
.object-card.release-await { opacity: 0; pointer-events: none; }
.object-card:not(.release-await) { transition: opacity .7s ease; }

/* 释放完毕 / 屈服献祭界面上方的爱心：粉色 */
.object-glyph.glyph-pink { color: #ff8fc4; text-shadow: 0 0 12px rgba(255, 105, 180, .55); }

/* 闪避成功的粗口气泡：淡金（自信）/ 白（动摇）/ 淡粉（渴望被打） */
.hero-speech[data-mood="dodge-gold"] { color: #4a3406; background: rgba(252, 237, 183, .97); box-shadow: 0 0 14px rgba(240, 200, 100, .55), 0 4px 14px rgba(0,0,0,.55); }
.hero-speech[data-mood="dodge-gold"]::before { border-bottom-color: rgba(252, 237, 183, .97); }
.hero-speech[data-mood="dodge-white"] { color: #1c1c22; background: rgba(255, 255, 255, .98); }
.hero-speech[data-mood="dodge-white"]::before { border-bottom-color: rgba(255, 255, 255, .98); }
.hero-speech[data-mood="dodge-pink"] { color: #5a1033; background: rgba(255, 205, 226, .97); box-shadow: 0 0 14px rgba(255, 120, 180, .5), 0 4px 14px rgba(0,0,0,.55); }
.hero-speech[data-mood="dodge-pink"]::before { border-bottom-color: rgba(255, 205, 226, .97); }

.mist-spring-thought {
  position: absolute;
  z-index: 12;
  max-width: min(340px, 48%);
  padding: 10px 14px 12px;
  border-radius: 18px 18px 18px 6px;
  font-size: calc(13px * var(--fs, 1));
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: .02em;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  width: max-content;
}
.mist-spring-thought.is-visible {
  opacity: 1;
  animation: mist-spring-thought-float 2.8s ease-in-out infinite;
}
.mist-spring-thought::before {
  content: "";
  position: absolute;
  left: -8px;
  top: var(--tail-y, 40%);
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: inherit;
  box-shadow: inherit;
}
.mist-spring-thought::after {
  content: "";
  position: absolute;
  left: -18px;
  top: var(--tail-y, 40%);
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: inherit;
}
.mist-spring-thought[data-tone="platinum"] {
  color: #3d2d0a;
  background: linear-gradient(180deg, rgba(255, 244, 214, .97), rgba(232, 208, 150, .96));
  box-shadow: 0 0 16px rgba(230, 198, 120, .55), 0 4px 14px rgba(0,0,0,.55);
  border: 1px solid rgba(236, 214, 160, .85);
}
.mist-spring-thought[data-tone="pink"] {
  color: #5a1033;
  background: rgba(255, 214, 228, .97);
  box-shadow: 0 0 16px rgba(255, 140, 190, .5), 0 4px 14px rgba(0,0,0,.55);
  border: 1px solid rgba(255, 180, 210, .8);
}
.mist-spring-thought[data-tone="violet"] {
  color: #4a1458;
  background: linear-gradient(180deg, rgba(255, 210, 236, .97), rgba(228, 186, 255, .97));
  box-shadow: 0 0 16px rgba(200, 120, 255, .5), 0 4px 14px rgba(0,0,0,.55);
  border: 1px solid rgba(210, 170, 240, .85);
}
.mist-spring-thought[data-tone="deep"] {
  color: #f3e6ff;
  background: linear-gradient(180deg, rgba(88, 30, 110, .96), rgba(42, 14, 58, .97));
  box-shadow: 0 0 18px rgba(160, 60, 220, .55), 0 4px 14px rgba(0,0,0,.55);
  border: 1px solid rgba(150, 80, 190, .7);
}
.mist-spring-thought-text { display: block; }
.mist-spring-thought-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.mist-spring-thought-actions button {
  pointer-events: auto;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: rgba(255,255,255,.46);
}
.mist-spring-thought[data-tone="deep"] .mist-spring-thought-actions button {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.12);
  color: #f3e6ff;
}
.mist-spring-thought[data-tone="ghost"] {
  color: #eef6ff;
  background: linear-gradient(180deg, rgba(186, 206, 230, .94), rgba(84, 104, 132, .96));
  box-shadow: 0 0 18px rgba(200, 220, 255, .45), 0 4px 14px rgba(0,0,0,.55);
  border: 1px solid rgba(220, 232, 255, .7);
}
.mist-spring-thought[data-tone="ghost"] .mist-spring-thought-actions button {
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.18);
  color: #f4f8ff;
}
.mist-spring-thought-actions button:hover,
.mist-spring-thought-actions button:focus-visible {
  background: rgba(255,255,255,.7);
}
@keyframes mist-spring-thought-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}


/* 颅内菌丝：脑部的青白色菌丝，随阶数扩大 */
.body-parasite[data-parasite-id="mycelium"] { stroke: #8fe8d0; fill: rgba(143, 232, 208, .14); stroke-width: 1; transform-box: view-box; transform-origin: 0 0; }
.body-parasite[data-parasite-id="mycelium"] .body-parasite-dot { fill: #c9fff0; }
.body-parasite[data-parasite-id="mycelium"].is-visible { animation: bodyMyceliumGlow 4.2s ease-in-out infinite; }
@keyframes bodyMyceliumGlow { 0%, 100% { opacity: .6; filter: drop-shadow(0 0 3px rgba(143, 232, 208, .5)); } 50% { opacity: 1; filter: drop-shadow(0 0 10px rgba(160, 255, 225, .95)); } }

/* 互动自慰：粉色射精槽 */
.jerk-gauge { margin: 14px 0 0; padding: 6px 12px; text-align: left; border: 1px solid rgba(255, 105, 180, .6); border-radius: 8px; background: linear-gradient(90deg, rgba(110, 22, 70, .55), rgba(40, 10, 32, .9)); box-shadow: 0 0 14px rgba(255, 105, 180, .22); }
.jerk-gauge-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; color: #ffb3d9; font-size: 14px; }
.jerk-gauge-head span { color: #ffd2e8; font-variant-numeric: tabular-nums; }
.jerk-gauge-track { position: relative; height: 12px; border-radius: 6px; background: rgba(20, 4, 14, .85); border: 1px solid rgba(255, 140, 200, .35); overflow: hidden; }
.jerk-gauge-track i { display: block; height: 100%; background: linear-gradient(90deg, #ff6fb5, #ff9ed0); box-shadow: 0 0 10px rgba(255, 120, 190, .8); transition: width .3s ease; }
.jerk-gauge-track em { position: absolute; top: 0; bottom: 0; left: 90%; width: 2px; background: rgba(255, 255, 255, .7); }
/* 互动自慰：射精槽放在“释放中”卡片内，卡片压缩以免被下方按钮盖住 */
.object-card:has(.jerk-gauge) { padding: 14px 28px 16px; }
.object-card:has(.jerk-gauge) .object-glyph { display: none; }
.object-card:has(.jerk-gauge) h3 { margin: 0; }
.object-card:has(.jerk-gauge) h3:empty { display: none; }
.object-card:has(.jerk-gauge) p { display: none; }
.object-card .jerk-gauge { margin-top: 12px; }

/* 互动自慰：“释放中”右侧粉色闪动爱心 */
.jerk-heart { display: inline-block; margin-left: 12px; color: #ff5fae; text-shadow: 0 0 10px rgba(255, 95, 174, .9), 0 0 20px rgba(255, 95, 174, .5); animation: jerkHeartBeat 1s ease-in-out infinite; }
@keyframes jerkHeartBeat { 0%, 100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.25); } }


/* 门扉之主·阿刻戎：二/三阶段时间之轮蓝色闪烁 */
@keyframes acheronTimeWheelPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(80, 170, 255, .35)) drop-shadow(0 0 14px rgba(40, 120, 255, .25)); }
  50% { filter: drop-shadow(0 0 16px rgba(120, 200, 255, .95)) drop-shadow(0 0 28px rgba(60, 140, 255, .7)); }
}
.enemy-figure.time-wheel-glow,
.enemy-figure.time-wheel-glow .enemy-portrait,
body.acheron-time-wheel-glow .enemy-figure.has-portrait.boss-portrait .enemy-portrait {
  animation: acheronTimeWheelPulse 1.35s ease-in-out infinite;
}
.enemy-figure.spectating {
  opacity: .92;
}
.enemy-figure.spectating .enemy-nameplate small::after {
  content: " · 旁观";
  color: #7ec8ff;
}
body.acheron-time-wheel-glow .combat-layer {
  box-shadow: inset 0 0 48px rgba(40, 120, 255, .18);
}


/* ===== 祭坛 · 阿刻戎 NPC / 小对话 / 左右分栏（防溢出、一屏看完） ===== */
/* scene-area：header 跨列；左 scene-object=立绘(+旁侧对话)；右 choice-layer=祭坛按钮 */
.dungeon-stage[data-room="altar"] .scene-area {
  display: grid;
  grid-template-columns: minmax(300px, 0.58fr) minmax(210px, 0.42fr);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: clamp(12px, 1.8vw, 24px);
  row-gap: 8px;
  align-content: stretch;
  min-height: 0;
  overflow: hidden;
  position: relative;
  padding: 18px clamp(16px, 2.2vw, 36px) 14px;
}
.dungeon-stage[data-room="altar"] .scene-header {
  grid-column: 1 / -1;
  grid-row: 1;
  position: relative;
  z-index: 5;
}
/* 左区：立绘 | 对话窗（对话打开时并排；关闭时立绘占满） */
.dungeon-stage[data-room="altar"] .scene-object {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  gap: 8px;
}
.dungeon-stage[data-room="altar"] .scene-object:has(.altar-talk:not([hidden])) {
  grid-template-columns: minmax(118px, 0.42fr) minmax(150px, 0.58fr);
}
/* 中间弹窗在时：不要把 scene-object 改成两列，以免把卡片/离开按钮卷进 grid */
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .scene-object:has(.altar-talk:not([hidden])) {
  grid-template-columns: minmax(0, 1fr);
}
.dungeon-stage[data-room="altar"] .scene-object:has(.altar-object-stack) {
  overflow: visible;
}
/* 有卡且无选项（如诅咒烙成 roomResult）：主区单列，卡片正中 */
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):not(:has(.choice-layer > .choice-card)) {
  grid-template-columns: minmax(0, 1fr);
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):not(:has(.choice-layer > .choice-card)) .scene-object {
  grid-column: 1;
  grid-row: 2;
  z-index: 4;
  pointer-events: none;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):not(:has(.choice-layer > .choice-card)) .choice-layer {
  display: none;
}
/* 有卡且有选项：三栏 —— 立绘 | 居中卡 | 选项，避免 choice 挤偏/盖住卡 */
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) {
  grid-template-columns: minmax(120px, 0.28fr) minmax(240px, 0.44fr) minmax(190px, 0.28fr);
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .scene-object {
  grid-column: 1 / 3;
  grid-row: 2;
  z-index: 4;
  pointer-events: none;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .choice-layer,
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .choice-layer.altar-curse-picks {
  grid-column: 3;
  grid-row: 2;
  z-index: 6;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-npc,
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-talk,
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-object-stack {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-npc {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: clamp(120px, 34%, 260px);
  height: auto;
  max-height: 100%;
  z-index: 5;
  pointer-events: none;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-npc {
  width: clamp(96px, 22%, 170px);
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-npc-hit {
  pointer-events: auto;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-talk:not([hidden]) {
  position: absolute;
  left: clamp(120px, 34%, 260px);
  top: 50%;
  transform: translateY(-50%);
  width: min(240px, 26%);
  max-width: 28%;
  max-height: calc(100% - 16px);
  z-index: 9;
  pointer-events: auto;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-talk:not([hidden]) {
  left: clamp(96px, 22%, 170px);
}
.dungeon-stage[data-room="altar"] .object-card {
  position: absolute;
  z-index: 8;
  left: 50%;
  right: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 52%);
  max-width: min(480px, 62%);
  max-height: min(68%, 260px);
  margin: 0;
  padding: 12px 16px;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: auto;
}
/* 有右侧选项时，卡片在「立绘+卡」两列区域内居中，略偏右以躲开立绘 */
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .object-card {
  left: 56%;
  width: min(380px, 58%);
  max-width: min(420px, 66%);
}
/* 卡片已在 stack 内时，不要再套 left:56%，以免相对偏移、离开按钮看起来偏到左下 */
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .altar-object-stack .object-card {
  left: auto;
  width: 100%;
  max-width: 100%;
}
/* 献祭成功后：把「离开祭坛」放在居中对话卡正下方，而不是右侧选项列 */
.dungeon-stage[data-room="altar"] .altar-object-stack {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, 52%);
  max-width: min(480px, 62%);
  max-height: 100%;
  box-sizing: border-box;
  overflow: visible;
  pointer-events: none;
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .altar-object-stack {
  left: 56%;
  width: min(380px, 58%);
  max-width: min(420px, 66%);
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-object-stack {
  left: 72%;
  width: min(360px, 44%);
  max-width: min(380px, 50%);
}
.dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card):has(.altar-talk:not([hidden])) .altar-object-stack {
  left: 74%;
  width: min(340px, 44%);
  max-width: min(380px, 50%);
}
.dungeon-stage[data-room="altar"] .altar-object-stack .object-card {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  transform: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  max-height: min(200px, calc(100% - 52px));
  flex: 0 1 auto;
  pointer-events: auto;
}
.dungeon-stage[data-room="altar"] .altar-leave-button {
  pointer-events: auto;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  min-width: 10em;
  max-width: 100%;
  margin: 0;
  padding: 6px 16px 7px;
  border: 1px solid rgba(214, 183, 127, .48);
  background: rgba(18, 14, 12, .92);
  box-shadow: 0 0 0 1px rgba(40, 28, 16, .45), 0 6px 14px rgba(0, 0, 0, .32);
  color: var(--ivory, #e8d5aa);
  cursor: pointer;
  font: inherit;
  text-align: center;
  box-sizing: border-box;
}
.dungeon-stage[data-room="altar"] .altar-leave-button:hover,
.dungeon-stage[data-room="altar"] .altar-leave-button:focus-visible {
  border-color: var(--gold, #d6b77f);
  background: rgba(26, 21, 18, .96);
  color: var(--gold-bright, #f4e6c0);
}
.dungeon-stage[data-room="altar"] .altar-leave-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.dungeon-stage[data-room="altar"] .altar-leave-copy b {
  display: block;
  font-family: "STSong", serif;
  font-size: calc(12px * var(--fs, 1));
  font-weight: 400;
  letter-spacing: .12em;
  line-height: 1.3;
}
.dungeon-stage[data-room="altar"] .altar-leave-copy small {
  display: block;
  color: #8f847b;
  font-size: calc(9px * var(--fs, 1));
  letter-spacing: .06em;
  line-height: 1.3;
}
.dungeon-stage[data-room="altar"] .object-card h3 {
  font-size: clamp(12px, 1.5vw, 15px);
  line-height: 1.35;
}
.dungeon-stage[data-room="altar"] .object-card p {
  font-size: calc(10.5px * var(--fs, 1));
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
.dungeon-stage[data-room="altar"] .object-glyph {
  font-size: calc(20px * var(--fs, 1));
}

/* 右列：整栏只给祭坛交互按钮；献祭后功能菜单在面板内滚动，不靠背后整页去够下面的按钮 */
.dungeon-stage[data-room="altar"] .choice-layer {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 100%;
  z-index: 6;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  align-content: start;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(220,190,138,.34) rgba(255,255,255,.025);
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-card {
  min-height: 0;
  height: auto;
  max-height: none;
  padding: 7px 10px;
  gap: 8px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  overflow: hidden;
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-index {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  font-size: calc(10px * var(--fs, 1));
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-copy {
  min-width: 0;
  overflow: hidden;
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-copy b {
  margin-bottom: 2px;
  font-size: calc(12px * var(--fs, 1));
  line-height: 1.3;
  letter-spacing: .04em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-copy small {
  font-size: calc(9px * var(--fs, 1));
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dungeon-stage[data-room="altar"] .choice-layer .choice-arrow {
  font-size: calc(13px * var(--fs, 1));
  align-self: center;
}
.dungeon-stage[data-room="altar"] .choice-layer.altar-curse-picks {
  width: 100%;
  max-height: 100%;
  gap: 5px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
}
.dungeon-stage[data-room="altar"] .choice-layer.altar-curse-picks .choice-card {
  padding: 6px 9px;
}
.dungeon-stage[data-room="altar"] .choice-layer.altar-curse-picks .choice-copy small {
  -webkit-line-clamp: 4;
  font-size: calc(8.5px * var(--fs, 1));
  line-height: 1.32;
}
.dungeon-stage[data-room="altar"] .combat-layer {
  grid-column: 1 / -1;
  grid-row: 2;
  z-index: 7;
}
.dungeon-stage[data-room="altar"] .combat-layer[hidden] {
  display: none !important;
}

.dungeon-stage[data-room="altar"].altar-bare-object .scene-object {
  min-height: 0;
  max-height: none;
}
.dungeon-stage[data-room="altar"].altar-bare-object .choice-layer,
.dungeon-stage[data-room="altar"].altar-bare-object .choice-layer.altar-curse-picks {
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* 左侧阿刻戎立绘：占左区第一子列，可点 */
.dungeon-stage[data-room="altar"] .altar-npc,
.altar-npc {
  position: relative;
  z-index: 5;
  inset: auto;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  pointer-events: none;
  box-sizing: border-box;
  grid-column: 1;
  grid-row: 1;
}
.dungeon-stage[data-room="altar"] .scene-object:has(.altar-talk:not([hidden])) .altar-npc {
  width: 100%;
}
.altar-npc[hidden] { display: none !important; }
.altar-npc-hit {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 0 0 26px;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 14px 16px rgba(0,0,0,.65));
  box-sizing: border-box;
}
.altar-npc-hit:hover .altar-npc-portrait,
.altar-npc-hit:focus-visible .altar-npc-portrait {
  filter: brightness(1.08) drop-shadow(0 0 12px rgba(220, 180, 110, .45));
  outline: none;
}
.altar-npc-portrait {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
  transition: filter .18s ease;
}
.altar-npc-tag {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  max-width: calc(100% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  color: #e6d3b0;
  border: 1px solid rgba(220, 187, 129, .35);
  border-radius: 999px;
  background: rgba(8, 6, 10, .82);
  font-size: calc(9px * var(--fs, 1));
  letter-spacing: .1em;
  pointer-events: none;
  box-sizing: border-box;
}

/* 立绘交谈按钮含全身大图，不能套用通用按钮文本滚动包裹层。
   包裹后 .btn-scroll-surface 没有 height:100%，立绘 height:100% 失效，
   图按容器宽度按比例放大并被裁成巨大半身像，「点击交谈」标签也跟着贴在裁切底边。 */
.altar-npc-hit.btn-text-scroll {
  overflow: hidden;
}
.altar-npc-hit > .btn-scroll-surface {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  flex: none;
  align-self: stretch;
  overflow: hidden;
}

/* 立绘气泡：贴在立绘上，尽量一屏不滚 */
.altar-npc-speech {
  position: absolute;
  z-index: 6;
  left: 4px;
  right: 4px;
  top: 4%;
  width: auto;
  max-width: calc(100% - 8px);
  max-height: min(36%, 110px);
  overflow: hidden;
  padding: 5px 7px;
  color: #f3e7d4;
  border: 1px solid rgba(200, 170, 110, .55);
  border-radius: 9px;
  background: rgba(28, 18, 12, .94);
  box-shadow: 0 4px 14px rgba(0,0,0,.55);
  font-size: calc(10px * var(--fs, 1));
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .02em;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px) scale(.94);
  transition: opacity .2s ease, transform .2s ease;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.altar-npc-speech.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.altar-npc-speech::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: -7px;
  border: 6px solid transparent;
  border-bottom: 0;
  border-top: 8px solid rgba(28, 18, 12, .94);
}

/* 对话窗：立绘旁（左区第二子列），绝不盖住右侧祭坛按钮；一屏看完 */
.dungeon-stage[data-room="altar"] .altar-talk,
.altar-talk {
  position: relative;
  z-index: 14;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  transform: none;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 11px 8px;
  border: 1px solid rgba(218, 190, 138, .28);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(22, 16, 20, .97), rgba(10, 8, 12, .98));
  box-shadow: 0 12px 28px rgba(0,0,0,.5);
  overflow: hidden;
  box-sizing: border-box;
}
.altar-talk[hidden] { display: none !important; }
.altar-talk-close {
  position: absolute;
  right: 6px;
  top: 2px;
  color: #8d8179;
  border: 0;
  background: transparent;
  font-size: calc(20px * var(--fs, 1));
  line-height: 1;
  cursor: pointer;
}
.altar-talk-close:hover { color: var(--gold-bright, #e6c98c); }
.altar-talk-kicker {
  margin: 0 0 2px;
  padding-right: 22px;
  color: #8a6b78;
  font-size: calc(8.5px * var(--fs, 1));
  letter-spacing: .2em;
}
.altar-talk-name {
  flex: 0 0 auto;
  margin: 0 0 6px;
  padding-right: 22px;
  color: #d8bd83;
  font-family: "STSong", Georgia, serif;
  font-size: calc(14px * var(--fs, 1));
  font-weight: 400;
  letter-spacing: .06em;
}
.altar-talk-body {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 34%;
  overflow: hidden;
  margin-bottom: 6px;
  color: #d3c9bf;
  font-family: "STSong", serif;
  font-size: calc(11.5px * var(--fs, 1));
  line-height: 1.45;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}
.altar-talk-choices {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.altar-talk-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  color: #e8dcc8;
  border: 1px solid rgba(218, 190, 138, .28);
  border-radius: 6px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  font-size: calc(11px * var(--fs, 1));
  letter-spacing: .03em;
  line-height: 1.3;
  transition: border-color .15s ease, background .15s ease;
  box-sizing: border-box;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.altar-talk-choice:hover,
.altar-talk-choice:focus-visible {
  border-color: rgba(238, 205, 142, .7);
  background: rgba(80, 55, 30, .35);
  outline: none;
}
.altar-talk-choice.is-pink {
  color: #ffb3d9;
  border-color: rgba(255, 105, 180, .65);
  background: linear-gradient(90deg, rgba(150, 30, 90, .4), rgba(60, 14, 44, .85));
  box-shadow: 0 0 12px rgba(255, 105, 180, .2);
}
.altar-talk-choice.is-pink:hover {
  border-color: #ff8fc7;
  background: linear-gradient(90deg, rgba(180, 40, 110, .5), rgba(76, 18, 56, .9));
}
.altar-talk-choice.is-muted {
  color: #9a9086;
  border-style: dashed;
}

@media (max-width: 900px) {
  .dungeon-stage[data-room="altar"] .scene-area {
    grid-template-columns: minmax(240px, 0.52fr) minmax(0, 0.48fr);
    padding: 14px 12px 10px;
    column-gap: 10px;
  }
  .dungeon-stage[data-room="altar"] .scene-object:has(.altar-talk:not([hidden])) {
    grid-template-columns: minmax(96px, 0.4fr) minmax(120px, 0.6fr);
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .scene-object:has(.altar-talk:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .dungeon-stage[data-room="altar"] .object-card {
    width: min(360px, 70%);
    max-width: min(400px, 78%);
    max-height: min(58%, 200px);
  }
  .dungeon-stage[data-room="altar"] .altar-object-stack {
    width: min(360px, 70%);
    max-width: min(400px, 78%);
  }
  .dungeon-stage[data-room="altar"] .altar-object-stack .object-card {
    max-height: min(170px, calc(100% - 48px));
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .altar-npc {
    width: clamp(96px, 30%, 180px);
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-npc {
    width: clamp(80px, 22%, 140px);
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-talk:not([hidden]) {
    left: clamp(80px, 22%, 140px);
    width: min(200px, 28%);
    max-width: 30%;
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.altar-talk:not([hidden])) .altar-object-stack,
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card):has(.altar-talk:not([hidden])) .altar-object-stack {
    left: 74%;
    width: min(280px, 44%);
    max-width: min(320px, 50%);
  }
  .altar-talk-body { -webkit-line-clamp: 5; font-size: calc(11px * var(--fs, 1)); }
  .altar-talk-choice { font-size: calc(10.5px * var(--fs, 1)); padding: 4px 7px; }
}
@media (max-width: 680px) {
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])),
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(200px, 46vh) minmax(0, 1fr);
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .scene-object {
    grid-column: 1;
    grid-row: 2;
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .choice-layer,
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])):has(.choice-layer > .choice-card) .choice-layer.altar-curse-picks {
    grid-column: 1;
    grid-row: 3;
  }
  .dungeon-stage[data-room="altar"] .scene-area {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(200px, 46vh) minmax(0, 1fr);
  }
  .dungeon-stage[data-room="altar"] .scene-object {
    grid-column: 1;
    grid-row: 2;
    min-height: 180px;
  }
  .dungeon-stage[data-room="altar"] .scene-object:has(.altar-talk:not([hidden])) {
    grid-template-columns: minmax(90px, 0.38fr) minmax(0, 0.62fr);
  }
  .dungeon-stage[data-room="altar"] .scene-area:has(.object-card:not([hidden])) .scene-object:has(.altar-talk:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .dungeon-stage[data-room="altar"] .choice-layer,
  .dungeon-stage[data-room="altar"] .choice-layer.altar-curse-picks {
    grid-column: 1;
    grid-row: 3;
    align-self: stretch;
    width: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .altar-npc-speech {
    font-size: calc(9.5px * var(--fs, 1));
    max-height: min(32%, 90px);
    -webkit-line-clamp: 4;
  }
}


/* 灵魂核心顶栏入口 / 商店（主界面与选角顶栏可配置；研发版局内可开关战斗效果） */
.soul-core-chip {
  min-width: 108px;
  height: 72px;
  padding: 0 16px;
  color: inherit;
  border: 0;
  border-left: 1px solid rgba(221, 202, 168, 0.1);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-content: center;
  text-align: center;
  flex-shrink: 0;
}
.soul-core-chip:hover b { color: var(--gold-bright); }
.soul-core-chip b { color: #e7c48a; }
.soul-core-chip.is-locked-run { opacity: 0.92; }
.soul-core-chip.is-locked-run:hover b { color: #c9b089; }

.soul-shard-chip {
  position: relative;
  min-width: 108px;
  height: 72px;
  padding: 0 16px;
  flex-shrink: 0;
  cursor: default;
}
.soul-shard-chip b { color: #e7c48a; }
.soul-shard-tip {
  position: absolute;
  z-index: 80;
  left: 50%;
  top: calc(100% + 8px);
  transform: translate(-50%, 6px);
  min-width: 126px;
  padding: 8px 12px;
  color: #bdb1a7;
  border: 1px solid rgba(220, 190, 138, .34);
  background: rgba(12, 10, 14, .98);
  box-shadow: 0 12px 34px #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: normal;
  text-align: center;
  font-size: calc(10px * var(--fs, 1));
  line-height: 1.55;
  transition: .18s ease;
}
.soul-shard-chip:hover .soul-shard-tip,
.soul-shard-chip:focus-visible .soul-shard-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
body.is-nidhogg-player .vital-row.compact { display: none !important; }
.soul-core-shop-modal { width: min(720px, 94vw); }
.soul-shop-lock-banner {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 170, 120, 0.28);
  background: rgba(180, 120, 60, 0.08);
  color: #e2c8a0;
}
.soul-shop-toggle.is-disabled { opacity: 0.55; cursor: not-allowed; }
.soul-shop-toggle input:disabled { cursor: not-allowed; }
.modal.return-home-modal { width: min(620px, 94vw); }
.modal.settlement-modal { width: min(760px, 94vw); }
.modal.settlement-modal .settlement-lead { margin: 0 0 14px; }
.modal.settlement-modal .settlement-grid { margin-top: 0; }
.return-home-story { max-height: min(52vh, 460px); }
.return-home-story p + p { margin-top: 2px; }
.return-home-story p:last-child { color: #dfd1bf; }
.soul-shop-grid { display: grid; gap: 12px; margin-top: 14px; }
.soul-shop-card {
  padding: 14px 16px;
  border: 1px solid rgba(220, 198, 160, 0.18);
  background: rgba(255, 255, 255, 0.03);
}
.soul-shop-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.soul-shop-head b { color: #eadcc6; font-size: calc(15px * var(--fs, 1)); }
.soul-shop-head small { color: #9a8f82; letter-spacing: 0.08em; }
.soul-shop-price-was {
  color: #7d746c;
  text-decoration: line-through;
  margin-right: 0.2em;
}
.soul-shop-discount-tag {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.42em;
  border-radius: 999px;
  border: 1px solid rgba(212, 176, 106, 0.55);
  background: rgba(212, 140, 160, 0.18);
  color: #e8c48a;
  font-size: 0.9em;
  letter-spacing: 0.06em;
  vertical-align: baseline;
  line-height: 1.35;
  white-space: nowrap;
}
.soul-shop-desc { margin: 8px 0 12px; color: #aea297; font-size: calc(12px * var(--fs, 1)); line-height: 1.7; }
.soul-shop-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.soul-shop-buy:disabled { opacity: .45; cursor: not-allowed; }
.soul-shop-buy.is-pink {
  color: #1a0b12;
  border-color: #e38bb6;
  background: #e58bb8;
}
.soul-shop-buy.is-pink:hover { filter: brightness(1.06); }
.soul-shop-buy.is-gray,
.soul-shop-buy.is-gray:disabled {
  color: #cfc6bc;
  border-color: #6f675f;
  background: #4a453f;
  opacity: .55;
  cursor: not-allowed;
}
.soul-shop-run-banner {
  padding: 10px 12px;
  color: #d8c4a3;
  border-left: 2px solid #c9a36a;
  background: rgba(80, 58, 28, .28);
}
.soul-shop-card.is-hidden-item .soul-shop-head b { letter-spacing: 0.28em; color: #9a8f82; }
.soul-core-convert {
  margin: 10px 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 163, 106, .35);
  background: rgba(40, 30, 18, .45);
}
.soul-core-convert .modal-copy { margin: 0 0 6px; }
.soul-shop-toggle span { white-space: nowrap; }
.soul-shop-toggle { display: inline-flex; align-items: center; gap: 8px; color: #cbbba7; font-size: calc(12px * var(--fs, 1)); cursor: pointer; }
.soul-shop-toggle input { accent-color: #d4b06a; width: 16px; height: 16px; }
.soul-shop-locked { color: #7d746c; font-size: calc(11px * var(--fs, 1)); }


/* ENDING_VOID_SETTLEMENT_CSS */
.ending-hotspots { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
.ending-hotspots .scene-hotspot { pointer-events: auto; }
.time-wheel-hotspot {
  left: 50%; top: 58%; transform: translate(-50%, -50%);
  min-width: 168px; text-align: center;
  border-color: rgba(110, 180, 255, .45);
  box-shadow: 0 0 28px rgba(60, 140, 255, .28), inset 0 0 22px rgba(40, 100, 200, .12);
  animation: acheronTimeWheelPulse 1.6s ease-in-out infinite;
}
.time-wheel-hotspot:hover, .time-wheel-hotspot:focus-visible {
  transform: translate(-50%, calc(-50% - 3px));
  border-color: rgba(160, 210, 255, .85);
}
.dungeon-stage[data-room="acheronWheel"] {
  background:
    radial-gradient(circle at 50% 62%, rgba(70, 140, 255, .16), transparent 28%),
    linear-gradient(180deg, #12151c, #07080c);
}
.dungeon-stage[data-room="acheronWheel"]::before {
  opacity: .35;
  background-image: radial-gradient(circle at 50% 58%, rgba(120, 190, 255, .18), transparent 40%);
}
.dungeon-stage[data-room="void"] {
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(220,230,255,.35), transparent),
    radial-gradient(1px 1px at 28% 72%, rgba(200,210,255,.22), transparent),
    radial-gradient(1px 1px at 63% 24%, rgba(230,240,255,.28), transparent),
    radial-gradient(1px 1px at 81% 61%, rgba(190,205,255,.2), transparent),
    radial-gradient(1.5px 1.5px at 47% 44%, rgba(255,255,255,.18), transparent),
    radial-gradient(circle at 50% 40%, rgba(40, 55, 90, .14), transparent 42%),
    linear-gradient(180deg, #05060a 0%, #020308 55%, #000 100%);
}
.dungeon-stage[data-room="void"]::before { opacity: .12; }
.dungeon-stage[data-room="void"] .scene-header,
.dungeon-stage[data-room="acheronWheel"] .scene-header,
.dungeon-stage[data-room="settlement"] .scene-header {
  position: relative; z-index: 5; text-shadow: 0 2px 16px #000;
}
.dungeon-stage[data-room="void"] .dialogue-box {
  background: linear-gradient(110deg, rgba(10, 12, 20, .92), rgba(4, 5, 10, .96));
}
.dungeon-stage[data-room="settlement"] {
  background: linear-gradient(180deg, #15131a, #08070b);
}
.choice-layer:has(.settlement-panel) {
  grid-template-columns: 1fr;
  width: min(760px, 100%);
  max-height: min(68vh, 620px);
}
.settlement-panel {
  width: 100%;
  margin: 0;
  padding: 18px 20px 16px;
  border: 1px solid rgba(214, 183, 127, .28);
  background: linear-gradient(160deg, rgba(22, 18, 24, .96), rgba(8, 7, 11, .96));
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 0 24px rgba(120, 90, 55, .06);
  position: relative; z-index: 4;
}
.settlement-actions {
  margin-top: 14px;
  display: grid;
}
.settlement-panel h3 {
  margin: 0 0 6px;
  font: 400 calc(18px * var(--fs, 1)) "STSong", serif;
  letter-spacing: .12em;
  color: #efd7a4;
}
.settlement-panel .settlement-lead {
  margin: 0 0 14px;
  color: #8f847b;
  font-size: calc(11px * var(--fs, 1));
  letter-spacing: .06em;
}
.settlement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.settlement-card {
  padding: 12px 12px 10px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.025);
}
.settlement-card b {
  display: block;
  margin-bottom: 4px;
  color: #d8bd83;
  font: 500 calc(12px * var(--fs, 1)) Georgia, serif;
  letter-spacing: .08em;
}
.settlement-card span, .settlement-card small {
  display: block;
  color: #d3c9bf;
  font-size: calc(13px * var(--fs, 1));
  line-height: 1.55;
  white-space: pre-wrap;
}
.settlement-card.full { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .settlement-grid { grid-template-columns: 1fr; }
  .time-wheel-hotspot { top: 64%; }
}


/* ===== 文集 & 画廊 ===== */
.archive-screen {
  display: none;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 96px 18px 48px; /* 顶栏 72px + 间距，避免大标题叠进 topbar */
  box-sizing: border-box;
}
.archive-screen.is-active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.archive-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 8px;
  flex-wrap: wrap;
}
.archive-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(16, 12, 18, 0.85);
  color: #b9aa98;
  padding: 10px 18px;
  border-radius: 999px;
  letter-spacing: 0.18em;
  cursor: pointer;
  font-family: inherit;
}
.archive-tab.is-active {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(212, 175, 95, 0.25) inset;
}
.archive-pane { display: none; margin-top: 10px; }
.archive-pane.is-active { display: block; }

.codex-shelf { margin: 18px 0 26px; }
.codex-shelf > header,
.gallery-section > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(212, 175, 95, 0.18);
  padding-bottom: 6px;
}
.codex-shelf h3,
.gallery-section h3 {
  margin: 0;
  font-size: calc(15px * var(--fs, 1));
  letter-spacing: 0.2em;
  color: var(--gold-bright);
  font-weight: 500;
}
.codex-shelf small,
.gallery-section small {
  opacity: 0.65;
  font-size: calc(11px * var(--fs, 1));
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.codex-book {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 158px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.codex-spine {
  width: 10px;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(180deg, #5a4632, #2a1c14 55%, #1a120e);
  box-shadow: inset -1px 0 0 rgba(255, 220, 160, 0.18);
}
.codex-cover {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 10px 12px 12px;
  border-radius: 0 8px 8px 0;
  border: 1px solid rgba(180, 150, 110, 0.28);
  background:
    linear-gradient(145deg, rgba(58, 42, 32, 0.95), rgba(22, 16, 20, 0.96)),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  min-width: 0;
}
.codex-cover small {
  opacity: 0.55;
  letter-spacing: 0.14em;
  font-size: calc(9px * var(--fs, 1));
}
.codex-cover b {
  font-weight: 500;
  font-size: calc(13px * var(--fs, 1));
  line-height: 1.35;
  color: #e6d7c3;
  word-break: break-word;
}
.codex-book.is-locked .codex-cover {
  filter: grayscale(0.35) brightness(0.72);
  border-color: rgba(120, 100, 90, 0.25);
}
.codex-book.is-locked .codex-cover b { color: #8d8074; letter-spacing: 0.28em; }
.codex-book.is-unlocked:hover .codex-cover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.codex-lock,
.gallery-lock {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #a8947d;
  opacity: 0.8;
  border: 1px solid rgba(168, 148, 125, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.35);
}

.gallery-section { margin: 18px 0 26px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
.gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(180, 150, 110, 0.22);
  background: rgba(14, 10, 14, 0.78);
  color: #d8cbb8;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.gallery-card.is-unlocked:hover { border-color: var(--gold); }
.gallery-frame {
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(80, 60, 50, 0.35), rgba(8, 6, 10, 0.95));
  display: grid;
  place-items: center;
}
.gallery-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-silhouette {
  width: 58%;
  height: 72%;
  border-radius: 40% 40% 28% 28%;
  background: linear-gradient(180deg, #2a2228, #0c0a0e);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.8);
  filter: blur(0.2px);
}
.gallery-card b {
  font-size: calc(12px * var(--fs, 1));
  font-weight: 500;
  line-height: 1.35;
}
.gallery-card.is-locked { filter: saturate(0.7); opacity: 0.88; }
.gallery-preview-body {
  display: grid;
  place-items: center;
  min-height: 280px;
  max-height: min(70vh, 560px);
  background: radial-gradient(circle at 50% 20%, rgba(70,50,40,0.35), rgba(8,6,10,0.95));
  border-radius: 12px;
  overflow: auto;
}
.gallery-preview-body img {
  max-width: 100%;
  max-height: min(68vh, 520px);
  object-fit: contain;
}
.gallery-frame video,
.gallery-frame .gallery-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a080c;
  pointer-events: none;
}
.gallery-card.is-video .gallery-frame {
  aspect-ratio: 9 / 16;
  background: radial-gradient(circle at 50% 35%, rgba(60, 40, 70, 0.4), rgba(8, 6, 10, 0.96));
}
.gallery-preview-body--video {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-height: min(78vh, 720px);
}
.gallery-preview-body--video video {
  width: min(100%, 360px);
  max-height: min(68vh, 620px);
  object-fit: contain;
  background: #050408;
  border-radius: 8px;
}
.gallery-video-tip {
  margin: 0;
  opacity: 0.65;
  font-size: calc(12px * var(--fs, 1));
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .codex-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
  .codex-book { min-height: 142px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}


/* 文集&画廊 · 调试锁 */
.archive-title-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.archive-debug-lock {
  appearance: none;
  border: 1px solid rgba(180, 150, 110, 0.35);
  background: rgba(20, 14, 18, 0.72);
  color: #d4b86a;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25) inset;
}
.archive-debug-lock:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  transform: translateY(-1px);
}

.archive-screen .panel-heading {
  align-items: flex-start;
  gap: 12px;
  margin-top: 0;
  padding-top: 4px;
}
.archive-screen .panel-heading h2 {
  line-height: 1.25;
}

/* ===== 育种腔室 · 插入后的射精条与插图位 ===== */
.breeding-rig { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.breeding-rig[hidden] { display: none; }
.breeding-illust { position: absolute; left: 4%; top: 22%; height: 50%; aspect-ratio: 2 / 3; margin: 0; display: grid; place-items: center; overflow: hidden; border: 1px dashed rgba(255, 140, 200, .6); border-radius: 6px; background: linear-gradient(180deg, rgba(40, 8, 28, .72), rgba(14, 3, 10, .82)); box-shadow: 0 0 22px rgba(255, 105, 180, .18), inset 0 0 30px rgba(255, 105, 180, .08); pointer-events: auto; }
.breeding-illust img,
.breeding-illust video,
.breeding-illust .breeding-illust-videos { position: absolute; inset: 0; width: 100%; height: 100%; }
.breeding-illust img,
.breeding-illust video { object-fit: cover; }
.breeding-illust video { opacity: 0; pointer-events: none; }
.breeding-illust video.is-active { opacity: 1; }
.breeding-illust.has-image,
.breeding-illust.has-video { border-style: solid; border-color: rgba(255, 140, 200, .45); }
.breeding-illust.has-image .breeding-illust-placeholder,
.breeding-illust.has-video .breeding-illust-placeholder { display: none; }
.breeding-illust-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; text-align: center; color: #e7a6c8; }
.breeding-illust-placeholder b { color: #ffb3d9; font: 500 calc(14px * var(--fs, 1)) Georgia, "Songti SC", serif; letter-spacing: .2em; }
.breeding-illust-placeholder span { font-size: calc(11px * var(--fs, 1)); line-height: 1.6; }
.breeding-illust-placeholder em { font-style: normal; color: #ffd2e8; font-size: calc(11px * var(--fs, 1)); font-variant-numeric: tabular-nums; }
.breeding-illust-placeholder small { color: rgba(231, 166, 200, .6); font-size: calc(9px * var(--fs, 1)); word-break: break-all; }
.breeding-illust:not([data-seq="idle"]) { border-color: rgba(255, 160, 210, .9); box-shadow: 0 0 26px rgba(255, 105, 180, .4), inset 0 0 30px rgba(255, 105, 180, .14); }
.breeding-illust.frame-tick:not(.has-image) .breeding-illust-placeholder em { animation: breeding-frame-tick .12s ease-out; }
@keyframes breeding-frame-tick { from { transform: scale(1.12); color: #fff; } to { transform: scale(1); } }
.breeding-control { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(600px, 70%); pointer-events: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 1.3fr) minmax(0, 1fr); grid-template-areas: ". finish ." "thrust gauge pull"; gap: 6px 10px; align-items: center; }
.breeding-buttons { display: contents; }
.breeding-gauge { grid-area: gauge; margin: 0; }
.breeding-gauge .jerk-gauge-track em.mark-pull { left: 60%; background: rgba(210, 200, 210, .55); }
.breeding-gauge .jerk-gauge-track em.mark-finish { left: 90%; }
.breeding-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 46px; padding: 6px 10px; color: #ffd2e8; cursor: pointer; border: 1px solid rgba(255, 105, 180, .65); border-radius: 8px; background: linear-gradient(90deg, rgba(150, 30, 90, .55), rgba(60, 14, 44, .9)); box-shadow: 0 0 14px rgba(255, 105, 180, .25), inset 0 0 18px rgba(255, 105, 180, .1); transition: transform .15s ease, opacity .2s ease, filter .2s ease; }
.breeding-btn b { color: #ffb3d9; font: 500 calc(13px * var(--fs, 1)) Georgia, "Songti SC", serif; letter-spacing: .12em; }
.breeding-btn small { color: #e7a6c8; font-size: calc(9px * var(--fs, 1)); line-height: 1.35; }
.breeding-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: #ff8fc7; }
.breeding-btn:disabled { cursor: default; opacity: .55; }
.breeding-btn.is-greyed { filter: grayscale(1); opacity: .38; border-color: rgba(180, 170, 175, .4); }
.breeding-btn-thrust { grid-area: thrust; }
.breeding-btn-pull { grid-area: pull; }
.breeding-btn-finish { grid-area: finish; min-height: 38px; border-color: #ff8fc7; animation: breeding-finish-glow 1.4s ease-in-out infinite; }
@keyframes breeding-finish-glow { 0%, 100% { box-shadow: 0 0 12px rgba(255, 105, 180, .35); } 50% { box-shadow: 0 0 26px rgba(255, 140, 200, .85); } }
.breeding-rig.is-finished .breeding-control { opacity: .7; }

/* 虚空之眼 · 精神气泡（虫族之母的精神低语，区别于普通对话气泡） */
.void-psy { position: absolute; z-index: 7; left: 57%; top: 5%; width: min(470px, 40%); max-height: 90%; display: flex; flex-direction: column; pointer-events: auto; filter: drop-shadow(0 0 18px rgba(255, 80, 190, .35)); }
.void-psy[hidden] { display: none; }
.void-psy-cloud { position: relative; flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px 14px; border-radius: 42px 46px 40px 44px / 34px 38px 34px 40px; border: 1px solid rgba(255, 150, 225, .55); background: radial-gradient(ellipse at 28% 18%, rgba(132, 30, 116, .9), rgba(46, 8, 46, .93) 58%, rgba(18, 4, 22, .95)); box-shadow: 0 0 26px rgba(255, 90, 200, .5), 0 0 70px rgba(150, 60, 255, .28), inset 0 0 34px rgba(255, 120, 220, .2); animation: void-psy-pulse 2.8s ease-in-out infinite; }
.void-psy-cloud::before, .void-psy-cloud::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 150, 225, .45); border-bottom-color: transparent; background: radial-gradient(circle at 40% 40%, rgba(132, 30, 116, .92), rgba(60, 10, 58, .94)); z-index: -1; }
.void-psy-cloud::before { width: 34%; height: 46px; left: 12%; top: -16px; }
.void-psy-cloud::after { width: 26%; height: 38px; right: 16%; top: -12px; }
.void-psy-text { flex: 1 1 auto; min-height: 48px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(255, 150, 225, .4) transparent; }
.void-psy-text p { margin: 0 0 8px; color: #ffdcf3; font: 500 calc(13.5px * var(--fs, 1))/1.75 Georgia, "Songti SC", "STSong", serif; letter-spacing: .04em; text-shadow: 0 0 7px rgba(255, 110, 215, .75), 1px 0 0 rgba(120, 200, 255, .32), -1px 0 0 rgba(255, 60, 130, .32); opacity: 0; animation: void-psy-in .9s ease-out forwards, void-psy-shimmer 4.6s ease-in-out infinite; animation-delay: var(--d, 0s), calc(var(--d, 0s) + .9s); }
.void-psy-text p:last-child { margin-bottom: 0; }
.void-psy-text p.is-glyph { color: #d4b2ff; letter-spacing: .14em; font-style: italic; word-break: break-all; text-shadow: 0 0 9px rgba(190, 120, 255, .9), 2px 0 0 rgba(255, 60, 160, .4), -2px 0 0 rgba(80, 220, 255, .35); animation: void-psy-in .9s ease-out forwards, void-psy-jitter .32s steps(2) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.void-psy-text p.is-laugh { color: #ff9fd6; font-size: calc(16px * var(--fs, 1)); letter-spacing: .1em; animation: void-psy-in .6s ease-out forwards, void-psy-shake .18s linear infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.void-psy-text p.is-boon { padding-left: 10px; border-left: 2px solid rgba(255, 150, 225, .55); }
.void-psy-choices { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.void-psy-choices[hidden] { display: none; }
.void-psy-btn { padding: 7px 14px; color: #ffe2f5; cursor: pointer; border: 1px solid rgba(255, 150, 225, .7); border-radius: 999px; background: linear-gradient(90deg, rgba(126, 22, 104, .78), rgba(44, 8, 54, .92)); box-shadow: 0 0 12px rgba(255, 105, 200, .3), inset 0 0 14px rgba(255, 120, 220, .12); font: 500 calc(13px * var(--fs, 1)) Georgia, "Songti SC", serif; letter-spacing: .08em; text-align: center; transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease; }
.void-psy-btn:hover:not(:disabled) { transform: translateY(-1px); border-color: #ffb3e6; box-shadow: 0 0 20px rgba(255, 120, 210, .65), inset 0 0 16px rgba(255, 140, 225, .2); }
.void-psy-btn:disabled { opacity: .5; cursor: default; }
.void-psy-btn-refuse { border-color: rgba(255, 110, 130, .75); background: linear-gradient(90deg, rgba(130, 16, 44, .8), rgba(50, 6, 24, .92)); }
.void-psy-trail { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.void-psy-trail i { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 190, 240, .85); background: radial-gradient(circle at 35% 35%, rgba(255, 190, 240, .95), rgba(170, 50, 150, .95) 55%, rgba(70, 10, 70, .95)); box-shadow: 0 0 14px rgba(255, 120, 220, .85), 0 0 4px rgba(255, 255, 255, .5); animation: void-psy-dot 2.8s ease-in-out infinite; }
.void-psy-trail i:nth-child(1) { width: 20px; height: 20px; left: -18px; top: 30px; }
.void-psy-trail i:nth-child(2) { width: 13px; height: 13px; left: -40px; top: 16px; animation-delay: .25s; }
.void-psy-trail i:nth-child(3) { width: 8px; height: 8px; left: -58px; top: 6px; animation-delay: .5s; }
.void-psy.is-pulse .void-psy-cloud { animation: void-psy-arrive .7s ease-out, void-psy-pulse 2.8s ease-in-out .7s infinite; }
@keyframes void-psy-pulse { 0%, 100% { box-shadow: 0 0 22px rgba(255, 90, 200, .45), 0 0 60px rgba(150, 60, 255, .22), inset 0 0 30px rgba(255, 120, 220, .16); } 50% { box-shadow: 0 0 36px rgba(255, 110, 215, .75), 0 0 96px rgba(170, 70, 255, .38), inset 0 0 40px rgba(255, 140, 230, .28); } }
@keyframes void-psy-arrive { from { opacity: 0; transform: scale(.94); filter: blur(6px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes void-psy-in { from { opacity: 0; filter: blur(5px); transform: translateY(3px); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes void-psy-shimmer { 0%, 100% { transform: none; filter: blur(0); } 46% { transform: skewX(0); filter: blur(0); } 50% { transform: skewX(-4deg) translateX(1px); filter: blur(.6px); } 54% { transform: skewX(2deg); filter: blur(0); } }
@keyframes void-psy-jitter { 0% { transform: translate(0, 0); } 50% { transform: translate(1px, -1px) skewX(-6deg); } 100% { transform: translate(-1px, 0); } }
@keyframes void-psy-shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 1px); } }
@keyframes void-psy-dot { 0%, 100% { opacity: .65; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }
@media (max-width: 900px) {
  .void-psy { left: 3%; right: 3%; width: auto; top: 26%; }
  .void-psy-trail { left: 50%; }
  .void-psy-trail i:nth-child(1) { left: -9px; top: -26px; }
  .void-psy-trail i:nth-child(2) { left: -6px; top: -46px; }
  .void-psy-trail i:nth-child(3) { left: -4px; top: -62px; }
  .void-psy { max-height: 70%; }
}
@media (max-width: 900px) {
  .breeding-illust { left: 3%; top: 12%; height: 40%; }
  .breeding-control { width: 96%; grid-template-columns: 1fr 1fr; grid-template-areas: "finish finish" "gauge gauge" "thrust pull"; }
}
/* 第二轮：拒绝气泡叠在榨精装置上方时，不遮挡下方按钮、也不挡点击 */
.void-psy.is-over-rig { pointer-events: none; max-height: 70%; }
.void-psy.is-over-rig .void-psy-text { pointer-events: auto; }

/* ── 混合体技能树 / 紫黑色战斗技能 ── */
.combat-button.hybrid {
  color: #e4d4f4;
  border-color: rgba(158, 92, 196, .62);
  background: linear-gradient(145deg, rgba(42, 14, 48, .92), rgba(10, 6, 14, .94));
  box-shadow: 0 0 12px rgba(132, 64, 168, .28), inset 0 0 10px rgba(88, 28, 110, .35);
}
.combat-button.hybrid:hover {
  border-color: #c89be8;
  color: #f6e8ff;
  box-shadow: 0 0 16px rgba(168, 92, 214, .45);
}
.combat-button.hybrid small { color: #a888c0; }
.combat-button.hybrid:disabled {
  filter: grayscale(.55) brightness(.72);
  box-shadow: none;
  color: #8a7a96;
  border-color: rgba(90, 70, 104, .45);
}
.hybrid-skill-tree {
  border-color: rgba(150, 96, 196, .32);
  box-shadow: inset 0 0 46px rgba(28, 8, 40, .55), 0 0 28px rgba(120, 60, 160, .14);
}
.hybrid-skill-tree .skill-tree-node {
  color: #e8d6f6;
  border-color: rgba(176, 112, 210, .7);
  background: radial-gradient(circle at 50% 30%, rgba(52, 22, 64, .94), rgba(10, 6, 14, .94));
  box-shadow: 0 0 12px rgba(132, 64, 168, .28);
}
.hybrid-skill-tree .skill-tree-node.is-learned {
  color: #f8e9ff;
  border-color: #d8b0f0;
  box-shadow: 0 0 16px rgba(176, 96, 214, .48), inset 0 0 10px rgba(120, 48, 150, .28);
}
.hybrid-skill-tree .skill-tree-node.is-locked {
  color: #8a7d96;
  border-color: rgba(110, 90, 126, .45);
  background: radial-gradient(circle at 50% 30%, rgba(28, 22, 32, .9), rgba(8, 6, 10, .92));
  box-shadow: none;
  opacity: .78;
  cursor: default;
}
.hybrid-skill-tree .skill-tree-node.is-locked .skill-tree-node-label small {
  display: none;
}
.hybrid-skill-tree .skill-tree-node.is-selected {
  outline-color: #d8b0f0;
}
.hybrid-skill-tree .skill-tree-node.is-learned.is-selected {
  box-shadow: 0 0 20px rgba(196, 120, 230, .62), inset 0 0 12px rgba(140, 64, 180, .3);
}
.skill-tree-node-popup.is-hybrid {
  border-color: rgba(176, 112, 210, .5);
  background: rgba(12, 8, 18, .9);
}
.skill-tree-node-popup.is-hybrid b { color: #e8d6f6; }
.sheet-level.is-capped small.sheet-cap-note {
  display: block;
  margin-top: 2px;
  color: #c4a0d8;
  font-size: calc(7px * var(--fs, 1));
  letter-spacing: .04em;
}
.hybrid-hud-chip,
.status-chip.hybrid-chip {
  color: #e0c8f0;
  border-color: rgba(158, 92, 196, .4);
  background: rgba(72, 28, 96, .22);
}
.combat-actions.essence-offering-actions,
.combat-actions:has(.essence-offering-panel) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  grid-template-columns: none;
}
.essence-offering-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
.essence-offering-panel .jerk-gauge {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.essence-offering-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  width: 100%;
}
.essence-offering-buttons .combat-button {
  min-height: 56px;
  padding: 12px 16px;
}
.essence-offering-buttons .combat-button b {
  line-height: 1.45;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}
.void-psy.is-over-rig .void-psy-choices { pointer-events: auto; }

/* 种源骑士跳场：从场景后方/上方冲入前景 */
@keyframes seedKnightLeapIn {
  0% {
    opacity: 0;
    transform: translate(-18%, -46%) scale(.62);
    filter: blur(10px) brightness(1.55) drop-shadow(0 0 18px rgba(232, 196, 122, .0));
  }
  42% {
    opacity: 1;
    transform: translate(6%, 8%) scale(1.12);
    filter: blur(0) brightness(1.2) drop-shadow(0 0 28px rgba(232, 196, 122, .55));
  }
  70% {
    transform: translate(-2%, -2%) scale(1.03);
    filter: brightness(1.06) drop-shadow(0 0 16px rgba(201, 92, 151, .35));
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    filter: none;
  }
}
.enemy-figure.seed-knight-leap,
.enemy-figure.has-portrait.seed-knight-leap {
  animation: seedKnightLeapIn .9s cubic-bezier(.14, .86, .28, 1) both;
  z-index: 8;
}
.enemy-figure.seed-knight-leap .enemy-portrait {
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .7));
}


/* —— Language switch + English typography —————————————— */

.topbar-trailing {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 18px;
  flex-shrink: 0;
}
.topbar-trailing .top-actions { margin-left: 0; }

html[data-edition="test"] #langSwitch {
  display: none !important;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  align-self: center;
  height: 36px;
  padding: 0 4px;
  border: 1px solid rgba(220, 198, 160, 0.2);
  background: rgba(255, 255, 255, 0.025);
  flex-shrink: 0;
}
.lang-switch-btn {
  margin: 0;
  padding: 7px 9px;
  color: #8a8078;
  border: 0;
  background: transparent;
  font-size: calc(11px * var(--fs, 1));
  letter-spacing: 0.14em;
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
}
.lang-switch-btn.is-active {
  color: var(--gold-bright);
}
.lang-switch-btn:hover { color: var(--gold-bright); }
.lang-switch-divider {
  color: #6a635c;
  padding: 0 1px;
  letter-spacing: 0;
  font-size: calc(11px * var(--fs, 1));
  pointer-events: none;
}

html.lang-en .brand-button strong { letter-spacing: 0.04em; }
html.lang-en .brand-button small { letter-spacing: 0.08em; }
html.lang-en .summary-item small { letter-spacing: 0.04em; }
html.lang-en .icon-button,
html.lang-en .text-button,
html.lang-en .primary-button,
html.lang-en .secondary-button { letter-spacing: 0.04em; }
html.lang-en .return-title-button {
  min-width: 118px;
  white-space: nowrap;
}
html.lang-en .lock-seal {
  white-space: normal;
  letter-spacing: 0.06em;
  max-width: 90%;
  text-align: center;
  line-height: 1.4;
}
html.lang-en .enemy-party .enemy-figure .enemy-nameplate span,
html.lang-en .enemy-nameplate span {
  white-space: normal;
  line-height: 1.25;
}
html.lang-en .combat-button {
  min-height: 68px;
}
html.lang-en .combat-button b,
html.lang-en .essence-offering-buttons .combat-button b {
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
html.lang-en .combat-actions {
  gap: 8px;
}
html.lang-en .skill-tree-node {
  width: 148px;
  min-height: 42px;
  padding: 7px 8px;
}
html.lang-en .skill-tree-node-label {
  letter-spacing: 0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: normal;
}
html.lang-en .skill-tree-node-popup b { letter-spacing: 0.03em; }
html.lang-en .sheet-tab {
  white-space: normal;
  line-height: 1.3;
  letter-spacing: 0.04em;
}
html.lang-en .modal-copy,
html.lang-en .story-overlay .story-body,
html.lang-en .story-page,
html.lang-en .dialogue-box,
html.lang-en #dialogueText {
  line-height: 1.7;
  letter-spacing: 0.01em;
}
html.lang-en .title-subtitle,
html.lang-en .panel-intro,
html.lang-en .character-card-copy,
html.lang-en .choice-copy,
html.lang-en .object-card p,
html.lang-en .object-card h3 {
  letter-spacing: 0.01em;
  line-height: 1.65;
}
html.lang-en .primary-button small,
html.lang-en .secondary-button small {
  letter-spacing: 0.03em;
  white-space: normal;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .topbar-trailing { margin-left: 8px; gap: 6px; }
  html.lang-en .return-title-button { min-width: 96px; }
  html.lang-en .skill-tree-node { width: 132px; }
}
@media (max-width: 680px) {
  .topbar-trailing { margin-left: 6px; gap: 4px; }
  .lang-switch { height: 30px; padding: 0 2px; }
  .lang-switch-btn { padding: 5px 7px; letter-spacing: 0.08em; }
  html.lang-en .return-title-button {
    min-width: 72px;
    font-size: calc(10px * var(--fs, 1));
    letter-spacing: 0.02em;
  }
  html.lang-en .summary-item { min-width: 52px; }
}


/* 锈锁石匣 · 宝箱怪挣扎 / 射精条 */
.rust-casket-gauges {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, 100%);
  margin: 0 0 10px;
  flex-shrink: 0;
  pointer-events: none;
}
.dungeon-stage[data-room="rustCasket"] .scene-area {
  position: relative;
  z-index: 12;
}
/* 宝箱怪射精条、挣扎条整体上移 64px，不改未出现宝箱怪时的选项位置。
   抓住后三条挣扎按钮用 transform 提到两条条的上方；两条条仍留在原文档流位置，不被挤下去。 */
.dungeon-stage[data-room="rustCasket"] .scene-area:has(.rust-casket-gauges:not([hidden])) .choice-layer.rust-casket-actions {
  margin-bottom: 64px;
  z-index: 41;
  transform: translateY(calc(-100% - var(--rust-casket-gauge-stack, 114px) - 18px));
}
.dungeon-stage[data-room="rustCasket"] .choice-layer.rust-casket-actions {
  z-index: 12;
  width: min(420px, 100%);
  gap: 8px;
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
  margin-left: 0;
  margin-right: auto;
  padding-right: 0;
}
.dungeon-stage[data-room="rustCasket"] .scene-area:has(.rust-casket-gauges:not([hidden])) .scene-object {
  min-height: 0;
}
.dungeon-stage[data-room="rustCasket"] .scene-area:has(.rust-casket-gauges:not([hidden])) {
  overflow: hidden;
}
.dungeon-stage[data-room="rustCasket"] .choice-layer.rust-casket-actions .choice-card {
  min-height: 44px;
  padding: 7px 12px;
  gap: 8px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
}
.dungeon-stage[data-room="rustCasket"] .choice-layer.rust-casket-actions .choice-index {
  width: 24px;
  height: 24px;
  margin-top: 0;
}
.dungeon-stage[data-room="rustCasket"] .choice-layer.rust-casket-actions .choice-copy b {
  margin-bottom: 0;
  font-size: calc(14px * var(--fs, 1));
}

.rust-casket-gauge {
  padding: 7px 12px 8px;
  text-align: left;
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(0, 0, 0, .28);
  transition: box-shadow .45s ease, border-color .45s ease, transform .35s ease;
}
.rust-casket-gauge-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
  font-size: 14px;
}
.rust-casket-gauge-head span {
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.rust-casket-gauge-track {
  position: relative;
  height: 14px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45);
}
.rust-casket-gauge-track i {
  position: relative;
  display: block;
  height: 100%;
  width: 0;
  overflow: hidden;
  border-radius: 8px;
  transform-origin: left center;
  transition: width .55s cubic-bezier(.22, .7, .28, 1);
}
.rust-casket-gauge-track i::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 45%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.rust-casket-gauge-track i::after {
  content: "";
  position: absolute;
  inset: -20% -40%;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, .0) 40%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, 0) 60%, transparent 80%);
  animation: rust-casket-sheen 2.6s ease-in-out infinite;
  pointer-events: none;
}
.rust-casket-gauge.is-ejac {
  border: 1px solid rgba(255, 105, 180, .6);
  background: linear-gradient(90deg, rgba(110, 22, 70, .55), rgba(40, 10, 32, .9));
}
.rust-casket-gauge.is-ejac .rust-casket-gauge-head { color: #ffb3d9; }
.rust-casket-gauge.is-ejac .rust-casket-gauge-head span { color: #ffd2e8; }
.rust-casket-gauge.is-ejac .rust-casket-gauge-track {
  background: rgba(20, 4, 14, .85);
  border: 1px solid rgba(255, 140, 200, .35);
}
.rust-casket-gauge.is-ejac .rust-casket-gauge-track i {
  background: linear-gradient(90deg, #ff4e9d, #ff6fb5 35%, #ffb3dc 70%, #ffd0ea);
  box-shadow: 0 0 12px rgba(255, 120, 190, .85), 0 0 18px rgba(255, 80, 160, .35);
}
.rust-casket-gauge.is-ejac .rust-casket-gauge-track em {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 90%;
  width: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .95), rgba(255, 255, 255, .15));
  box-shadow: 0 0 8px rgba(255, 255, 255, .65);
  z-index: 2;
}
.rust-casket-gauge.is-ejac.is-warming {
  box-shadow: 0 0 16px rgba(255, 90, 170, .32), 0 0 14px rgba(0, 0, 0, .28);
}
.rust-casket-gauge.is-ejac.is-hot {
  border-color: rgba(255, 170, 210, .95);
  box-shadow: 0 0 22px rgba(255, 80, 170, .55), 0 0 14px rgba(0, 0, 0, .28);
  animation: rust-casket-hot-glow 1.15s ease-in-out infinite;
}
.rust-casket-gauge.is-ejac.is-hot .rust-casket-gauge-track i {
  box-shadow: 0 0 16px rgba(255, 150, 210, 1), 0 0 24px rgba(255, 70, 160, .6);
}
.rust-casket-gauge.is-struggle {
  border: 1px solid rgba(230, 230, 235, .55);
  background: linear-gradient(90deg, rgba(52, 52, 60, .62), rgba(18, 18, 22, .92));
}
.rust-casket-gauge.is-struggle .rust-casket-gauge-head { color: #f2f2f6; }
.rust-casket-gauge.is-struggle .rust-casket-gauge-head span { color: #d8d8e0; }
.rust-casket-gauge.is-struggle .rust-casket-gauge-track {
  background: rgba(10, 10, 14, .85);
  border: 1px solid rgba(220, 220, 230, .3);
}
.rust-casket-gauge.is-struggle .rust-casket-gauge-track i {
  background: linear-gradient(90deg, #d8d8e4, #f7f7fb 45%, #ffffff 75%, #ececf4);
  box-shadow: 0 0 12px rgba(240, 240, 245, .5), 0 0 16px rgba(200, 200, 220, .25);
}
.rust-casket-gauge.is-rising.is-flash {
  transform: translateY(-1px);
}
.rust-casket-gauge.is-falling.is-flash .rust-casket-gauge-track i {
  filter: brightness(1.15);
}
@keyframes rust-casket-sheen {
  0% { transform: translateX(-55%); opacity: .15; }
  45% { opacity: .85; }
  100% { transform: translateX(55%); opacity: .2; }
}
@keyframes rust-casket-hot-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 80, 170, .4), 0 0 14px rgba(0, 0, 0, .28); }
  50% { box-shadow: 0 0 26px rgba(255, 120, 200, .7), 0 0 14px rgba(0, 0, 0, .28); }
}


/* 育种房 · 插入后左侧动画栏与底部进度（复用育种腔室栏位布局，无抽离键） */
.breeding-hall-rig .breeding-control,
.breeding-hall-control {
  grid-template-columns: minmax(0, 1.15fr) minmax(170px, 1.3fr) minmax(0, 1.15fr);
  grid-template-areas: "thrust gauge finish";
}
.breeding-hall-rig .breeding-btn-finish {
  grid-area: finish;
  min-height: 46px;
}
.dungeon-stage[data-room="breedingHall"] .scene-area {
  position: relative;
  z-index: 12;
}
.dungeon-stage[data-room="nidhoggFestivalSpring"] .scene-area,
.dungeon-stage[data-room="nidhoggFestivalPending"] .scene-area,
.dungeon-stage[data-room="nidhoggFestivalImpact"] .scene-area {
  position: relative;
  z-index: 12;
}


/* ===== 尼德霍格独有资源条 / 技能树 ===== */
.nidhogg-mp-row,
.nidhogg-qi-row,
.nidhogg-hormone-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nidhogg-mp-bar { background: #0c1c28; }
.nidhogg-mp-bar i { background: linear-gradient(90deg, #1a6a8a, #6fd0e6); }
.nidhogg-qi-ticks { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; justify-content: flex-end; align-content: center; min-height: 12px; max-width: 100%; }
.nidhogg-qi-ticks.is-inline { display: inline-flex; flex: 0 1 auto; vertical-align: middle; margin-left: 4px; }
.nidhogg-qi-ticks i { width: 12px; height: 12px; border-radius: 1px; border: 1px solid #d8d8d8; box-sizing: border-box; flex: 0 0 auto; }
.nidhogg-qi-ticks i.is-filled { background: #f5f5f5; border-color: #ffffff; }
.nidhogg-qi-ticks i.is-empty { background: #050505; border-color: #2a2a2a; }
.nidhogg-qi-article b { display: block; font-weight: 500; }
.nidhogg-qi-article .nidhogg-qi-ticks { justify-content: flex-start; margin-top: 4px; }
.vital-row.compact.is-nidhogg-no-resolve { justify-content: flex-end; }
.vital-row.compact.is-nidhogg-no-resolve > span[hidden] { display: none !important; }
body.is-nidhogg-player .vital-row.compact > span:has(#resolveText) { display: none; }
.soul-shop-card.is-nidhogg-disabled { opacity: 0.72; }
.soul-shop-card.is-nidhogg-disabled .soul-shop-actions { opacity: 0.95; }
.character-sheet-head .sheet-summary .nidhogg-qi-ticks { display: inline-flex; vertical-align: middle; margin-left: 2px; }
.nidhogg-heartbeat { display: inline-flex; width: 88px; height: 18px; margin-left: 8px; overflow: hidden; }
.nidhogg-heartbeat svg { width: 100%; height: 100%; }
.nidhogg-heartbeat polyline { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nidhogg-heartbeat.is-calm polyline { stroke: #f2f2f2; animation: nidhoggBeatCalm 1.4s ease-in-out infinite; }
.nidhogg-heartbeat.is-wave polyline { stroke: #e6c84a; animation: nidhoggBeatWave 1.05s ease-in-out infinite; }
.nidhogg-heartbeat.is-heat polyline { stroke: #d88ad8; animation: nidhoggBeatHeat .72s ease-in-out infinite; }
.nidhogg-heartbeat.is-rut polyline { stroke: #8a1a1a; animation: nidhoggBeatRut .52s ease-in-out infinite; }
@keyframes nidhoggBeatCalm { 0%,100% { transform: scaleY(0.7); } 50% { transform: scaleY(1); } }
@keyframes nidhoggBeatWave { 0%,100% { transform: scaleY(0.85); } 50% { transform: scaleY(1.25); } }
@keyframes nidhoggBeatHeat { 0%,100% { transform: scaleY(0.9); } 40% { transform: scaleY(1.55); } }
@keyframes nidhoggBeatRut { 0%,100% { transform: scaleY(1); } 30% { transform: scaleY(1.85); } }
.bar.nidhogg-sanity-bar { position: relative; }
.nidhogg-gold-line { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: linear-gradient(180deg, #f6e27a, #c9a227); box-shadow: 0 0 4px rgba(240, 210, 110, .8); pointer-events: none; z-index: 3; }
.nidhogg-gold-line.is-shattered { background: linear-gradient(180deg, #8a7a3a, #3a320f); box-shadow: none; opacity: .45; clip-path: polygon(0 0, 100% 0, 80% 35%, 100% 55%, 70% 100%, 0 100%, 20% 60%, 0 40%); }
.nidhogg-armor-chip { display: flex; flex-direction: column; gap: 4px; }
.nidhogg-armor-chip .nidhogg-armor-label { display: block; }
.nidhogg-armor-chip .armor-dura-bar { display: block; height: 6px; background: #1a1a1a; border: 1px solid #6a6a6a; }
.nidhogg-armor-chip .armor-dura-bar i { display: block; height: 100%; background: #f4f4f4; }
.nidhogg-armor-chip.is-white .nidhogg-armor-label,
.nidhogg-armor-chip.is-white .armor-dura-bar i { color: #f4f4f4; }
.nidhogg-armor-chip.is-white .armor-dura-bar i { background: #f4f4f4; }
.nidhogg-armor-chip.is-yellow .nidhogg-armor-label { color: #d8b84a; }
.nidhogg-armor-chip.is-yellow .armor-dura-bar i { background: #d8b84a; }
.nidhogg-armor-chip.is-red .nidhogg-armor-label { color: #c44a4a; }
.nidhogg-armor-chip.is-red .armor-dura-bar i { background: #c44a4a; }
.sheet-status-row.nidhogg-armor-sheet .nidhogg-armor-sheet-bar {
  display: block;
  height: 5px;
  margin: 4px 0 2px;
  background: #1a1a1a;
  border: 1px solid #6a6a6a;
}
.sheet-status-row.nidhogg-armor-sheet .nidhogg-armor-sheet-bar i {
  display: block;
  height: 100%;
  background: #f4f4f4;
}
.sheet-status-row.nidhogg-armor-sheet.is-white b,
.sheet-status-row.nidhogg-armor-sheet.is-white .nidhogg-armor-sheet-bar i { color: #f4f4f4; }
.sheet-status-row.nidhogg-armor-sheet.is-white .nidhogg-armor-sheet-bar i { background: #f4f4f4; }
.sheet-status-row.nidhogg-armor-sheet.is-yellow b { color: #d8b84a; }
.sheet-status-row.nidhogg-armor-sheet.is-yellow .nidhogg-armor-sheet-bar i { background: #d8b84a; }
.sheet-status-row.nidhogg-armor-sheet.is-red b { color: #c44a4a; }
.sheet-status-row.nidhogg-armor-sheet.is-red .nidhogg-armor-sheet-bar i { background: #c44a4a; }
.nidhogg-skill-points { margin: 0 0 8px; font-size: 13px; color: #d7c9b0; }
.nidhogg-skill-points-overlay {
  position: absolute;
  z-index: 4;
  left: 2.6%;
  top: auto;
  bottom: 2.0%;
  padding: 6px 12px;
  color: #e8d7b4;
  font-size: calc(13px * var(--fs, 1));
  letter-spacing: .12em;
  line-height: 1.35;
  border: 1px solid rgba(210, 178, 118, .38);
  background: linear-gradient(180deg, rgba(18, 12, 10, .78), rgba(8, 5, 6, .72));
  box-shadow: 0 0 18px rgba(0, 0, 0, .45), inset 0 0 12px rgba(180, 120, 70, .08);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .85);
}
.nidhogg-spear-tree .nidhogg-skill-points-overlay {
  left: auto;
  right: 2.8%;
  top: auto;
  bottom: 2.0%;
  color: #d7ebe8;
  border-color: rgba(120, 190, 200, .34);
  background: linear-gradient(180deg, rgba(8, 16, 18, .8), rgba(4, 10, 12, .72));
  box-shadow: 0 0 18px rgba(0, 0, 0, .45), inset 0 0 12px rgba(70, 160, 180, .08);
}
.nidhogg-learn-skill { margin-top: 8px; }


/* t309: Nidhogg trees fill the sheet content area — no postage-stamp 16:9 inset. */
.character-sheet-modal.is-nidhogg-skill-tree .sheet-body,
.sheet-body.is-skill-tree:has(.nidhogg-skill-tree-tab) {
  align-items: stretch;
  justify-content: stretch;
  padding: 2px 0 4px;
}
.nidhogg-skill-tree-tab {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  gap: 0;
}
.nidhogg-skill-tree-tab .platinum-skill-tree-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  align-items: stretch;
  justify-content: stretch;
}
.nidhogg-skill-tree.nidhogg-blood-tree,
.nidhogg-skill-tree.nidhogg-spear-tree,
.platinum-skill-tree.nidhogg-skill-tree {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  margin: 0;
}
.nidhogg-skill-tree-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}
.nidhogg-skill-tree-edges line {
  fill: none;
  stroke-width: 1.15;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.nidhogg-blood-tree .nidhogg-skill-tree-edges line.is-dim,
.nidhogg-skill-tree.is-blood .nidhogg-skill-tree-edges line.is-dim {
  stroke: rgba(90, 28, 32, .42);
}
.nidhogg-blood-tree .nidhogg-skill-tree-edges line.is-lit,
.nidhogg-skill-tree.is-blood .nidhogg-skill-tree-edges line.is-lit {
  stroke: rgba(190, 72, 78, .88);
  filter: drop-shadow(0 0 3px rgba(190, 72, 78, .45));
}
.nidhogg-spear-tree .nidhogg-skill-tree-edges line.is-dim {
  stroke: rgba(28, 74, 88, .42);
}
.nidhogg-spear-tree .nidhogg-skill-tree-edges line.is-lit {
  stroke: rgba(78, 190, 214, .9);
  filter: drop-shadow(0 0 3px rgba(78, 190, 214, .45));
}
.nidhogg-skill-tree .skill-tree-node {
  width: 118px;
  min-height: 34px;
  padding: 5px 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.nidhogg-skill-tree .skill-tree-node-label {
  font-size: calc(10.5px * var(--fs, 1));
  letter-spacing: .03em;
}
.nidhogg-skill-tree .skill-tree-node-label small {
  margin-top: 1px;
  font-size: calc(9px * var(--fs, 1));
  opacity: .88;
}
.nidhogg-blood-tree .skill-tree-node.is-locked,
.nidhogg-skill-tree.is-blood .skill-tree-node.is-locked {
  background: rgba(22, 6, 8, .78);
  border-color: #3a181a;
  color: #7a5558;
  opacity: .72;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.nidhogg-spear-tree .skill-tree-node.is-locked {
  background: rgba(4, 16, 22, .78);
  border-color: #143842;
  color: #4d7380;
  opacity: .72;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.nidhogg-blood-tree .skill-tree-node.is-available,
.nidhogg-skill-tree.is-blood .skill-tree-node.is-available,
.nidhogg-blood-tree .skill-tree-node.is-locked.is-available,
.nidhogg-skill-tree.is-blood .skill-tree-node.is-locked.is-available {
  background: linear-gradient(180deg, rgba(92, 58, 18, .92), rgba(42, 22, 8, .9));
  border-color: #f0c46a;
  color: #ffe9b8;
  opacity: 1;
  box-shadow: 0 0 18px rgba(240, 170, 70, .55), 0 0 4px rgba(255, 210, 120, .7), inset 0 0 10px rgba(255, 190, 90, .16);
  animation: nidhogg-available-pulse-blood 1.8s ease-in-out infinite;
}
.nidhogg-spear-tree .skill-tree-node.is-available,
.nidhogg-spear-tree .skill-tree-node.is-locked.is-available {
  background: linear-gradient(180deg, rgba(18, 72, 78, .92), rgba(8, 34, 40, .9));
  border-color: #7ef0ff;
  color: #e7ffff;
  opacity: 1;
  box-shadow: 0 0 18px rgba(90, 230, 240, .55), 0 0 4px rgba(170, 250, 255, .7), inset 0 0 10px rgba(120, 240, 255, .16);
  animation: nidhogg-available-pulse-spear 1.8s ease-in-out infinite;
}
@keyframes nidhogg-available-pulse-blood {
  0%, 100% { box-shadow: 0 0 14px rgba(240, 170, 70, .42), 0 0 3px rgba(255, 210, 120, .55), inset 0 0 8px rgba(255, 190, 90, .12); }
  50% { box-shadow: 0 0 22px rgba(255, 190, 90, .72), 0 0 6px rgba(255, 230, 160, .85), inset 0 0 12px rgba(255, 200, 110, .22); }
}
@keyframes nidhogg-available-pulse-spear {
  0%, 100% { box-shadow: 0 0 14px rgba(90, 230, 240, .42), 0 0 3px rgba(170, 250, 255, .55), inset 0 0 8px rgba(120, 240, 255, .12); }
  50% { box-shadow: 0 0 22px rgba(120, 245, 255, .72), 0 0 6px rgba(200, 255, 255, .85), inset 0 0 12px rgba(150, 250, 255, .22); }
}
.nidhogg-blood-tree .skill-tree-node.is-learned,
.nidhogg-skill-tree.is-blood .skill-tree-node.is-learned,
.skill-tree-node.is-blood.is-learned {
  background: linear-gradient(180deg, #6a1a1e, #3f0c10);
  border-color: #c24a52;
  color: #ffe4e2;
  opacity: 1;
  animation: none;
  box-shadow: 0 0 16px rgba(190, 72, 78, .45), inset 0 0 10px rgba(255, 120, 120, .12);
}
.nidhogg-spear-tree .skill-tree-node.is-learned,
.skill-tree-node.is-spear.is-learned {
  background: linear-gradient(180deg, #136274, #0a3642);
  border-color: #5fd0e6;
  color: #e8fbff;
  opacity: 1;
  animation: none;
  box-shadow: 0 0 16px rgba(78, 190, 214, .45), inset 0 0 10px rgba(140, 230, 255, .12);
}
html.lang-en .nidhogg-skill-tree .skill-tree-node { width: 128px; }

/* In-game load modal (next to Save) */
.in-game-load-modal .in-game-load-slot-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: min(52vh, 52dvh, 420px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.in-game-load-slot {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  color: #dfd1bf;
  border: 1px solid rgba(220, 188, 130, 0.28);
  background: rgba(20, 16, 14, 0.72);
  border-radius: 6px;
  font: inherit;
}
.in-game-load-slot:hover {
  border-color: rgba(220, 188, 130, 0.55);
  color: var(--gold-bright);
}
.in-game-load-slot-label {
  font-size: calc(12px * var(--fs, 1));
  letter-spacing: 0.14em;
  color: var(--gold);
}
.in-game-load-slot-summary {
  font-size: calc(12px * var(--fs, 1));
  line-height: 1.55;
  color: #aaa097;
}


/* t313: Nidhogg attribute allocation + unspent-point portrait glow */
.sheet-stat-card .sheet-stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8e837b;
  font-size: calc(9px * var(--fs, 1));
  letter-spacing: .12em;
}
.nidhogg-main-attr-star {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  overflow: visible;
}
.nidhogg-main-attr-star polygon {
  fill: #e4c56a;
  stroke: #f3dd97;
  stroke-width: 0.7;
  filter: drop-shadow(0 0 3px rgba(232, 195, 106, .7));
}
.nidhogg-attr-points {
  margin: 2px 0 10px;
  color: var(--gold-bright);
  font: calc(13px * var(--fs, 1)) "Noto Serif SC", "Songti SC", Georgia, serif;
  letter-spacing: .08em;
}
.nidhogg-attr-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 7px 0 5px;
}
.nidhogg-attr-value-row b {
  margin: 0;
  display: block;
}
.nidhogg-attr-pending,
.sheet-stat-card span.nidhogg-attr-pending {
  display: inline;
  margin-left: 6px;
  color: var(--gold-bright);
  font-size: 0.72em;
  letter-spacing: .04em;
  vertical-align: middle;
}
.nidhogg-attr-alloc {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 0;
  flex: 0 0 auto;
}
.nidhogg-attr-alloc button {
  appearance: none;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  color: #ead9b0;
  border: 1px solid rgba(220, 197, 157, .38);
  background: rgba(28, 22, 20, .72);
  font: calc(11px * var(--fs, 1)) "Noto Serif SC", Georgia, serif;
  letter-spacing: .08em;
  cursor: pointer;
}
.nidhogg-attr-alloc button:hover:not(:disabled) {
  border-color: rgba(232, 195, 106, .8);
  color: var(--gold-bright);
  background: rgba(48, 36, 24, .85);
}
.nidhogg-attr-alloc button:disabled {
  opacity: .38;
  cursor: default;
}
.nidhogg-attr-alloc .nidhogg-attr-commit {
  min-width: 44px;
  letter-spacing: .14em;
}
.nidhogg-combat-alloc-hint,
.nidhogg-combat-learn-hint {
  margin-top: 6px;
  color: #c9897c;
  font: calc(11px * var(--fs, 1)) "Noto Serif SC", "Songti SC", Georgia, serif;
  letter-spacing: .08em;
  line-height: 1.45;
}
.nidhogg-skill-points-overlay .nidhogg-combat-learn-hint {
  margin-top: 4px;
  color: #e0b0a4;
  letter-spacing: .1em;
}
.portrait-frame.is-nidhogg-unspent-glow {
  box-shadow: inset 0 0 28px rgba(132, 16, 24, .55), 0 0 22px rgba(112, 10, 18, .42);
}
.portrait-frame.is-nidhogg-unspent-glow img {
  filter: saturate(.86) contrast(1.08) brightness(1.04);
}
.nidhogg-portrait-glow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.nidhogg-portrait-ecg {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 78%;
  height: 22%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  opacity: .96;
}
.nidhogg-portrait-ecg[hidden],
.nidhogg-portrait-ecg.is-hidden { display: none !important; }
.nidhogg-portrait-ecg svg { width: 100%; height: 100%; overflow: hidden; }
.nidhogg-portrait-ecg polyline {
  fill: none;
  stroke: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
}
.nidhogg-portrait-ecg.is-calm polyline {
  stroke: #f2f2f2;
  stroke-width: 1.6;
  filter: drop-shadow(0 0 3px rgba(242, 242, 242, .55));
  animation: nidhoggBeatCalm 1.4s ease-in-out infinite;
}
.nidhogg-portrait-ecg.is-wave polyline {
  stroke: #e6c84a;
  stroke-width: 1.7;
  filter: drop-shadow(0 0 4px rgba(230, 200, 74, .7));
  animation: nidhoggBeatWave 1.05s ease-in-out infinite;
}
.nidhogg-portrait-ecg.is-heat polyline {
  stroke: #d88ad8;
  stroke-width: 1.9;
  filter: drop-shadow(0 0 5px rgba(216, 138, 216, .8));
  animation: nidhoggBeatHeat .72s ease-in-out infinite;
}
.nidhogg-portrait-ecg.is-rut polyline {
  stroke: #8a1a1a;
  stroke-width: 2;
  filter: drop-shadow(0 0 5px rgba(138, 26, 26, .85));
  animation: nidhoggBeatRut .52s ease-in-out infinite;
}

/* t319/t225: Nidhogg portrait nameplate XP bar (gold frame + gold fill, EXP at left) */
.portrait-name .nidhogg-portrait-xp {
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  width: min(100%, 7.8em);
  pointer-events: none;
}
.portrait-name .nidhogg-portrait-xp[hidden] { display: none !important; }
.portrait-name .nidhogg-portrait-xp-label {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: calc(8px * var(--fs, 1));
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1;
  text-shadow: 0 0 4px rgba(10, 8, 6, .85);
}
.portrait-name .nidhogg-portrait-xp-track {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  height: 5px;
  border: 1px solid var(--gold);
  background: rgba(10, 8, 6, 0.62);
  box-shadow: inset 0 0 0 1px rgba(241, 212, 151, 0.08);
  overflow: hidden;
}
.portrait-name .nidhogg-portrait-xp-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b8904e 0%, var(--gold) 42%, var(--gold-bright) 100%);
  box-shadow: 0 0 6px rgba(241, 212, 151, 0.42);
}


.nidhogg-mat-name.is-red { color: #e4453a; }
.nidhogg-mat-name.is-orange { color: #f0a12b; }
.nidhogg-mat-name.is-purple { color: #c56bff; }
.nidhogg-mat-name.is-blue { color: #4aa3ff; }
.nidhogg-mat-name.is-white { color: #f4f4f4; }
.object-card p .nidhogg-mat-name.is-red { color: #e4453a; }
.object-card p .nidhogg-mat-name.is-orange { color: #f0a12b; }
.object-card p .nidhogg-mat-name.is-purple { color: #c56bff; }
.object-card p .nidhogg-mat-name.is-blue { color: #4aa3ff; }
.object-card p .nidhogg-mat-name.is-white { color: #f4f4f4; }
.choice-card.nidhogg-mat-sacrifice.is-red b { color: #e4453a; }
.choice-card.nidhogg-mat-sacrifice.is-orange b { color: #f0a12b; }
.choice-card.nidhogg-mat-sacrifice.is-purple b { color: #c56bff; }
.choice-card.nidhogg-mat-sacrifice.is-blue b { color: #4aa3ff; }
.choice-card.nidhogg-mat-sacrifice.is-white b { color: #f4f4f4; }

.modal.nidhogg-altar-material-modal { width: min(640px, 96vw); }
.nidhogg-altar-materials {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.nidhogg-mat-row {
  display: grid;
  grid-template-columns: minmax(5.5em, auto) 2.2em minmax(4.5em, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(214, 183, 127, .28);
  background: rgba(18, 14, 12, .55);
}
.nidhogg-mat-label { color: var(--ivory, #e8d5aa); letter-spacing: .06em; font-size: calc(13px * var(--fs, 1)); }
.nidhogg-mat-row.is-red .nidhogg-mat-label { color: #e4453a; }
.nidhogg-mat-row.is-orange .nidhogg-mat-label { color: #f0a12b; }
.nidhogg-mat-row.is-purple .nidhogg-mat-label { color: #c56bff; }
.nidhogg-mat-row.is-blue .nidhogg-mat-label { color: #4aa3ff; }
.nidhogg-mat-row.is-white .nidhogg-mat-label { color: #f4f4f4; }
.nidhogg-mat-count { color: #d8cbb8; text-align: right; font-variant-numeric: tabular-nums; }
.nidhogg-mat-qty {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 4px 8px;
  box-sizing: border-box;
  color: var(--ivory, #e8d5aa);
  border: 1px solid rgba(214, 183, 127, .4);
  background: rgba(8, 6, 8, .85);
  font: inherit;
}
.nidhogg-mat-row button {
  min-height: 32px;
  padding: 6px 12px;
  cursor: pointer;
}
.nidhogg-mat-row button:disabled { opacity: .45; cursor: default; }
@media (max-width: 640px) {
  .nidhogg-mat-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label count"
      "qty qty"
      "sacrifice craft";
  }
  .nidhogg-mat-label { grid-area: label; }
  .nidhogg-mat-count { grid-area: count; }
  .nidhogg-mat-qty { grid-area: qty; }
  .nidhogg-mat-row .modal-primary { grid-area: sacrifice; }
  .nidhogg-mat-row .modal-secondary { grid-area: craft; }
}
/* fog-embers-asset-type */

@media (max-width: 680px) {
  body.is-nidhogg-player .scene-area { --scene-pad-x: 14px; }
  .combat-actions.has-nidhogg-preselect { --nidhogg-action-w: 88px; --nidhogg-action-h: 50px; }
}
/* fog-embers-t222 */
/* fog-embers-t223 */
/* fog-embers-t225 */
/* fog-embers-t226 */
/* fog-embers-t228 */


@media (prefers-reduced-motion: reduce) {
  .nidhogg-preselect-empty {
    animation: nidhoggHintPulse 3.6s ease-in-out infinite !important;
  }
}

/* fog-embers-t277：尼德霍格祭坛献出 · 按钮 / 特效 / 记忆碎片 */

.choice-card.choice-nidhogg-blood {
  border-color: rgba(190, 36, 42, .75);
  background: linear-gradient(90deg, rgba(120, 16, 18, .55), rgba(42, 8, 10, .92));
  box-shadow: 0 0 16px rgba(180, 20, 28, .28), inset 0 0 18px rgba(255, 70, 70, .08);
}
.choice-card.choice-nidhogg-blood:hover {
  border-color: #ff5a55;
  background: linear-gradient(90deg, rgba(150, 22, 24, .65), rgba(52, 10, 12, .94));
}
.choice-card.choice-nidhogg-blood .choice-copy b { color: #ffb0aa; }
.choice-card.choice-nidhogg-blood .choice-copy small { color: #e39a96; }
.choice-card.choice-nidhogg-blood .choice-index { border-color: rgba(255, 110, 100, .6); color: #ff8b82; }

.choice-card.choice-nidhogg-mana {
  border-color: rgba(64, 130, 220, .75);
  background: linear-gradient(90deg, rgba(22, 42, 110, .55), rgba(8, 14, 42, .92));
  box-shadow: 0 0 16px rgba(60, 130, 255, .28), inset 0 0 18px rgba(120, 180, 255, .1);
}
.choice-card.choice-nidhogg-mana:hover {
  border-color: #7eb8ff;
  background: linear-gradient(90deg, rgba(28, 58, 140, .65), rgba(10, 18, 52, .94));
}
.choice-card.choice-nidhogg-mana .choice-copy b { color: #c4e0ff; }
.choice-card.choice-nidhogg-mana .choice-copy small { color: #9ab8e0; }
.choice-card.choice-nidhogg-mana .choice-index { border-color: rgba(120, 180, 255, .6); color: #8ec4ff; }

.choice-card.choice-nidhogg-essence,
.choice-card.choice-dragon-essence {
  border-color: rgba(220, 80, 160, .75);
  background: linear-gradient(90deg, rgba(120, 24, 80, .55), rgba(42, 8, 30, .92));
  box-shadow: 0 0 16px rgba(220, 70, 150, .3), inset 0 0 18px rgba(255, 140, 200, .1);
}
.choice-card.choice-nidhogg-essence:hover,
.choice-card.choice-dragon-essence:hover {
  border-color: #ff8fd0;
  background: linear-gradient(90deg, rgba(150, 30, 96, .65), rgba(52, 10, 36, .94));
}
.choice-card.choice-nidhogg-essence .choice-copy b,
.choice-card.choice-dragon-essence .choice-copy b { color: #ffc4e4; }
.choice-card.choice-nidhogg-essence .choice-copy small,
.choice-card.choice-dragon-essence .choice-copy small { color: #e8a6c8; }
.choice-card.choice-nidhogg-essence .choice-index,
.choice-card.choice-dragon-essence .choice-index { border-color: rgba(255, 140, 200, .65); color: #ff9ed0; }

.object-card:has(.jerk-gauge--dragon-essence) {
  border-color: rgba(220, 80, 160, .45);
  background: linear-gradient(180deg, rgba(48, 12, 32, .94), rgba(16, 6, 14, .96));
}
.jerk-gauge--dragon-essence .jerk-gauge-head b { color: #ffd0e8; letter-spacing: .12em; }
.jerk-gauge--dragon-essence .jerk-gauge-head span { color: #ffc0dc; }
.jerk-gauge--dragon-essence .jerk-gauge-track {
  background: rgba(28, 6, 20, .9);
  border-color: rgba(255, 130, 190, .5);
}
.jerk-gauge--dragon-essence .jerk-gauge-track i {
  background: linear-gradient(90deg, #9a2068, #ff6fb5 55%, #ffd0ea);
  box-shadow: 0 0 12px rgba(255, 90, 170, .85);
}
.jerk-heart--offering {
  color: #e8b070;
  text-shadow: 0 0 10px rgba(232, 160, 80, .9), 0 0 18px rgba(200, 60, 110, .55);
}

.hero-speech[data-mood="altar-essence"] {
  color: #4a1028;
  background: linear-gradient(180deg, rgba(255, 220, 230, .97), rgba(255, 190, 210, .96));
  border: 1px solid rgba(180, 60, 100, .45);
  box-shadow: 0 0 16px rgba(200, 50, 110, .45), 0 4px 14px rgba(0,0,0,.55);
  border-radius: 4px 12px 12px 12px;
}
.hero-speech[data-mood="altar-essence"]::before {
  border-bottom-color: rgba(255, 220, 230, .97);
}

.story-overlay.nidhogg-memory-overlay .story-kicker { color: #d4a070; }

/* 过去的记忆碎片 其一：半透明背景图铺满弹窗，不影响无背景的剧情弹窗 */
.story-overlay.nidhogg-memory-overlay .story-overlay-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.story-overlay.nidhogg-memory-overlay .story-overlay-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}
.story-overlay.nidhogg-memory-overlay.story-overlay--memory-bg > :not(.story-overlay-bg) {
  position: relative;
  z-index: 1;
}

.story-overlay.nidhogg-festival-intro-overlay .story-overlay-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.story-overlay.nidhogg-festival-intro-overlay .story-overlay-bg-media {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  pointer-events: none;
}
.story-overlay.nidhogg-festival-intro-overlay .story-overlay-bg-media::before {
  content: "";
  position: absolute;
  inset: -14%;
  background: var(--nidhogg-festival-intro-bg) center / cover no-repeat;
  filter: blur(36px) saturate(1.05);
  transform: scale(1.05);
}
.story-overlay.nidhogg-festival-intro-overlay .story-overlay-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  pointer-events: none;
  user-select: none;
}
.story-overlay.nidhogg-festival-intro-overlay .story-overlay-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 3, 8, .55), rgba(8, 4, 10, .42) 45%, rgba(6, 3, 8, .62));
  pointer-events: none;
}
.story-overlay.nidhogg-festival-intro-overlay.story-overlay--festival-intro-bg > :not(.story-overlay-bg) {
  position: relative;
  z-index: 1;
}

.story-foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
}
.story-foot-actions .story-portal-btn {
  min-width: 160px;
  padding: 10px 22px;
  font: inherit;
  letter-spacing: .12em;
  cursor: pointer;
  border-radius: 2px;
}
.story-foot-actions .story-portal-enter {
  color: #2a1208;
  border: 1px solid rgba(232, 180, 110, .7);
  background: linear-gradient(180deg, #f0c888, #c47a3a);
  box-shadow: 0 0 16px rgba(220, 140, 60, .35);
}
.story-foot-actions .story-portal-enter:hover { filter: brightness(1.08); }
.story-foot-actions .story-portal-close {
  color: #e8d8c8;
  border: 1px solid rgba(200, 170, 140, .4);
  background: rgba(20, 14, 16, .85);
}
.story-foot-actions .story-portal-close:hover { border-color: rgba(232, 200, 160, .7); }

/* 全屏受伤特效：恰好 2 秒后收干净 */
.nidhogg-altar-injury-fx {
  position: fixed;
  inset: 0;
  z-index: 260;
  overflow: hidden;
  pointer-events: auto;
  animation: nidhoggAltarFxLife 2s ease-in-out forwards;
}
.nidhogg-altar-injury-fx.is-done { pointer-events: none; opacity: 0; }
.nidhogg-altar-injury-fx > * { position: absolute; inset: 0; pointer-events: none; }

@keyframes nidhoggAltarFxLife {
  0% { opacity: 0; }
  10% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

/* —— 龙血：网格样红色，无掉落物 —— */
.nidhogg-altar-injury-fx.is-blood {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(110, 8, 12, .28) 0%, rgba(50, 0, 6, .58) 46%, rgba(8, 0, 0, .82) 100%);
}
.nidhogg-altar-injury-fx.is-blood .fx-vignette {
  box-shadow:
    inset 0 0 120px 24px rgba(80, 0, 0, .85),
    inset 0 0 220px 80px rgba(20, 0, 0, .7);
  background: radial-gradient(circle at 50% 40%, transparent 22%, rgba(90, 0, 0, .32) 70%, rgba(20, 0, 0, .7) 100%);
}
.nidhogg-altar-injury-fx.is-blood .fx-grid {
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(210, 28, 32, 0) 0 21px,
      rgba(210, 28, 32, .55) 22px,
      rgba(210, 28, 32, .55) 23px,
      rgba(210, 28, 32, 0) 24px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(170, 16, 20, 0) 0 21px,
      rgba(180, 18, 22, .48) 22px,
      rgba(180, 18, 22, .48) 23px,
      rgba(180, 18, 22, 0) 24px
    );
  background-size: 100% 100%;
  animation: nidhoggBloodGrid 2s ease-in-out forwards;
}
.nidhogg-altar-injury-fx.is-blood .fx-pulse {
  background: radial-gradient(circle at 50% 46%, rgba(255, 40, 40, .32) 0 8%, rgba(160, 0, 8, .14) 26%, transparent 60%);
  animation: nidhoggBloodPulse 2s ease-in-out forwards;
  mix-blend-mode: screen;
}

@keyframes nidhoggBloodGrid {
  0% { opacity: 0; }
  16% { opacity: 1; }
  82% { opacity: .95; }
  100% { opacity: 0; }
}
@keyframes nidhoggBloodPulse {
  0%, 100% { opacity: 0; transform: scale(.92); }
  18% { opacity: .8; }
  40% { opacity: .35; transform: scale(1.04); }
  58% { opacity: .85; transform: scale(1); }
  80% { opacity: .3; }
}

/* —— 魔力：光点推进变大后消失，无线段、无符号 —— */
.nidhogg-altar-injury-fx.is-mana {
  background:
    radial-gradient(ellipse at 50% 44%, rgba(30, 70, 160, .22) 0%, rgba(8, 20, 60, .55) 48%, rgba(2, 6, 24, .8) 100%);
}
.nidhogg-altar-injury-fx.is-mana .fx-vignette {
  box-shadow:
    inset 0 0 120px 24px rgba(10, 30, 90, .85),
    inset 0 0 220px 80px rgba(2, 8, 30, .72);
  background: radial-gradient(circle at 50% 42%, transparent 18%, rgba(20, 50, 140, .32) 68%, rgba(2, 8, 30, .7) 100%);
}
.nidhogg-altar-injury-fx.is-mana .fx-orbs {
  inset: 0;
}
.nidhogg-altar-injury-fx.is-mana .fx-orbs i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(240, 250, 255, .98) 0 18%, rgba(160, 210, 255, .85) 32%, rgba(70, 140, 255, .35) 58%, transparent 72%);
  box-shadow:
    0 0 16px 6px rgba(120, 190, 255, .55),
    0 0 36px 14px rgba(50, 120, 255, .28);
  transform: translate(-50%, -50%) scale(.12);
  opacity: 0;
  animation: nidhoggManaOrb var(--dur, 1.2s) ease-out forwards;
  animation-delay: var(--d, 0s);
  mix-blend-mode: screen;
}
.nidhogg-altar-injury-fx.is-mana .fx-pulse {
  background: radial-gradient(circle at 50% 46%, rgba(120, 190, 255, .36) 0 8%, rgba(40, 90, 200, .12) 26%, transparent 60%);
  animation: nidhoggManaPulse 2s ease-in-out forwards;
  mix-blend-mode: screen;
}

@keyframes nidhoggManaOrb {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.12);
  }
  10% {
    opacity: 1;
    transform: translate(calc(-50% + var(--tx) * .15), calc(-50% + var(--ty) * .15)) scale(.55);
  }
  55% {
    opacity: .95;
    transform: translate(calc(-50% + var(--tx) * .7), calc(-50% + var(--ty) * .7)) scale(calc(var(--sc) * .75));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(var(--sc));
  }
}
@keyframes nidhoggManaPulse {
  0%, 100% { opacity: 0; transform: scale(.9); }
  16% { opacity: .7; }
  42% { opacity: .3; transform: scale(1.06); }
  64% { opacity: .75; transform: scale(1); }
  84% { opacity: .25; }
}

/* fog-embers-t280 · 青年黑龙体型较小 */
.enemy-figure.is-youth-dragon .enemy-portrait {
  transform: scale(0.82);
  transform-origin: bottom center;
}

/* fog-embers-t407 · 隐秘 黑龙祭典挑战 其一 · 淫欲温泉 */
.enemy-speech.is-festival-invite {
  max-width: min(440px, 260%);
  white-space: pre-line;
}
.enemy-speech.is-festival-invite .enemy-speech-text {
  white-space: pre-line;
  line-height: 1.65;
}
.festival-spring-rig,
.festival-pending-rig,
.festival-impact-rig {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}
.festival-spring-rig[hidden],
.festival-pending-rig[hidden],
.festival-impact-rig[hidden] { display: none; }
.festival-illust {
  position: absolute;
  left: 4%;
  top: 22%;
  height: 50%;
  aspect-ratio: 2 / 3;
  margin: 0;
  overflow: hidden;
  border: 1px dashed rgba(255, 140, 200, .6);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(40, 8, 28, .72), rgba(14, 3, 10, .82));
  box-shadow: 0 0 22px rgba(255, 105, 180, .18), inset 0 0 30px rgba(255, 105, 180, .08);
  pointer-events: none;
}
.festival-illust img,
.festival-illust video,
.festival-illust-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.festival-illust.is-empty img,
.festival-illust.is-empty video,
.festival-illust.is-empty .festival-illust-video,
.festival-illust img:not([src]),
.festival-illust img[src=""],
.festival-illust img[hidden] {
  display: none;
}
.festival-spring-rig {
  --festival-thought-bg:
    linear-gradient(180deg, rgba(255, 226, 234, .14), transparent 42%),
    linear-gradient(165deg, rgba(54, 16, 34, .74) 0%, rgba(26, 8, 18, .80) 55%, rgba(14, 4, 10, .84) 100%);
  --festival-thought-border: 1px solid rgba(232, 176, 198, .38);
  --festival-thought-shadow:
    0 12px 28px rgba(6, 0, 8, .4),
    0 2px 8px rgba(6, 0, 8, .24),
    inset 0 1px 0 rgba(255, 228, 236, .16),
    inset 0 -12px 18px rgba(10, 2, 8, .16);
}
.festival-thought {
  position: absolute;
  /* Cluster sits in the mid-upper mist/waterfall (red-box region), right of the empty left frame
     and left of Nidhogg's head (~58–66% / 12–24%). Do not park the balloon over the left frame. */
  left: 26%;
  top: 23%;
  width: min(360px, 22%);
  max-width: 24%;
  max-height: 38%;
  overflow: visible;
  padding: 15px 20px 16px;
  color: #f3d4e2;
  font: 500 calc(15px * var(--fs, 1)) "Songti SC", "Songti SC Regular", "Noto Serif SC", "STSong", Georgia, serif;
  line-height: 1.75;
  letter-spacing: .05em;
  text-align: left;
  pointer-events: none;
  z-index: 9;
  filter: none;
  border: var(--festival-thought-border);
  border-radius: 18px;
  background: var(--festival-thought-bg);
  box-shadow: var(--festival-thought-shadow);
  -webkit-backdrop-filter: blur(12px) saturate(1.06);
  backdrop-filter: blur(12px) saturate(1.06);
  opacity: 0;
}
.festival-thought.is-arriving {
  animation: festival-thought-arrive .64s cubic-bezier(.22, .82, .28, 1) both;
  animation-delay: .04s;
}
.festival-thought[hidden] { display: none; }
/* Tiny glass sibling bubbles of the same thought balloon, leading from the temple. */
.festival-thought-lead {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}
.festival-thought-lead[hidden] { display: none; }
.festival-thought-lead i {
  position: absolute;
  border-radius: 50%;
  border: var(--festival-thought-border);
  background: var(--festival-thought-bg);
  box-shadow: var(--festival-thought-shadow);
  -webkit-backdrop-filter: blur(8px) saturate(1.04);
  backdrop-filter: blur(8px) saturate(1.04);
  opacity: 0;
  transform: scale(.88);
}
/* Smallest, still at the left temple / hairline of the background figure. */
.festival-thought-lead i:nth-child(1) { width: 8px; height: 8px; left: 55.5%; top: 16.5%; }
/* Mid-size, a short step down and left toward the balloon in the red-box region. */
.festival-thought-lead i:nth-child(2) { width: 12px; height: 12px; left: 51%; top: 20%; }
/* Largest lead bubble, just before the main balloon's right edge. */
.festival-thought-lead i:nth-child(3) { width: 17px; height: 17px; left: 46.5%; top: 23%; }
/* The cluster fades in together: only a whisper of head-to-balloon order, no staged pop. */
.festival-thought-lead.is-on i {
  animation: festival-thought-lead-in .64s cubic-bezier(.22, .82, .28, 1) both;
}
.festival-thought-lead.is-on i:nth-child(1) { animation-delay: 0s; }
.festival-thought-lead.is-on i:nth-child(2) { animation-delay: .03s; }
.festival-thought-lead.is-on i:nth-child(3) { animation-delay: .05s; }
@keyframes festival-thought-lead-in {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes festival-thought-arrive {
  from { opacity: 0; transform: scale(.97) translate(5px, 2px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .festival-thought-lead.is-on i,
  .festival-thought.is-arriving {
    animation-delay: 0s;
    animation-duration: .01s;
  }
}
.festival-title-burst {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(40, 6, 22, .18), rgba(0, 0, 0, .08) 62%, transparent 78%);
}
.festival-title-burst[hidden] { display: none; }
.festival-title-burst span {
  color: #ffd6ea;
  font: 700 calc(64px * var(--fs, 1)) "Songti SC", "Noto Serif SC", "STSong", serif;
  letter-spacing: 0.28em;
  text-shadow: 0 0 24px rgba(255, 120, 180, .65), 0 2px 12px rgba(0, 0, 0, .55);
  animation: festival-title-in .6s ease-out both;
}
.festival-title-burst span:nth-child(2) { animation-delay: .08s; }
.festival-title-burst span:nth-child(3) { animation-delay: .16s; }
.festival-title-burst span:nth-child(4) { animation-delay: .24s; }
@keyframes festival-title-in {
  from { opacity: 0; transform: translateY(12px) scale(.94); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}
.festival-gauges {
  position: absolute;
  left: 3%;
  bottom: 7%;
  width: min(250px, 24%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 8;
}
.festival-gauge { display: grid; grid-template-columns: 2.4em 1fr 2.2em; gap: 6px; align-items: center; }
.festival-gauge-label {
  color: #f0c4d8;
  font-size: calc(11px * var(--fs, 1));
  letter-spacing: .08em;
}
.festival-gauge-value {
  color: #ffe8f4;
  font-size: calc(11px * var(--fs, 1));
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.festival-gauge-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(20, 6, 12, .72);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .45);
}
.festival-gauge-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: inherit;
}
.festival-gauge.is-desire .festival-gauge-fill {
  background: linear-gradient(90deg, #9a2458, #ff6ea3);
}
.festival-gauge.is-sanity .festival-gauge-fill {
  background: linear-gradient(90deg, #3a5c9a, #8ec4ff);
}
.festival-gauge.is-ejac .festival-gauge-fill {
  background: linear-gradient(90deg, #6a2a16, #e08a3a);
}
.festival-gold-line,
.festival-ejac-mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  z-index: 2;
  pointer-events: none;
  transform: translateX(-50%);
}
.festival-gold-line {
  background: #e7c56a;
  box-shadow: 0 0 6px #f0d48a;
}
.festival-gold-line.is-shattered,
.festival-gauge.is-sanity.is-shattered .festival-gold-line {
  background: #6a2a2a;
  box-shadow: none;
  opacity: .55;
  height: 4px;
  top: 3px;
  bottom: auto;
  width: 10px;
  clip-path: polygon(0 40%, 30% 0, 45% 60%, 70% 10%, 100% 55%, 80% 100%, 40% 70%, 0 100%);
}
.festival-ejac-mark { background: rgba(255, 220, 170, .9); }
.festival-gauge.is-ejac.is-over .festival-gauge-fill {
  background: linear-gradient(90deg, #a03020, #ff8a4a);
}
.festival-actions {
  position: absolute;
  left: 52%;
  bottom: 7%;
  width: min(460px, 44%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  pointer-events: auto;
  z-index: 8;
}
.festival-btn-calm,
.festival-btn-tempt,
.festival-leave-btn,
.festival-ejac-btn {
  min-height: 46px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  font: 600 calc(14px * var(--fs, 1)) "Songti SC", "Noto Serif SC", serif;
  letter-spacing: .08em;
  transition: transform .15s ease, opacity .2s ease, filter .2s ease;
}
.festival-btn-calm {
  color: #3a2a08;
  border: 1px solid rgba(232, 200, 120, .75);
  background: linear-gradient(180deg, #f3e0a8, #c9a24a);
  box-shadow: 0 0 12px rgba(232, 196, 110, .28);
}
.festival-btn-tempt {
  color: #fff0f6;
  border: 1px solid rgba(255, 130, 180, .75);
  background: linear-gradient(180deg, #d24a86, #7a183e);
  box-shadow: 0 0 16px rgba(255, 105, 180, .35);
  animation: festival-tempt-pulse 1.15s ease-in-out infinite;
}
.festival-btn-calm:disabled,
.festival-btn-tempt:disabled,
.festival-ejac-btn:disabled {
  cursor: default;
  opacity: .45;
  filter: grayscale(.15);
  animation: none;
  transform: none;
}
.festival-btn-calm:not(:disabled):hover,
.festival-btn-tempt:not(:disabled):hover,
.festival-leave-btn:hover,
.festival-ejac-btn:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
@keyframes festival-tempt-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 105, 180, .28); filter: brightness(1); }
  50% { box-shadow: 0 0 22px rgba(255, 140, 200, .7); filter: brightness(1.12); }
}
.festival-leave-btn {
  grid-column: 1 / -1;
  color: #f8e7c8;
  border: 1px solid rgba(232, 200, 130, .7);
  background: linear-gradient(180deg, rgba(90, 50, 20, .92), rgba(30, 14, 8, .95));
}
.festival-ejac-btn {
  position: absolute;
  left: 3%;
  bottom: calc(7% + 92px);
  z-index: 9;
  pointer-events: auto;
  color: #fff4e8;
  border: 1px solid rgba(255, 170, 90, .85);
  background: linear-gradient(180deg, #c44a22, #6a1808);
  box-shadow: 0 0 16px rgba(255, 120, 40, .45);
}
.festival-ejac-btn[hidden] { display: none; }
.festival-pending-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 80%);
  padding: 28px 32px 32px;
  pointer-events: auto;
  color: #f3d7c4;
  border: 1px solid rgba(232, 180, 110, .4);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(28, 12, 10, .88), rgba(10, 4, 4, .92));
  box-shadow: 0 0 28px rgba(0, 0, 0, .45);
}
.festival-pending-kicker {
  margin: 0 0 8px;
  color: #e0b47a;
  letter-spacing: .18em;
  font-size: calc(12px * var(--fs, 1));
}
.festival-pending-panel h2 {
  margin: 0 0 14px;
  color: #ffe7c8;
  font: 700 calc(26px * var(--fs, 1)) "Songti SC", "Noto Serif SC", serif;
  letter-spacing: .16em;
}
.festival-pending-body {
  margin: 0;
  line-height: 1.8;
  font-size: calc(15px * var(--fs, 1));
}

.festival-impact-rig {
  --festival-thought-bg:
    linear-gradient(180deg, rgba(255, 226, 234, .14), transparent 42%),
    linear-gradient(165deg, rgba(54, 16, 34, .74) 0%, rgba(26, 8, 18, .80) 55%, rgba(14, 4, 10, .84) 100%);
  --festival-thought-border: 1px solid rgba(232, 176, 198, .38);
  --festival-thought-shadow:
    0 12px 28px rgba(6, 0, 8, .4),
    0 2px 8px rgba(6, 0, 8, .24),
    inset 0 1px 0 rgba(255, 228, 236, .16),
    inset 0 -12px 18px rgba(10, 2, 8, .16);
}
.festival-impact-rig .festival-thought {
  left: 36%;
  top: 18%;
  width: min(360px, 28%);
  max-width: 32%;
}
.festival-impact-rig .festival-thought-lead { display: none; }
/* fog-embers-t470: festival character lines use the EDE-12 / dodge-pink
   portrait-side dialogue bubble. Never show the mid-scene dark glass overlay. */
.festival-spring-rig .festival-thought,
.festival-spring-rig .festival-thought-lead,
.festival-impact-rig .festival-thought,
.festival-impact-rig .festival-thought-lead {
  display: none !important;
}
.festival-hero-speech {
  position: absolute;
  z-index: 6;
  padding: 7px 10px;
  color: #5a1033;
  border-radius: 9px;
  background: rgba(255, 205, 226, .97);
  box-shadow: 0 0 14px rgba(255, 120, 180, .5), 0 4px 14px rgba(0, 0, 0, .55);
  font-size: calc(12px * var(--fs, 1));
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .02em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(.92);
  transition: opacity .18s ease, transform .18s ease;
  width: max-content;
  max-width: 80%;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}
.festival-hero-speech.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.festival-hero-speech[hidden] { display: none; }
/* Triangle tail points up at the standing portrait, same geometry as .hero-speech. */
.festival-hero-speech::before {
  content: "";
  position: absolute;
  top: -7px;
  left: var(--tail-x, 50%);
  margin-left: -6px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom: 8px solid rgba(255, 205, 226, .97);
}
@media (prefers-reduced-motion: reduce) {
  .festival-hero-speech { transition: none; transform: none; }
}
@media (max-width: 900px) {
  .festival-hero-speech {
    font-size: calc(11px * var(--fs, 1));
    padding: 6px 8px;
    max-width: 86%;
  }
}
.festival-impact-illust {
  z-index: 9;
}
.festival-impact-illust[hidden] { display: none; }
.festival-impact-stage {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  aspect-ratio: 848 / 1062;
  transform: translateX(-50%);
  overflow: hidden;
}
.festival-impact-canal,
.festival-impact-thrust-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.festival-impact-thrust-video {
  z-index: 1;
}
.festival-impact-thrust-video[hidden] { display: none; }
.festival-impact-cock {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  display: none;
}
.festival-impact-cock[hidden] { display: none; }
.festival-impact-array[hidden] { display: none; }
.festival-impact-cock {
  transform: translateY(56%);
  will-change: transform;
}
.festival-impact-stage.is-thrusting .festival-impact-cock {
  animation: festival-impact-thrust .42s ease-out;
}
.festival-impact-stage.is-shattered .festival-impact-cock,
.festival-impact-cock.is-deep {
  transform: translateY(0);
  animation: none;
}
@keyframes festival-impact-thrust {
  0% { transform: translateY(56%); }
  48% { transform: translateY(8%); }
  100% { transform: translateY(26%); }
}
.festival-impact-array {
  position: absolute;
  left: 38.8%;
  top: 15.4%;
  width: 23.3%;
  height: 23.4%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, var(--impact-array-color, #2a6cff) 0%, rgba(42, 108, 255, 0) 72%);
  box-shadow: 0 0 16px var(--impact-array-color, #2a6cff);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
  opacity: .92;
}
.festival-impact-array.is-shaking {
  animation: festival-impact-array-shake .28s ease-out;
}
.festival-impact-array.is-shattered,
.festival-impact-stage.is-shattered .festival-impact-array {
  opacity: 0;
  box-shadow: none;
  transition: opacity .28s ease;
}
@keyframes festival-impact-array-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -2px); }
  75% { transform: translate(-1px, 2px); }
}
.festival-impact-shatter {
  position: absolute;
  left: 36%;
  top: 12%;
  width: 30%;
  height: 28%;
  background:
    linear-gradient(115deg, transparent 46%, rgba(255, 230, 240, .7) 47%, transparent 48%),
    linear-gradient(70deg, transparent 52%, rgba(255, 220, 180, .55) 53%, transparent 54%),
    linear-gradient(20deg, transparent 40%, rgba(255, 240, 245, .45) 41%, transparent 43%);
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
}
.festival-impact-shatter[hidden] { display: none; }
.festival-impact-tentacles[hidden] { display: none; }
.festival-impact-actions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.festival-impact-approach-row {
  position: absolute;
  left: 50%;
  top: 66%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 14px;
  pointer-events: auto;
  align-items: center;
}
.festival-impact-mid-approach-row {
  position: absolute;
  left: 61%;
  top: 74%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 14px;
  pointer-events: auto;
  align-items: center;
  z-index: 11;
}
.festival-impact-approach-btn,
.festival-impact-prep-btn,
.festival-impact-rect-btn {
  min-height: 46px;
  min-width: 148px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 8px;
  font: 600 calc(14px * var(--fs, 1)) "Songti SC", "Noto Serif SC", serif;
  letter-spacing: .08em;
  pointer-events: auto;
  transition: transform .15s ease, opacity .2s ease, filter .2s ease;
}
.festival-impact-approach-btn {
  color: #fff0f6;
  border: 1px solid rgba(255, 130, 180, .75);
  background: linear-gradient(180deg, #d24a86, #7a183e);
  box-shadow: 0 0 16px rgba(255, 105, 180, .35);
}
.festival-impact-prep-btn {
  color: #3a2a08;
  border: 1px solid rgba(232, 200, 120, .75);
  background: linear-gradient(180deg, #f3e0a8, #c9a24a);
  box-shadow: 0 0 12px rgba(232, 196, 110, .28);
}
.festival-impact-approach-btn:disabled {
  cursor: default;
  opacity: .45;
  filter: grayscale(.15);
}
.festival-impact-approach-btn:not(:disabled):hover,
.festival-impact-prep-btn:hover,
.festival-impact-rect-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.festival-impact-thrust-btn {
  position: absolute;
  left: 36.5%;
  top: 53.5%;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid rgba(255, 170, 210, .9);
  background:
    radial-gradient(circle at 50% 42%, #f7b6d0 0%, #d24a86 55%, #7a183e 100%);
  color: #fff;
  font: 700 calc(18px * var(--fs, 1)) "Songti SC", "Noto Serif SC", serif;
  letter-spacing: .12em;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 22px rgba(255, 105, 180, .45), inset 0 0 12px rgba(255, 230, 240, .25);
  overflow: visible;
  z-index: 11;
  transform: translate(-50%, -50%);
}
.festival-impact-thrust-btn:hover { filter: brightness(1.08); }
.festival-impact-thrust-label { position: relative; z-index: 2; }
.festival-impact-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 170, 210, .85);
  pointer-events: none;
  animation: festival-impact-ring-in 1.15s linear infinite;
}
.festival-impact-ring:nth-child(2) { animation-delay: -0.38s; }
.festival-impact-ring:nth-child(3) { animation-delay: -0.76s; }
@keyframes festival-impact-ring-in {
  0% { transform: scale(1.55); opacity: .85; }
  100% { transform: scale(0.35); opacity: 0; }
}
.festival-impact-aftermath {
  position: absolute;
  left: 44%;
  top: 50%;
  transform: translate(-10%, -50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
.festival-impact-rect-btn.is-withdraw {
  color: #f8e7c8;
  border: 1px solid rgba(232, 200, 130, .7);
  background: linear-gradient(180deg, rgba(90, 50, 20, .92), rgba(30, 14, 8, .95));
}
.festival-impact-rect-btn.is-enjoy {
  color: #fff0f6;
  border: 1px solid rgba(255, 130, 180, .75);
  background: linear-gradient(180deg, #d24a86, #7a183e);
}
.nidhogg-festival-impact-intro-overlay .story-page {
  background: linear-gradient(180deg, rgba(28, 12, 10, .9), rgba(10, 4, 4, .94));
}
@media (max-width: 900px) {
  .festival-impact-approach-row { top: 72%; width: 92%; left: 50%; }
  .festival-impact-mid-approach-row { left: 61%; top: 74%; }
  .festival-impact-thrust-btn { left: 36.5%; top: 53.5%; transform: translate(-50%, -50%); }
  .festival-impact-aftermath { left: 50%; transform: translate(-50%, -50%); width: 70%; }
  .festival-impact-rig .festival-thought { left: 28%; width: min(52%, 280px); max-width: 56%; }
}
@media (prefers-reduced-motion: reduce) {
  .festival-impact-ring,
  .festival-impact-stage.is-thrusting .festival-impact-cock,
  .festival-impact-array.is-shaking {
    animation: none;
  }
}

@media (max-width: 900px) {
  .festival-illust { left: 3%; top: 12%; height: 40%; }
  .festival-actions { left: 4%; width: 92%; bottom: 4%; }
  .festival-gauges { width: 46%; }
  .festival-thought { left: 24%; width: min(42%, 280px); max-width: 46%; top: 20%; bottom: auto; }
  .festival-thought-lead i:nth-child(1) { left: 56%; top: 17%; }
  .festival-thought-lead i:nth-child(2) { left: 50%; top: 19.5%; }
  .festival-thought-lead i:nth-child(3) { left: 45%; top: 22%; }
  .festival-title-burst span { font-size: calc(40px * var(--fs, 1)); letter-spacing: .16em; }
}

/* Short viewports (phones/tablets, itch iframe): tighten modal/story chrome so
   inner scrollers with 100dvh / max-height bounds can actually move. */
@media (max-height: 700px) {
  .modal-backdrop { padding: 12px; }
  .modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .story-overlay {
    padding: 44px 16px 16px;
  }
  .platinum-intro-modal .platinum-intro-story,
  .nidhogg-intro-modal .platinum-intro-story,
  .nidhogg-intro-modal .nidhogg-intro-story {
    max-height: min(48vh, 48dvh, 420px);
  }
}


/* =============================================================================
   t431u: portable UI from itch-mobile (not a phone-only layout).
   - GAM-18: hide unused top-bar turn widget if the markup is still present
   - D20 rail collapse (desktop/landscape-friendly)
   - t418: unclip combat skill flyouts; keep them inside the mid frame
   - t416 (portable subset): mid-stage controls stay inside the mid frame
   - short-viewport modal/story scroll tightening
   Do not treat itch-mobile-layout.js / is-mobile-fit as the only layout.
   ============================================================================= */

/* Hide the unused top-bar run-turn widget (state.turn). Keep 身后腐化迷雾. */
.summary-item:has(#turnLabel),
#turnLabel { display: none !important; }

.status-chip[title] { cursor: help; }

/* D20 rail collapse toggle — hidden until the desktop-like stage layout applies. */
.dice-rail-toggle { display: none; }
.dice-history-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 8px;
}

@media (orientation: landscape) and (min-width: 560px), (min-width: 901px) {
  .dice-rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 2px 8px;
    color: #cfc3b4;
    border: 1px solid rgba(220, 198, 160, 0.28);
    background: rgba(255, 255, 255, 0.04);
    font-size: calc(10px * var(--fs, 1));
    letter-spacing: 0.08em;
    cursor: pointer;
  }
  .dice-rail-toggle:hover,
  .dice-rail-toggle:focus-visible {
    color: var(--gold-bright);
    border-color: rgba(220, 188, 130, 0.48);
  }
  .dice-rail-toggle-expand { display: none; }
  .dice-history-rail.is-collapsed .dice-rail-toggle-collapse { display: none; }
  .dice-history-rail.is-collapsed .dice-rail-toggle-expand { display: inline; }

  .dungeon-stage.is-dice-rail-collapsed {
    grid-template-columns: 92px minmax(0, 1fr) 56px;
  }
  .dice-history-rail.is-collapsed {
    min-width: 0;
    width: auto;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    justify-content: flex-start;
    align-items: stretch;
  }
  .dice-history-rail.is-collapsed .dice-history-heading {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 8px 2px 10px;
    box-sizing: border-box;
  }
  .dice-history-rail.is-collapsed .dice-rail-title {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.08em;
    font-size: 11px;
    line-height: 1.15;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    width: auto;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
  }
  .dice-history-rail.is-collapsed .dice-rail-toggle {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    margin: 0;
    padding: 4px 2px;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
  }
  .dice-history-rail.is-collapsed .dice-readout,
  .dice-history-rail.is-collapsed small {
    display: none;
  }
}

@media (orientation: landscape) and (min-width: 560px) and (max-width: 900px) {
  .dungeon-stage.is-dice-rail-collapsed {
    grid-template-columns: 64px minmax(0, 1fr) 52px;
  }
}

/* --- t418: unclip combat skill flyouts; keep them inside the mid frame --- */
.dungeon-stage .combat-layer,
.dungeon-stage:not([data-room="altar"]) .combat-layer,
.dungeon-stage[data-room="altar"] .combat-layer {
  overflow: visible;
}

.dungeon-stage .combat-flyout {
  z-index: 30;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto;
}

.dungeon-stage .combat-skill-bar {
  position: relative;
  z-index: 23;
  overflow: visible;
}

.dungeon-stage .combat-actions {
  overflow: visible;
  pointer-events: auto;
  z-index: 23;
}
.dungeon-stage .combat-actions .combat-button {
  position: relative;
  z-index: 23;
  pointer-events: auto;
  flex-shrink: 0;
}

/* Mid-frame clip stays so the flyout cannot cover the top bar or bottom HUD.
   Do not put overflow-x:auto/hidden on .combat-layer; that forces overflow-y
   to auto and clips the upward flyout. */
.dungeon-stage .scene-area {
  overflow: hidden;
}
.scene-area:has(.combat-flyout) {
  overflow: visible;
}

/* Mid-stage interactive rows stay under the art, never under the HUD. */
.dungeon-stage .choice-layer,
.dungeon-stage .combat-layer,
.dungeon-stage .combat-actions,
.dungeon-stage .altar-object-stack,
.dungeon-stage .essence-offering-buttons {
  position: relative;
  z-index: 22;
  max-width: 100%;
  box-sizing: border-box;
  pointer-events: auto;
}

/* Rust-casket: drop the negative translateY that lifted struggle buttons
   out of the mid frame. */
.dungeon-stage[data-room="rustCasket"] .choice-layer.rust-casket-actions {
  margin-bottom: 0 !important;
  transform: none !important;
  max-height: min(42%, 200px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 23;
  pointer-events: auto;
}

/* Short viewports: tighten modal/story chrome so inner scrollers can move. */
@media (max-height: 700px) {
  .modal-backdrop { padding: 12px; }
  .modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .story-overlay {
    padding: 36px clamp(16px, 5vw, 80px) 20px;
  }
  .story-page,
  .story-overlay .story-body {
    overscroll-behavior: contain;
  }
}


/* =============================================================================
   t433u: phone landscape 1280x720 design-frame (from live itch-mobile).
   Wrappers are inert on desktop. html.is-mobile-fit is applied only when
   itch-mobile-layout.js detects a phone AND the viewport is landscape.
   Portrait is not force-rotated. Desktop/laptop stay 1:1.
   Surgical merge: is-mobile-fit / mobile-fit-* rules plus --mid-frame-scale
   support. General desktop/festival/Nidhogg rules from the itch-mobile
   stylesheet were not copied. t431 portable UI (D20, flyout visible,
   scene-area overflow:hidden, short-viewport menus, no turn label) stays above.
   ============================================================================= */

/* Phone design-frame wrappers: inert on desktop (no scale, no rotation). */

.mobile-fit-root,
.mobile-fit-rotate,
.mobile-fit-frame,
.mobile-fit-inner {
  display: block;
  width: auto;
  height: auto;
  transform: none;
  position: static;
}

html.is-mobile-fit,
html.is-mobile-fit body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #07060a;
  overscroll-behavior: none;
  touch-action: manipulation;
}

html.is-mobile-fit .mobile-fit-root {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #07060a;
  z-index: 1;
}

html.is-mobile-fit .mobile-fit-rotate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* t415: no CSS 90deg rotate fallback. Portrait is not forced into a
   landscape frame; is-mobile-fit is only applied in phone landscape. */

html.is-mobile-fit .mobile-fit-frame {
  display: block;
  position: relative;
  width: calc(var(--design-w) * var(--fit-scale));
  height: calc(var(--design-h) * var(--fit-scale));
  overflow: hidden;
  flex: 0 0 auto;
  background: #07060a;
}

html.is-mobile-fit .mobile-fit-inner {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--design-w);
  height: var(--design-h);
  transform: scale(var(--fit-scale));
  transform-origin: top left;
  overflow: hidden;
}

/* Inside the 1280x720 frame, force the desktop shell. Viewport media queries
   still see the phone size, so compact/portrait/max-width:900 rules must not
   shrink only the HUD or stack the dungeon. */

html.is-mobile-fit .app-shell,
html.is-mobile-fit .screen-stack,
html.is-mobile-fit .screen,
html.is-mobile-fit .screen.is-active,
html.is-mobile-fit .game-screen {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

html.is-mobile-fit .app-shell { min-height: 0; isolation: isolate; }

html.is-mobile-fit .screen { padding-top: 72px; }

html.is-mobile-fit .topbar,
html.is-mobile-fit .run-summary,
html.is-mobile-fit .soul-core-chip { height: 72px; }

html.is-mobile-fit .topbar { padding: 0 34px; }

html.is-mobile-fit .dungeon-stage,
html.is-mobile-fit html.lang-en .dungeon-stage,
html.is-mobile-fit.lang-en .dungeon-stage,
html.is-mobile-fit.lang-ja .dungeon-stage,
html.is-mobile-fit.lang-ko .dungeon-stage {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: none;
  grid-template-columns: 92px minmax(0, 1fr) 310px;
}

html.is-mobile-fit.lang-en .dungeon-stage,
html.is-mobile-fit.lang-ja .dungeon-stage,
html.is-mobile-fit.lang-ko .dungeon-stage {
  grid-template-columns: 92px minmax(0, 1fr) minmax(20rem, 26rem);
}

html.is-mobile-fit .route-rail,
html.is-mobile-fit .scene-area,
html.is-mobile-fit .dice-history-rail {
  grid-column: auto;
  grid-row: auto;
}

html.is-mobile-fit .dice-history-rail {
  border-left: 1px solid rgba(218, 198, 157, .14);
  border-top: 0;
  min-width: 0;
}

html.is-mobile-fit .scene-area { padding: 24px clamp(26px, 4vw, 66px) 22px; }

html.is-mobile-fit .scene-object { min-height: 0; }

html.is-mobile-fit .choice-layer { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: min(42%, 320px); }

html.is-mobile-fit .combat-actions { grid-template-columns: repeat(4, 1fr); }

html.is-mobile-fit .combat-skill-bar { grid-template-columns: repeat(6, 1fr); }

html.is-mobile-fit .combat-button { min-height: 64px; }

html.is-mobile-fit .choice-card { min-height: 78px; }

html.is-mobile-fit .hud-panel {
  --hud-scale: 0.84;
  flex: 0 0 calc(350px * var(--hud-scale));
  height: calc(350px * var(--hud-scale));
  min-height: calc(350px * var(--hud-scale));
  flex-basis: calc(350px * var(--hud-scale));
  overflow: hidden;
  z-index: 15;
}

html.is-mobile-fit .hud-panel-inner {
  height: 350px;
  grid-template-columns: 270px 202px minmax(0, 1fr) 170px 170px;
  grid-template-rows: minmax(0, 1fr);
}

html.is-mobile-fit .story-overlay,
html.is-mobile-fit .scene-fade-overlay,
html.is-mobile-fit .modal-backdrop {
  position: absolute;
  inset: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
}

html.is-mobile-fit .story-overlay { padding: 56px clamp(24px, 8vw, 140px) 28px; }

html.is-mobile-fit .toast { position: absolute; }

/* D20 collapse stays available inside the landscape design frame
   (is-mobile-fit is on only when the phone is actually in landscape). */

html.is-mobile-fit .dice-history-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 8px;
}

html.is-mobile-fit .dice-history-heading span,
html.is-mobile-fit .dice-history-heading small { display: block; flex: 1 1 100%; }

html.is-mobile-fit .dice-rail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 32px;
  padding: 5px 8px;
  color: #cbbfb0;
  border: 1px solid rgba(220, 198, 160, 0.2);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  letter-spacing: 0.12em;
  font-size: calc(11px * var(--fs, 1));
}

html.is-mobile-fit .dice-rail-toggle-expand { display: none; }

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle-collapse { display: none; }

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle-expand { display: inline; }

html.is-mobile-fit .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-en .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-ja .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-ko .dungeon-stage.is-dice-rail-collapsed {
  grid-template-columns: 92px minmax(0, 1fr) 44px;
}

html.is-mobile-fit .dice-history-rail.is-collapsed { min-width: 0; overflow: hidden; }

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-readout { display: none; }

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-history-heading {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: 10px 4px;
  border-bottom: 0;
  gap: 10px;
}

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-history-heading span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.16em;
  flex: 0 0 auto;
  font-size: calc(11px * var(--fs, 1));
}

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-history-heading small { display: none; }

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle {
  margin: 0;
  min-width: 0;
  width: 100%;
  writing-mode: horizontal-tb;
  padding: 8px 2px;
  font-size: calc(10px * var(--fs, 1));
}

/* Inside the design frame, size modals against the 720px inner box, not 100vh. */

html.is-mobile-fit .modal-backdrop {
  padding: 16px;
  overflow: hidden;
  box-sizing: border-box;
  align-items: center;
  justify-items: center;
}

html.is-mobile-fit .modal,
html.is-mobile-fit .modal.character-sheet-modal,
html.is-mobile-fit .modal.character-sheet-modal.is-skill-tree {
  width: min(1080px, 100%);
  max-width: 100%;
  min-height: 0;
  max-height: 100%;
  height: auto;
}

html.is-mobile-fit .modal.character-sheet-modal.is-skill-tree {
  height: 100%;
}

html.is-mobile-fit .combat-layer,
html.is-mobile-fit .combat-actions,
html.is-mobile-fit .combat-skill-bar,
html.is-mobile-fit .combat-menu-slot {
  overflow: visible;
}

html.is-mobile-fit .combat-flyout {
  width: max(100%, min(260px, 28vw));
  max-height: 240px;
}

html.is-mobile-fit .character-sheet-modal.is-skill-tree .sheet-body,
html.is-mobile-fit .sheet-body.is-skill-tree {
  overflow-x: auto;
  overflow-y: auto;
}

html.is-mobile-fit .asset-preload-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  z-index: 10000;
  box-sizing: border-box;
}

html.is-mobile-fit .asset-preload-panel h1 {
  font-size: clamp(52px, 6.5%, 84px);
}

html.is-mobile-fit .title-screen,
html.is-mobile-fit .title-screen.is-active,
html.is-mobile-fit .slot-screen,
html.is-mobile-fit .slot-screen.is-active,
html.is-mobile-fit .character-screen,
html.is-mobile-fit .character-screen.is-active,
html.is-mobile-fit .archive-screen,
html.is-mobile-fit .archive-screen.is-active {
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

html.is-mobile-fit .title-screen,
html.is-mobile-fit .title-screen.is-active {
  align-items: flex-start;
}

html.is-mobile-fit .title-content {
  width: min(620px, 50%);
  margin-left: clamp(48px, 10%, 150px);
  margin-top: auto;
  margin-bottom: auto;
}

html.is-mobile-fit .game-screen,
html.is-mobile-fit .game-screen.is-active {
  overflow: hidden;
}

/* Only set the custom property here. Do not restated overflow/position so
   t431's .scene-area overflow:hidden and :has(.combat-flyout) rules stay as-is
   on desktop. Phone landscape uses html.is-mobile-fit rules below. */
.dungeon-stage .scene-area {
  --mid-frame-scale: 1;
}

/* 射精条 / 挣扎条 / 育种控制: scale with the mid frame, stay in-flow or
   bottom-anchored inside .scene-area. */

.dungeon-stage .jerk-gauge,
.dungeon-stage .rust-casket-gauges,
.dungeon-stage .rust-casket-gauge,
.dungeon-stage .essence-offering-panel .jerk-gauge {
  max-width: 100%;
  box-sizing: border-box;
  transform-origin: left bottom;
  zoom: var(--mid-frame-scale, 1);
}

@supports not (zoom: 1) {
  .dungeon-stage .jerk-gauge,
  .dungeon-stage .rust-casket-gauges,
  .dungeon-stage .rust-casket-gauge,
  .dungeon-stage .essence-offering-panel .jerk-gauge {
    transform: scale(var(--mid-frame-scale, 1));
  }
}

.dungeon-stage .breeding-control {
  left: 50%;
  bottom: 8px;
  width: min(600px, calc(96% / var(--mid-frame-scale, 1)));
  max-width: 100%;
  transform: translateX(-50%) scale(var(--mid-frame-scale, 1));
  transform-origin: bottom center;
  z-index: 22;
  pointer-events: auto;
  box-sizing: border-box;
}

/* Landscape 1280x720 fit: the whole inner shell already scales. Keep mid-frame
   overflow rules, but let --mid-frame-scale stay 1 so bars are not double-scaled. */

html.is-mobile-fit .dungeon-stage .scene-area {
  --mid-frame-scale: 1;
}

html.is-mobile-fit .dungeon-stage .choice-layer,
html.is-mobile-fit .dungeon-stage .combat-layer {
  max-height: min(46%, 280px);
}

/* Flyouts may be visible inside the scaled mid frame, not outside it. */

html.is-mobile-fit .dungeon-stage .combat-layer,
html.is-mobile-fit .dungeon-stage .combat-actions,
html.is-mobile-fit .dungeon-stage .combat-skill-bar,
html.is-mobile-fit .dungeon-stage .combat-menu-slot {
  overflow: visible;
}

html.is-mobile-fit .dungeon-stage .combat-layer {
  overflow-x: hidden;
  overflow-y: auto;
}

/* =============================================================================
   itch-mobile t417 + t418 (do not ship one without the other)

   t417: After collapse, the D20 expand button + hint were blank in EN/JA/KO.
   Catalogs and t() already had 展开/收起 and the title keys. The empty box
   came from CSS:
     - html.lang-en/ja/ko .dice-history-rail { min-width: 20rem } (and the
       max-width:900px 18rem EN rule) can outlive or visually fight the
       collapsed 44px/40px grid column. The rail stays ~20rem wide, overflow
       clips it to a gold strip, and centered vertical text sits outside the
       visible window. ZH has no 20rem min-width, so 展开 still showed.
     - .dice-history-heading span { writing-mode: vertical-rl } also applied
       to toggle labels, while the button itself was writing-mode:horizontal-tb
       with short padding, so longer EN/KO strings could clip even when the
       column width was correct.
   Fix: force collapsed rail min-width:0 for every language, slightly widen
   the collapsed column, scope title typography to .dice-rail-title, and give
   the collapsed toggle vertical writing-mode with enough height so Expand /
   展開 / 펼치기 stay readable. Title/aria still come from t().

   t418: Tapping 攻击技能 / 状态技能 did not show skill pickers. t410 set
   overflow:visible on .combat-layer / .combat-skill-bar so the upward
   .combat-flyout (position:absolute; bottom: calc(100% + 6px)) could paint.
   t416 mid-frame tightening then set .combat-layer { overflow-x:hidden;
   overflow-y:auto } (and the same again under is-mobile-fit), which re-clips
   the flyout to nothing. overflow-x:hidden also forces overflow-y to compute
   as auto. t416's max-height: min(240px, 42%) on the flyout is also relative
   to the positioned slot (~button height), so 42% is a sliver.
   Fix: restore overflow:visible on the flyout ancestors, keep .scene-area
   overflow:hidden so the picker stays inside the mid frame (not over the
   top bar or HUD), and cap flyout height in px, not a % of the slot.
   ============================================================================= */

/* --- t417: collapsed D20 rail text --- */

html.is-mobile-fit .dice-history-rail.is-collapsed,
html.is-mobile-fit.lang-en .dice-history-rail.is-collapsed,
html.is-mobile-fit.lang-ja .dice-history-rail.is-collapsed,
html.is-mobile-fit.lang-ko .dice-history-rail.is-collapsed {
  min-width: 0;
  width: auto;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  justify-content: flex-start;
  align-items: stretch;
}

/* Title typography only — do not restyle the toggle labels. */

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-title {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.08em;
  font-size: 11px;
  line-height: 1.15;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: auto;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
}

html.is-mobile-fit.lang-en .dice-history-rail.is-collapsed .dice-rail-title {
  letter-spacing: 0.02em;
  font-size: 10px;
}

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: row;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 5.2em;
  padding: 10px 3px;
  margin-top: auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.15;
  overflow: visible;
  white-space: nowrap;
  box-sizing: border-box;
}

html.is-mobile-fit.lang-en .dice-history-rail.is-collapsed .dice-rail-toggle {
  letter-spacing: 0.02em;
  font-size: 10px;
  min-height: 6em;
}

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle-expand {
  writing-mode: inherit;
  text-orientation: inherit;
  letter-spacing: inherit;
  font-size: inherit;
  line-height: inherit;
  overflow: visible;
  white-space: nowrap;
  width: auto;
  height: auto;
  flex: 0 0 auto;
}

html.is-mobile-fit .dice-history-rail.is-collapsed .dice-rail-toggle-expand {
  display: inline-block;
}

html.is-mobile-fit .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-en .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-ja .dungeon-stage.is-dice-rail-collapsed,
html.is-mobile-fit.lang-ko .dungeon-stage.is-dice-rail-collapsed {
  grid-template-columns: 92px minmax(0, 1fr) 56px;
}

/* --- t418: unclip combat skill flyouts; keep them inside the mid frame --- */

html.is-mobile-fit .dungeon-stage .combat-layer,
html.is-mobile-fit .dungeon-stage:not([data-room="altar"]) .combat-layer,
html.is-mobile-fit .dungeon-stage .combat-actions,
html.is-mobile-fit .dungeon-stage .combat-skill-bar,
html.is-mobile-fit .dungeon-stage .combat-menu-slot {
  overflow: visible;
}

html.is-mobile-fit .dungeon-stage .combat-flyout {
  z-index: 30;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto;
}

/* Mid-frame clip stays so the flyout cannot cover the top bar or bottom HUD.
   Do not put overflow-x:auto/hidden on .combat-layer; that forces overflow-y
   to auto and clips the upward flyout to nothing. */

html.is-mobile-fit .dungeon-stage .scene-area {
  overflow: hidden;
}

/* t450u: no visible button scrollbars; overflowing inner text is press-and-drag / swipe only.
   The surface inherits the button's grid/flex and spans every track so door cards keep their
   original columns (a column-flex wrapper was squeezing labels into the first 42px track). */
button.btn-text-scroll {
  overflow: hidden;
  box-sizing: border-box;
}
button.btn-text-scroll > .btn-scroll-surface {
  display: inherit;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  grid-template-columns: inherit;
  grid-template-rows: inherit;
  grid-template-areas: inherit;
  grid-auto-columns: inherit;
  grid-auto-rows: inherit;
  grid-auto-flow: inherit;
  gap: inherit;
  column-gap: inherit;
  row-gap: inherit;
  align-items: inherit;
  align-content: inherit;
  justify-items: inherit;
  justify-content: inherit;
  flex-direction: inherit;
  flex-wrap: inherit;
  place-items: inherit;
  place-content: inherit;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  flex: 1 1 auto;
  overflow: hidden;
  overscroll-behavior: contain;
  text-align: inherit;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
button.btn-text-scroll::-webkit-scrollbar,
button.btn-text-scroll > .btn-scroll-surface::-webkit-scrollbar,
button.btn-text-scroll.has-overflow > .btn-scroll-surface::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent;
}
button.btn-text-scroll.has-overflow > .btn-scroll-surface {
  overflow-x: hidden;
  overflow-y: hidden;
  touch-action: none;
}
