:root {
  --bg-top: #fff2cf;
  --bg-bottom: #c8ecff;
  --panel: rgba(255, 252, 244, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --text: #2d3a3a;
  --muted: #68757a;
  --accent: #ff9f68;
  --accent-strong: #ff7d3c;
  --shadow: rgba(58, 65, 92, 0.14);
  --sky-top: #96defd;
  --sky-mid: #b7efff;
  --grass-top: #e0f8c8;
  --grass-bottom: #c8eb99;
  --ground-shadow: #9fd06f;
  --flower-a: rgba(255, 231, 132, 0.9);
  --flower-b: rgba(255, 160, 160, 0.88);
  --flower-c: rgba(255, 191, 119, 0.9);
  --play-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cpath fill='%23306ea7' d='M4 4l8 20 3.2-7.2 7.8-1.7z'/%3E%3Cpath fill='%23ffd85f' stroke='%23d28c1e' stroke-width='1.8' stroke-linejoin='round' d='M25 4.5l2.3 4.9 5.4.8-3.9 3.7.9 5.2-4.7-2.5-4.7 2.5.9-5.2-3.9-3.7 5.4-.8z'/%3E%3C/svg%3E") 4 4, pointer;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Marker Felt", "Comic Sans MS", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.98), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 230, 150, 0.68), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.app {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero,
.side-panel,
.game-shell {
  background: var(--panel);
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: 0 16px 32px var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow,
.small-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 0.95;
}

.intro {
  max-width: 54ch;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.secondary-link,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(255, 245, 219, 0.98), rgba(255, 232, 174, 0.96));
  color: #25323a;
  border: 2px solid rgba(240, 171, 73, 0.34);
  text-decoration: none;
  box-shadow:
    0 10px 18px rgba(76, 90, 110, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
  appearance: none;
}

.secondary-link::after,
.fullscreen-button::after {
  content: "↗";
  font-size: 0.92em;
  line-height: 1;
  opacity: 0.76;
  transition: transform 180ms ease, opacity 180ms ease;
}

.secondary-link:hover,
.secondary-link:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(255, 239, 202, 1), rgba(255, 223, 148, 0.98));
  border-color: rgba(217, 96, 40, 0.44);
  box-shadow:
    0 14px 24px rgba(76, 90, 110, 0.18),
    0 0 0 4px rgba(255, 198, 105, 0.16);
}

.secondary-link:hover::after,
.secondary-link:focus-visible::after,
.secondary-button:hover::after,
.secondary-button:focus-visible::after {
  opacity: 1;
  transform: translateX(2px);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  min-height: 48px;
  border-radius: 999px;
  font-weight: 700;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  background: linear-gradient(180deg, rgba(255, 245, 219, 0.98), rgba(255, 232, 174, 0.96));
  color: #25323a;
  border: 2px solid rgba(240, 171, 73, 0.34);
  text-decoration: none;
  box-shadow:
    0 10px 18px rgba(76, 90, 110, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.fullscreen-button[aria-pressed="true"]::after {
  content: "↙";
}

#gameFrame:fullscreen {
  padding: 18px;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: stretch;
}

#gameFrame:fullscreen::backdrop {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.98), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 230, 150, 0.68), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

#gameFrame:fullscreen .game-shell {
  min-height: calc(100vh - 36px);
  display: flex;
}

#gameFrame:fullscreen .playfield {
  flex: 1;
  min-height: 100%;
}

#gameFrame:fullscreen .side-panel {
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.start-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fffdf7;
  font: inherit;
  font-size: 1.5rem;
  padding: 14px 22px;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(255, 125, 60, 0.22);
}

.main-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 360px;
  gap: 14px;
  align-items: start;
}

.game-shell {
  padding: 16px;
}

.playfield {
  position: relative;
  overflow: hidden;
  min-height: 68vh;
  border-radius: 26px;
  cursor: var(--play-cursor);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
    url("assets/fond-jeu.png") center / cover no-repeat;
}

.playfield button {
  cursor: var(--play-cursor);
}

.playfield::after {
  content: none;
}

.playfield::before {
  content: none;
}

.sky-decor,
.celebration-layer,
.game-popover {
  position: absolute;
  inset: 0;
}

.sky-decor {
  z-index: 1;
  pointer-events: none;
}

.celebration-layer {
  z-index: 5;
  pointer-events: none;
}

.game-popover {
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 248, 231, 0.54), rgba(255, 255, 255, 0.24));
  backdrop-filter: blur(4px);
}

.game-popover-card {
  width: min(100%, 430px);
  padding: 22px 22px 20px;
  border-radius: 28px;
  background: rgba(255, 251, 243, 0.96);
  box-shadow: 0 24px 40px rgba(76, 82, 98, 0.18);
  text-align: center;
}

.game-popover-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-popover-card h2 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 0.95;
}

.game-popover-text {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.3;
}

.game-popover-button {
  margin-top: 14px;
  min-width: 180px;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-size: 1.15rem;
  color: #fffaf1;
  background: linear-gradient(180deg, #ffae74, #ff8d54);
  box-shadow: 0 16px 28px rgba(255, 141, 84, 0.28);
}

.game-popover-button:hover,
.game-popover-button:focus-visible {
  transform: translateY(-1px);
}

.kite {
  position: absolute;
  top: 10%;
  right: 8%;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #ff9dc3, #ffca6b);
  transform: rotate(12deg);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 10px 20px rgba(120, 82, 28, 0.18);
}

.kite::before,
.kite::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
}

.kite::before {
  left: 26px;
  top: 2px;
  width: 4px;
  height: 52px;
}

.kite::after {
  left: 2px;
  top: 26px;
  width: 52px;
  height: 4px;
}

.kite-tail {
  position: absolute;
  left: 25px;
  top: 52px;
  width: 2px;
  height: 72px;
  background: rgba(126, 106, 88, 0.7);
}

.kite-tail::before,
.kite-tail::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #7fd2ff, #b18dff);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.kite-tail::before {
  left: -7px;
  top: 16px;
}

.kite-tail::after {
  left: -7px;
  top: 42px;
}

.path-target,
.player,
.star-button,
.celebration-item {
  position: absolute;
}

.path-target,
.player,
.star-button {
  transform: translate(-50%, -50%);
}

.celebration-item {
  width: clamp(42px, 7vw, 76px);
  height: clamp(42px, 7vw, 76px);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  will-change: transform, opacity;
  filter: drop-shadow(0 10px 12px rgba(56, 76, 96, 0.16));
}

.celebration-item.balloon { animation: balloon-rise 2.8s ease-out forwards; }
.celebration-item.plane {
  width: clamp(84px, 12vw, 138px);
  height: clamp(46px, 6vw, 76px);
  animation: plane-fly 2.4s ease-out forwards;
}
.celebration-item.reward { animation: reward-pop 1.7s ease-out forwards; }
.celebration-item.oops { animation: oops-pop 1.2s ease-out forwards; }
.celebration-item.big-reward { animation: big-reward 2.4s ease-out forwards; }
.celebration-item.sparkle { animation: sparkle-burst 1.1s ease-out forwards; }
.celebration-item.album-entry {
  width: 180px;
  height: 120px;
  border-radius: 18px;
  box-shadow:
    0 14px 22px rgba(74, 84, 94, 0.16),
    inset 0 0 0 4px rgba(255, 255, 255, 0.76);
  animation: album-fly 1.9s cubic-bezier(0.2, 0.75, 0.18, 1) forwards;
}

.path-target {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  animation: float-target 1.8s ease-in-out infinite;
  z-index: 2;
}

.target-star-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 22px rgba(255, 190, 59, 0.28))
    drop-shadow(0 0 18px rgba(255, 236, 145, 0.7));
}

.player {
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: left 100ms linear, top 100ms linear, transform 140ms ease;
  z-index: 3;
}

.player-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(92, 70, 22, 0.18));
}

.player.happy { transform: translate(-50%, -50%) scale(1.08); }
.player.oops { transform: translate(-50%, -50%) scale(0.94); }

.star-button {
  width: 214px;
  height: 162px;
  border: 0;
  border-radius: 26px;
  background: transparent;
  box-shadow: none;
  cursor: var(--play-cursor);
  animation: float 2.1s ease-in-out infinite;
  z-index: 4;
}

.star-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(120, 72, 18, 0.24));
  pointer-events: none;
}

.star-button.captured {
  animation: star-capture 550ms ease-out forwards;
  pointer-events: none;
}

.hidden {
  display: none;
}

.side-panel {
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.picture-panel,
.album {
  border-radius: 22px;
  background: var(--panel-strong);
}

.picture-panel,
.album {
  padding: 14px;
}

.picture-head,
.picture-footer,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.picture-index {
  font-size: 1.35rem;
}

.picture-board {
  position: relative;
  margin-top: 12px;
  aspect-ratio: 3 / 2;
  border-radius: 22px;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.65);
}

.picture-board.scene-garden { background-image: url("assets/scene-garden.svg"); }
.picture-board.scene-castle { background-image: url("assets/scene-castle.svg"); }
.picture-board.scene-sea { background-image: url("assets/scene-sea.svg"); }

.picture-tile {
  position: absolute;
  width: 33.3334%;
  height: 50%;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.95), rgba(240, 230, 210, 0.95)),
    repeating-linear-gradient(45deg, rgba(255, 183, 121, 0.12), rgba(255, 183, 121, 0.12) 12px, rgba(255, 255, 255, 0.12) 12px, rgba(255, 255, 255, 0.12) 24px);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  transition: opacity 180ms ease, transform 180ms ease;
}

.picture-tile.revealed {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.picture-tile[data-piece="0"] { left: 0; top: 0; }
.picture-tile[data-piece="1"] { left: 33.3334%; top: 0; }
.picture-tile[data-piece="2"] { left: 66.6667%; top: 0; }
.picture-tile[data-piece="3"] { left: 0; top: 50%; }
.picture-tile[data-piece="4"] { left: 33.3334%; top: 50%; }
.picture-tile[data-piece="5"] { left: 66.6667%; top: 50%; }

.picture-footer {
  margin-top: 12px;
  align-items: end;
}

.picture-tile.tile-pop {
  animation: tile-reveal-pop 500ms ease-out;
}

.surprise {
  min-width: 160px;
}

.surprise-track {
  height: 16px;
  margin: 6px 0 4px;
  border-radius: 999px;
  background: rgba(210, 223, 233, 0.92);
  overflow: hidden;
}

.surprise-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd86b, #ff9f68);
  transition: width 180ms ease;
}

.album-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.album-badge {
  min-height: 62px;
  border-radius: 16px;
  padding: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(227, 235, 240, 0.88);
  color: #7d8e98;
  font-size: 0.95rem;
}

.album-badge.unlocked {
  background: linear-gradient(180deg, #fff8d9, #ffe3a1);
  color: #7a5a1d;
  box-shadow: inset 0 0 0 2px rgba(255, 185, 77, 0.3);
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 14px rgba(255, 247, 177, 0.22); }
  50% { box-shadow: 0 0 0 24px rgba(255, 247, 177, 0.4); }
}

@keyframes float-target {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) scale(1); }
  50% { transform: translate(-50%, -50%) translateY(-8px) scale(1.04); }
}

@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

@keyframes balloon-rise {
  0% { transform: translate(-50%, -50%) translateY(12px) scale(0.9); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-260px) translateX(24px) scale(1.08); opacity: 0; }
}

@keyframes plane-fly {
  0% { transform: translate(-50%, -50%) translateX(-40px) translateY(18px) rotate(-6deg) scale(0.9); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateX(280px) translateY(-84px) rotate(10deg) scale(1.02); opacity: 0; }
}

@keyframes reward-pop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-90px) scale(1.2); opacity: 0; }
}

@keyframes sparkle-burst {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-20deg); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-70px) scale(1.15) rotate(18deg); opacity: 0; }
}

@keyframes big-reward {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-160px) scale(1.36) rotate(12deg); opacity: 0; }
}

@keyframes album-fly {
  0% {
    transform: translate(-50%, -50%) scale(0.55) rotate(-8deg);
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  100% {
    transform: translate(220px, -220px) scale(0.36) rotate(10deg);
    opacity: 0;
  }
}

@keyframes oops-pop {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-36px) scale(1); opacity: 0; }
}

@keyframes star-capture {
  0% { transform: translate(-50%, -50%) scale(1); }
  30% { transform: translate(-50%, -50%) scale(1.16) rotate(8deg); }
  100% { transform: translate(-50%, -50%) scale(0.2) rotate(-14deg); opacity: 0; }
}

@keyframes tile-reveal-pop {
  0% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.7; transform: scale(1.06); }
  100% { opacity: 0; transform: scale(0.96); }
}

@keyframes drift {
  0% { transform: translateX(-8px); }
  100% { transform: translateX(18px); }
}

@media (max-width: 980px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .playfield {
    min-height: 56vh;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 14px, 1180px);
    padding-top: 10px;
  }

  .hero {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .picture-footer,
  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .album-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .player {
    width: 104px;
    height: 104px;
  }

  .path-target {
    width: 112px;
    height: 112px;
  }

  .star-button {
    width: 176px;
    height: 136px;
  }
}
