html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  text-align: center;
  background-image: url('Assets/backgrounds/background.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  cursor: url('Assets/curseurs/curseur_32.png') 0 0, auto;
}

#app {
  transform: scale(var(--ui-scale, 1));
  transform-origin: top left;
  width: calc(100% / var(--ui-scale, 1));
  height: calc(100% / var(--ui-scale, 1));
}

#top-bar {
  margin: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#ronron-counter {
font-size: 1.5em;
margin: 20px;
background-color: rgba(0, 0, 0, 0.28);
padding: 10px 20px;
display: inline-block;
border-radius: 12px;
color: #fff;
border: 2px solid rgba(0, 0, 0, 0.6);
}

#game-container {
display: flex;
justify-content: center;
align-items: flex-start;
gap: 40px;
margin-top: 30px;
}

#shop-panel {
position: fixed;
top: 46vh; /* 46% de la hauteur totale de l'écran */
right: 4vw; /* 6% de la largeur totale de l'écran */
width: 250px;
background-color: rgba(255, 240, 245, 0.0);
padding: 20px;
border-radius: 12px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#shop-panel-toggle {
width: 96px;
height: 96px;
padding: 0;
border-radius: 14px;
background: transparent;
border: 2px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
display: inline-flex;
align-items: center;
justify-content: center;
}

#shop-panel-toggle img {
width: 100%;
height: 100%;
object-fit: contain;
}

#shop-panel.dragging #shop-panel-toggle {
  cursor: grabbing;
}

#shop-panel-content {
display: none;
margin-top: 12px;
}

#shop-panel-content.open {
display: block;
}

#shop-section,
#decor-shop-section {
background: rgba(255, 240, 245, 0.85);
padding: 12px;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
margin-bottom: 12px;
}

#shop-section h2,
#decor-shop-section h2 {
margin: 0 0 8px;
}

#shop-content button,
#decor-shop-content button {
width: 100%;
margin: 10px 0;
}

button,
select,
input {
  cursor: url('Assets/curseurs/curseur_32.png') 0 0, pointer;
}

#decor-layer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}

.decor-delete-zone {
position: fixed;
top: 16px;
right: 16px;
width: 48px;
height: 48px;
border-radius: 12px;
background: rgba(0, 0, 0, 0.6);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: bold;
opacity: 0;
transform: scale(0.9);
transition: opacity 0.15s ease, transform 0.15s ease;
pointer-events: none;
z-index: 3;
}

.decor-delete-zone.active {
opacity: 1;
transform: scale(1);
pointer-events: auto;
}

.decor-delete-zone.over {
background: rgba(220, 60, 60, 0.9);
transform: scale(1.05);
}

.decor-item {
position: fixed;
left: 0;
top: 0;
width: 160px;
height: auto;
cursor: url('Assets/curseurs/curseur_32.png') 0 0, grab;
user-select: none;
touch-action: none;
pointer-events: auto;
}

.decor-item.dragging {
cursor: grabbing;
}

.decor-item.removing {
  animation: decorRemove 0.25s ease forwards;
}

.decor-delete-zone.pulse {
  animation: decorDeletePulse 0.35s ease;
}

#main-cat {
  width: 70vw;
  max-width: 280px;
  height: auto;
  border-radius: 12px;
  cursor: url('Assets/curseurs/curseur_32.png') 0 0, pointer;
  transition: transform 0.1s ease;
}

#main-cat:active {
transform: scale(0.9);
}

#main-cat.sprite {
  object-fit: none;
  object-position: 0 0;
  image-rendering: pixelated;
  transform: scale(var(--sprite-scale, 1));
  transform-origin: center;
}

#main-cat.sprite:active {
  transform: scale(var(--sprite-scale-active, 0.9));
}

.pop {
  position: absolute;
  font-weight: bold;
  font-size: 18px;
  color: #5e2750;
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-50px); }
}

@keyframes decorRemove {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.7); }
}

@keyframes decorDeletePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

#settings, #achievements {
background-color: #fff0f5;
margin: 10px auto;
padding: 10px;
width: 300px;
border-radius: 12px;
}

#particles-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
overflow: hidden;
z-index: 10;
}

.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.5);
z-index: 20;
padding: 20px;
box-sizing: border-box;
}

.modal.open {
display: flex;
}

.modal-content {
max-width: 680px;
width: 100%;
background: #fff0f5;
border-radius: 16px;
padding: 20px 24px;
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
text-align: left;
color: #3a1f2a;
}

.modal-content h2 {
margin: 0 0 10px;
}

.modal-content h3 {
margin: 16px 0 8px;
}

.modal-content ul {
margin: 0 0 12px 18px;
padding: 0;
}

#welcome-close {
width: 100%;
margin-top: 10px;
}

.particle {
  position: absolute;
  font-size: 24px;
  color: #ff69b4;
  animation: rise 1s ease-out forwards;
}

@keyframes rise {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100px); opacity: 0; }
}


#item-stacks {
position: fixed;
top: 16px;
left: 16px;
display: flex;
flex-direction: column;
gap: 10px;
max-width: 38vw;
padding: 10px;
border-radius: 14px;
background: rgba(92, 60, 40, 0.28);
backdrop-filter: blur(6px);
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

#toggle-collection {
width: 100%;
margin-bottom: 6px;
}

#item-stacks-content {
display: flex;
flex-direction: column;
gap: 10px;
}

.item-stack {
display: flex;
flex-direction: column;
gap: 6px;
padding: 8px 10px;
border-radius: 12px;
background: rgba(92, 60, 40, 0.18);
box-shadow: inset 0 0 0 1px rgba(94, 39, 80, 0.08);
}

.item-stack-title {
font-weight: bold;
color: #5e2750;
text-align: left;
font-size: 0.85em;
letter-spacing: 0.3px;
text-transform: uppercase;
}

.item-stack-line {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
}

.item-stack-slot {
display: flex;
flex-direction: column;
align-items: center;
font-size: 0.7em;
color: #3a1f2a;
padding: 4px 6px;
border-radius: 10px;
background: rgba(92, 60, 40, 0.22);
box-shadow: 0 4px 10px rgba(94, 39, 80, 0.08);
}

.item-stack-slot img {
width: 30px;
height: 30px;
border-radius: 8px;
background-color: transparent;
padding: 0;
box-shadow: none;
}

.item-stack-slot span {
margin-top: 2px;
font-weight: bold;
}

.item-stack-slot.empty {
opacity: 0.25;
filter: grayscale(0.6);
}

#success-toast {
position: fixed;
top: 30px;
left: 50%;
transform: translateX(-50%);
background-color: #fff3cd;
color: #856404;
border: 2px solid #ffeeba;
padding: 10px 20px;
border-radius: 12px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
font-weight: bold;
opacity: 0;
pointer-events: none;
transition: opacity 0.5s ease;
z-index: 1000;
}

#success-toast.show {
opacity: 1;
}

#treat {
position: fixed;
width: 105px;
height: auto;
z-index: 1200;
cursor: pointer;
opacity: 0;
transform: scale(0.9);
transition: opacity 0.2s ease, transform 0.2s ease;
pointer-events: none;
}

#treat.visible {
opacity: 1;
transform: scale(1);
pointer-events: auto;
}

.animated-rps {
  background: #fff;
  color: #ff4081;
  border: 3px solid #ff4081;
  padding: 5px 12px;
  border-radius: 12px;
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: 1em;
  font-weight: bold;
  box-shadow: 3px 3px 0 #000;
  transform: rotate(-2deg);
  display: inline-block;
  margin-left: 12px;
}

/* Cœurs */
.heart {
  position: absolute;
  font-size: 26px;
  animation: floatHeart 1s ease-out forwards;
  pointer-events: none;
}
@keyframes floatHeart {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.5); opacity: 0; }
}

/* Zone de caresse */
#pet-zone {
position: relative;
display: inline-block;
width: fit-content;
touch-action: none;
cursor: url('Assets/curseurs/curseur_32.png') 0 0, grab;
z-index: 2;
}
#pet-zone.dragging {
  cursor: grabbing;
}
#pet-zone::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
background: transparent;
pointer-events: none;
}

/* Halo du chat */
#main-cat.caresse {
box-shadow: 0 0 30px 15px rgba(255, 105, 180, 0.3);
transform: scale(0.93);
transition: box-shadow 0.3s ease, transform 0.3s ease;
}

#main-cat.sprite.caresse {
  transform: scale(var(--sprite-scale-caresse, 0.93));
}


#grade-title {
  font-size: 1.2em;
  font-weight: bold;
  color: #fff;
  margin-top: 10px;
  transition: transform 0.3s ease;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid rgba(0, 0, 0, 0.6);
  background-color: rgba(0, 0, 0, 0.28);
}

#grade-title.pop {
  animation: popGrade 0.5s ease;
}

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


@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  #game-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  #shop-panel {
    position: static;
    width: 90vw;
    max-width: 320px;
    margin: 0 auto 10px;
  }

  #shop-panel-toggle {
    width: 84px;
    height: 84px;
  }

  #item-stacks {
    position: static;
    width: 90vw;
    max-width: 420px;
    margin: 10px auto;
  }

  .item-stack-title {
    text-align: center;
  }

  .item-stack-line {
    justify-content: center;
  }

  #main-cat {
    max-width: 420px;
  }
}
