/* ========================================
   Cat Fish Milk - CSS Styles
   ======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* ========================================
   Logo
   ======================================== */

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.logo h1 {
  color: white;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
  font-size: 1.8rem;
  margin: 0;
  letter-spacing: 2px;
}

.logo-icons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo-icons svg {
  width: 45px;
  height: 45px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Logo on mobile - smaller to prevent scroll */
@media (max-width: 600px) {
  .logo {
    margin-bottom: auto;
    gap: 8px;
    padding: 10px;
  }
  
  .logo h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }
  
  .logo-icons {
    gap: 15px;
  }
  
  .logo-icons svg {
    width: 40px;
    height: 40px;
  }
}

/* ========================================
   Top Bar - New Game, Lives & Timer
   ======================================== */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.top-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 6px;
}

.top-icon-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.top-icon-btn {
  font-size: 1.2rem;
  font-weight: bold;
  color: #764ba2;
}

.lives {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.life {
  width: 40px;
  height: 40px;
  transition: all 0.3s ease;
  position: relative;
}

.life svg {
  width: 100%;
  height: 100%;
}

.life.lost {
  filter: grayscale(100%) opacity(0.4);
  transform: scale(0.85);
}

.life.losing {
  animation: life-lost 0.5s ease;
}

@keyframes life-lost {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) rotate(-10deg); }
  60% { transform: scale(0.8) rotate(10deg); }
  100% { transform: scale(0.85); filter: grayscale(100%) opacity(0.4); }
}

/* Timer */
.timer {
  font-size: 2.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  font-variant-numeric: tabular-nums;
}

.timer.warning {
  color: #ff6b6b;
  animation: pulse-timer 0.5s ease infinite;
}

@keyframes pulse-timer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ========================================
   Help Modal
   ======================================== */

.help-modal {
  background: white;
  padding: 30px;
  border-radius: 25px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
}

.help-modal h3 {
  color: #764ba2;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.help-grid {
  display: inline-grid;
  grid-template-columns: repeat(3, 45px);
  gap: 4px;
  padding: 8px;
  background: #eee;
  border-radius: 10px;
  margin-bottom: 15px;
}

.help-cell {
  width: 45px;
  height: 45px;
  background: #f5f5f5;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-cell svg {
  width: 32px;
  height: 32px;
}

.help-cell.center {
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  border: 3px solid #f39c12;
}

.help-tip {
  background: #f0f0f0;
  padding: 10px 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 0.9rem;
  color: #666;
}

.help-tip strong {
  color: #e17055;
}

.help-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.9rem;
  color: #666;
}

.help-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.help-legend .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.help-legend .dot.fish { background: #e17055; }
.help-legend .dot.milk { background: #74B9FF; border: 2px solid #ddd; }

.help-modal button {
  margin-top: 15px;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

.help-credit {
  margin-top: 15px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   Tile Selector
   ======================================== */


.tile-btn {
  width: 50px;
  height: 50px;
  border: 4px solid transparent;
  border-radius: 16px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
}

.tile-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tile-btn.selected {
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  transform: scale(1.1);
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

.tile-btn.needs-cooking {
  border-color: #e17055;
  animation: pulse-cook 1s ease infinite;
}

@keyframes pulse-cook {
  0%, 100% { box-shadow: 0 0 10px rgba(225, 112, 85, 0.4); }
  50% { box-shadow: 0 0 25px rgba(225, 112, 85, 0.8); }
}

.tile-btn svg {
  width: 36px;
  height: 36px;
}

.tile-btn-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tile-btn-wrapper span {
  color: white;
  font-weight: bold;
  margin-top: 5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.raw-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff6b6b;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 8px;
  display: none;
}

.tile-btn.raw .raw-indicator {
  display: block;
}

/* ========================================
   Game Area & Grid
   ======================================== */

.game-area {
  display: flex;
  align-items: center;
  gap: 20px;
}

.game-container {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  background: #ddd;
  padding: 4px;
  border-radius: 12px;
}

.cell {
  width: 50px;
  height: 50px;
  background: #f5f5f5;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  border: 3px solid transparent;
}

.cell:hover {
  background: #e8e8e8;
  transform: scale(1.05);
}

.cell.cat-cell {
  cursor: default;
}

.cell.cat-cell:hover {
  transform: none;
}

.cell svg {
  width: 36px;
  height: 36px;
}

/* Cat states */
.cell.satisfied {
  background: linear-gradient(135deg, #a8edea 0%, #90EE90 100%);
  border-color: #32CD32;
  box-shadow: 0 0 12px rgba(50, 205, 50, 0.5);
  animation: pulse-green 2s infinite;
}

.cell.unsatisfied {
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  border-color: #f39c12;
  box-shadow: 0 0 12px rgba(243, 156, 18, 0.5);
}

.cell.mistake {
  animation: mistake-flash 0.5s ease;
}

@keyframes mistake-flash {
  0%, 100% { background: #f5f5f5; }
  25% { background: #ff6b6b; transform: scale(1.1); }
  50% { background: #ff4757; transform: scale(0.95) rotate(5deg); }
  75% { background: #ff6b6b; transform: scale(1.05) rotate(-5deg); }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 12px rgba(50, 205, 50, 0.5); }
  50% { box-shadow: 0 0 20px rgba(50, 205, 50, 0.8); }
}

/* ========================================
   Cooking Pan
   ======================================== */

.pan {
  width: 50px;
  height: 50px;
  border: 4px solid #e17055;
  border-radius: 16px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pan:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pan.cooking {
  animation: pan-sizzle 0.5s ease;
  background: linear-gradient(135deg, #fff9e6 0%, #ffeaa7 100%);
}

@keyframes pan-sizzle {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1) rotate(-5deg); }
  50% { transform: scale(1.15); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.pan svg {
  width: 36px;
  height: 36px;
}

/* Cooked state label */
.pan-label.cooked {
  color: #2ecc71;
}

/* ========================================
   Status & Reset Button
   ======================================== */

.status-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.status {
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.restart-text-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: bold;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.restart-text-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

.reset-btn {
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #764ba2;
  background: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.reset-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Overlays & Modals
   ======================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  padding: 40px 60px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: bounceIn 0.5s ease;
  max-width: 90vw;
}

@keyframes bounceIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.modal h2 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.modal.win h2 { color: #32CD32; }
.modal.gameover h2 { color: #ff6b6b; }
.modal.lives-out h2 { color: #e17055; }

.modal p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 20px;
}

.modal button {
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.modal button:hover {
  transform: scale(1.05);
}

/* ========================================
   Confetti
   ======================================== */

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 3s linear forwards;
  z-index: 1001;
}

@keyframes confetti-fall {
  to {
    top: 100vh;
    transform: rotate(720deg);
  }
}

/* ========================================
   Bottom Controls
   ======================================== */

.bottom-controls {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
}

/* ========================================
   Footer Credit
   ======================================== */

.credit {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  margin-top: 15px;
  text-align: center;
}

/* ========================================
   Responsive - Mobile
   ======================================== */

@media (max-width: 600px) {
  body { 
    padding: 10px;
    padding-bottom: 10px;
    min-height: 100vh;
    justify-content: flex-end;
  }
  h1 { font-size: 1.8rem; }
  .timer { font-size: 2rem; }
  .top-bar { gap: 12px; }
  .life { width: 32px; height: 32px; }
  .game-area { flex-direction: column; }
  .pan { width: 44px; height: 44px; }
  .pan svg { width: 30px; height: 30px; }
  .cell { 
    width: 44px; 
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .cell svg { width: 30px; height: 30px; }
  .tile-btn { width: 44px; height: 44px; }
  .tile-btn svg { width: 30px; height: 30px; }
  .top-icon-btn { width: 44px; height: 44px; font-size: 1.4rem; }
  .bottom-controls { 
    gap: 8px; 
    padding: 10px 12px;
  }
  .game-container { padding: 8px; }
  .grid { gap: 2px; padding: 2px; }
  .modal { padding: 25px 35px; }
  .modal h2 { font-size: 1.8rem; }
  .help-cell { width: 45px; height: 45px; }
  .help-cell svg { width: 32px; height: 32px; }
}

/* Landscape warning on mobile */
.landscape-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: 20px;
}

.landscape-warning span {
  font-size: 4rem;
  margin-bottom: 20px;
}

.landscape-warning p {
  font-size: 1.3rem;
  font-weight: bold;
}

@media (max-height: 500px) and (orientation: landscape) {
  .landscape-warning {
    display: flex;
  }
}

/* Prevent hover on touch devices */
@media (hover: none) {
  .cell:hover { background: #f5f5f5; transform: none; }
  .tile-btn:hover { transform: none; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); }
  .tile-btn.selected:hover { transform: scale(1.05); }
  .pan:hover { transform: none; }
  .restart-text-btn:hover { background: rgba(255, 255, 255, 0.2); }
  .top-icon-btn:hover { transform: none; background: rgba(255, 255, 255, 0.2); }
}
