@font-face { font-family: "Baloo 2"; font-weight: 500; font-display: swap; src: url(fonts/baloo2-500.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(fonts/baloo2-700.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(fonts/baloo2-800.woff2) format("woff2"); }

:root {
  --wall: #cbe6f7;
  --wall-deep: #b3d9f1;
  --ink: #1d2b4f;
  --muted: #4c5b7c;
  --wood: #c98b4f;
  --wood-edge: #e2a96c;
  --wood-dark: #94602f;
  --sun: #ffc83d;
  --sun-dark: #e0a400;
  --leaf: #23875a;
  --paper: #ffffff;
  --line: #d9e4ef;
  --round: "Baloo 2", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #16233f; --wall-deep: #1d2d50; --ink: #eef3ff; --muted: #b4c0dc;
    --wood: #8a5a30; --wood-edge: #a8733f; --wood-dark: #5e3b1c;
    --paper: #22325a; --line: #34477a; --leaf: #5fd39a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--text);
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sun-dark); outline-offset: 3px; border-radius: 8px; }

/* En-tête */
.top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  max-width: 1040px; margin: 0 auto; padding: 28px 20px 8px;
}
.wordmark {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: .9; letter-spacing: -.01em;
  margin: 0;
}
.tagline { margin: 6px 0 0; color: var(--muted); max-width: 34ch; font-size: 1rem; }
.top-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.langs { display: flex; gap: 4px; background: var(--wall-deep); border-radius: 999px; padding: 4px; }
.langs button {
  border: 0; background: transparent; border-radius: 999px; padding: 4px 12px; cursor: pointer;
  font-family: var(--round); font-weight: 700; font-size: .95rem; color: var(--muted);
}
.langs button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.week { margin: 0; font-family: var(--round); font-weight: 700; color: var(--muted); text-align: right; }
.week strong { color: var(--ink); font-weight: 800; }

/* Les étagères */
.shelves { max-width: 1040px; margin: 0 auto; padding: 24px 20px 8px; }
.shelf { margin-bottom: 34px; }
.shelf-row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 0 clamp(14px, 4vw, 36px); padding: 0 clamp(8px, 3vw, 28px); align-items: end; }
.plank {
  height: 18px; border-radius: 4px;
  background: linear-gradient(var(--wood-edge) 0 5px, var(--wood) 5px 14px, var(--wood-dark) 14px);
  box-shadow: 0 10px 14px -10px rgba(29, 43, 79, .45);
}
.labels { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 0 clamp(14px, 4vw, 36px); padding: 10px clamp(8px, 3vw, 28px) 0; }

.game {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 100%; transition: transform .18s cubic-bezier(.3, 1.6, .5, 1);
}
.game img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 22%; background: var(--game, var(--wall-deep));
  box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
}
.game:hover { transform: translateY(-4px); }
.game:active { transform: translateY(-1px) scale(.97); }
.game-label { text-align: center; }
.game-label b { display: block; font-family: var(--round); font-weight: 700; font-size: clamp(1.02rem, 3.6vw, 1.2rem); line-height: 1.15; }
.game-label span { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }

.empty, .error { font-family: var(--round); font-size: 1.15rem; text-align: center; padding: 40px 0; color: var(--muted); }

.foot { max-width: 1040px; margin: 0 auto; padding: 8px 20px 40px; color: var(--muted); font-size: .92rem; }
.foot p { margin: 4px 0; }
.linklike { border: 0; background: none; padding: 0; text-decoration: underline; cursor: pointer; }

/* Fiche (feuille qui monte du bas) */
.sheet {
  width: min(640px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0;
  padding: 0; border: 0; border-radius: 26px 26px 0 0;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 -10px 40px rgba(29, 43, 79, .3);
}
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 26px; max-height: 88vh; } }
.sheet::backdrop { background: rgba(22, 35, 63, .55); }
.sheet[open] { animation: rise .26s cubic-bezier(.2, .9, .3, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } .game { transition: none; } }

.sheet-inner { padding: 22px 22px 28px; }
.sheet-close {
  position: sticky; top: 0; float: right; margin: -6px -6px 0 0; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: var(--wall); cursor: pointer; font-size: 1.3rem; line-height: 1;
}
.sheet-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.sheet-head img { width: 84px; height: 84px; border-radius: 22%; flex: none; background: var(--game, var(--wall)); }
.sheet-head h2 { font-family: var(--round); font-weight: 800; font-size: 1.75rem; line-height: 1.05; margin: 0; }
.sheet-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.pitch { margin: 0 0 18px; font-size: 1.04rem; max-width: 60ch; }

.play {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: 0; border-radius: 18px; padding: 14px 20px; cursor: pointer;
  background: var(--sun); color: #1d2b4f; box-shadow: 0 5px 0 var(--sun-dark);
  font-family: var(--round); font-weight: 800; font-size: 1.5rem; line-height: 1;
}
.play:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--sun-dark); }
.play svg { width: 22px; height: 22px; }
.newtab { margin: 10px 0 0; color: var(--muted); font-size: .9rem; text-align: center; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 18px; margin: 22px 0 6px; }
.facts div { border-left: 3px solid var(--line); padding-left: 10px; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: 0; font-weight: 600; }

.sheet section { margin-top: 22px; }
.sheet h3 { font-family: var(--round); font-weight: 800; font-size: 1.2rem; margin: 0 0 6px; }
.sheet section p { margin: 0 0 8px; max-width: 62ch; }
.level { font-family: var(--round); font-weight: 700; color: var(--leaf); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; padding: 0; list-style: none; }
.chips li { background: var(--wall); border-radius: 999px; padding: 2px 12px; font-size: .9rem; }

.promises { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 16px; }
.promises li { display: flex; gap: 8px; align-items: baseline; }
.promises li::before { content: "✓"; color: var(--leaf); font-weight: 800; }
.third { color: var(--muted); font-size: .9rem; margin-top: 8px !important; }

.ours { background: var(--wall); border-radius: 16px; padding: 12px 16px; }
.ours p { margin: 2px 0 !important; }
.meta { margin-top: 22px; color: var(--muted); font-size: .88rem; }
.meta p { margin: 2px 0; }

/* Le jeu en plein écran */
.player { position: fixed; inset: 0; z-index: 10; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-back {
  position: absolute; z-index: 1; top: calc(env(safe-area-inset-top) + 8px); left: calc(env(safe-area-inset-left) + 8px);
  height: 34px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .55); color: #1d2b4f; opacity: .7;
  font-family: var(--round); font-weight: 700; font-size: .95rem;
}
.player-back:hover, .player-back:focus-visible { opacity: 1; background: #fff; }
