/* Stylizacja Słodki Lodożerca - Estetyka Pastelowa i Przyjazna Dzieciom */

:root {
  --primary-pink: #ff70a6;
  --secondary-mint: #70d6ff;
  --accent-yellow: #ffd670;
  --soft-lavender: #b39ddb;
  --bg-gradient-top: #ffe5ec;
  --bg-gradient-bottom: #d8f3dc;
  --text-dark: #37474f;
  --card-bg: rgba(255, 255, 255, 0.94);
  --shadow-color: rgba(140, 110, 160, 0.22);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(145deg, #ffdde1 0%, #ee9ca7 50%, #b5e2fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
}

/* Główny kontener gry - bezpieczny dla każdego urządzenia */
#gameWrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 860px;
  background: #ffffff;
  box-shadow: 0 14px 40px var(--shadow-color);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  #gameWrapper {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}

/* Płótno Canvas */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(180deg, #dcf0ff 0%, #fef3e2 70%, #fae1dd 100%);
  cursor: ew-resize;
}

/* Pasek HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 20;
}

.hud-item {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-weight: 700;
  font-size: 17px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  transition: transform 0.15s ease;
}

.hud-icon {
  font-size: 19px;
}

.hud-value {
  color: #d81b60;
  min-width: 30px;
  text-align: center;
}

/* Licznik Combo */
.hud-combo-box {
  background: #fff3e0;
  border-color: #ffe0b2;
}

.hud-combo-box .hud-value {
  color: #e65100;
}

.combo-pop {
  animation: pulseScale 0.25s ease-out;
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Serduszka */
.hud-lives-box {
  padding: 6px 12px;
  gap: 4px;
}

.heart {
  font-size: 20px;
  transition: transform 0.2s, opacity 0.2s;
  display: inline-block;
}

.heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.85);
}

.hud-buttons {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ffffff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, background-color 0.15s;
}

.hud-btn:hover {
  transform: scale(1.1);
  background: #ffffff;
}

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

/* Pasek Lodowego Szału (Frenzy Bar) */
#frenzyBarWrapper {
  position: absolute;
  top: 72px;
  left: 20px;
  right: 20px;
  z-index: 20;
  text-align: center;
  pointer-events: none;
  animation: fadeInDown 0.3s ease-out;
}

.frenzy-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ad1457;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
  margin-bottom: 4px;
}

.frenzy-progress-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.frenzy-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4081, #ff9100, #ffeb3b, #00e676, #00b0ff, #d500f9);
  background-size: 300% 100%;
  animation: rainbowMove 2s linear infinite;
  border-radius: 8px;
  transition: width 0.1s linear;
}

@keyframes rainbowMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* Przyciski dotykowe na telefony */
#touchControls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  z-index: 15;
}

.touch-btn {
  pointer-events: auto;
  flex: 1;
  max-width: 140px;
  height: 60px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  font-size: 20px;
  font-weight: 700;
  color: #e91e63;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
}

.touch-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.95);
}

/* Modale / Nakładki */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 20, 60, 0.45);
  backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.modal-card {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  border: 4px solid #ffffff;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-badge {
  display: inline-block;
  background: #f8bbd0;
  color: #880e4f;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.modal-badge-cheer {
  display: inline-block;
  background: #e1bee7;
  color: #4a148c;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 30px;
  font-weight: 700;
  color: #ad1457;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(255, 105, 180, 0.2);
}

.modal-subtitle {
  font-size: 15px;
  color: #546e7a;
  margin-bottom: 18px;
  line-height: 1.4;
}

/* Wybór skórek */
.skin-selector-wrapper {
  margin-bottom: 18px;
}

.section-heading {
  font-size: 14px;
  font-weight: 700;
  color: #455a64;
  margin-bottom: 10px;
  text-align: left;
}

.skin-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.skin-card {
  background: #ffffff;
  border: 3px solid #eceff1;
  border-radius: 18px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skin-card:hover {
  transform: translateY(-2px);
  border-color: #f48fb1;
}

.skin-card.active {
  border-color: #ff4081;
  background: #fff0f5;
  transform: scale(1.04);
  box-shadow: 0 6px 14px rgba(255, 64, 129, 0.25);
}

.skin-emoji {
  font-size: 26px;
  margin-bottom: 4px;
}

.skin-name {
  font-size: 14px;
  font-weight: 700;
  color: #37474f;
}

.skin-desc {
  font-size: 11px;
  color: #78909c;
}

/* Instrukcja */
.guide-box {
  background: #f8fafc;
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  border: 1px solid #e2e8f0;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #475569;
  line-height: 1.35;
}

.guide-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* Przyciski główne */
.primary-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #ff4081 0%, #ff80ab 100%);
  color: #ffffff;
  border: none;
  border-radius: 22px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 64, 129, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 64, 129, 0.45);
}

.primary-btn:active {
  transform: translateY(1px);
}

/* Statystyki końca gry */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: #f1f5f9;
  border-radius: 16px;
  padding: 12px 8px;
  border: 2px solid #e2e8f0;
}

.stat-box.highlight {
  grid-column: span 2;
  background: #fff3e0;
  border-color: #ffe082;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-box.highlight .stat-label {
  color: #b78103;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.stat-box.highlight .stat-value {
  font-size: 32px;
  color: #e65100;
}

.badge-record {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700 0%, #ffa000 100%);
  color: #4a2800;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(255, 160, 0, 0.35);
  margin-bottom: 14px;
  animation: pulseScale 1s infinite alternate;
}

.badge-record.hidden {
  display: none;
}

.best-score-info {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 18px;
}

.best-score-info strong {
  color: #e91e63;
}
