/* ─── Fonts ─── */
@font-face {
  font-family: 'ComicRelief';
  src: url('fonts/ComicRelief-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #fddc56; }

/* ─── Screen visibility ─── */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none !important; }
.screen.active { display: flex; }

/* ══════════════════════════════════════
   START SCREEN
══════════════════════════════════════ */
#screen-start {
  background: #fddc56;
  overflow: hidden;
  align-items: stretch;
}
.start-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  gap: 16px;
}
/* Logo + characters combined row */
.start-top-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.start-top-row a { display: flex; align-items: center; }
.start-logo {
  height: 90px;
  width: auto;
  object-fit: contain;
}
.start-dl-img {
  width: 200px;
  max-width: 70%;
  object-fit: contain;
  margin-top: 4px;
}

/* Character header (inside top row) */
.start-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.start-cat {
  width: 80px;
  height: 80px;
  object-fit: contain;
}
.start-lifegone {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.start-instructions {
  font-size: 15px;
  color: #49495f;
  text-align: center;
  line-height: 1.5;
  max-width: 340px;
  padding: 0 8px;
}

/* ── Cartoon button ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 400;
  font-family: monospace;
  border: 2px solid #000;
  border-radius: 20px;
  padding: 14px 28px;
  cursor: pointer;
  position: relative;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, top 0.08s;
  top: 0;
  width: 100%;
  max-width: 340px;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 2px solid #000;
  background: #000;
  transform: translate(4px, 4px);
  z-index: -1;
}
.btn:active { transform: translate(2px, 2px); top: 2px; }
.btn-blue   { background: #37b6ff; color: #000; }
.btn-pink   { background: #ff66c4; color: #000; }

/* High score box */
.high-score-box {
  background: #000;
  color: #fff;
  border-radius: 8px;
  padding: 12px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

/* ── Cat shelf ── */
.shelf-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.shelf-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 4px;
}
.shelf-cats {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  width: 100%;
  padding: 0 4px;
}
.cat-slot {
  position: relative;
  width: 18%;
  display: flex;
  justify-content: center;
}
.cat-slot img {
  width: 100%;
  max-height: 80px;
  object-fit: contain;
  cursor: pointer;
  transition: filter 0.2s;
}
/* Locked cats: darken only the visible (non-transparent) pixels */
.cat-slot img.cat-locked {
  filter: brightness(0.15) saturate(0);
  cursor: default;
}
.shelf-img {
  width: 100%;
  object-fit: contain;
  margin-top: -4px;
}

/* ── Cat detail modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 20px;
  border: 3px solid #000;
  padding: 24px 28px;
  max-width: 320px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.modal-cat-img { width: 120px; height: 120px; object-fit: contain; }
.modal-box h2  { font-size: 20px; font-weight: 700; }
.modal-box p   { font-size: 14px; color: #555; line-height: 1.4; }
.modal-locked-text { color: #888; font-style: italic; }
.modal-close-btn { margin-top: 6px; }

/* ══════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════ */
#screen-game { overflow: hidden; background: transparent; }

/* Gradient background */
.game-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, #38b6ff 0%, #52525e 100%);
  z-index: 0;
}

/* London street cat — full-width, scales with window */
#london-cat {
  position: absolute;
  bottom: 40%;
  left: 0;
  width: 100%;
  height: auto;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
}

/* Clouds — 2× size, scale with window */
.cloud {
  position: absolute;
  top: 80px;
  width: 20vw;
  min-width: 80px;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}
#cloud1 { left: -22vw; }
#cloud2 { left: -22vw; top: 140px; }

/* Lightning */
.lightning {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.1s;
}
.lightning.hidden { display: none; }
.bolt { font-size: 70px; display: block; color: white; text-shadow: 0 0 20px white, 0 0 30px cyan; filter: blur(1px); line-height: 1; }
.bolt-main { transform: rotate(15deg); }
.bolt-b    { font-size: 50px; transform: rotate(-20deg) translate(40px,-30px); }
.bolt-c    { font-size: 38px; transform: rotate(25deg) translate(-30px, 20px); }

/* Particles */
#particles-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none; /* individual particles get pointer-events: auto */
}
.particle {
  position: absolute;
  background: #000;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

/* Sentence box */
#sentence-box-wrap {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  padding: 8px 16px 12px;
  z-index: 15;
  pointer-events: none;
  display: flex;
  justify-content: center;
}
#sentence-box {
  background: #fff;
  border-radius: 16px;
  border: 4px solid #000;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  padding: 14px 20px;
  font-size: 17px;
  color: #49495f;
  text-align: center;
  line-height: 1.5;
  max-width: 420px;
  width: 100%;
}
.verb-highlight {
  color: purple;
  font-weight: 700;
}

/* Bottom characters — 2× size, scale with window */
#bottom-chars {
  position: absolute;
  bottom: max(130px, 13vw);
  left: 0; right: 0;
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}
.catlife {
  position: absolute;
  left: 16px;
  width: 18vw;
  height: 18vw;
  min-width: 90px;
  min-height: 90px;
  object-fit: contain;
  bottom: 0;
}
.faccat {
  position: absolute;
  right: 8px;
  width: 32vw;
  height: 32vw;
  min-width: 160px;
  min-height: 160px;
  object-fit: contain;
  bottom: 0;
}
.lifegone-sprite {
  position: absolute;
  width: 12vw;
  height: 12vw;
  min-width: 62px;
  min-height: 62px;
  object-fit: contain;
  bottom: 10px;
  /* left is set dynamically by JS */
  transition: left 0.4s cubic-bezier(.34,1.56,.64,1);
}
.lifegone-sprite.hidden { display: none; }

/* Feedback image (kittyhappy / angrykitty) — 2× size, scale with window */
.feedback-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 26vw;
  height: 26vw;
  min-width: 130px;
  min-height: 130px;
  object-fit: contain;
  z-index: 20;
  pointer-events: none;
}
.feedback-img.hidden { display: none; }
.feedback-img.pop-in {
  animation: popIn 0.5s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes popIn {
  0%   { transform: translate(-50%,-50%) scale(0.1); opacity: 0; }
  60%  { transform: translate(-50%,-50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}

/* Level transition overlay */
.level-transition {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.level-transition.hidden { display: none; }
.level-transition-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 24px;
  animation: springIn 0.5s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes springIn {
  0%   { transform: scale(0.1); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
.level-transition-content.exit-anim {
  animation: flyOut 1s ease-in-out forwards;
}
@keyframes flyOut {
  0%   { transform: scale(1) translate(0,0);           opacity: 1; }
  100% { transform: scale(0.1) translate(-50vw, 50vh); opacity: 0; }
}
.level-title-text {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.level-subtitle-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.level-cat-img {
  width: 36vw;
  height: 36vw;
  min-width: 180px;
  min-height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
}

/* Top HUD */
#top-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
}
.hud-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}
.hud-btn img { width: 44px; height: 44px; object-fit: contain; }
#hud-notifications {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}
.hud-notif {
  font-size: 13px;
  font-weight: 600;
  color: #5D67E7;
  background: rgba(255,255,255,0.85);
  border-radius: 6px;
  padding: 2px 8px;
}
.hud-notif.hidden { display: none; }

/* ══════════════════════════════════════
   GAME COMPLETE SCREEN
══════════════════════════════════════ */
#screen-complete {
  background: #fddc56;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
.complete-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
}
.complete-cat-img {
  width: 120px; height: 120px;
  object-fit: contain;
}
.complete-title {
  font-size: 26px;
  font-weight: 700;
  color: #49495f;
  text-align: center;
}
.complete-taunt {
  font-size: 15px;
  color: #49495f;
  text-align: center;
  font-style: italic;
  padding: 0 12px;
}
.score-box {
  background: #000;
  border-radius: 12px;
  padding: 16px 28px;
  display: flex;
  gap: 28px;
  color: #fff;
}
.score-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.score-label { font-size: 14px; font-weight: 600; }
.score-value { font-size: 28px; font-weight: 700; }
.complete-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.complete-buttons .btn { max-width: 320px; }

/* ══════════════════════════════════════
   PROMO / GAME OVER SCREEN
══════════════════════════════════════ */
#screen-promo {
  background: #fddc56;
  align-items: center;
  overflow-y: auto;
}
.promo-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 20px 40px;
  max-width: 420px;
  width: 100%;
}
.promo-squiddy {
  width: 180px;
  max-width: 50%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.2));
}
/* Comic-style dialogue box — white fill, thick black border, rounded corners */
.promo-bubble {
  background: #fff;
  border: 5px solid #000;
  border-radius: 18px;
  padding: 16px 22px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  position: relative;
  box-shadow: 4px 4px 0 #000;
}
.promo-bubble-text {
  font-family: 'ComicRelief', 'Comic Sans MS', cursive;
  font-size: 19px;
  font-weight: 700;
  color: #111;
  line-height: 1.35;
}
.promo-dl {
  width: 200px;
  max-width: 65%;
  object-fit: contain;
  cursor: pointer;
}
.promo-benefits {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  justify-content: center;
}
.benefit-box {
  flex: 1;
  background: #fff;
  border: 3px solid #000;
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  line-height: 1.3;
  box-shadow: 3px 3px 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}
.promo-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.promo-buttons .btn { max-width: 320px; }

/* ══════════════════════════════════════
   MISTAKES REVIEW SCREEN
══════════════════════════════════════ */
#screen-review {
  background: #fddc56;
  overflow-y: auto;
  align-items: center;
}
.review-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 16px 40px;
  max-width: 420px;
  width: 100%;
}
.review-title {
  font-size: 24px;
  font-weight: 700;
  color: #49495f;
}
.review-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.review-item {
  background: #fff;
  border-radius: 12px;
  border: 2px solid #000;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-verb {
  font-size: 17px;
  font-weight: 700;
  color: purple;
}
.review-sentence {
  font-size: 14px;
  color: #49495f;
  line-height: 1.5;
}
