/* ─── Case study password gate ─────────────────────────── */
.cs-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg, #02131c);
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text, #d0f4ff);
  overflow: auto;
}

.cs-gate-card {
  width: 100%;
  max-width: 720px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Top-left back button — fixed inside the gate overlay so it's still
   reachable while the rest of the case-study content is locked. */
.cs-gate-back {
  position: absolute;
  top: 26px;
  left: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(0, 200, 255, 0.10));
  color: var(--text-dim, rgba(180, 230, 255, 0.55));
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.cs-gate-back:hover {
  color: var(--cyan, #00f0e0);
  border-color: rgba(0, 240, 224, 0.45);
  background: rgba(0, 240, 224, 0.08);
  transform: translateX(-4px);
}

.cs-gate-back:focus-visible {
  outline: 2px solid var(--cyan, #00f0e0);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .cs-gate-back {
    top: 16px;
    left: 16px;
    padding: 8px 14px;
    font-size: 10px;
    letter-spacing: 1.5px;
  }
}

.cs-gate-tag {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cyan, #00f0e0);
  margin: 0;
}

.cs-gate-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  color: var(--hero-name, #fff);
}

.cs-gate-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dim, rgba(180, 230, 255, 0.55));
  max-width: 520px;
  margin: 0;
}

/* Kaomoji line — slightly larger and brighter than the prompt below */
.cs-gate-kao {
  display: inline-block;
  font-size: 20px;
  letter-spacing: 0;
  color: var(--text, #d0f4ff);
  margin-bottom: 4px;
}

.cs-gate-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.cs-gate-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(0, 200, 255, 0.10));
  border-radius: 100px;
  padding: 14px 20px;
  color: var(--text, #d0f4ff);
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.3s ease;
}

.cs-gate-form input:focus {
  border-color: var(--cyan, #00f0e0);
}

.cs-gate-form input.shake {
  animation: cs-gate-shake 0.4s ease;
  border-color: #ff5577;
}

@keyframes cs-gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.cs-gate-form button {
  background: var(--cyan, #00f0e0);
  border: none;
  border-radius: 100px;
  padding: 14px 24px;
  color: #02131c;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cs-gate-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 240, 224, 0.25);
}

/* ─── Dino game ──────────────────────────── */
.cs-gate-game-wrap {
  width: 100%;
  max-width: 640px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.cs-gate-game-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim, rgba(180, 230, 255, 0.45));
  margin: 0;
}

.cs-gate-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
}

#dinoCanvas {
  width: 100%;
  max-width: 640px;
  height: 180px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, rgba(0, 200, 255, 0.10));
  border-radius: 14px;
  display: block;
}

.cs-gate-hint {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim, rgba(180, 230, 255, 0.35));
  margin: 4px 0 0;
}

.cs-gate-start {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cyan, #00f0e0);
  border: none;
  border-radius: 100px;
  padding: 14px 34px;
  color: #02131c;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 8px 32px rgba(0, 240, 224, 0.35),
              0 0 0 4px rgba(0, 240, 224, 0.15);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s ease,
              box-shadow 0.25s ease;
}
.cs-gate-start:hover {
  transform: translate(-50%, -52%);
  box-shadow: 0 14px 40px rgba(0, 240, 224, 0.45),
              0 0 0 5px rgba(0, 240, 224, 0.2);
}
.cs-gate-start.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.85);
}

/* Game-over: shift the Play Again button below the GAME OVER + SCORE rows
   so the canvas reads as three clean rows instead of crowding the middle. */
.cs-gate-start--lower {
  top: calc(50% + 28px);
}
.cs-gate-start--lower:hover {
  transform: translate(-50%, calc(-50% - 2px));
}

/* Leaderboard */
.cs-gate-leaderboard {
  width: 100%;
  max-width: 640px;
  margin-top: 12px;
  font-family: 'Space Mono', monospace;
}
.cs-gate-leaderboard h4 {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim, rgba(180, 230, 255, 0.5));
  margin: 0 0 8px;
  text-align: center;
}
.cs-gate-leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}
.cs-gate-leaderboard li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(0, 200, 255, 0.10));
  font-size: 13px;
  color: var(--text, #d0f4ff);
}
.cs-gate-leaderboard li .rank {
  color: var(--text-dim, rgba(180, 230, 255, 0.5));
  font-size: 11px;
  margin-right: 8px;
}
.cs-gate-leaderboard li .name { font-weight: 700; letter-spacing: 1px; }
.cs-gate-leaderboard li .score { color: var(--cyan, #00f0e0); font-weight: 700; }
.cs-gate-leaderboard li.fresh {
  background: rgba(0, 240, 224, 0.16);
  border-color: rgba(0, 240, 224, 0.45);
  animation: cs-fresh-glow 1.2s ease;
}
.cs-gate-leaderboard li.pending {
  /* Subtle pulse so the row reads as "your turn" while the input is open */
  animation: cs-fresh-glow 1.6s ease infinite;
}
.cs-gate-leaderboard li .name-input {
  width: 56px;
  padding: 4px 6px;
  background: rgba(0, 240, 224, 0.12);
  border: 1px solid rgba(0, 240, 224, 0.55);
  border-radius: 6px;
  color: var(--text, #d0f4ff);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.cs-gate-leaderboard li .name-input::placeholder {
  color: rgba(180, 230, 255, 0.4);
  letter-spacing: 2px;
}
.cs-gate-leaderboard li .name-input:focus {
  border-color: var(--cyan, #00f0e0);
  box-shadow: 0 0 0 3px rgba(0, 240, 224, 0.2);
}
.cs-gate-leaderboard li .name-input.shake {
  animation: cs-gate-shake 0.4s ease;
  border-color: #ff5577;
  box-shadow: 0 0 0 3px rgba(255, 85, 119, 0.25);
}

/* "Enter your initials" prompt under the leaderboard, only shown
   while there's an unresolved pending entry. */
.cs-gate-lb-prompt {
  margin: 12px 0 0;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan, #00f0e0);
  animation: cs-fresh-glow 1.6s ease infinite;
}
.cs-gate-lb-prompt[hidden] { display: none; }
@keyframes cs-fresh-glow {
  0%   { box-shadow: 0 0 0 rgba(0, 240, 224, 0); }
  40%  { box-shadow: 0 0 24px rgba(0, 240, 224, 0.4); }
  100% { box-shadow: 0 0 0 rgba(0, 240, 224, 0); }
}

.cs-name-form {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cs-name-form .label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim, rgba(180, 230, 255, 0.5));
  text-transform: uppercase;
}
.cs-name-form input {
  width: 80px;
  padding: 8px 10px;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
  text-align: center;
  letter-spacing: 4px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(0, 200, 255, 0.10));
  border-radius: 8px;
  color: var(--text, #d0f4ff);
  outline: none;
}
.cs-name-form input:focus { border-color: var(--cyan, #00f0e0); }
.cs-name-form button {
  padding: 8px 16px;
  border: none;
  background: var(--cyan, #00f0e0);
  color: #02131c;
  border-radius: 8px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.cs-name-form button:hover { transform: translateY(-1px); }

/* Hide the rest of the page while locked */
body.cs-locked > *:not(.cs-gate):not(script):not(.site-cursor):not(.site-cursor-ripple):not(.site-scrollbar) {
  visibility: hidden !important;
  pointer-events: none !important;
}
