/* ===============================
   RESET + FONT
================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Pixelify Sans", monospace;
}

/* ===============================
   PAGE BACKGROUND
================================ */
body {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background-image: url("assets/sprites/cafe-bg1.gif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===============================
   MAIN APP CONTAINER
================================ */
.app {
  position: relative;
  z-index: 10;
  background-color: rgba(137, 207, 240, 0.95);
  padding: 32px;
  border: 4px solid #0047AB;
  text-align: center;
}

/* ===============================
   TITLE + MODE
================================ */
.title {
  font-size: 32px;
  margin-bottom: 20px;
  color: #00008B;
}

#mode {
  font-size: 14px;
  margin-bottom: 12px;
  color: #00008B;
}

/* ===============================
   TIMER DISPLAY
================================ */
.timer-box {
  font-size: 48px;
  margin-bottom: 24px;
  background-color: #ADD8E6;
  padding: 16px;
  border: 4px solid #0047AB;
  color: #0047AB;
}

/* ===============================
   BUTTONS
================================ */
.controls button {
  font-size: 16px;
  padding: 10px 16px;
  margin: 6px;
  background-color: #6495ED;
  border: 4px solid #0047AB;
  cursor: pointer;
  color: #2b083f;
}

.controls button:hover {
  background-color: #00A36C;
}

/* ===============================
   SETTINGS
================================ */
.settings {
  margin-top: 16px;
  font-size: 14px;
  color: #3b114f;
}

.settings input {
  width: 50px;
  margin-left: 6px;
  padding: 4px;
  border: 2px solid #0047AB;
  background: #ADD8E6;
}

/* ===============================
   PIXEL PERFECT
================================ */
img,
.cat-runner,
.mouse-runner {
  image-rendering: pixelated;
}

/* ===============================
   IDLE CAT
================================ */
#cat {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  animation: float 1.5s infinite alternate;
}

@keyframes float {
  from { transform: translateY(0); }
  to   { transform: translateY(-4px); }
}

/* ===============================
   BACKGROUND RUNNERS
================================ */

/* ---- CAT RUNNER ---- */
.cat-runner {
  position: absolute;
  bottom: 40px;
  left: -300px;

  width: 96px;
  height: 96px;

  background-image: url("assets/sprites/cats/cat-run.png");
  background-repeat: no-repeat;
  background-size: 576px 96px; /* 6 frames */

  z-index: 5;

  animation:
    cat-run-frames 0.8s steps(6) infinite,
    chase-move 12s linear infinite;

  animation-play-state: paused;
}

/* ---- MOUSE RUNNER ---- */
.mouse-runner {
  position: absolute;
  bottom: 5px;
  left: -300px;

  width: 96px;
  height: 96px;

  background-image: url("assets/sprites/mouse/mouse-run.png");
  background-repeat: no-repeat;
  background-size: 96px 576px; /* 6 vertical frames */

  z-index: 6;

  transform: translateX(140px); /* stays ahead */

  animation:
    mouse-frames 0.6s steps(6) infinite,
    chase-move 12s linear infinite;

  animation-play-state: paused;
}

/* ===============================
   SPRITE FRAMES
================================ */
@keyframes cat-run-frames {
  from { background-position: 0 0; }
  to   { background-position: -576px 0; }
}

@keyframes mouse-frames {
  from { background-position: 0 0; }
  to   { background-position: 0 -576px; }
}

/* ===============================
   MOVEMENT
================================ */
@keyframes chase-move {
  from { left: -300px; }
  to   { left: 110vw; }
}

/* ===============================
   BUTTON CONTROL
================================ */
body.running .cat-runner,
body.running .mouse-runner {
  animation-play-state: running;
}

.pixel-hud {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 12px;
  z-index: 9999;
}

.stat-box {
  background: #cfe8ff; /* soft blue */
  border: 4px solid #5a8fd8;
  padding: 8px 12px;
  min-width: 80px;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  box-shadow: 4px 4px 0 #3f6fb5;
}

.stat-number {
  display: block;
  font-size: 14px;
  color: #1f3f66;
}

.stat-label {
  display: block;
  font-size: 7px;
  color: #355c8a;
  margin-top: 6px;
}

.stat-box.streak {
  background: #ffe6cc; /* warm streak tone */
  border-color: #ff9f43;
  box-shadow: 4px 4px 0 #cc7a29;
}

/* ===============================
   RESPONSIVE DESIGN
================================ */

/* Tablet Devices (768px - 1024px) */
@media screen and (max-width: 1024px) {
  .app {
    padding: 24px;
    max-width: 90%;
  }
  
  .title {
    font-size: 28px;
    margin-bottom: 16px;
  }
  
  .timer-box {
    font-size: 40px;
    padding: 12px;
    margin-bottom: 20px;
  }
  
  .controls button {
    font-size: 14px;
    padding: 8px 12px;
    margin: 4px;
  }
  
  .pixel-hud {
    top: 12px;
    right: 12px;
    gap: 8px;
  }
  
  .stat-box {
    min-width: 70px;
    padding: 6px 8px;
  }
  
  .stat-number {
    font-size: 12px;
  }
  
  .stat-label {
    font-size: 6px;
  }
}

/* Mobile Devices (< 768px) */
@media screen and (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .app {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  
  .title {
    font-size: 24px;
    margin-bottom: 12px;
  }
  
  #mode {
    font-size: 12px;
    margin-bottom: 8px;
  }
  
  #cat {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
  }
  
  .timer-box {
    font-size: 32px;
    padding: 10px;
    margin-bottom: 16px;
  }
  
  .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  
  .controls button {
    font-size: 12px;
    padding: 8px 12px;
    margin: 0;
    flex: 1 1 calc(50% - 4px);
    min-width: 100px;
  }
  
  .controls button:nth-child(4) {
    flex: 1 1 100%;
  }
  
  .settings {
    margin-top: 12px;
    font-size: 12px;
  }
  
  .settings input {
    width: 40px;
    padding: 2px;
  }
  
  .pixel-hud {
    position: fixed;
    top: 8px;
    right: 8px;
    left: 8px;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
  }
  
  .stat-box {
    min-width: 60px;
    padding: 4px 6px;
  }
  
  .stat-number {
    font-size: 10px;
  }
  
  .stat-label {
    font-size: 5px;
    margin-top: 4px;
  }
}

/* Small Mobile Devices (< 480px) */
@media screen and (max-width: 480px) {
  .app {
    padding: 12px;
  }
  
  .title {
    font-size: 20px;
    margin-bottom: 10px;
  }
  
  .timer-box {
    font-size: 28px;
    padding: 8px;
    margin-bottom: 12px;
  }
  
  .controls button {
    font-size: 10px;
    padding: 6px 8px;
    min-width: 80px;
  }
  
  .settings {
    font-size: 10px;
  }
  
  .settings input {
    width: 35px;
  }
}
