:root {
  --bg: #0e1a2b;
  --text: #e8eef5;
  --muted: rgba(232, 238, 245, 0.65);
  --accent: #ff8a3d;
  --cyan: #5bc0be;
  --line: rgba(232, 238, 245, 0.14);
  --stage-max: 100vw;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --dialogue-size: 16px;
  --choice-title: 15px;
  --btn-h: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: #050a12;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100dvh;
  min-height: 100svh;
}

#app {
  width: 100%;
  max-width: var(--stage-max);
  min-height: 100dvh;
  min-height: 100svh;
  position: relative;
}

/* 手机竖屏：全宽沉浸，不留大黑边 */
@media (max-width: 519px) {
  :root {
    --stage-max: 100vw;
  }
  body {
    background: var(--bg);
  }
  #app {
    max-width: 100%;
  }
}

/* 平板竖屏：保留居中舞台（仅 <900） */
@media (min-width: 520px) and (max-width: 899px) {
  :root {
    --stage-max: 480px;
    --dialogue-size: 16.5px;
    --choice-title: 15.5px;
  }
  body {
    padding: 16px 0;
    align-items: center;
    background: #050a12;
  }
  #app {
    min-height: min(900px, calc(100dvh - 32px));
    height: min(900px, calc(100dvh - 32px));
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 28px 70px rgba(0, 0, 0, 0.55);
  }
}

/* 真·PC 桌面布局（≥900）：去手机框，左右分栏 */
@media (min-width: 900px) {
  :root {
    --stage-max: 100vw;
    --dialogue-size: 17px;
    --choice-title: 16px;
    --btn-h: 52px;
    --pc-panel: clamp(360px, 38vw, 480px);
  }
  body {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: #070d16;
  }
  #app {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
  }

  .stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pc-panel);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "visual hud"
      "visual progress"
      "visual panel";
    width: 100%;
    height: 100%;
    min-height: 100dvh;
  }

  .stage-visual {
    grid-area: visual;
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
  .stage-visual .scene-bg {
    inset: -2%;
    animation-duration: 56s;
  }
  .stage-visual .star-overlay,
  .stage-visual .dust-overlay {
    inset: 0;
  }
  .stage-visual .portrait-layer {
    left: 0;
    right: 0;
    bottom: 2%;
    height: 88%;
  }
  .stage-visual .portrait {
    max-width: 55%;
  }
  .stage-visual .portrait.left {
    left: 6%;
  }
  .stage-visual .portrait.right {
    right: 6%;
  }

  .hud-top {
    grid-area: hud;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 16px 20px 4px;
    background: rgba(8, 14, 24, 0.92);
  }
  .hud-progress {
    grid-area: progress;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 0 20px 10px;
    background: rgba(8, 14, 24, 0.92);
  }
  .hud-progress .bar {
    height: 4px;
  }

  /* 右侧面板：对白 / 选项 / 开机 / 报告 共用 */
  .dialogue,
  .choice-overlay,
  .boot-panel,
  .report-scroll,
  .chips {
    grid-area: panel;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    inset: auto !important;
  }

  .dialogue {
    margin: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--line);
    min-height: 0;
    max-height: none;
    height: 100%;
    overflow-y: auto;
    padding: 22px 24px 28px;
    background: rgba(10, 18, 30, 0.96);
    backdrop-filter: blur(18px);
    cursor: pointer;
  }
  .dialogue .tap-hint {
    position: static;
    display: block;
    text-align: right;
    margin-top: 16px;
  }
  .line {
    font-size: 17.5px;
    line-height: 1.7;
    max-width: 36em;
  }

  .chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px 0;
    background: rgba(10, 18, 30, 0.96);
    margin: 0;
  }
  /* chips + dialogue both in panel: stack via flex wrapper simulation —
     when both present, chips sit above; use absolute within panel flow */
  .stage:has(.chips) .chips {
    height: auto;
  }
  .stage:has(.chips) .dialogue {
    /* dialogue still fills remaining via grid same cell — use flex on a pseudo stack */
  }

  .choice-overlay {
    margin: 0;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    padding: 20px 22px 28px;
    background: rgba(10, 18, 30, 0.96);
    border-top: 1px solid var(--line);
  }
  .choice-q {
    text-align: left;
    font-size: 15px;
    margin-bottom: 16px;
  }
  .choice-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .choice-card {
    flex: 1 1 calc(50% - 12px);
    min-width: 160px;
    min-height: 88px;
    padding: 16px;
    border-radius: 16px;
  }
  .choice-card strong {
    font-size: 16px;
  }
  .choice-card small {
    font-size: 13px;
  }

  .boot-panel {
    margin: 0;
    height: 100%;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--line);
    text-align: left;
    padding: 36px 28px;
    background: rgba(10, 18, 30, 0.96);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .boot-panel h1 {
    font-size: 40px;
    letter-spacing: 0.16em;
  }
  .boot-panel .btn {
    width: 100%;
    max-width: 280px;
  }

  .report-scroll {
    margin: 0;
    height: 100%;
    padding: 20px 22px 32px;
    background: rgba(8, 14, 24, 0.97);
    border-top: 1px solid var(--line);
  }
  .report-scroll .arch h2 {
    font-size: 32px;
  }

  /* 超宽：场景更大 */
  @media (min-width: 1280px) {
    :root {
      --pc-panel: clamp(400px, 34vw, 520px);
      --dialogue-size: 18px;
    }
    .stage-visual .portrait {
      max-width: 48%;
    }
  }
}

/* 横屏手机：压缩纵向空间，保证按钮可见 */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --dialogue-size: 14px;
    --btn-h: 42px;
  }
  #app {
    min-height: 100dvh;
    height: 100dvh;
    max-width: min(720px, 100vw);
    border-radius: 0;
  }
  .portrait-layer {
    height: 62% !important;
    bottom: 16% !important;
  }
  .dialogue {
    min-height: 72px !important;
    padding: 10px 12px 14px !important;
  }
  .choice-overlay {
    padding-top: 8px !important;
    max-height: 58dvh;
    overflow-y: auto;
  }
  .boot-panel {
    padding: 12px 14px !important;
  }
  .boot-panel h1 {
    font-size: 26px !important;
  }
  .report-scroll {
    padding-top: 56px !important;
  }
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  overflow: hidden;
  background: var(--bg);
}
.stage-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.stage-visual .scene-bg,
.stage-visual .star-overlay,
.stage-visual .dust-overlay,
.stage-visual .portrait-layer {
  /* keep absolute children relative to visual */
}

/* Full-bleed scene + parallax */
.scene-bg {
  position: absolute;
  inset: -3%;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  will-change: transform;
  transition: filter 0.45s ease;
  animation: bgDrift 48s ease-in-out infinite alternate;
}
@keyframes bgDrift {
  from {
    transform: scale(1.05) translate3d(-1.8%, 0.4%, 0);
  }
  to {
    transform: scale(1.12) translate3d(1.8%, -1.2%, 0);
  }
}
.scene-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 14, 24, 0.12) 0%,
    rgba(8, 14, 24, 0.08) 42%,
    rgba(8, 14, 24, 0.55) 72%,
    rgba(8, 14, 24, 0.9) 100%
  );
  pointer-events: none;
}
.scene-bg.tint-warm {
  filter: saturate(1.12) brightness(1.04) hue-rotate(-6deg);
}
.scene-bg.tint-cold {
  filter: saturate(0.88) brightness(0.93) hue-rotate(10deg);
}
.scene-bg.tint-alert {
  filter: saturate(1.18) contrast(1.06);
}


.dust-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(1.5px 1.5px at 12% 28%, rgba(255,190,120,0.35), transparent),
    radial-gradient(1px 1px at 38% 62%, rgba(255,210,160,0.28), transparent),
    radial-gradient(1.5px 1.5px at 72% 22%, rgba(255,180,100,0.3), transparent),
    radial-gradient(1px 1px at 88% 48%, rgba(230,240,255,0.22), transparent),
    radial-gradient(1.2px 1.2px at 54% 78%, rgba(255,200,140,0.25), transparent);
  background-size: 100% 100%;
  animation: dustDrift 22s linear infinite;
  opacity: 0.55;
  mix-blend-mode: screen;
}
@keyframes dustDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-2.5%, -4%, 0); }
}

.star-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.45;
  z-index: 1;
}

/* Portraits — transparent PNG, no screen blend */
.portrait-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 68%;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: none !important;
  transform: none !important;
}
@keyframes layerDrift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, -1.4%, 0);
  }
}

.portrait {
  position: absolute;
  background: transparent;
  border: 0;
  box-shadow: none;
  mix-blend-mode: normal;
  -webkit-mix-blend-mode: normal;
  bottom: 0;
  height: 100%;
  width: auto;
  max-width: 72%;
  object-fit: contain;
  object-position: bottom center;
  /* large bottom dissolve — no hard plate / box behind char */
  -webkit-mask-image: none;
  mask-image: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
  opacity: 0;
  transform: none;
  transition: opacity 0.12s ease, filter 0.2s ease;
  /* no transform transition — kills floaty entrance */
}
.portrait.in {
  opacity: 1 !important;
  transform: none;
}
.portrait.left {
  left: -2%;
  transform-origin: bottom left;
}
.portrait.left.in {
  transform: none;
}
.portrait.right {
  right: -2%;
  transform-origin: bottom right;
}
.portrait.center {
  left: 50%;
  transform: translate3d(-50%, 0, 0);
}
.portrait.center.in {
  transform: translate3d(-50%, 0, 0);
}

.portrait.dim {
  /* 禁止半透明：只用亮度/饱和度区分非说话人 */
  opacity: 1 !important;
  filter: grayscale(0.15) brightness(0.78) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}
.portrait.active {
  opacity: 1 !important;
  z-index: 3;
  animation: none;
  filter: drop-shadow(0 0 14px rgba(255, 138, 61, 0.32))
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}
.portrait.left.active.in {
  /* breathe overrides transform via keyframes */
}
@keyframes breathe {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -1px, 0) scale(1.004);
  }
}
.portrait.center.active {
  animation: none;
}
@keyframes breatheCenter {
  0%,
  100% {
    transform: translate3d(-50%, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-50%, -1px, 0) scale(1.004);
  }
}
.portrait.right.active {
  animation: none;
}

/* HUD */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10px + var(--safe-top)) 14px 0;
  pointer-events: none;
}
.hud-top .icon-btn {
  pointer-events: auto;
}
.brand {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: rgba(232, 238, 245, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(14, 26, 43, 0.55);
  backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
}
.hud-progress {
  position: absolute;
  top: calc(50px + var(--safe-top));
  left: 14px;
  right: 14px;
  z-index: 20;
  pointer-events: none;
}
.hud-progress span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  text-shadow: 0 1px 3px #000;
}
.hud-progress .bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.hud-progress .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff9a52, var(--accent));
  border-radius: 99px;
}

/* Dialogue */
.dialogue {
  position: absolute;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(14px + var(--safe-bottom));
  z-index: 15;
  padding: 14px 16px 18px;
  border-radius: 16px;
  background: rgba(10, 18, 30, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  cursor: pointer;
  min-height: 108px;
  max-height: 36dvh;
  overflow-y: auto;
  animation: fadeUp 0.28s ease;
}
.speaker-name {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.speaker-name.narrator {
  color: var(--cyan);
  font-weight: 600;
}
.line {
  margin: 0;
  font-size: var(--dialogue-size);
  line-height: 1.65;
  color: var(--text);
}
.tap-hint {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-size: 11px;
  color: var(--muted);
  animation: blink 1.4s ease infinite;
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.chips {
  position: absolute;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(132px + var(--safe-bottom));
  z-index: 14;
  display: grid;
  gap: 6px;
}
.chip {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  background: rgba(10, 18, 30, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.chip b {
  display: inline-block;
  margin-right: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.chip.gain b {
  color: var(--cyan);
}
.chip.cost b {
  color: var(--accent);
}

/* Choice overlay */
.choice-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 16;
  padding: 16px max(14px, env(safe-area-inset-left, 0px))
    calc(18px + var(--safe-bottom)) max(14px, env(safe-area-inset-right, 0px));
  background: linear-gradient(180deg, transparent, rgba(6, 12, 22, 0.9) 26%);
  max-height: 62dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.choice-q {
  margin: 0 0 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 14px;
  min-height: var(--btn-h);
  border-radius: 14px;
  border: 1px solid rgba(255, 138, 61, 0.35);
  background: rgba(14, 26, 43, 0.86);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(10px);
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.choice-card:active {
  transform: scale(0.98);
}
.choice-card:hover,
.choice-card:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 138, 61, 0.12);
  outline: none;
}
.choice-card .idx {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 138, 61, 0.18);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.choice-card .body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.choice-card strong {
  font-size: var(--choice-title);
}
.choice-card small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Boot */
.boot-panel {
  position: absolute;
  left: max(14px, env(safe-area-inset-left, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + var(--safe-bottom));
  z-index: 12;
  text-align: center;
  padding: 20px 16px;
  border-radius: 18px;
  background: rgba(10, 18, 30, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.boot-panel h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 8vw, 36px);
  letter-spacing: 0.14em;
}
.boot-panel .sub {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.boot-panel .tag {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.boot-panel .foot {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--btn-h);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.btn.primary {
  background: linear-gradient(135deg, #ff9a52, var(--accent));
  color: #1a1008;
}
.btn.ghost {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}

/* Hatch */
.hatch-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.hatch-overlay .door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(180deg, #152338, #0a121c);
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 2;
}
.hatch-overlay .door.L {
  left: 0;
  border-right: 1px solid var(--accent);
}
.hatch-overlay .door.R {
  right: 0;
  border-left: 1px solid var(--accent);
}
.hatch-overlay.open .door.L {
  transform: translateX(-102%);
}
.hatch-overlay.open .door.R {
  transform: translateX(102%);
}
.hatch-meta {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-shadow: 0 2px 12px #000;
}
.hatch-meta span {
  color: var(--accent);
  letter-spacing: 0.14em;
  font-size: 12px;
}
.hatch-meta strong {
  font-size: 26px;
}
.hatch-meta small {
  color: var(--muted);
}
.skip {
  position: absolute;
  right: 14px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 25;
  border: 1px solid var(--line);
  background: rgba(10, 18, 30, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 36px;
  font-size: 12px;
  cursor: pointer;
}

/* Report */
.report-scroll {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(68px + var(--safe-top)) 14px calc(28px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(8, 14, 24, 0.35), rgba(8, 14, 24, 0.88));
}
.arch {
  text-align: center;
  padding: 20px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 138, 61, 0.4);
  background: linear-gradient(145deg, rgba(255, 138, 61, 0.16), rgba(91, 192, 190, 0.08));
  margin-bottom: 18px;
}
.arch .lab {
  color: var(--accent);
  letter-spacing: 0.14em;
  font-size: 12px;
}
.arch h2 {
  margin: 8px 0;
  font-size: 28px;
}
.arch p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.arch .warn {
  margin-top: 10px;
  color: var(--accent);
  font-size: 12px;
}
.report-scroll h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 16px 0 10px;
}
.dumbbell {
  margin-bottom: 12px;
}
.dh {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}
.dh .tag {
  color: var(--accent);
  font-size: 12px;
}
.dt {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}
.eq {
  position: absolute;
  left: 40%;
  width: 20%;
  top: 0;
  bottom: 0;
  background: rgba(91, 192, 190, 0.22);
  border-radius: 99px;
}
.cur {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.55);
}
.replay {
  padding: 12px;
  border-radius: 12px;
  background: rgba(14, 26, 43, 0.75);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.replay strong {
  display: block;
  margin-bottom: 4px;
}
.muted {
  color: var(--muted);
}
.report-scroll ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.6;
}

/* Detailed report cards */
.report-card {
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: rgba(14, 26, 43, 0.82);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.report-card.soft {
  background: rgba(14, 26, 43, 0.65);
  padding-top: 10px;
}
.report-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #fff;
}
.report-card h5 {
  margin: 12px 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
}
.report-card p {
  margin: 0 0 8px;
}
.report-card p:last-child {
  margin-bottom: 0;
}
.report-card .alt {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 12.5px;
}
.report-card.focus .pat {
  font-weight: 600;
}
.report-card.focus .bound {
  color: var(--muted);
}
.report-card.focus .act {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 138, 61, 0.1);
  border: 1px solid rgba(255, 138, 61, 0.28);
}
.pill {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(255, 138, 61, 0.14);
  border: 1px solid rgba(255, 138, 61, 0.35);
  vertical-align: middle;
}
.emp-head h4 {
  display: inline;
  margin-left: 4px;
}
.report-card .frame {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 4px;
}
.report-card ul,
.report-card ol {
  margin: 0;
  padding-left: 18px;
}
.report-card li {
  margin-bottom: 4px;
}
.report-card .steps li {
  margin-bottom: 6px;
}
.report-card .fields li {
  color: var(--muted);
}
.section-lead {
  font-size: 12.5px;
  color: var(--muted);
  margin: -4px 0 10px;
  line-height: 1.5;
}
.pad { padding: 0 4px 8px; }
.report-scroll .spectrum {
  margin-bottom: 4px;
}

.declare {
  margin: 18px 0;
  padding: 12px;
  border-left: 2px solid var(--accent);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  background: rgba(255, 138, 61, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .dialogue,
  .portrait,
  .hatch-overlay .door,
  .tap-hint,
  .scene-bg,
  .portrait-layer,
  .portrait.active {
    animation: none !important;
    transition: none !important;
  }
  .portrait,
  .portrait.center {
    opacity: 1;
    transform: none;
  }
  .portrait.center {
    transform: translateX(-50%);
  }
}

/* ===== PC overrides (must be last for specificity) ===== */
@media (min-width: 900px) {
  body {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: #070d16 !important;
  }
  #app {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }
  .stage {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 38vw, 520px) !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    grid-template-areas:
      "visual hud"
      "visual progress"
      "visual panel" !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100dvh !important;
  }
  .stage-visual {
    grid-area: visual !important;
    position: relative !important;
    inset: auto !important;
    min-width: 0;
    min-height: 0;
    height: 100% !important;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
  .stage-visual .portrait-layer {
    bottom: 2% !important;
    height: 88% !important;
  }
  .stage-visual .portrait {
    max-width: 52% !important;
  }
  .hud-top {
    grid-area: hud !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    padding: 16px 20px 4px !important;
    background: rgba(8, 14, 24, 0.94);
  }
  .hud-progress {
    grid-area: progress !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    padding: 0 20px 10px !important;
    background: rgba(8, 14, 24, 0.94);
  }
  .dialogue,
  .choice-overlay,
  .boot-panel,
  .report-scroll,
  .chips {
    grid-area: panel !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
  }
  .dialogue {
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 1px solid var(--line) !important;
    padding: 22px 24px 28px !important;
    background: rgba(10, 18, 30, 0.96) !important;
    overflow-y: auto !important;
  }
  .dialogue .tap-hint {
    position: static !important;
    display: block !important;
    text-align: right;
    margin-top: 16px;
  }
  .choice-overlay {
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 20px 22px 28px !important;
    background: rgba(10, 18, 30, 0.96) !important;
    border-top: 1px solid var(--line);
    overflow-y: auto !important;
  }
  .choice-q {
    text-align: left !important;
  }
  .choice-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  .choice-card {
    flex: 1 1 calc(50% - 12px) !important;
    min-width: 168px !important;
    min-height: 92px !important;
    padding: 16px !important;
    border-radius: 16px !important;
  }
  .boot-panel {
    height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 1px solid var(--line) !important;
    text-align: left !important;
    padding: 36px 28px !important;
    background: rgba(10, 18, 30, 0.96) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }
  .report-scroll {
    height: 100% !important;
    margin: 0 !important;
    padding: 20px 22px 32px !important;
    background: rgba(8, 14, 24, 0.97) !important;
    border-top: 1px solid var(--line);
  }
  .stage:has(.chips) .chips {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 3;
    height: auto !important;
    padding: 14px 20px 8px !important;
    background: rgba(10, 18, 30, 0.96) !important;
  }
  .stage:has(.chips) .dialogue {
    padding-top: 118px !important;
  }
}
@media (min-width: 1280px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) clamp(400px, 34vw, 520px) !important;
  }
  .stage-visual .portrait {
    max-width: 46% !important;
  }
}

/* ===== Portrait solidity + no puppet loop (last) ===== */
.portrait,
.portrait.in,
.portrait.active,
.portrait.dim,
.portrait.left,
.portrait.right,
.portrait.center {
  mix-blend-mode: normal !important;
}
.portrait.in,
.portrait.active,
.portrait.dim.in {
  opacity: 1 !important;
}
.portrait.active,
.portrait.center.active,
.portrait.right.active,
.portrait.left.active {
  animation: none !important;
}


/* Force solid portraits — no holographic fade */
.portrait {
  -webkit-mask-image: none !important;
  mask-image: none !important;
  opacity: 1;
}
.portrait.in,
.portrait.dim,
.portrait.active {
  opacity: 1 !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

/* ===== Dual-buffer portrait: still under, motion over (no flash) ===== */
.portrait {
  /* container for stacked still + motion */
}
.portrait .portrait-still,
.portrait .portrait-motion {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  pointer-events: none;
  background: transparent;
  mix-blend-mode: normal !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
.portrait .portrait-still {
  position: relative;
  opacity: 1 !important;
  z-index: 1;
}
.portrait .portrait-motion {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  opacity: 0;
  /* 不用长 transition，避免尾帧与静帧叠出残影；瞬切即可因末帧≈静帧 */
  transition: none;
}
.portrait.right .portrait-motion {
  left: auto;
  right: 0;
}
.portrait.center .portrait-still,
.portrait.center .portrait-motion {
  /* center container already translated */
}
.portrait.center .portrait-motion {
  left: 0;
  right: 0;
  margin: 0 auto;
  transform: none;
}
.portrait.is-animating .portrait-motion {
  opacity: 1 !important;
  visibility: visible;
}
/* 动作期间完全卸下静帧可见性，避免 WebP 半透明边缘叠出双影 */
.portrait.is-animating .portrait-still {
  opacity: 0 !important;
  visibility: hidden !important;
}


/* ===== v11: kill float / rise entrance ===== */
.portrait-layer {
  animation: none !important;
  transform: none !important;
}
.portrait,
.portrait.in,
.portrait.left.in,
.portrait.right.in,
.portrait.center.in {
  /* appear instantly at final pose — no translateY float */
  transition: opacity 0.12s ease, filter 0.2s ease !important;
}
.portrait.left.in,
.portrait.right.in {
  transform: none !important;
}
.portrait.center.in {
  transform: translate3d(-50%, 0, 0) !important;
}
.portrait.active,
.portrait.left.active,
.portrait.right.active,
.portrait.center.active,
.portrait.left.active.in {
  animation: none !important;
}
.portrait .portrait-still,
.portrait .portrait-motion {
  height: 100% !important;
  width: auto !important;
  object-fit: contain !important;
  object-position: bottom center !important;
}
.portrait .portrait-motion {
  top: auto !important;
  bottom: 0 !important;
}
