/* typecritter.css — modern cartoon-vector UI (no pixel art).
   Pairs with typecritter-render.js's smooth canvas rendering. */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@600;800&display=swap');

/* The HTML `hidden` attribute should win over the explicit `display: flex`
   in style.css's .score-entry / .leaderboard rules — without this, the
   name-entry and leaderboard stay visible at the start of the game even
   though we'd marked them hidden in the HTML. */
[hidden] { display: none !important; }

.typecritter-body {
  background:
    radial-gradient(circle at 15% 10%, #2d1f5a 0%, #0e0820 60%) fixed;
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
  color: #fff;
}

.game-shell.typecritter,
.game-shell.typecritter * {
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
}

.game-shell.typecritter {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}

.game-shell.typecritter .stage {
  position: relative;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.4);
}

.game-shell.typecritter canvas {
  display: block;
  width: 100%;
  height: auto;
  /* Smooth — explicitly NOT pixelated. */
  image-rendering: auto;
}

/* HUD — solid dark panel. White text + gold labels are always readable
   regardless of what's underneath (no more white-on-white-glass). */
.game-shell.typecritter .hud {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(180deg, #2a1a4a 0%, #1a103a 100%);
  border: 2px solid rgba(255, 216, 74, 0.5);
  border-radius: 14px;
  padding: 14px 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 18px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  color: #ffffff;
}
.game-shell.typecritter .hud .hud-label {
  color: #ffd84a;
  margin-right: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.game-shell.typecritter .hud .hud-item {
  display: inline-flex;
  align-items: center;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  /* No background on the item itself — that was creating false white panels.
     The contrast is handled by the dark HUD background. */
  background: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}
.game-shell.typecritter .hud .hud-back,
.game-shell.typecritter .hud .hud-link {
  color: #ffd84a;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(255, 216, 74, 0.14);
  border: 1px solid rgba(255, 216, 74, 0.5);
  transition: all 140ms ease;
}
.game-shell.typecritter .hud .hud-back:hover,
.game-shell.typecritter .hud .hud-link:hover {
  background: #ffd84a;
  color: #2a1a05;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 216, 74, 0.4);
}

/* Heart count gently pulses like a heartbeat. */
@keyframes heart-beat {
  0%, 70%, 100% { transform: scale(1); }
  10% { transform: scale(1.20); }
  35% { transform: scale(1.10); }
  45% { transform: scale(1.18); }
}
.game-shell.typecritter #hearts {
  display: inline-block;
  color: #ff6088;
  text-shadow: 0 2px 8px rgba(255, 96, 136, 0.45);
  animation: heart-beat 1100ms ease-in-out infinite;
  transform-origin: center;
  font-size: 20px;
}

/* Overlay — friendly modern card. */
.game-shell.typecritter .overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(40, 20, 80, 0.55) 0%, rgba(0, 0, 0, 0.85) 80%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-shell.typecritter .overlay[hidden] { display: none; }

.game-shell.typecritter .overlay-card {
  background: linear-gradient(160deg, #ffffff 0%, #f5f0fa 100%);
  border-radius: 24px;
  padding: 36px 44px;
  text-align: center;
  color: #2a1a4a;
  max-width: 520px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.game-shell.typecritter .overlay-card h1 {
  margin: 0 0 14px;
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(180deg, #f59c2c 0%, #ff5d8a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.game-shell.typecritter .overlay-card p {
  font-size: 16px;
  line-height: 1.5;
  color: #4a3a6a;
  margin: 8px 0;
}

.game-shell.typecritter .overlay-card button {
  background: linear-gradient(180deg, #6dd44f 0%, #3da32a 100%);
  border: none;
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 32px;
  margin: 8px 6px;
  border-radius: 14px;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow:
    0 4px 0 #2a7a1a,
    0 8px 20px rgba(61, 163, 42, 0.35);
  transition: all 100ms ease;
}
.game-shell.typecritter .overlay-card button:hover {
  background: linear-gradient(180deg, #ffd84a 0%, #f59c2c 100%);
  box-shadow: 0 4px 0 #b56808, 0 8px 20px rgba(245, 156, 44, 0.4);
}
.game-shell.typecritter .overlay-card button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2a7a1a, 0 4px 10px rgba(61, 163, 42, 0.3);
}
.game-shell.typecritter .overlay-card .hint {
  font-size: 13px;
  color: #7a6a8a;
  margin-top: 18px;
  line-height: 1.6;
}
.game-shell.typecritter .overlay-card kbd {
  background: #ece6f5;
  border: 1px solid #c8b8d8;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: 'Fredoka', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #4a3a6a;
  box-shadow: 0 1px 0 #c8b8d8;
}
.game-shell.typecritter .overlay-card .resume-line {
  color: #3da32a;
  font-weight: 600;
  margin: 10px 0;
}
.game-shell.typecritter .overlay-card .final-score strong {
  color: #f59c2c;
  font-size: 32px;
  font-weight: 700;
}

/* Finger guide — soft glass panel with chunky friendly keys. */
.game-shell.typecritter .teaching {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.game-shell.typecritter .finger-guide {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  /* Sized to its content, centered in the panel — keeps row offsets
     consistent regardless of viewport width. */
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}
.game-shell.typecritter .fg-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.game-shell.typecritter .fg-row-space {
  width: 100%;
  justify-content: center;
  padding-left: 0 !important;
  margin-top: 4px;
}

.game-shell.typecritter .fg-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  background: linear-gradient(180deg, #ffffff 0%, #e8e0f0 100%);
  border: 3px solid var(--c, #888);
  /* Always-dark letter on the cap so contrast is consistent across the
     pink/yellow/cyan finger colors. */
  color: #2a1a4a;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 22px;
  border-radius: 12px;
  box-shadow:
    0 4px 0 var(--c, #888),
    0 6px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 100ms ease, box-shadow 100ms ease;
}
.game-shell.typecritter .fg-key.fg-space {
  width: 260px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

@keyframes fg-pulse {
  0%, 100% { transform: scale(1.18) translateY(-2px); }
  50%      { transform: scale(1.32) translateY(-5px); }
}
.game-shell.typecritter .fg-key.fg-next {
  /* Active key: cap stays light, border + glow uses finger color, letter
     stays dark. Letters never vanish on yellow/cyan fingers. */
  background: linear-gradient(180deg, #ffffff 0%, #fff8d0 100%);
  color: #2a1a4a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: fg-pulse 720ms ease-in-out infinite;
  box-shadow:
    0 6px 0 var(--c, #888),
    0 0 0 4px var(--c, #888),
    0 10px 28px var(--c, #fff),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.game-shell.typecritter .fg-key.fg-locked {
  opacity: 0.30;
  filter: grayscale(0.5);
  color: #666;
  box-shadow: 0 2px 0 #555;
}
