:root {
  --text: #f4f4f4;
  --muted: #d7d7d7;
  --panel: #00000055;
  --panel-strong: #0000007a;
  --line: #ffffff40;
  --btn: #1f2937d6;
  --btn-hover: #374151e0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background: url("assets/photo.png") center center / cover no-repeat fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: #0000004a;
  pointer-events: none;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  display: none;
  padding: 22px;
  text-align: center;
  animation: fadeIn 0.45s ease;
}

.scene.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.scene-title {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  color: #ffffff;
  text-shadow: 0 2px 12px #000000a8;
}

.pixel-title {
  margin: 0;
  line-height: 1.6;
  font-size: clamp(0.92rem, 2.3vw, 1.28rem);
  color: #ffffff;
  font-family: "Press Start 2P", monospace;
  text-shadow: 0 2px 12px #000000a8;
}

.stone-wrap {
  margin-top: 8px;
  display: grid;
  place-items: center;
}

.pixel-fox {
  width: min(170px, 44vw);
  image-rendering: pixelated;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.18s ease;
}

.pixel-fox:hover {
  transform: translateY(-6px) scale(1.03);
}

.stone {
  width: min(180px, 46vw);
  height: 24px;
  margin-top: -8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #999, #777);
}

.hint {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.68rem;
  color: var(--muted);
  text-shadow: 0 2px 10px #000;
}

.dialogue-box {
  width: min(680px, 100%);
  min-height: 240px;
  max-height: 54vh;
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
}

.chat-line {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 11px;
  max-width: 88%;
  animation: popIn 0.22s ease;
}

.chat-line.player {
  margin-left: auto;
  background: #ffffff1e;
}

.chat-line.fox {
  margin-right: auto;
  background: #00000042;
}

.chat-line.system {
  margin: 10px auto;
  text-align: center;
  background: #ffffff1f;
}

.dialogue-options {
  width: min(680px, 100%);
  display: grid;
  gap: 8px;
}

.choice-btn,
.btn,
.option {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--btn);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.choice-btn:hover,
.btn:hover,
.option:hover {
  transform: translateY(-1px);
  background: var(--btn-hover);
}

.btn-soft {
  background: #2b313bcc;
}

.hidden {
  display: none !important;
}

.slide-frame {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #00000059;
}

.slide-frame img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.fade-slide {
  animation: crossFade 0.65s ease;
}

.caption {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  font-weight: 600;
  color: #1a1a1a;
  text-shadow: 0 1px 4px #ffffffd1;
  z-index: 2;
  pointer-events: none;
}

.journey-hint {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.95rem;
  color: #1a1a1a;
  text-shadow: 0 1px 4px #ffffffd1;
  z-index: 2;
  pointer-events: none;
}

#journey {
  padding: 0;
}

#journey.scene.active {
  justify-content: center;
  align-items: center;
  gap: 0;
}

#quiz {
  position: relative;
}

.quiz-overlay {
  position: absolute;
  inset: 0;
  background: #00000047;
  backdrop-filter: blur(2px);
}

.quiz-content {
  position: relative;
  z-index: 2;
  width: min(760px, 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.quiz-progress {
  margin: 2px 0;
  font-weight: 700;
  text-shadow: 0 2px 10px #000;
}

.question-card {
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  width: min(760px, 100%);
}

#blackout {
  padding: 0;
  background: #000;
}

.blackout-glitch {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}

.blackout-glitch::before,
.blackout-glitch::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 8px,
      #ffffff12 8px 10px
    );
  mix-blend-mode: screen;
  animation: glitchShift 0.22s steps(2, end) infinite;
}

.blackout-glitch::after {
  animation-duration: 0.31s;
  opacity: 0.5;
}

#video {
  padding: 0;
}

.arrive-frame {
  height: min(86vh, calc(92vw * 1.414));
  aspect-ratio: 1 / 1.414;
  width: auto;
  max-width: 94vw;
  border: 1px solid var(--line);
  background: #0000009a;
  display: grid;
  place-items: center;
}

#arrive-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
}

#terminal {
  padding: 0;
}

.terminal-box {
  width: min(900px, 100%);
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.terminal-text {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(1.1rem, 2.8vw, 1.6rem);
  color: #dbffd8;
  text-shadow: 0 0 10px #7bff72aa;
  min-height: 1.4em;
}

.terminal-proceed {
  border-radius: 4px;
  background: #111;
  border: 1px solid #5c5c5c;
  color: #f3f3f3;
  padding: 8px 14px;
  font-family: "Courier New", Courier, monospace;
  letter-spacing: 0.02em;
}

.question-text {
  margin: 0 0 12px;
  font-size: 1.12rem;
  font-weight: 700;
}

.options-wrap {
  display: grid;
  gap: 10px;
}

.text-wrap {
  display: flex;
  justify-content: center;
  gap: 10px;
}

#text-answer {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  color: #fff;
  background: #00000066;
}

#text-answer::placeholder {
  color: #d7d7d7;
}

.decision-actions {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

#no-btn {
  position: relative;
}

#final {
  padding: 0;
}

.final-bg-wrap {
  position: absolute;
  inset: 0;
}

.final-bg-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.final-overlay {
  position: absolute;
  inset: 0;
  background: #0000005f;
}

.letter-card {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  padding: 16px;
}

.letter-lines {
  text-align: left;
  min-height: 160px;
}

.letter-line {
  margin: 9px 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px #000;
  animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes crossFade {
  from {
    opacity: 0.25;
    transform: scale(1.01);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glitchShift {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(2px);
  }
  60% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

@media (max-width: 720px) {
  .scene {
    padding: 14px;
  }

  .dialogue-box {
    min-height: 210px;
  }

  .text-wrap {
    flex-direction: column;
    align-items: center;
  }
}
