:root {
  color-scheme: dark;
  --ink: #020505;
  --paper: #d5ddd8;
  --muted: #7f918b;
  --cyan: #75e9d2;
  --cyan-dim: #356e66;
  --danger: #e04e46;
  --panel: rgba(2, 8, 7, 0.82);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 560px;
  background: #000;
  isolation: isolate;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease, visibility 420ms;
}

.screen.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.start-screen {
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(28, 53, 47, 0.2), transparent 42%),
    #000;
}

.start-copy {
  width: min(720px, 88vw);
  text-align: center;
  animation: rise-in 1.1s ease both;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

h1 {
  margin: 0;
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: clamp(54px, 9vw, 112px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 0 48px rgba(117, 233, 210, 0.12);
}

.start-hint {
  margin: 30px 0 42px;
  color: #8e9b96;
  font-size: 14px;
  letter-spacing: 0.12em;
}

.primary-button {
  min-width: 184px;
  padding: 14px 28px;
  border: 1px solid #71827d;
  background: rgba(10, 18, 16, 0.74);
  cursor: pointer;
  letter-spacing: 0.18em;
  transition: border-color 180ms, color 180ms, background 180ms;
}

.primary-button:hover,
.primary-button:focus-visible {
  border-color: var(--cyan);
  background: rgba(26, 59, 52, 0.55);
  color: #fff;
  outline: none;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.start-loader {
  width: min(420px, 72vw);
  margin: 24px auto 0;
}

.start-loader[hidden] {
  display: none;
}

.start-loader-track {
  height: 3px;
  overflow: hidden;
  border: 1px solid rgba(117, 233, 210, 0.32);
  background: rgba(117, 233, 210, 0.06);
}

.start-loader-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 16px rgba(117, 233, 210, 0.7);
  transition: width 120ms linear;
}

.start-loader-status {
  margin: 10px 0 0;
  color: #73857f;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.cinematic-screen {
  background: #000;
  overflow: hidden;
}

.cinematic-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.cinematic-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.82)),
    url("assets/1-3_二维美漫动画版.png") center / cover no-repeat;
}

.cinematic-placeholder[hidden] {
  display: none;
}

.cinematic-placeholder h2 {
  margin: 0;
  font-size: clamp(34px, 6vw, 72px);
  letter-spacing: 0.14em;
}

.cinematic-placeholder p:last-child {
  color: #aab4b0;
  font-size: 13px;
}

.cinematic-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  color: rgba(226, 235, 231, 0.74);
  font-size: 11px;
  letter-spacing: 0.18em;
  background: linear-gradient(rgba(0, 0, 0, 0.62), transparent);
}

#chapter-label {
  font-size: clamp(28px, 2.2vw, 36px);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.1em;
  color: rgba(240, 248, 245, 0.94);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.78);
}

.text-button {
  padding: 8px 12px;
  border: 0;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  color: #aebbb6;
  letter-spacing: 0.12em;
}

.text-button:hover,
.text-button:focus-visible {
  color: #fff;
  outline: 1px solid var(--cyan-dim);
}

.black-screen {
  place-items: center;
  z-index: 4;
  background: #000;
}

.black-caption {
  opacity: 0;
  color: #89938f;
  font-size: 14px;
  letter-spacing: 0.3em;
}

.black-screen.is-active .black-caption {
  animation: pulse-caption 1.4s ease 0.45s both;
}

.monitor-screen {
  place-items: center;
  background: #000;
  overflow: hidden;
}

.monitor-stage {
  position: relative;
  width: min(100vw, calc(100svh * 1.7768));
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  background: #000;
}

.monitor-frame {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.monitor-feed-window {
  position: absolute;
  z-index: 1;
  left: 19.378%;
  top: 11.902%;
  width: 59.988%;
  height: 62.168%;
  overflow: hidden;
  background: #06100e;
}

.idle-feed,
.action-feed,
.monitor-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idle-feed {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  opacity: 0;
  background: #000;
}

.idle-feed.is-active {
  opacity: 1;
}

.action-feed {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  object-fit: cover;
  transition: opacity 110ms linear;
}

.action-feed.is-playing {
  opacity: 1;
}

.monitor-feed.is-ready ~ .monitor-fallback,
.breathing-feed.is-ready ~ .monitor-fallback {
  visibility: hidden;
}

.monitor-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.action-placeholder {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 8%;
  text-align: center;
  background:
    linear-gradient(rgba(4, 12, 11, 0.62), rgba(4, 12, 11, 0.88)),
    url("assets/场景构图_v4_半露天废墟.png") center / cover no-repeat;
}

.action-placeholder[hidden] {
  display: none;
}

.action-placeholder span {
  color: rgba(117, 233, 210, 0.72);
  font: 700 clamp(8px, 0.7vw, 12px) / 1 Consolas, monospace;
  letter-spacing: 0.2em;
}

.action-placeholder strong {
  color: #f1f5f3;
  font-size: clamp(24px, 3.4vw, 58px);
  letter-spacing: 0.08em;
  text-shadow: 0 3px 18px #000;
}

.action-placeholder p {
  margin: 0;
  color: #9eaaa6;
  font: clamp(9px, 0.7vw, 12px) / 1.4 Consolas, monospace;
}

.feed-treatment {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: none;
  opacity: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(210, 226, 221, 0.035) 0,
      rgba(210, 226, 221, 0.035) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(circle at center, transparent 62%, rgba(0, 0, 0, 0.35) 115%);
  animation: signal-shift 8s steps(2, end) infinite;
}

.monitor-hud {
  position: absolute;
  z-index: 5;
  top: 14.1%;
  left: 21.1%;
  right: 22.2%;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(195, 241, 227, 0.72);
  font: 700 clamp(8px, 0.72vw, 13px) / 1 Consolas, monospace;
  letter-spacing: 0.1em;
  text-shadow: 0 0 8px rgba(75, 255, 215, 0.5);
}

.recording-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 9px var(--danger);
  animation: recording 1.2s steps(2, end) infinite;
}

.hud-divider {
  opacity: 0.4;
}

.countdown {
  margin-left: auto;
  color: #d5e7e1;
  font-size: clamp(12px, 1.25vw, 22px);
}

.countdown.is-urgent {
  color: #ff6259;
  text-shadow: 0 0 11px rgba(255, 54, 45, 0.65);
}

.comms-panel {
  position: absolute;
  z-index: 6;
  left: 22%;
  right: 23%;
  bottom: 28.5%;
  min-height: 58px;
  padding: 12px 16px;
  border-left: 2px solid rgba(117, 233, 210, 0.74);
  background: linear-gradient(90deg, rgba(1, 8, 7, 0.9), rgba(1, 8, 7, 0.54));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 320ms, transform 320ms;
}

.comms-panel.is-visible {
  opacity: 1;
  transform: none;
}

.speaker {
  color: var(--cyan);
  font-size: clamp(8px, 0.72vw, 12px);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.comms-panel p {
  margin: 7px 0 0;
  color: #e2ebe7;
  font-size: clamp(11px, 1.03vw, 17px);
  line-height: 1.55;
  text-shadow: 0 1px 2px #000;
}

.command-form {
  position: absolute;
  z-index: 7;
  left: 21.8%;
  right: 22.1%;
  bottom: 14.7%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 300ms, transform 300ms;
}

.command-form.is-ready {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.radio-hand {
  position: absolute;
  z-index: 6;
  right: 16%;
  bottom: -6%;
  width: 30%;
  height: 58%;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(4%, 78%, 0) rotate(3deg);
  transform-origin: 80% 100%;
  transition:
    transform 820ms cubic-bezier(0.18, 0.78, 0.18, 1),
    opacity 260ms ease;
}

.radio-hand img {
  display: none;
}

.radio-hand canvas {
  position: absolute;
  right: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: brightness(1.14) contrast(1.05) saturate(0.92) drop-shadow(-12px 18px 16px rgba(0, 0, 0, 0.42));
}

.radio-hand.is-raised {
  opacity: 1;
  transform: translate3d(0, 4%, 0) rotate(0deg);
}

.radio-hand.is-lowering {
  opacity: 0;
  transform: translate3d(5%, 84%, 0) rotate(4deg);
  transition-duration: 520ms, 300ms;
}

.command-prefix,
.command-form input,
.command-form button {
  height: clamp(32px, 3vw, 48px);
  border: 1px solid rgba(117, 233, 210, 0.28);
  background: rgba(1, 8, 7, 0.88);
}

.command-prefix {
  display: grid;
  place-items: center;
  padding: 0 12px;
  color: #7b928b;
  font-size: clamp(8px, 0.74vw, 12px);
  letter-spacing: 0.1em;
}

.command-form input {
  min-width: 0;
  padding: 0 14px;
  color: #e8f3ef;
  outline: 0;
}

.command-form input:focus {
  border-color: rgba(117, 233, 210, 0.8);
  box-shadow: inset 0 0 16px rgba(60, 159, 140, 0.1);
}

.command-form input::placeholder {
  color: #5f706b;
}

.command-form button {
  padding: 0 17px;
  color: var(--cyan);
  cursor: pointer;
}

.command-form button:disabled,
.command-form input:disabled {
  cursor: wait;
  opacity: 0.55;
}

.connection-state {
  position: absolute;
  z-index: 6;
  left: 22%;
  bottom: 11.8%;
  color: rgba(149, 172, 165, 0.62);
  font: 700 clamp(7px, 0.62vw, 10px) / 1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.ai-debug {
  position: absolute;
  z-index: 11;
  right: 2.2%;
  bottom: 3.2%;
  width: min(245px, 17.5vw);
  padding: 10px 12px;
  border: 1px solid rgba(117, 233, 210, 0.2);
  border-left: 2px solid rgba(117, 233, 210, 0.62);
  background: rgba(1, 8, 7, 0.86);
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.28);
  color: rgba(200, 220, 214, 0.78);
  font: 700 clamp(7px, 0.61vw, 10px) / 1.35 Consolas, "Microsoft YaHei", monospace;
  pointer-events: none;
}

.ai-debug-title {
  display: flex;
  gap: 7px;
  align-items: center;
  color: rgba(117, 233, 210, 0.82);
  letter-spacing: 0.08em;
}

.ai-debug-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #697772;
  box-shadow: 0 0 7px currentColor;
}

.ai-debug.is-pending .ai-debug-dot {
  color: #e6b750;
  background: #e6b750;
  animation: recording-pulse 900ms ease-in-out infinite;
}

.ai-debug.is-deepseek .ai-debug-dot {
  color: var(--cyan);
  background: var(--cyan);
}

.ai-debug.is-fallback .ai-debug-dot,
.ai-debug.is-error .ai-debug-dot {
  color: #ef795f;
  background: #ef795f;
}

.ai-debug-status {
  margin-top: 5px;
  color: #e5efec;
}

.ai-debug-detail {
  margin-top: 3px;
  color: rgba(149, 172, 165, 0.62);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.ending-panel {
  position: absolute;
  z-index: 12;
  inset: 17% 27% 18%;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 4%;
  border: 1px solid rgba(117, 233, 210, 0.25);
  background: rgba(1, 5, 5, 0.92);
  text-align: center;
  opacity: 0;
  transform: scale(0.98);
  visibility: hidden;
  transition: opacity 320ms, transform 320ms, visibility 320ms;
}

.ending-panel.is-visible {
  opacity: 1;
  transform: none;
  visibility: visible;
}

.ending-panel h2 {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 62px);
  letter-spacing: 0.08em;
}

.ending-panel > p:not(.eyebrow) {
  max-width: 580px;
  margin: 18px 0;
  color: #aebbb6;
  font-size: clamp(11px, 0.95vw, 16px);
  line-height: 1.7;
}

.ending-clue {
  padding: 10px 16px;
  border-left: 2px solid var(--danger);
  background: rgba(224, 78, 70, 0.08);
  color: #dfe8e4;
  font-size: clamp(10px, 0.82vw, 14px);
  letter-spacing: 0.08em;
}

.ending-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
}

.secondary-button {
  min-width: 150px;
  padding: 13px 20px;
  border: 1px solid #56635f;
  background: transparent;
  cursor: pointer;
}

.signal-cut {
  position: absolute;
  z-index: 10;
  inset: 11.5% 20% 25.7% 19.4%;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(transparent 44%, rgba(215, 255, 245, 0.78) 49%, transparent 54%),
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(117, 233, 210, 0.16) 8px 9px);
  mix-blend-mode: screen;
}

.signal-cut.is-active {
  animation: signal-cut 140ms steps(2, end) both;
}

.eyelids {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
  background: #000;
}

.eyelids.is-opening {
  animation: remove-black 2.35s ease forwards;
}

.eyelids.is-closing {
  background: transparent;
  animation: add-black 1.2s ease forwards;
}

.eyelid {
  position: absolute;
  left: -6%;
  width: 112%;
  height: 57%;
  background: #000;
  will-change: transform;
}

.eyelid-top {
  top: -6%;
  border-radius: 0 0 48% 48% / 0 0 20% 20%;
  transform-origin: top center;
}

.eyelid-bottom {
  bottom: -6%;
  border-radius: 48% 48% 0 0 / 20% 20% 0 0;
  transform-origin: bottom center;
}

.is-opening .eyelid-top {
  animation: open-top 2.35s cubic-bezier(0.42, 0, 0.12, 1) forwards;
}

.is-opening .eyelid-bottom {
  animation: open-bottom 2.35s cubic-bezier(0.42, 0, 0.12, 1) forwards;
}

.is-closing .eyelid-top {
  transform: translateY(-101%) scaleY(0.05);
  animation: close-top 1.2s cubic-bezier(0.45, 0, 0.2, 1) forwards;
}

.is-closing .eyelid-bottom {
  transform: translateY(101%) scaleY(0.05);
  animation: close-bottom 1.2s cubic-bezier(0.45, 0, 0.2, 1) forwards;
}

.is-closing .eye-vignette {
  animation: darken-vignette 1.2s ease forwards;
}

.eye-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 14%, rgba(0, 0, 0, 0.96) 76%);
  opacity: 1;
}

.is-opening .eye-vignette {
  animation: clear-vignette 2.9s ease forwards;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse-caption {
  0% { opacity: 0; }
  45% { opacity: 0.78; }
  100% { opacity: 0; }
}

@keyframes recording {
  50% { opacity: 0.32; }
}

@keyframes signal-shift {
  48% { transform: translateX(0); }
  49% { transform: translateX(1px); }
  50% { transform: translateX(-1px); }
  51% { transform: translateX(0); }
}

@keyframes open-top {
  0%, 10% { transform: translateY(0) scaleY(1); }
  32% { transform: translateY(-18%) scaleY(0.76); }
  42% { transform: translateY(-8%) scaleY(0.86); }
  100% { transform: translateY(-101%) scaleY(0.05); }
}

@keyframes open-bottom {
  0%, 10% { transform: translateY(0) scaleY(1); }
  32% { transform: translateY(18%) scaleY(0.76); }
  42% { transform: translateY(8%) scaleY(0.86); }
  100% { transform: translateY(101%) scaleY(0.05); }
}

@keyframes close-top {
  0% { transform: translateY(-101%) scaleY(0.05); }
  70% { transform: translateY(-12%) scaleY(0.84); }
  100% { transform: translateY(0) scaleY(1); }
}

@keyframes close-bottom {
  0% { transform: translateY(101%) scaleY(0.05); }
  70% { transform: translateY(12%) scaleY(0.84); }
  100% { transform: translateY(0) scaleY(1); }
}

@keyframes darken-vignette {
  0% { opacity: 0; }
  55% { opacity: 0.55; }
  100% { opacity: 1; }
}

@keyframes add-black {
  0%, 68% { background: transparent; }
  100% { background: #000; }
}

@keyframes clear-vignette {
  0%, 20% { opacity: 1; }
  70% { opacity: 0.42; }
  100% { opacity: 0; }
}

@keyframes remove-black {
  0%, 18% { background: #000; }
  42%, 100% { background: transparent; }
}

@keyframes signal-cut {
  0% { opacity: 0; transform: translateX(0); }
  35% { opacity: 0.9; transform: translateX(-5px); }
  70% { opacity: 0.45; transform: translateX(4px); }
  100% { opacity: 0; transform: translateX(0); }
}

@media (max-width: 760px), (max-height: 600px) {
  .game-shell { min-height: 0; }
  .monitor-stage { width: 100vw; }
  .command-prefix { display: none; }
  .command-form { grid-template-columns: 1fr auto; }
  .comms-panel { min-height: 46px; padding: 8px 10px; }
  .comms-panel p { margin-top: 4px; }
  .ai-debug { right: 1.5%; bottom: 1.5%; width: 180px; padding: 7px 9px; }
  .radio-hand { width: 31%; height: 52%; }
}

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