:root {
  --bg: #06090c;
  --bg-alt: #0d1518;
  --panel: rgba(16, 23, 27, 0.92);
  --panel-soft: rgba(22, 31, 36, 0.82);
  --line: rgba(157, 232, 199, 0.16);
  --text: #edf8f0;
  --muted: #98ada3;
  --good: #64f0b4;
  --bad: #ff6d7a;
  --warn: #ffd06b;
  --glow: #79ffd0;
  --door: linear-gradient(180deg, #27413b 0%, #1a2925 48%, #101818 100%);
  --shadow: 0 20px 44px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(121, 255, 208, 0.1), transparent 30%),
    radial-gradient(circle at 85% 12%, rgba(255, 109, 122, 0.08), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body {
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
}

.app-shell {
  width: min(100%, 460px);
  margin: 0 auto;
  min-height: calc(100vh - 28px);
  display: flex;
}

.screen {
  display: none;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px 16px 20px;
  backdrop-filter: blur(10px);
}

.screen.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-pill,
.tiny-label {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(100, 240, 180, 0.12);
  border: 1px solid rgba(100, 240, 180, 0.18);
  color: #c8ffe6;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 1.06;
}

.tagline {
  color: var(--muted);
  line-height: 1.7;
}

.hero-door {
  position: relative;
  height: 220px;
  border-radius: 28px;
  background: var(--door);
  border: 1px solid rgba(121, 255, 208, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 -30px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.hero-door::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 36%, rgba(0, 0, 0, 0.24));
}

.peephole,
.peephole-core {
  border-radius: 50%;
}

.peephole {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 72px;
  border: 6px solid rgba(255, 214, 123, 0.5);
  background: radial-gradient(circle at 40% 35%, #22352f, #030607 68%);
  box-shadow: 0 0 20px rgba(121, 255, 208, 0.18);
}

.glow {
  animation: pulse 2.2s ease-in-out infinite;
}

.door-scratch {
  position: absolute;
  left: 58%;
  top: 120px;
  width: 4px;
  height: 58px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 85, 85, 0.1));
  transform: rotate(-14deg);
  border-radius: 999px;
}

.door-scratch.short {
  left: 63%;
  top: 132px;
  height: 40px;
}

.intro-card,
.result-card,
.feedback-box,
.door-panel,
.life-panel {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
}

.intro-card,
.result-card,
.feedback-box,
.door-panel {
  padding: 14px;
}

.intro-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.stat-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chip,
.top-item,
.life-box {
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.chip span,
.top-item span,
.life-box span,
.result-score span,
.response-box span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.chip strong,
.top-item strong,
.life-box strong,
.result-score strong,
.response-box strong {
  font-size: 1.06rem;
}

.primary-btn,
.secondary-btn,
.choice-btn {
  border-radius: 18px;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  padding: 16px 18px;
}

.primary-btn {
  color: #062118;
  background: linear-gradient(120deg, var(--glow), #a3ffde);
  box-shadow: 0 14px 30px rgba(121, 255, 208, 0.2);
}

.secondary-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-btn:active,
.secondary-btn:active,
.choice-btn:active {
  transform: translateY(1px) scale(0.995);
}

.topbar,
.life-panel,
.choice-panel,
.result-actions {
  display: grid;
  gap: 10px;
}

.topbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.top-item.accent strong {
  color: var(--good);
}

.top-item.warn strong {
  color: var(--warn);
}

.life-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 10px;
}

.life-box.safe strong {
  color: var(--good);
}

.life-box.human strong {
  color: #7fd3ff;
}

.life-box.round strong {
  color: var(--warn);
}

.door-panel {
  gap: 14px;
  display: flex;
  flex-direction: column;
}

.door-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.response-box {
  min-width: 84px;
  text-align: right;
}

.response-box strong {
  color: var(--warn);
}

.peephole-view {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 168px;
  border-radius: 20px;
  padding: 18px;
  background:
    radial-gradient(circle at center, rgba(121, 255, 208, 0.14), transparent 28%),
    radial-gradient(circle at center, rgba(3, 7, 8, 0.95) 0%, rgba(6, 9, 10, 0.9) 45%, rgba(25, 38, 42, 0.6) 70%, transparent 71%);
  border: 1px solid rgba(121, 255, 208, 0.1);
  overflow: hidden;
}

.peephole-view::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.06);
}

.peephole-core {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(121, 255, 208, 0.12);
}

#peephole-text {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  line-height: 1.65;
}

.timer-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.timer-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--good), #ffe170 60%, #ff717a 100%);
  transform-origin: left center;
}

.clue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.clue-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.clue-list span {
  font-size: 0.76rem;
  color: var(--muted);
}

.clue-list strong {
  line-height: 1.5;
}

.feedback-box {
  min-height: 86px;
}

.feedback-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.feedback-detail {
  color: var(--muted);
  line-height: 1.65;
}

.feedback-box.good {
  border-color: rgba(100, 240, 180, 0.28);
  box-shadow: inset 0 0 0 1px rgba(100, 240, 180, 0.12);
}

.feedback-box.bad {
  border-color: rgba(255, 109, 122, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 109, 122, 0.12);
}

.feedback-box.neutral {
  border-color: rgba(255, 255, 255, 0.05);
}

.choice-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: auto;
}

.choice-btn {
  padding: 16px 12px;
  color: white;
  font-size: 1.02rem;
}

.choice-btn.open {
  background: linear-gradient(140deg, #62d5ff, #398bff);
}

.choice-btn.bar {
  background: linear-gradient(140deg, #ff8b6d, #ff4f6f);
}

.choice-btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.result-screen {
  justify-content: center;
}

.result-score {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 14px 0 0;
}

.result-score strong {
  font-size: 2rem;
}

.result-score.sub strong {
  font-size: 1.3rem;
  color: var(--glow);
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#share-text {
  width: 100%;
  min-height: 116px;
  resize: none;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 10, 11, 0.95);
  color: var(--text);
  line-height: 1.6;
}

.copy-hint {
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

body.danger-pulse {
  animation: bodyFlash 0.28s linear 1;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 0 18px rgba(121, 255, 208, 0.14);
  }
  50% {
    transform: translateX(-50%) scale(1.04);
    box-shadow: 0 0 28px rgba(121, 255, 208, 0.22);
  }
}

@keyframes bodyFlash {
  0% {
    filter: saturate(1);
  }
  35% {
    filter: saturate(1.4) brightness(1.08);
  }
  100% {
    filter: saturate(1);
  }
}

@media (max-width: 360px) {
  .screen {
    border-radius: 20px;
    padding: 14px 12px 18px;
  }

  .stat-chips,
  .topbar,
  .life-panel,
  .choice-panel,
  .result-actions {
    gap: 8px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 24px;
  }

  .app-shell {
    width: min(92vw, 760px);
  }

  .game-screen.active {
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    grid-template-areas:
      "top top"
      "life life"
      "door feedback"
      "door choice";
    align-items: start;
  }

  .topbar {
    grid-area: top;
  }

  .life-panel {
    grid-area: life;
  }

  .door-panel {
    grid-area: door;
  }

  .feedback-box {
    grid-area: feedback;
    min-height: 100%;
  }

  .choice-panel {
    grid-area: choice;
    margin-top: 0;
  }
}
