/* ============================================
   OPERACIÓ TIÓ 2026 - DAMOS EN EL BLANCO
   Estils principals
   ============================================ */

:root {
  --c-red: #e63946;
  --c-gold: #ffb703;
  --c-green: #2a9d8f;
  --c-idea: #ff9f1c;
  --c-money: #8b5a2b;
  --c-zen: #f4d35e;
  --c-dark: #0a0a0a;
  --font-fun: 'Titan One', cursive;
  --font-main: 'Montserrat', sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
}

html, body {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  cursor: default;
}

/* Força no-selecció en tot el document */
::selection {
  background: transparent;
}

::-moz-selection {
  background: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: #050505;
  background-image: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
  min-height: 100dvh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

/* ===== ANIMACIONS ===== */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes popTextAnim {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shakeBody {
  0%, 100% { transform: translate3d(0, 0, 0); }
  10%, 90% { transform: translate3d(-4px, 0, 0); }
  20%, 80% { transform: translate3d(6px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

@keyframes squashAnim {
  0% { transform: translate(var(--tx), var(--ty)) scale(var(--scale)); }
  50% { transform: translate(var(--tx), var(--ty)) scale(calc(var(--scale) * 1.12), calc(var(--scale) * 0.88)); }
  100% { transform: translate(var(--tx), var(--ty)) scale(var(--scale)); }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateY(-120px) scale(1.3) rotate(var(--r)); }
}

@keyframes snowFall {
  0% { transform: translateY(-10px); opacity: 0.9; }
  100% { transform: translateY(110vh); opacity: 0.2; }
}

@keyframes lootPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-8deg); }
  20% { opacity: 1; transform: translate(-50%, -65%) scale(1.05) rotate(6deg); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1.2) rotate(12deg); }
}

@keyframes explode {
  0% { transform: scale(var(--scale)); opacity: 1; }
  55% { transform: scale(calc(var(--scale) * 1.15)); filter: brightness(1.25); opacity: 1; }
  100% { transform: scale(calc(var(--scale) * 0.35)); opacity: 0; }
}

@keyframes superDigest {
  0% { transform: scale(1.5) rotate(0deg); filter: hue-rotate(0deg); }
  50% { transform: scale(1.7) rotate(10deg); filter: hue-rotate(180deg); }
  100% { transform: scale(1.5) rotate(360deg); filter: hue-rotate(360deg); }
}

@keyframes eventPop {
  0% { transform: translateY(-20px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes comboFire {
  0% { transform: scale(0.5); opacity: 0; }
  30% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1) translateY(-30px); opacity: 0; }
}

@keyframes panicPulse {
  0% { opacity: 0.35; }
  50% { opacity: 0.70; }
  100% { opacity: 0.35; }
}

@keyframes eventGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(230, 57, 70, 0.3); }
  50% { box-shadow: 0 0 40px rgba(230, 57, 70, 0.6); }
}

.pop-text { animation: popTextAnim 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.shake-screen { animation: shakeBody 0.4s cubic-bezier(.36,.07,.19,.97) both; }
.squash { animation: squashAnim 0.15s ease-out; }
.digesting-anim { animation: superDigest 4s ease-in-out infinite; }
.exploding { animation: explode 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ===== PANTALLES ===== */
.screen {
  position: relative;
  z-index: 100;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  transition: opacity 0.4s ease;
}

.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

/* ===== TIPOGRAFIA ===== */
h1 {
  font-family: var(--font-fun);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  line-height: 1;
  color: white;
  text-shadow: 0 4px 0 #000;
  margin-bottom: 15px;
  transform: rotate(-2deg);
}

/* ===== BOTONS ===== */
.btn {
  position: relative;
  z-index: 200;
  background: var(--c-red);
  color: white;
  font-family: var(--font-main);
  font-weight: 900;
  text-transform: uppercase;
  padding: 16px 36px;
  border: 4px solid white;
  border-radius: 50px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
  animation: pulse 2s infinite;
  letter-spacing: 1px;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.95);
  animation: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

/* ===== HUD ===== */
.hud {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 500px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.guide-text {
  font-size: 0.75rem;
  color: #888;
  font-weight: 700;
  margin-bottom: 6px;
  min-height: 1.2em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 2px black;
}

.msg-box {
  font-family: var(--font-fun);
  font-size: clamp(1rem, 4.5vw, 1.4rem);
  color: var(--c-gold);
  text-shadow: 2px 2px 0 #000;
  min-height: 3em;
  width: 100%;
  line-height: 1.2;
  background: rgba(0, 0, 0, 0.85);
  padding: 12px 15px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  margin-bottom: 8px;
}

/* ===== BARRA ALIMENTACIÓ ===== */
.feed-bar-container {
  width: 85%;
  display: flex;
  gap: 3px;
  height: 10px;
  margin-top: 5px;
  justify-content: center;
  transition: opacity 0.3s;
}

.feed-segment {
  flex: 1;
  background: #333;
  border-radius: 4px;
  transition: background 0.3s, transform 0.2s;
}

.feed-segment.filled {
  background: var(--c-green);
  box-shadow: 0 0 8px var(--c-green);
  transform: scaleY(1.2);
}

.feed-segment.over {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.25);
}

.feed-segment.over.filled {
  background: var(--c-red);
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.55);
  transform: scaleY(1.25);
}

/* ===== ZONA DE JOC ===== */
.game-zone {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  width: min(420px, 75vw);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 110;
  touch-action: manipulation;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.tio-scaler {
  --tx: 0px;
  --ty: 0px;
  --scale: 1;
  width: 100%;
  height: auto;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transform: translate(var(--tx), var(--ty)) scale(var(--scale));
  will-change: transform;
}

.tio-img {
  width: 85%;
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.6));
  pointer-events: none;
  transition: filter 0.3s;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
}


/* ===== PAL (STICK) ===== */
.stick {
  position: absolute;
  top: 5%;
  right: 5%;
  width: 110px;
  height: auto;
  transform-origin: 50% 85%;
  transform: rotate(30deg);
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: opacity 0.3s;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
}

.stick.visible {
  opacity: 1;
}

.stick.hit-anim {
  animation: stickHit 0.12s ease-out;
}

@keyframes stickHit {
  0% { transform: rotate(30deg); }
  50% { transform: rotate(-20deg); }
  100% { transform: rotate(30deg); }
}

/* ===== CONTROLS MENJAR ===== */
#controls-feed {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex;
  gap: 8px;
  justify-content: center;
  z-index: 200;
  width: min(420px, 94vw);
  padding: 0 8px;
}

.food-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 88px;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
  touch-action: manipulation;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.food-btn img {
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
  object-fit: contain;
  pointer-events: none;
}

.food-btn span {
  font-size: 0.7rem;
  color: #eee;
  font-weight: 800;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.food-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.18);
}

/* ===== CONTROLS HIT / DIGEST ===== */
#controls-hit,
#controls-digest {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 110px);
  width: min(400px, 90vw);
  z-index: 200;
  text-align: center;
}

/* ===== BARRA PROGRÉS ===== */
#progress-container {
  width: min(320px, 90vw);
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.5s;
  display: none;
}

.progress-track {
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid white;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-red), #ff5c6a);
  transition: width 0.1s;
  border-radius: 15px;
}

/* ===== TEXTOS FLOTANTS ===== */
.floater {
  position: fixed;
  font-weight: 900;
  font-size: clamp(1.2rem, 5vw, 2.2rem);
  font-family: var(--font-fun);
  pointer-events: none;
  text-shadow: 3px 3px 0 #000, 0 0 20px rgba(0,0,0,0.5);
  animation: floatUp 2.5s forwards;
  z-index: 300;
  max-width: min(480px, 85vw);
  text-align: center;
  will-change: transform, opacity;
  contain: layout paint;
  white-space: normal;
  word-break: break-word;
  padding: 8px 12px;
  line-height: 1.15;
  will-change: transform, opacity;
  contain: layout style;
}

/* ===== MENJAR VOLADOR ===== */
.flying-food {
  position: fixed;
  width: 50px;
  height: 50px;
  object-fit: contain;
  pointer-events: none;
  z-index: 500;
  transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== LOOT DROP ===== */
.loot-drop {
  position: fixed;
  font-size: 2rem;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 450;
  text-shadow: 2px 2px 0 #000;
  animation: lootPop 0.8s ease-out forwards;
  will-change: transform, opacity;
  contain: layout style;
}

/* ===== COMBO DISPLAY ===== */
#combo-display {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 15px);
  right: 15px;
  text-align: right;
  z-index: 140;
  font-family: var(--font-fun);
  opacity: 0;
  transition: opacity 0.2s;
}

#combo-num {
  font-size: 2.5rem;
  color: var(--c-gold);
  line-height: 1;
  text-shadow: 3px 3px 0 #000;
}

/* ===== COMBO FIRE ===== */
.combo-fire {
  position: fixed;
  font-size: 2.5rem;
  pointer-events: none;
  z-index: 300;
  animation: comboFire 0.6s ease-out forwards;
  will-change: transform, opacity;
  contain: layout style;
}

/* ===== HIT EFFECT ===== */
.hit-effect {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 250;
  transform: translate(-50%, -50%) scale(0.3);
  animation: hitRipple 0.3s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes hitRipple {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* ===== EVENT BANNER ===== */
.event-banner {
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.95), rgba(150, 30, 40, 0.98));
  border: 4px solid #fff;
  border-radius: 18px;
  padding: 18px 28px;
  font-weight: 900;
  text-align: center;
  width: fit-content;
  max-width: 94%;
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 40px rgba(230, 57, 70, 0.6), inset 0 0 20px rgba(255,255,255,0.1);
}

.event-banner.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: eventPulse 0.6s ease-in-out infinite;
}

@keyframes eventPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 40px rgba(230, 57, 70, 0.6); }
  50% { transform: scale(1.04); box-shadow: 0 12px 50px rgba(230, 57, 70, 0.8); }
}

.event-banner .ev-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-banner .ev-txt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.event-banner .ev-title {
  font-family: var(--font-fun);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(1.4rem, 6vw, 2rem);
  line-height: 1.1;
  color: #fff;
  text-shadow: 3px 3px 0 #000, 0 0 15px rgba(255,255,255,0.3);
}

.event-banner .ev-effect {
  font-weight: 900;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  color: var(--c-gold);
  text-shadow: 2px 2px 0 #000;
  margin-top: 6px;
  background: rgba(0,0,0,0.3);
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-block;
}

/* ===== EVENT STICKER ===== */
.event-sticker {
  position: fixed;
  z-index: 215;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.4), rgba(180, 40, 50, 0.5));
  border: 4px solid rgba(230, 57, 70, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(230, 57, 70, 0.4);
}

.event-sticker img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.event-sticker.emoji {
  font-size: 32px;
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.35), rgba(0, 0, 0, 0.5));
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.event-sticker.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0);
  animation: stickerPulse 0.8s ease-in-out infinite;
}

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

/* Indicador de bloqueig (quan no pots picar) */
.blocked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(230, 57, 70, 0.15);
  pointer-events: none;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.blocked-overlay.show {
  opacity: 1;
}

.blocked-text {
  font-family: var(--font-fun);
  font-size: 2.5rem;
  color: var(--c-red);
  text-shadow: 3px 3px 0 #000;
  animation: blockedPulse 0.3s ease-in-out infinite;
}

@keyframes blockedPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== CHAOS METER ===== */
.chaos-meter {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  z-index: 140;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.chaos-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to top, var(--c-green), var(--c-gold), var(--c-red));
  border-radius: 8px;
  transition: height 0.3s;
}

.chaos-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 800;
  color: #666;
  white-space: nowrap;
}

/* ===== TRANSICIÓ / DIGESTIÓ ===== */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
  backdrop-filter: blur(12px);
}

#transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.digest-progress {
  width: 260px;
  max-width: 80vw;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.digest-bar {
  height: 100%;
  width: 0%;
  background: var(--c-gold);
  border-radius: 999px;
  transition: width 0.08s linear;
}

/* ===== TIMER BAR ===== */
#timer-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  width: 100%;
  background: linear-gradient(90deg, var(--c-red), #ff5c6a);
  z-index: 300;
  display: none;
}

/* ===== NEU ===== */
#snow-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -10px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  opacity: 0.8;
  animation-name: snowFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  filter: blur(0.3px);
}

/* ===== CONFETTI ===== */
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ===== PANIC MODE ===== */
body.panic::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  background: radial-gradient(circle at 50% 40%, rgba(230, 57, 70, 0), rgba(230, 57, 70, 0.25));
  animation: panicPulse 0.8s ease-in-out infinite;
}

body.panic .game-zone {
  filter: drop-shadow(0 0 25px rgba(230, 57, 70, 0.5));
}

body.panic .msg-box {
  border-color: rgba(230, 57, 70, 0.4);
}

/* ===== TIO MOODS ===== */
body.tio-angry .tio-img {
  filter: saturate(1.15) contrast(1.12) drop-shadow(0 0 18px rgba(230, 57, 70, 0.45));
  animation: tioAngry 0.3s ease-out;
}

@keyframes tioAngry {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

body.tio-happy .tio-img {
  filter: saturate(1.15) brightness(1.08) drop-shadow(0 0 18px rgba(42, 157, 143, 0.45));
}

body.tio-sick .tio-img {
  filter: saturate(0.6) hue-rotate(25deg) brightness(0.9) drop-shadow(0 0 18px rgba(139, 90, 43, 0.45));
  animation: tioSick 1s ease-in-out infinite;
}

@keyframes tioSick {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

body.tio-panic .tio-img {
  filter: saturate(1.3) contrast(1.15) drop-shadow(0 0 22px rgba(230, 57, 70, 0.6));
  animation: tioPanic 0.15s ease-in-out infinite;
}

@keyframes tioPanic {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}

/* Moods especials segons dieta */
body.tio-money .tio-img {
  filter: saturate(1.2) drop-shadow(0 0 20px rgba(139, 90, 43, 0.5)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.3));
}

body.tio-idea .tio-img {
  filter: saturate(1.1) brightness(1.1) drop-shadow(0 0 20px rgba(255, 159, 28, 0.5));
}

body.tio-zen .tio-img {
  filter: saturate(0.9) brightness(1.05) drop-shadow(0 0 20px rgba(244, 211, 94, 0.4));
}

/* ===== MODE SELECTOR ===== */
.mode-selector {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  touch-action: manipulation;
  min-width: 90px;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--c-gold);
}

.mode-btn.active {
  background: var(--c-gold);
  color: #111;
  border-color: var(--c-gold);
}

.mode-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.mode-btn .mode-emoji {
  font-size: 1.3rem;
  display: block;
  margin-bottom: 4px;
}

.mode-btn .mode-desc {
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.75;
  display: block;
  margin-top: 3px;
}

.mode-btn .mode-lock {
  font-size: 0.55rem;
  opacity: 0.6;
  display: block;
  margin-top: 2px;
}

/* ===== CARD FINAL ===== */
.card-final {
  background: linear-gradient(155deg, #1a1a1a 0%, #0a0a0a 100%);
  color: #fff;
  padding: 24px 18px;
  border-radius: 20px;
  width: 92%;
  max-width: 380px;
  border: 2px solid rgba(255, 183, 3, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 200;
  overflow: hidden;
  margin-top: 15px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.rank-badge {
  font-family: var(--font-fun);
  font-size: 1.1rem;
  color: var(--c-gold);
  margin-bottom: 10px;
  text-shadow: 2px 2px 0 #000;
  line-height: 1.2;
}

.rank-desc {
  font-size: 0.85rem;
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 10px;
}

.rank-lesson {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.12), rgba(42, 157, 143, 0.12));
  border: 2px solid rgba(255, 183, 3, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-gold);
  line-height: 1.4;
  margin: 12px 0;
  text-align: center;
}

.rank-lesson:empty {
  display: none;
}

/* ===== NEW RECORD ===== */
.new-record {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 183, 3, 0.3));
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  text-align: center;
  font-family: var(--font-fun);
  font-size: 0.95rem;
  color: var(--c-gold);
  animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
  50% { transform: scale(1.02); box-shadow: 0 0 30px rgba(255, 215, 0, 0.5); }
}

/* ===== BEST SCORE ===== */
.best-score {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 0.7rem;
  color: #999;
  text-align: center;
}

.best-score-item {
  margin: 4px 0;
}

/* ===== CHRISTMAS MESSAGE - REDESIGN ===== */
#christmas-message {
  margin-bottom: 20px;
}

.christmas-msg {
  background: linear-gradient(145deg, rgba(230, 57, 70, 0.2), rgba(42, 157, 143, 0.2));
  border: 2px solid rgba(255, 183, 3, 0.4);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  animation: xmasGlow 2s ease-in-out infinite alternate;
}

@keyframes xmasGlow {
  from { box-shadow: 0 0 20px rgba(230, 57, 70, 0.3); }
  to { box-shadow: 0 0 30px rgba(42, 157, 143, 0.4); }
}

.christmas-msg .xmas-emoji {
  font-size: 2.5rem;
  margin-bottom: 12px;
  animation: emojiFloat 2s ease-in-out infinite;
}

@keyframes emojiFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.christmas-msg .xmas-title {
  font-family: var(--font-fun);
  font-size: 1.6rem;
  color: var(--c-gold);
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(255, 183, 3, 0.3);
}

.christmas-msg .xmas-text {
  font-size: 0.95rem;
  color: #eee;
  line-height: 1.6;
}

.new-record {
  background: linear-gradient(90deg, var(--c-gold), #ffd700);
  color: #000;
  font-weight: 900;
  padding: 10px 16px;
  border-radius: 30px;
  margin-bottom: 16px;
  display: inline-block;
  animation: recordPulse 0.8s ease-in-out infinite alternate;
  font-size: 0.9rem;
}

/* ===== RESULT CARD ===== */
.result-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== STATS DETAILS (COLLAPSIBLE) ===== */
.stats-details {
  margin-bottom: 16px;
}

.stats-summary {
  cursor: pointer;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  color: #aaa;
  font-size: 0.85rem;
  list-style: none;
  text-align: center;
  transition: background 0.2s;
}

.stats-summary::-webkit-details-marker {
  display: none;
}

.stats-summary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.stats-content {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 12px 12px;
  margin-top: -4px;
}

.diet-mini {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.diet-tag {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.stats-mini {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.9rem;
  color: #ccc;
}

.stats-mini span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== FINAL BUTTONS ===== */
.final-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-share {
  flex: 1;
  padding: 14px 20px;
  font-size: 0.95rem;
}

.btn-replay-small {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #aaa;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-replay-small:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.final-logo {
  max-width: 100px;
  margin-top: 20px;
  opacity: 0.7;
}

/* ===== STATS FINALS ===== */
.final-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.final-h {
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.7rem;
  opacity: 0.85;
  margin-bottom: 8px;
  color: #888;
}

.stats-bar-container {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  background: #222;
}

.sb-part {
  height: 100%;
  transition: width 0.8s ease-out;
}

.stats-legend {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.7rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 10px;
}

.legend-item strong {
  font-weight: 900;
  color: #fff;
}

/* ===== SHARE BUTTON ===== */
.btn-share {
  width: 100%;
  margin-top: 12px;
  background: var(--c-gold);
  color: #111;
  font-family: var(--font-main);
  font-weight: 900;
  text-transform: uppercase;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
  touch-action: manipulation;
}

.btn-share:active {
  transform: scale(0.97);
}

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

/* Pantalles mitjanes-petites */
@media (max-width: 400px) {
  .food-btn {
    height: 78px;
    border-radius: 12px;
  }
  
  .food-btn img {
    width: 30px;
    height: 30px;
  }
  
  .food-btn span {
    font-size: 0.6rem;
  }
  
  #combo-display {
    top: calc(env(safe-area-inset-top) + 10px);
    right: 10px;
  }
  
  #combo-num {
    font-size: 2rem;
  }
  
  .chaos-meter {
    right: 6px;
    height: 70px;
    width: 7px;
  }
  
  .hud {
    width: 96%;
  }
  
  .msg-box {
    font-size: 0.95rem;
    padding: 10px 12px;
  }
  
  .card-final {
    padding: 18px 14px;
    width: 96%;
  }
  
  .rank-badge {
    font-size: 1rem;
  }
  
  .mode-btn {
    min-width: 80px;
    padding: 10px 12px;
  }
  
  .intro-tips {
    max-width: 260px;
  }
  
  .intro-tip {
    padding: 8px 10px;
  }
  
  h1 {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
  }
}

/* Pantalles molt petites */
@media (max-width: 350px) {
  .food-btn {
    height: 68px;
    gap: 2px;
  }
  
  .food-btn img {
    width: 26px;
    height: 26px;
    margin-bottom: 4px;
  }
  
  .food-btn span {
    font-size: 0.55rem;
  }
  
  #controls-feed {
    gap: 5px;
    padding: 0 5px;
  }
  
  .msg-box {
    font-size: 0.85rem;
    padding: 8px 10px;
    min-height: 2.5em;
  }
  
  .guide-text {
    font-size: 0.65rem;
  }
  
  .stats-legend {
    gap: 5px;
  }
  
  .legend-item {
    padding: 4px 6px;
    font-size: 0.65rem;
  }
  
  .mode-selector {
    gap: 6px;
  }
  
  .mode-btn {
    min-width: 70px;
    padding: 8px 10px;
    font-size: 0.7rem;
  }
  
  .mode-btn .mode-emoji {
    font-size: 1.1rem;
  }
}

/* Altures baixes (pantalles horitzontals o petites) */
@media (max-height: 700px) {
  .game-zone {
    transform: translate(-50%, -48%);
    width: min(360px, 70vw);
  }
  
  .card-final {
    max-height: calc(100dvh - 30px);
  }
  
  .intro-tips {
    gap: 5px;
    margin-bottom: 15px;
  }
  
  .intro-tip {
    padding: 6px 10px;
  }
}

/* Pantalles molt baixes (landscape mòbil) */
@media (max-height: 550px) {
  .game-zone {
    transform: translate(-50%, -50%);
    width: min(280px, 55vw);
  }
  
  .hud {
    top: 5px;
  }
  
  .msg-box {
    min-height: auto;
    padding: 8px 12px;
  }
  
  #controls-feed {
    bottom: 8px;
  }
  
  .food-btn {
    height: 60px;
  }
  
  .card-final {
    padding: 12px 10px;
    max-height: 95dvh;
  }
  
  .final-section {
    margin-top: 8px;
    padding-top: 6px;
  }
  
  .christmas-msg {
    padding: 10px;
  }
  
  .christmas-msg .xmas-emoji {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

