/* ============================================================
   DINO HUNT — game.css
   ============================================================ */

/* === RESET / BASE ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: 'Arial Black', 'Impact', sans-serif;
  background: #111;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

html { overflow: hidden; }
body { overflow-y: auto; }

.hidden { display: none !important; }

/* === PROFILE MODAL ========================================= */
#profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.profile-modal-content {
  background: #1a1a2e;
  border: 4px solid #ffcc00;
  padding: 30px 28px;
  border-radius: 12px;
  width: 85%;
  max-width: 480px;
  position: relative;
  color: #fff;
}
.profile-modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  background: #cc0000;
  color: #fff;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
}
.profile-modal-title {
  color: #ffcc00;
  text-align: center;
  margin: 0 0 20px;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
}
.stat-section { margin: 10px 0; }
.stat-section h3 { color: #ffcc00; margin: 0 0 8px; font-size: 1rem; }
.stat-section p  { margin: 6px 0 0; font-size: 0.85rem; color: #aaa; }
.stat-divider    { border-color: rgba(255,255,255,0.15); margin: 14px 0; }

/* === SCREENS =============================================== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* === TITLE SCREEN ========================================== */
#title-screen {
  background: radial-gradient(ellipse at center, #1a3a0a 0%, #060e02 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* block (not flex) so overflow is computed correctly on iOS */
}

.title-content {
  text-align: center;
  padding: 20px;
  min-height: 100%;        /* fills viewport height when short, scrolls when tall */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.version-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
  margin-top: 14px;
}

.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: #7fff00;
  text-shadow: 0 0 20px #3a8a00, 0 4px 0 #1a4800;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.tagline {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 40px;
  font-family: Arial, sans-serif;
  font-weight: normal;
}

.login-required-msg {
  font-size: 1.4rem;
  color: #ff9944;
  margin-top: 40px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(255, 153, 68, 0.6);
}

/* === TITLE OPTION GROUPS (profile + language) ===================== */
.profile-group {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.profile-btns {
  display: flex;
  gap: 20px;
}

.profile-card {
  border: 3px solid #fff;
  background: #111;
  padding: 16px 14px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  min-width: 100px;
}
.profile-card .profile-avatar {
  font-size: 2.6rem;
  margin-bottom: 8px;
  line-height: 1;
}
.profile-card .profile-card-name {
  font-size: 1rem;
  font-weight: bold;
  color: #ccc;
  text-transform: capitalize;
}
.profile-card:hover {
  transform: scale(1.08);
  border-color: #ffcc00;
}
.profile-card.active {
  border-color: #ffcc00;
  transform: scale(1.1);
  box-shadow: 0 0 20px #ffcc00;
}
.profile-card.active .profile-card-name { color: #ffcc00; }

.title-option-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.option-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 56px;
  text-align: right;
}

.option-btns {
  display: flex;
  gap: 8px;
}

.option-btn {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.2);
  color: #ccc;
  padding: 7px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-transform: capitalize;
}
.option-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.option-btn.active {
  background: rgba(127,255,0,0.18);
  border-color: #7fff00;
  color: #7fff00;
}

.level-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.level-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #2a5c1a, #1a3a0a);
  border: 2px solid #4a9a2a;
  color: #fff;
  padding: 14px 32px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  min-width: 260px;
  transition: transform 0.1s, background 0.2s, border-color 0.2s;
}
.level-btn:hover, .level-btn:focus-visible {
  background: linear-gradient(135deg, #3a7c2a, #2a5c1a);
  border-color: #7fff00;
  transform: scale(1.04);
  outline: none;
}
.level-num {
  font-size: 1.8rem;
  color: #7fff00;
  min-width: 24px;
  text-align: center;
}
.level-name {
  font-size: 1.1rem;
}

/* === MUSIC BUTTON ========================================== */
.music-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.15s;
}
.music-btn:hover { background: rgba(255,255,255,0.22); }
.music-btn.small { padding: 4px 12px; font-size: 0.75rem; }

.test-btn {
  background: rgba(127,255,0,0.1);
  border: 1px solid rgba(127,255,0,0.35);
  color: #7fff00;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  margin-top: 10px;
  transition: background 0.15s;
}
.test-btn:hover { background: rgba(127,255,0,0.2); }

/* === WORLD SCREEN ========================================== */
#world-screen {
  display: flex;
  flex-direction: column;
  background: #111;
}

/* HUD */
#hud {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(0,0,0,0.75);
  border-bottom: 2px solid #333;
  z-index: 30;
}
.hud-label {
  font-size: 0.75rem;
  color: #aaa;
  white-space: nowrap;
}
.health-bar-wrap {
  flex: 1;
  height: 14px;
  background: #400;
  border: 2px solid #900;
  border-radius: 4px;
  overflow: hidden;
}
.health-fill {
  height: 100%;
  background: linear-gradient(to right, #f00 0%, #ff0 50%, #0f0 100%);
  transition: width 0.3s ease;
}

/* Captured bar */
#captured-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.6);
  border-bottom: 2px solid #333;
  min-height: 76px;
  z-index: 20;
}

.captured-cell {
  position: relative;
  width: 60px;
  height: 60px;
  border: 2px solid #8b6914;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
  transform: scale(0);
  opacity: 0;
  transition: none;
}
.captured-cell.pop-in {
  animation: cell-pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes cell-pop-in {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  70%  { transform: scale(1.2) rotate(3deg);  opacity: 1; }
  100% { transform: scale(1)  rotate(0deg);  opacity: 1; }
}

.cell-snapshot {
  display: block;
  image-rendering: pixelated;
}

.bars-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to right,
    rgba(60, 35, 10, 0.88)  0px, rgba(60, 35, 10, 0.88)  5px,
    transparent              5px, transparent             13px
  );
  border-top:    5px solid rgba(60, 35, 10, 0.95);
  border-bottom: 5px solid rgba(60, 35, 10, 0.95);
  pointer-events: none;
}

.cell-name {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  background: rgba(0,0,0,0.7);
  font-size: 7px;
  text-align: center;
  padding: 1px 0;
  color: #ffd700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Viewport + World */
#viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#world {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  /* width set dynamically */
  will-change: transform;
}

#bg-layer {
  position: absolute;
  inset: 0;
  background-size: auto 80%;
  background-repeat: repeat-x;
  background-position: center bottom;
  z-index: 0;
  will-change: background-position;
}

#ground {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 60px;
  z-index: 1;
  background: #2a5c1a;
}

#world-end {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 100%;
  z-index: 20;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.6));
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  color: rgba(255,255,255,0.55);
  border-right: 3px solid rgba(255,255,255,0.25);
  pointer-events: none;
}

/* === PLAYER CHARACTER ====================================== */
#player-char {
  position: absolute;
  bottom: 60px;
  z-index: 5;
  will-change: left, transform;
  /* width/height expand to fit selected character sprite */
}

#player-sprite {
  display: block;
  background: transparent;   /* ensure no accidental background */
  image-rendering: pixelated;
}

/* === DINO ENTITIES ========================================= */
.dino-entity {
  position: absolute;
  bottom: 60px;
  cursor: pointer;
  z-index: 4;
  transform-origin: bottom center;
  transform: scale(0.5);
  transition: filter 0.3s;
}

.dino-sprite {
  display: block;
  background: transparent;   /* let transparency show the scene behind */
  image-rendering: pixelated;
}

.dino-label {
  text-align: center;
  font-size: 11px;
  color: #ffd700;
  text-shadow: 0 1px 2px #000;
  margin-top: 4px;
  pointer-events: none;
}

/* Flee countdown bar */
.flee-bar-wrap {
  width: 60px;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  margin: 0 auto 4px;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
}
.flee-bar-wrap.active { opacity: 1; }

.flee-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, #f00 0%, #ff0 50%, #0f0 100%);
  transform-origin: left;
}

@keyframes flee-countdown {
  from { width: 100%; }
  to   { width: 0%;   }
}

/* Dino fleeing (runs off screen) */
.dino-entity.fleeing {
  animation: dino-flee 1.4s ease-in forwards;
  pointer-events: none;
}
@keyframes dino-flee {
  0%   { transform: scale(0.5)  translateX(0);                                    opacity: 1; }
  30%  { transform: scale(0.42) translateX(calc(var(--flee-dir, 1) *  70px));    opacity: 1; }
  100% { transform: scale(0.05) translateX(calc(var(--flee-dir, 1) * 320px));    opacity: 0; }
}

/* Flip sprite to face the flee direction when running left */
.dino-sprite.flee-flip { transform: scaleX(-1); }

/* Dino reappearing (pops back in) */
.dino-entity.reappearing {
  animation: dino-reappear 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes dino-reappear {
  0%   { transform: scale(0)     translateY(20px); opacity: 0; }
  70%  { transform: scale(0.575) translateY(-4px); opacity: 1; }
  100% { transform: scale(0.5)   translateY(0);    opacity: 1; }
}

/* Nearby glow */
.dino-entity.nearby {
  animation: dino-nearby 1.2s ease-in-out infinite alternate;
}
@keyframes dino-nearby {
  from { filter: drop-shadow(0 0 6px rgba(255, 220, 0, 0.5)); transform: scale(0.5); }
  to   { filter: drop-shadow(0 0 18px rgba(255, 220, 0, 0.9)); transform: scale(0.52); }
}

/* Too-far shake */
.dino-entity.too-far {
  animation: too-far-shake 0.4s ease;
}
@keyframes too-far-shake {
  0%,100% { transform: scale(0.5) translateX(0); }
  25%     { transform: scale(0.5) translateX(-8px); }
  75%     { transform: scale(0.5) translateX(8px); }
}

/* Combat sprite flip (used on enemy dino side) */
.combat-flip { transform: scaleX(-1); }

/* === SPRITE GRID ANIMATION ================================= */
.sprite {
  background-repeat: no-repeat;
  animation-name: sprite-grid;
  animation-timing-function: steps(var(--frames), end);
  animation-duration: var(--duration, 900ms);
  animation-iteration-count: var(--loop, infinite);
  animation-fill-mode: forwards;
  image-rendering: pixelated;
  will-change: background-position;
}

@keyframes sprite-grid {
  from { background-position: 0 var(--row-offset, 0); }
  to   { background-position: calc(-1 * var(--frames) * var(--frame-w, 64px)) var(--row-offset, 0); }
}

/* Hit flash */
.hit {
  animation: hit-flash 0.4s ease !important;
}
@keyframes hit-flash {
  0%,100% { filter: brightness(1); }
  25%     { filter: brightness(3) saturate(0); }
  50%     { filter: brightness(1); }
  75%     { filter: brightness(3) saturate(0); }
}

/* === MOBILE D-PAD ========================================== */
#mobile-controls {
  position: fixed;
  bottom: 20px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  pointer-events: none;
  z-index: 50;
}

.dpad-btn {
  pointer-events: all;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.dpad-btn:active { background: rgba(255,255,255,0.35); }

/* Hide D-pad on devices with precise pointer (desktop) */
@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none !important; }
}

.jump-btn { font-size: 1.4rem; }

/* === COMBAT SCREEN ========================================= */
#combat-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(160deg, #0a0a1a 0%, #1a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 16px;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#combat-screen.active {
  opacity: 1;
  transform: scale(1);
}

#combat-arena {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 600px;
  padding: 20px 0 10px;
}

.combatant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.combatant-name {
  font-size: 0.9rem;
  color: #ffdd88;
  text-align: center;
  text-shadow: 0 1px 3px #000;
}

/* === COMBAT SPRITE containers — explicit transparency ====== */
.combat-sprite {
  min-height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  image-rendering: pixelated;
}

.player-fill { background: linear-gradient(to right, #0f0, #ff0); }
.dino-fill   { background: linear-gradient(to right, #f00, #ff0); }

/* Combat health bars — override flex sizing from HUD context */
.combatant .health-bar-wrap {
  width: 100%;
  flex: 0 0 auto;
  height: 18px;
}

.vs-text {
  font-size: 2rem;
  color: #ffdd00;
  text-shadow: 0 0 12px #ff8800;
  align-self: center;
  flex: 0 0 auto;
  padding-bottom: 20px;
}

/* Correct-answer banner */
#correct-answer-banner {
  background: rgba(200, 0, 0, 0.9);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  border: 2px solid #f00;
  font-size: 1rem;
  text-align: center;
  margin: 6px 0;
  width: 100%;
  max-width: 500px;
}

/* Question panel */
#question-panel {
  width: 100%;
  max-width: 500px;
  background: rgba(0,0,0,0.7);
  border: 2px solid #334;
  border-radius: 12px;
  padding: 16px;
  margin-top: 6px;
}

#question-text {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: #fff;
  text-align: center;
  margin-bottom: 14px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  line-height: 1.4;
}

#input-container {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.mc-btn {
  background: linear-gradient(135deg, #1a2a5a, #0a1a3a);
  border: 2px solid #336;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  min-width: 80px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.mc-btn:hover, .mc-btn:focus-visible {
  background: linear-gradient(135deg, #2a3a7a, #1a2a5a);
  border-color: #66f;
  transform: scale(1.05);
  outline: none;
}
.mc-btn:active { transform: scale(0.97); }

#write-in-answer {
  display: block;
  width: 100%;
  background: #1a1a2a;
  border: 2px solid #446;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-size: 1.2rem;
  text-align: center;
  outline: none;
}
#write-in-answer:focus { border-color: #88f; }

#submit-btn {
  display: block;
  margin: 10px auto 0;
  background: linear-gradient(135deg, #2a6a3a, #1a4a2a);
  border: 2px solid #4a9a5a;
  color: #fff;
  padding: 12px 32px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: background 0.15s, transform 0.1s;
}
#submit-btn:hover { background: linear-gradient(135deg, #3a8a4a, #2a6a3a); }
#submit-btn:active { transform: scale(0.97); }
#submit-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Combat player attacking */
.player-side .combat-sprite.attacking {
  animation: player-attack-lunge 0.5s ease;
}
@keyframes player-attack-lunge {
  0%   { transform: translateX(0); }
  40%  { transform: translateX(40px); }
  100% { transform: translateX(0); }
}

/* Screen shake on hit */
@keyframes screen-shake {
  0%,100% { transform: translate(0); }
  20%     { transform: translate(-6px, 3px); }
  40%     { transform: translate(6px, -3px); }
  60%     { transform: translate(-4px, 2px); }
  80%     { transform: translate(4px, -2px); }
}
.shake {
  animation: screen-shake 0.4s ease;
}

/* === CAPTURE OVERLAY ======================================= */
#capture-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  font-size: clamp(1.6rem, 6vw, 3rem);
  color: #ffd700;
  text-shadow: 0 0 30px #ff8800, 0 2px 0 #000;
  font-family: 'Arial Black', sans-serif;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.2s, transform 0.2s;
}
#capture-overlay.active {
  opacity: 1;
  transform: scale(1);
  animation: capture-pulse 0.4s ease alternate 3;
}
@keyframes capture-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

/* === PARTICLES ============================================= */
.capture-particle {
  position: fixed;
  pointer-events: none;
  z-index: 500;
  animation: particle-burst var(--dur, 0.6s) ease-out forwards;
}
@keyframes particle-burst {
  0%   { transform: translate(0, 0) rotate(0deg)     scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0); opacity: 0; }
}

/* Streak pop */
.streak-pop {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  font-size: 1.4rem;
  color: #ffd700;
  text-shadow: 0 0 10px #ff8800;
  pointer-events: none;
  animation: streak-pop-anim 1.5s ease forwards;
}
@keyframes streak-pop-anim {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0)   scale(0.7); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.1); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(-30px) scale(1);   }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.9); }
}

/* === GAME COMPLETE SCREEN ================================== */
#game-complete-screen {
  background: radial-gradient(ellipse at center, #0d1f04 0%, #040a02 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gc-bg-pulse 4s ease-in-out infinite alternate;
}
@keyframes gc-bg-pulse {
  from { background: radial-gradient(ellipse at center, #0d1f04 0%, #040a02 100%); }
  to   { background: radial-gradient(ellipse at center, #1a3a08 0%, #050d02 100%); }
}

.game-complete-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  max-width: 480px;
  width: 100%;
}

.gc-star {
  font-size: clamp(3rem, 12vw, 6rem);
  animation: gc-star-spin 1.2s ease-out forwards;
  transform-origin: center;
}
@keyframes gc-star-spin {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  70%  { transform: scale(1.3) rotate(15deg);  opacity: 1; }
  100% { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

.gc-title {
  font-size: clamp(1.6rem, 6vw, 3rem);
  color: #7fff00;
  text-shadow: 0 0 30px #3a8a00, 0 4px 0 #1a4800;
  text-align: center;
  letter-spacing: 0.04em;
  margin: 0;
}

.gc-player {
  font-size: 1.2rem;
  color: #ffd700;
  font-family: Arial, sans-serif;
  margin: 0;
  text-transform: capitalize;
}

.gc-stats {
  display: flex;
  gap: 28px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px 28px;
  font-family: Arial, sans-serif;
}
.gc-stat {
  text-align: center;
}
.gc-stat-num {
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
}
.gc-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin-top: 2px;
}

.gc-status {
  font-size: 0.9rem;
  color: #888;
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 1.2em;
}

/* === END SCREENS =========================================== */
#level-complete-screen,
#game-over-screen {
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-content {
  text-align: center;
  padding: 30px 20px;
}
.end-content h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  margin-bottom: 16px;
}
.end-content p {
  font-size: 1.1rem;
  color: #ccc;
  font-family: Arial, sans-serif;
  margin-bottom: 28px;
}

.sf-btn {
  background: linear-gradient(135deg, #2a6a3a, #1a4a2a);
  border: 2px solid #4a9a5a;
  color: #fff;
  padding: 14px 36px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  margin: 6px;
  transition: background 0.15s, transform 0.1s;
}
.sf-btn:hover    { background: linear-gradient(135deg, #3a8a4a, #2a6a3a); }
.sf-btn:active   { transform: scale(0.97); }
.sf-btn.secondary {
  background: linear-gradient(135deg, #3a3a3a, #222);
  border-color: #666;
}

/* === CHARACTER SELECT SCREEN =============================== */
#char-select-screen {
  background: radial-gradient(ellipse at center, #0d1a08 0%, #040a02 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.char-select-content {
  text-align: center;
  padding: 24px 16px;
  width: 100%;
  max-width: 900px;
}

.char-select-title {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  color: #7fff00;
  text-shadow: 0 0 14px #3a8a00;
  margin-bottom: 28px;
}

#char-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 28px;
}

.char-card {
  background: linear-gradient(160deg, #1a2a0a 0%, #0a1a04 100%);
  border: 2px solid #3a6a1a;
  border-radius: 14px;
  padding: 20px 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 140px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.char-card:hover, .char-card:focus-visible {
  border-color: #7fff00;
  transform: scale(1.07) translateY(-4px);
  box-shadow: 0 8px 28px rgba(100, 220, 0, 0.3);
  outline: none;
}
.char-card:active { transform: scale(1.02); }

/* The dino sprite preview is rendered as a .sprite div — transparent background! */
.char-preview {
  background: transparent;
  image-rendering: pixelated;
}

.char-name {
  font-size: 1rem;
  color: #ffd700;
  font-family: 'Arial Black', sans-serif;
}

.char-stats {
  font-size: 0.75rem;
  color: #aaa;
  font-family: Arial, sans-serif;
}

/* === ANIMATION TEST SCREEN ================================= */
#test-screen {
  background: radial-gradient(ellipse at center, #0d1a08 0%, #040a02 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.test-content {
  text-align: center;
  padding: 24px 16px 40px;
  width: 100%;
  max-width: 1000px;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.test-title {
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: #7fff00;
  text-shadow: 0 0 14px #3a8a00;
}

.test-char-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.test-anim-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.test-anim-panel {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 100px;
}

.test-anim-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7fff00;
  font-family: Arial, sans-serif;
}

.test-sprite-wrap {
  overflow: hidden;
  display: block;
  image-rendering: pixelated;
}
.vertical-equation-grid {
  border-collapse: collapse;
  margin: 16px auto;
  background: #111;
  border: 2px solid #fff;
  border-radius: 10px;
  padding: 10px;
}

.vertical-equation-grid td {
  width: 60px;
  height: 60px;
  text-align: center;
  vertical-align: middle;
  font-family: 'Courier New', monospace;
  font-size: 36px;
  padding: 0;
}

.vertical-equation-grid tr:last-child td {
  border-top: 4px solid #fff;
}

.digit-btn {
  background: #444;
  border: 4px solid #fff;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  padding: 10px 20px;
  margin: 5px;
  min-width: 40px;
  position: relative;
  transition: transform 0.1s;
}
.digit-btn.slashed::after {
  content: "";
  position: absolute;
  top: 50%; left: -5px; right: -5px;
  height: 3px;
  background: #ff4444;
  transform: rotate(-45deg);
}

.help-slot-box {
  font-size: 22px;
  color: #00ffff;
  height: 30px;
  position: relative;
  display: inline-block;
  margin-right: 1em;
}
.help-slot-box.slashed::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 140%;
  height: 3px;
  background: #ff4444;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* === AVATAR PICK BUTTON (title screen) ===================== */
.avatar-pick-btn {
  background: linear-gradient(135deg, #1a3a5a, #0a1a3a);
  border: 2px solid #3a6a9a;
  color: #88ccff;
  padding: 9px 22px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-transform: capitalize;
}
.avatar-pick-btn:hover {
  background: linear-gradient(135deg, #2a4a7a, #1a2a5a);
  border-color: #88ccff;
  color: #fff;
}

/* === AVATAR SCREEN ========================================= */
#avatar-screen {
  background: radial-gradient(ellipse at center, #0d1a08 0%, #040a02 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.avatar-screen-content {
  text-align: center;
  padding: 24px 16px 40px;
  width: 100%;
  max-width: 960px;
}

.avatar-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.avatar-screen-title {
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: #7fff00;
  text-shadow: 0 0 14px #3a8a00;
}

.avatar-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.avatar-card {
  background: linear-gradient(160deg, #1a2a0a 0%, #0a1a04 100%);
  border: 2px solid #3a6a1a;
  border-radius: 14px;
  padding: 18px 14px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 120px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.avatar-card:hover {
  border-color: #7fff00;
  transform: scale(1.07) translateY(-4px);
  box-shadow: 0 8px 28px rgba(100, 220, 0, 0.3);
}
.avatar-card.selected {
  border-color: #7fff00;
  box-shadow: 0 0 20px rgba(127, 255, 0, 0.5);
  transform: scale(1.05) translateY(-2px);
}
.avatar-card.selected .avatar-card-name {
  color: #7fff00;
}

.avatar-sprite-wrap {
  overflow: hidden;
  display: block;
  image-rendering: pixelated;
}

.avatar-card-name {
  font-size: 0.9rem;
  color: #ffd700;
  font-family: 'Arial Black', sans-serif;
  text-transform: capitalize;
}
