@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: 0.45; }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  image-rendering: pixelated;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  user-select: none;
  touch-action: manipulation;
}

#game-container {
  display: block;
  border: 4px solid #e63946;
  box-shadow: 0 0 0 4px #f4a261, 0 0 30px rgba(230, 57, 70, 0.4);
  image-rendering: pixelated;
  touch-action: none;
}

#game-container canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  image-rendering: pixelated;
}

/* ---- STAT BARLARI ---- */
#stats-overlay {
  background: rgba(15, 15, 30, 0.92);
  border: 3px solid #e63946;
  border-top: none;
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.stat-bar-bg {
  flex: 1;
  height: 12px;
  background: #2d2d44;
  border: 2px solid #444466;
  image-rendering: pixelated;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  width: 100%;
  transition: width 0.4s ease;
  image-rendering: pixelated;
}

.stat-label {
  font-size: 8px;
  color: #ccc;
  width: 28px;
  text-align: right;
}

/* ---- BUTONLAR ---- */
#action-buttons {
  display: flex;
  justify-content: space-around;
  background: #0f0f1e;
  border: 3px solid #e63946;
  border-top: none;
  padding: 10px 8px;
  gap: 6px;
}

.action-btn {
  font-size: 22px;
  background: #1e1e3a;
  border: 3px solid #457b9d;
  color: white;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  line-height: 1;
  image-rendering: pixelated;
}

.action-btn:hover {
  background: #2d2d55;
  border-color: #f4a261;
  transform: scale(1.1);
}

.action-btn:active {
  transform: scale(0.95);
}

/* İlaç butonu — hasta olunca kırmızı yanar */
#btn-medicine {
  transition: border-color 0.3s, box-shadow 0.3s;
}
#btn-medicine.sick-alert {
  border-color: #ff2222 !important;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
  animation: pulse 0.5s infinite alternate;
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ---- DURUM MESAJI ---- */
#status-message {
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #f4a261;
  font-size: 7px;
  padding: 5px 10px;
  border: 2px solid #f4a261;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

#status-message.show {
  opacity: 1;
}

/* ---- KEDI ADI ---- */
#cat-name-display {
  background: #0f0f1e;
  border: 3px solid #e63946;
  border-bottom: none;
  padding: 8px 0;
  text-align: center;
  font-size: 10px;
  color: #f4a261;
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

#cat-name-display:hover {
  color: #ffd166;
  background: #1a1a2e;
}

/* ---- MİNİ OYUN OVERLAY ---- */
#minigame-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10,10,20,0.92);
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#minigame-overlay.active {
  display: flex;
}

#minigame-overlay h2 {
  font-size: 10px;
  color: #f4a261;
}

#minigame-canvas {
  border: 3px solid #457b9d;
  image-rendering: pixelated;
}

#minigame-score {
  font-size: 8px;
  color: #2a9d8f;
}

#minigame-close {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: #e63946;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
}

/* ---- MUTE SATIRI ---- */
#mute-row {
  background: #0f0f1e;
  border: 3px solid #e63946;
  border-top: none;
  padding: 8px 0;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 12px;
}

#btn-mute-bgm,
#btn-mute-sfx,
#btn-wardrobe,
#btn-reset {
  font-size: 16px;
  background: #1e1e3a;
  border: 2px solid #457b9d;
  border-radius: 4px;
  padding: 5px 18px;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s, transform 0.1s;
}

#btn-mute-bgm:hover,
#btn-mute-sfx:hover,
#btn-wardrobe:hover,
#btn-reset:hover {
  border-color: #f4a261;
  transform: scale(1.1);
}

#btn-mute-bgm:active,
#btn-mute-sfx:active,
#btn-wardrobe:active,
#btn-reset:active {
  transform: scale(0.9);
}

/* ---- CUSTOM NAME INPUT ---- */
#custom-name-input {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 80px);
  width: 180px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  text-align: center;
  background: #0f0f1e;
  color: #f4a261;
  border: 2px solid #457b9d;
  padding: 8px 10px;
  outline: none;
  z-index: 25;
  image-rendering: pixelated;
}

#custom-name-input:focus {
  border-color: #f4a261;
  box-shadow: 0 0 8px rgba(244, 162, 97, 0.4);
}

/* ---- MOBİL UYUMLULUK ---- */
@media (max-width: 520px) {
  body {
    align-items: flex-start;
    min-height: 100dvh;
  }

  #game-wrapper {
    width: 100%;
    max-width: 100vw;
  }

  #game-container {
    border-width: 2px;
    box-shadow: 0 0 0 2px #f4a261;
  }

  #cat-name-display {
    font-size: 8px;
    padding: 6px 0;
    border-width: 2px;
  }

  #stats-overlay {
    padding: 6px 8px 4px;
    gap: 4px;
    border-width: 2px;
  }

  .stat-icon { font-size: 11px; width: 16px; }
  .stat-bar-bg { height: 9px; border-width: 1px; }
  .stat-label { font-size: 6px; width: 22px; }

  #action-buttons {
    padding: 6px 4px;
    gap: 3px;
    border-width: 2px;
  }

  .action-btn {
    font-size: 18px;
    padding: 8px 6px;
    border-width: 2px;
  }

  #mute-row {
    padding: 6px 0;
    gap: 6px;
    border-width: 2px;
  }

  #btn-mute-bgm,
  #btn-mute-sfx,
  #btn-wardrobe,
  #btn-reset {
    font-size: 13px;
    padding: 5px 10px;
  }

  #status-message {
    font-size: 6px;
    top: 36px;
  }
}

@media (max-width: 380px) {
  .action-btn {
    font-size: 15px;
    padding: 6px 4px;
  }

  .stat-icon { font-size: 9px; width: 14px; }
  .stat-bar-bg { height: 7px; }
  .stat-label { font-size: 5px; width: 18px; }

  #btn-mute-bgm,
  #btn-mute-sfx,
  #btn-wardrobe,
  #btn-reset {
    font-size: 11px;
    padding: 4px 7px;
  }
}
