/* 🔧 Reset & Base */
html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #222;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
  width: 100%;
  height: 100%;

  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea {
  -webkit-user-select: auto;
  user-select: auto;
}

body {
  height: 100%;
}

#app {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Smooth scrolling for iOS */
  overscroll-behavior-y: none;
  /* Disables all bounce effects completely */
}

/* 📱 Screens */
.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
}

/* =========================
   🎮 MAIN MENU
========================= */

.main-menu {
  position: relative;
  background-image: url("assets/backgrounds/Start_Click-the-Cat_BG.gif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 20px;
  padding-top: calc(40px + env(safe-area-inset-top));
}

.main-menu>* {
  position: relative;
  z-index: 1;
}

.spacer {
  flex: 1;
}

.menu-buttons {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 400px;
  margin-bottom: 40px;
}

/* =========================
   ⚙️ SETTINGS SCREEN
========================= */
.settings-screen {
  background: #fff7fb;
  padding: 40px 20px;
  padding-top: calc(40px + env(safe-area-inset-top));
  align-items: center;
  text-align: center;
}

.settings-screen h2 {
  margin: 0 0 20px 0;
  font-size: 28px;
  font-weight: 700;
  color: #222;
}

.settings-screen .stack {
  align-items: stretch;
  /* Buttons sollen die volle Breite nehmen */
}

.settings-screen .button {
  width: 100%;
}

.settings-screen .nav {
  width: min(320px, 100%);
}

/* =========================
   🛍️ SHOP SCREEN
========================= */
.shop-screen {
  background: #fff7fb;
  padding: 40px 20px;
  padding-top: calc(40px + env(safe-area-inset-top));
  align-items: center;
  text-align: center;
}

.shop-screen h2 {
  margin: 0 0 20px 0;
  font-size: 28px;
  font-weight: 700;
  color: #222;
}

.shop-screen .stack {
  align-items: stretch;
}

.shop-screen .button {
  width: 100%;
}

.shop-screen .nav {
  width: min(320px, 100%);
}

/* =========================
   🃏 SHOP CARDS
========================= */
.shop-screen .card {
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;

  background: rgba(255, 179, 217, 0.12);
  border: 1px solid rgba(255, 179, 217, 0.35);
  backdrop-filter: blur(10px);

  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.shop-screen .card p {
  margin: 0;
  text-align: left;
}

.shop-screen .card p+p {
  margin-top: 6px;
  color: rgba(34, 34, 34, 0.7);
  font-size: 14px;
}

/* =========================
   🔘 BUTTONS
========================= */

.button {
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 18px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

/* Primary */
.button-primary {
  background: #ffb3d9;
  color: #222;
}

.button-primary:active {
  transform: scale(0.97);
}

/* Secondary */
.button-secondary {
  background: transparent;
  border: 2px solid #ffb3d9;
  color: #ffb3d9;
}

.button-secondary:active {
  background: rgba(255, 179, 217, 0.1);
}

/* Layout helpers */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, 100%);
}

.nav {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* =========================
   🎮 GAME SCREEN
========================= */

.game-screen {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  overflow: hidden;

  /* Verhindert gelegentliches UI-Markieren (Textselektion) beim Tippen/Klicken */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   🔝 HEADER (NEU)
========================= */

.game-header {
  padding-top: calc(env(safe-area-inset-top) + 12px);
  padding-bottom: 12px;

  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);

  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-header {
  padding-top: 10px;
  /* Reduziert für den mobilen Browser */
  text-align: center;
  position: relative;
}

/* App-Kontext (Capacitor / installiert als PWA) */
@media (display-mode: standalone) {
  .score-header {
    padding-top: 40px;
  }
}

.score-big {
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

/* =========================
   📊 INFO BAR
========================= */

.info-bar {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;

  display: flex;
  flex-direction: column;
  gap: 6px;

  padding: 0 16px;

  background: none;
  backdrop-filter: none;

  /* progress-container.small ist position:absolute, braucht aber eine minimale Höhe */
  min-height: 6px;
}

.ppc-top-right {
  position: absolute;
  top: 40px;
  right: 32px;
}

.coins-left {
  position: absolute;
  top: 40px;
  left: 32px;
}

.info-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: bold;
  color: white;
  margin-top: -11px;
  /* für mobilen Browser */
}

/* App-Kontext (Capacitor / PWA) */
@media (display-mode: standalone) {
  .info-item {
    margin-top: 0;
    padding-top: 18px;
  }
}

/* =========================
   🐱 CAT
========================= */

.cat-container {
  position: absolute;
  top: 10%;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.cat-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;

  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;

  transition: transform 0.1s ease;
}

.cat-image.tap {
  animation: catTap 0.25s ease;
}

@keyframes catTap {
  0% {
    transform: scale(1, 1);
  }

  30% {
    transform: scale(0.92, 1.08);
  }

  60% {
    transform: scale(1.05, 0.95);
  }

  100% {
    transform: scale(1, 1);
  }
}

/* =========================
   🪙 FALLING COINS
========================= */
@keyframes pulseMystery {
  0% {
    scale: 1;
    filter: brightness(1);
  }

  50% {
    scale: 1.15;
    filter: brightness(1.15);
  }

  100% {
    scale: 1;
    filter: brightness(1);
  }
}

.mystery-falling {
  animation: pulseMystery 1.5s infinite ease-in-out;
}

.coin-falling,
.mystery-falling {
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  cursor: pointer;

  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;

  touch-action: manipulation;
  pointer-events: auto;

  transform: translateY(0);
  will-change: transform;
}


/* =========================
   📊 PROGRESS
========================= */

.progress-container.small {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;

  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff69b4, #ffb3d9);
  transition: width 0.2s ease;
}

/* =========================
   📱 TAB BAR
========================= */

.tab-bar {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 16px;

  padding: 12px 20px;
  width: calc(100% - 40px);
  max-width: 400px;

  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);

  border-radius: 999px;
  color: white;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 4px;

  font-size: 20px;
  opacity: 0.7;
  transition: all 0.2s ease;

  -webkit-tap-highlight-color: transparent;
}

.tab-item span {
  font-size: 10px;
}

.tab-item.active {
  opacity: 1;
  font-weight: 600;
}

.tab-item:active {
  transform: scale(0.9);
}

/* =========================
   ✨ FLOATING SCORE
========================= */

.floating-score {
  position: fixed;
  pointer-events: none;
  z-index: 9999;

  font-size: 28px;
  font-weight: 800;
  color: white;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);

  transform: translate(-50%, -50%);
}

.score-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
}

/* =========================
   🪟 MODALS
========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-content h3 {
  margin: 0;
  color: #222;
  font-size: 20px;
}

.modal-content input {
  padding: 12px 16px;
  border: 2px solid #ffb3d9;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  width: 100%;
}

.modal-content input:focus {
  border-color: #ff69b4;
}

/* =========================
   🏆 LEADERBOARD
========================= */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin-top: 10px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 10px 4px;
  /* Reduced side padding so it fits well on mobile */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
}

.leaderboard-table th {
  color: rgba(34, 34, 34, 0.6);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr.current-player td {
  background: rgba(255, 179, 217, 0.25);
  font-weight: bold;
}

.leaderboard-table td:nth-child(1) {
  text-align: center;
  font-weight: bold;
  width: 40px;
}

.leaderboard-table td:nth-child(3),
.leaderboard-table td:nth-child(4) {
  text-align: right;
}

.leaderboard-table th:nth-child(1) {
  text-align: center;
  width: 40px;
}

.leaderboard-table th:nth-child(3),
.leaderboard-table th:nth-child(4) {
  text-align: right;
}