:root {
  --bg-1: #e7f6d5;
  --bg-2: #b9e4a8;
  --jungle-deep: #154734;
  --jungle-mid: #2d6a4f;
  --jungle-light: #5e9f61;
  --sand: #f4e2b8;
  --card: #fff9ec;
  --text: #14261c;
  --accent: #e07a2d;
  --accent-dark: #7a4a14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.45) 0%, transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(243, 226, 175, 0.7) 0%, transparent 35%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

body.gate-flow-locked {
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 1;
  pointer-events: none;
  opacity: 0.25;
}

body::before {
  left: -40px;
  bottom: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at 20% 40%, var(--jungle-mid) 0%, transparent 60%);
}

body::after {
  right: -60px;
  top: -30px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at 60% 50%, var(--jungle-light) 0%, transparent 65%);
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 26, 19, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gate.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.gate-card {
  width: min(460px, 100%);
  background: color-mix(in srgb, var(--card) 92%, white);
  border: 2px solid rgba(45, 106, 79, 0.32);
  border-radius: 18px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.game-card {
  width: min(520px, 100%);
}

.code-mission-card {
  width: min(700px, 100%);
  color: #234434;
}

.code-mission-card .gate-tag {
  color: #4e946d;
  font-weight: 800;
}

.code-mission-card h2 {
  color: #1f4b39;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.code-mission-card .gate-hint {
  color: #6f786f;
  font-weight: 500;
}

.gate-tag {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--jungle-mid);
  font-weight: 700;
}

.gate-card h2 {
  margin: 10px 0 8px;
  color: var(--jungle-deep);
}

.gate-hint {
  margin: 0 0 12px;
  opacity: 0.82;
}

.gate-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(45, 106, 79, 0.4);
  font-size: 1rem;
  outline: none;
}

.gate-input:focus {
  border-color: var(--jungle-mid);
}

.gate-btn {
  margin-top: 12px;
  width: 100%;
}

.gate-error {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #b42318;
  font-size: 0.92rem;
  font-weight: 700;
}

.dino-canvas {
  margin-top: 8px;
  width: 100%;
  max-width: 460px;
  height: auto;
  border-radius: 12px;
  border: 2px solid rgba(45, 106, 79, 0.42);
  background: linear-gradient(180deg, #f2f9eb 0%, #e1efce 100%);
  touch-action: manipulation;
}

.dino-score {
  margin: 10px 0 6px;
  font-weight: 700;
  color: var(--jungle-deep);
}

.game-message {
  margin: 0 0 10px;
}

.code-block {
  margin: 10px 0 0;
  padding: 12px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(45, 106, 79, 0.35);
  background: #122218;
  color: #d3ffd8;
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre;
}

.code-block code {
  font-family: "Consolas", "Courier New", monospace;
}

.repo-preview-wrap {
  margin-top: 10px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(66, 123, 92, 0.34);
  overflow: hidden;
  background: #f4ede2;
}

.repo-preview-frame {
  display: block;
  width: 100%;
  height: min(72vh, 620px);
  border: 0;
  background: #fbf7f0;
}

.mission-progress {
  margin-top: 12px;
}

.mission-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(45, 106, 79, 0.18);
  overflow: hidden;
}

.mission-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #87c87a, #4aa56e);
  transition: width 0.2s linear;
}

.mission-progress-text {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: #2c5f49;
}

.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;
}

.page {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.page.locked {
  filter: blur(14px) brightness(0.55) saturate(0.75);
  transform: scale(1.01);
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
}

.hero {
  text-align: center;
  background: color-mix(in srgb, var(--card) 92%, white);
  border: 2px solid rgba(45, 106, 79, 0.24);
  border-radius: 20px;
  padding: 28px 18px;
  box-shadow: 0 12px 32px rgba(20, 65, 44, 0.2);
}

.tag {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--jungle-mid);
  font-weight: 700;
}

h1 {
  margin: 10px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--jungle-deep);
}

.subtitle {
  min-height: 1.5em;
  margin: 0 auto 18px;
  max-width: 700px;
}

.hero-lead {
  max-width: 690px;
  margin: 0 auto 22px;
  color: #5d6d64;
  font-size: 1.02rem;
  line-height: 1.65;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn:active {
  transform: translateY(0);
}

.btn-alt {
  background: var(--accent-dark);
}

.section-head {
  max-width: 720px;
  margin: 0 auto 20px;
  text-align: center;
}

.section-head h2 {
  margin: 10px 0 10px;
  color: var(--jungle-deep);
  font-size: clamp(1.6rem, 3vw, 2.35rem);
}

.section-copy {
  margin: 0;
  color: #627067;
  line-height: 1.65;
}

.story-wrap,
.gallery-wrap {
  margin-top: 22px;
  background: color-mix(in srgb, var(--card) 88%, white);
  border: 2px solid rgba(45, 106, 79, 0.22);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 10px 30px rgba(20, 65, 44, 0.17);
}

.story-wrap {
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.55) 0%, transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 239, 0.96) 0%, rgba(243, 248, 237, 0.95) 100%);
}

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

.story-card {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(45, 106, 79, 0.12);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(20, 65, 44, 0.1);
}

.story-card-tag {
  margin: 0;
  color: #6aa17c;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.story-card h3 {
  margin: 10px 0 8px;
  color: var(--jungle-deep);
  font-size: 1.15rem;
}

.story-card p:last-child {
  margin: 0;
  color: #5f6e65;
  line-height: 1.62;
}

.gallery-wrap h2 {
  margin: 0;
  text-align: center;
  color: var(--jungle-deep);
}

.hint {
  margin: 6px 0 14px;
  text-align: center;
  opacity: 0.78;
}

.gallery-lead {
  max-width: 690px;
  margin: 0 auto 14px;
  text-align: center;
  color: #5f6d64;
  line-height: 1.62;
}

.memory-themes {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.memory-themes span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(45, 106, 79, 0.15);
  color: #47735a;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.photo-card {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: #edf4df;
  box-shadow: 0 7px 18px rgba(20, 65, 44, 0.2);
}

.photo-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}


.video-wrap {
  margin-top: 22px;
  background: color-mix(in srgb, var(--card) 88%, white);
  border: 2px solid rgba(45, 106, 79, 0.22);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 10px 30px rgba(20, 65, 44, 0.17);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.video-frame {
  border-radius: 18px;
  overflow: hidden;
  background: #173425;
  box-shadow: 0 10px 24px rgba(20, 65, 44, 0.18);
}

.memory-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #10261b;
}
.finale-wrap {
  margin-top: 22px;
}

.finale-card {
  background:
    radial-gradient(circle at 84% 18%, rgba(244, 198, 125, 0.18) 0%, transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 239, 0.98) 0%, rgba(247, 243, 235, 0.96) 100%);
  border: 2px solid rgba(45, 106, 79, 0.2);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(20, 65, 44, 0.16);
}

.finale-card h2 {
  margin: 10px 0 14px;
  color: var(--jungle-deep);
  font-size: clamp(1.65rem, 3.2vw, 2.45rem);
}

.finale-card p {
  max-width: 720px;
  margin: 0 auto 14px;
  color: #5c6c63;
  line-height: 1.68;
}

.finale-actions {
  margin-top: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 26, 19, 0.8);
  padding: 18px;
  z-index: 10;
}

.modal.show {
  display: flex;
}

.modal img {
  max-width: min(820px, 95vw);
  max-height: 85vh;
  border-radius: 16px;
  border: 3px solid #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  border: none;
  background: white;
  color: #21372b;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}

.egg {
  position: fixed;
  width: 14px;
  height: 18px;
  border-radius: 50% 50% 45% 45%;
  border: 2px solid #75654a;
  background: var(--sand);
  pointer-events: none;
  z-index: 9;
  animation: popUp 1000ms ease-out forwards;
}

.egg::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9a865f;
  box-shadow: 4px 5px 0 #9a865f;
}

.roar-banner {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.75);
  z-index: 40;
  font-size: clamp(1.4rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff7d4;
  text-shadow:
    0 2px 0 #8a4a0b,
    0 8px 20px rgba(0, 0, 0, 0.35);
  background: linear-gradient(120deg, #d47a1f, #f2b84b);
  border: 3px solid #6b3d12;
  border-radius: 14px;
  padding: 10px 18px;
  animation: roarPop 1200ms ease-out forwards;
  pointer-events: none;
}

body.screen-shake main {
  animation: screenShake 700ms linear;
}

@keyframes popUp {
  to {
    transform: translateY(-85px) rotate(10deg) scale(0.55);
    opacity: 0;
  }
}

@keyframes roarPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.65);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.12);
  }
}

@keyframes screenShake {
  0% { transform: translate(0, 0); }
  15% { transform: translate(-3px, 2px); }
  30% { transform: translate(4px, -2px); }
  45% { transform: translate(-4px, -1px); }
  60% { transform: translate(3px, 2px); }
  75% { transform: translate(-2px, 1px); }
  100% { transform: translate(0, 0); }
}

@media (max-width: 640px) {
  .gate {
    padding: 10px;
  }

  .gate-card {
    padding: 16px 12px;
  }

  .gate-card h2 {
    margin: 8px 0 6px;
    font-size: 1.45rem;
  }

  .gate-hint {
    font-size: 0.92rem;
    margin-bottom: 9px;
  }

  .hero,
  .story-wrap,
  .gallery-wrap,
  .video-wrap {
    border-radius: 16px;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .gallery-lead {
    max-width: 32ch;
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 12px;
  }

  .memory-themes {
    gap: 8px;
    margin-bottom: 16px;
  }

  .memory-themes span {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .photo-card {
    width: 100%;
  }

  .photo-card img {
    height: 280px;
  }

  .game-card {
    width: min(480px, 100%);
  }

  .code-mission-card {
    width: min(440px, 100%);
  }

  .repo-preview-frame {
    height: min(66vh, 520px);
  }

  .gate-btn {
    margin-top: 10px;
    padding: 10px 14px;
    font-size: 0.95rem;
  }
}

@media (max-width: 430px), (max-height: 760px) {
  .gate {
    padding: 8px;
  }

  .code-mission-card {
    width: min(390px, 100%);
    padding: 12px 10px;
  }

  .hero,
  .story-wrap,
  .gallery-wrap,
  .video-wrap,
  .finale-card {
    padding: 18px 14px;
  }

  .hero-lead,
  .gallery-lead,
  .finale-card p {
    font-size: 0.96rem;
  }

  .code-mission-card h2 {
    font-size: 1.2rem;
    margin: 6px 0 5px;
  }

  .code-mission-card .gate-hint {
    font-size: 0.86rem;
    margin-bottom: 7px;
  }

  .repo-preview-wrap {
    margin-top: 6px;
    border-radius: 10px;
  }

  .repo-preview-frame {
    height: min(56vh, 420px);
  }

  .code-mission-card .gate-btn {
    margin-top: 8px;
    font-size: 0.9rem;
    padding: 9px 12px;
  }
}



