:root {
  --ink: #16324f;
  --ink-soft: #4a6179;
  --lagoon: #0d7f83;
  --lagoon-deep: #075a5e;
  --lagoon-light: #8fe3d8;
  --sand: #fbeed8;
  --shell: #fffaf1;
  --hibiscus: #e03a6c;
  --mango: #ffad2e;
  --line: #e6d4b4;
  --c1: #e03a6c;
  --c2: #0d7f83;
  --c3: #f08c00;
  --c4: #3b5bdb;
  --display: "Shrikhand", "Cooper Black", Georgia, serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --radius-lg: 22px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--lagoon-light) 0%, transparent 60%),
    var(--sand);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--hibiscus); outline-offset: 3px; }
[hidden] { display: none !important; }

.page { max-width: 1040px; margin: 0 auto; padding: 24px 18px 40px; }

/* ---------- Carte d'embarquement ---------- */
.pass {
  display: grid;
  grid-template-columns: 1fr 300px;
  background: var(--shell);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -22px rgba(22, 50, 79, .45);
  overflow: hidden;
  position: relative;
}
.pass-main { padding: 26px 30px 24px; }
.pass-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.2rem); color: var(--lagoon); }
.player-chip {
  border: 2px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 6px 14px; font-weight: 700; font-size: .92rem; white-space: nowrap;
}
.player-chip:hover { background: var(--ink); color: var(--shell); }

.route { display: flex; align-items: center; gap: 14px; margin: 22px 0 18px; }
.city { display: flex; flex-direction: column; }
.city-end { text-align: right; }
.code { font-weight: 800; font-size: clamp(2.4rem, 7vw, 3.6rem); letter-spacing: .02em; line-height: 1; }
.city-name { color: var(--ink-soft); font-weight: 500; }
.plane { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--hibiscus); }
.plane .dash { flex: 1; border-top: 2px dashed var(--line); }
.plane-icon { font-size: 1.6rem; }

.pass-meta { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 10px 18px; margin: 0; }
.pass-meta dt { font-size: .8rem; color: var(--ink-soft); }
.pass-meta dd { margin: 0; font-weight: 700; font-size: 1.05rem; }

.pass-stub {
  background: var(--hibiscus); color: var(--shell);
  padding: 26px 24px; display: flex; flex-direction: column; justify-content: center;
  position: relative;
  border-left: 3px dashed rgba(255, 250, 241, .7);
}
.pass-stub::before, .pass-stub::after {
  content: ""; position: absolute; left: -15px; width: 28px; height: 28px; border-radius: 50%; background: var(--sand);
}
.pass-stub::before { top: -14px; }
.pass-stub::after { bottom: -14px; }
.stub-label { margin: 0 0 8px; font-weight: 600; opacity: .92; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.countdown div { display: flex; flex-direction: column; align-items: flex-start; }
.countdown span { font-family: var(--display); font-size: 2.2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.countdown small { font-size: .78rem; opacity: .85; }
.countdown.done { display: block; font-family: var(--display); font-size: 1.8rem; line-height: 1.2; }

/* ---------- Mode d'emploi ---------- */
.howto { margin-top: 22px; }
.howto details { background: var(--shell); border-radius: var(--radius-lg); border: 2px dashed var(--line); }
.howto summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary h2 { font-family: var(--display); font-weight: 400; font-size: 1.4rem; color: var(--lagoon-deep); }
.howto-toggle::after { content: "Afficher"; font-weight: 700; font-size: .9rem; color: var(--hibiscus); }
.howto details[open] .howto-toggle::after { content: "Masquer"; }
.steps { list-style: none; margin: 0; padding: 0 22px 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.steps li { position: relative; padding-top: 4px; }
.step-num {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--hibiscus); color: var(--shell); font-family: var(--display); font-size: 1.1rem; margin-bottom: 6px;
}
.steps h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.steps strong { color: var(--ink); }
.howto-faq { margin: 12px 22px 18px; padding: 12px 14px; background: #fff3df; border-radius: var(--radius-sm); font-size: .93rem; color: var(--ink-soft); }
.howto-faq strong { color: var(--ink); }

/* ---------- Sections ---------- */
main { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; margin-top: 30px; align-items: start; }
.section-head { margin-bottom: 14px; }
.section-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; color: var(--ink); }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); max-width: 46ch; }

/* ---------- Carte des jeux (menu de bar) ---------- */
.menu-list { list-style: none; margin: 0; padding: 8px 0; background: var(--shell); border-radius: var(--radius-lg); border: 2px solid var(--ink); }
.menu-list li + li { border-top: 1px solid var(--line); }
.game-row {
  width: 100%; display: grid; grid-template-columns: 56px 1fr; gap: 4px 14px; align-items: center;
  padding: 16px 20px; background: none; border: 0; text-align: left;
}
.game-row:hover { background: #fff3df; }
.game-row .g-emoji { grid-row: span 2; font-size: 2.4rem; line-height: 1; text-align: center; }
.g-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.g-name { font-family: var(--display); font-size: 1.28rem; color: var(--lagoon-deep); white-space: nowrap; }
.g-leader { flex: 1; border-bottom: 2px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
.g-best { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-best.none { color: var(--ink-soft); font-weight: 500; font-size: .9rem; }
.g-desc { color: var(--ink-soft); font-size: .95rem; }
.g-tag { display: inline-block; margin-left: 6px; font-size: .78rem; font-weight: 700; color: var(--hibiscus); }

/* ---------- Tableau ---------- */
.board { background: var(--ink); color: var(--shell); border-radius: var(--radius-lg); padding: 22px 22px 18px; }
.board .section-head h2 { color: var(--mango); }
.tabs { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tabs button {
  border: 2px solid currentColor; background: transparent; border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: .9rem; opacity: .75;
}
.tabs button[aria-selected="true"] { opacity: 1; background: var(--mango); border-color: var(--mango); color: var(--ink); }
.board-body { min-height: 180px; }
.empty { color: #b8c6d4; }

.lane { margin: 12px 0 16px; }
.lane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lane-name { font-weight: 800; font-size: 1.05rem; }
.lane-rank { display: inline-block; width: 1.6em; color: var(--mango); font-weight: 800; }
.lane-total { font-weight: 800; font-variant-numeric: tabular-nums; }
.lane-bar { height: 12px; background: rgba(255, 255, 255, .12); border-radius: 999px; margin: 6px 0 4px; overflow: hidden; }
.lane-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.lane-members { font-size: .86rem; color: #b8c6d4; }

.rank-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank-table th { text-align: left; font-size: .8rem; font-weight: 600; color: #b8c6d4; padding: 6px 4px; }
.rank-table td { padding: 8px 4px; border-top: 1px solid rgba(255, 255, 255, .1); }
.rank-table td.num, .rank-table th.num { text-align: right; }
.rank-table tr.me td { color: var(--mango); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.game-select { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.game-select button { background: rgba(255, 255, 255, .1); border: 0; border-radius: 8px; padding: 6px 10px; font-size: 1.2rem; }
.game-select button[aria-pressed="true"] { background: var(--mango); }

.recent { margin-top: 14px; border-top: 1px dashed rgba(255, 255, 255, .25); padding-top: 12px; }
.recent h3 { font-size: .95rem; color: #b8c6d4; font-weight: 600; margin-bottom: 6px; }
.recent ul { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.recent li { padding: 3px 0; display: flex; gap: 8px; }
.recent li span:last-child { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.foot { text-align: center; color: var(--ink-soft); margin-top: 34px; font-size: .92rem; }

/* ---------- Boutons ---------- */
.btn {
  border: 2px solid var(--ink); background: var(--shell); color: var(--ink);
  border-radius: 999px; padding: 11px 22px; font-weight: 800;
}
.btn-primary { background: var(--hibiscus); border-color: var(--hibiscus); color: var(--shell); }
.btn-primary:hover { background: #c52b5b; }
.btn-wide { width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: var(--shell); font-size: 1.1rem; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; background: rgba(22, 50, 79, .55); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal-card { background: var(--shell); border-radius: var(--radius-lg); padding: 26px; width: min(460px, 100%); max-height: 92vh; overflow: auto; }
.modal-card h2 { font-family: var(--display); font-weight: 400; font-size: 1.8rem; color: var(--lagoon); }
.modal-card .tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--shell); }
form { display: grid; gap: 14px; margin-top: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input {
  font: inherit; padding: 11px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
input:focus { border-color: var(--lagoon); outline: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.couple-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.couple-options label { display: block; cursor: pointer; }
.couple-options input { position: absolute; opacity: 0; pointer-events: none; }
.couple-options span {
  display: block; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 700; background: #fff;
}
.couple-options input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--shell); }
.couple-options input:focus-visible + span { outline: 3px solid var(--hibiscus); outline-offset: 2px; }
.couple-options .full { opacity: .45; }
.hint { font-weight: 500; font-size: .84rem; color: var(--ink-soft); }
.auth-intro { margin: 10px 0 0; color: var(--ink-soft); }
input.invalid { border-color: var(--hibiscus); }
.form-error { color: var(--hibiscus); font-weight: 700; margin: 0; min-height: 1.2em; }

/* ---------- Écran de jeu ---------- */
.stage {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: var(--lagoon-deep); color: var(--shell);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.stage-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.stage-bar h2 { font-family: var(--display); font-weight: 400; font-size: 1.3rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-stats { display: flex; gap: 14px; align-items: baseline; font-variant-numeric: tabular-nums; }
.stage-stats span { opacity: .85; font-weight: 600; }
.stage-stats strong { font-family: var(--display); font-weight: 400; font-size: 1.7rem; color: var(--mango); min-width: 2ch; text-align: right; }
.arena { flex: 1; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }

.result { position: absolute; inset: 0; background: rgba(7, 90, 94, .82); display: grid; place-items: center; padding: 18px; z-index: 5; }
.result-card { background: var(--shell); color: var(--ink); border-radius: var(--radius-lg); padding: 28px; text-align: center; width: min(420px, 100%); }
.result-emoji { font-size: 3rem; margin: 0; }
.result-card h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--lagoon); }
.result-score { font-family: var(--display); font-size: 3.4rem; margin: 6px 0; color: var(--hibiscus); line-height: 1.1; }
.result-note { color: var(--ink-soft); min-height: 1.5em; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* Intro commune */
.intro { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; z-index: 3; }
.intro-card { max-width: 440px; }
.intro-card .big { font-size: 4rem; line-height: 1; }
.intro-title { font-family: var(--display); font-weight: 400; font-size: 1.8rem; color: var(--mango); margin: 10px 0 4px; }
.intro-card p { font-size: 1.05rem; }
.intro-card .btn { margin-top: 8px; }

/* Jeu : pluie de cocktails */
.sky { position: absolute; inset: 0; background: linear-gradient(#ffcf8a 0%, #ffb3a0 38%, #8fe3d8 70%, #f3dcb4 100%); }
.sky canvas { position: absolute; inset: 0; display: block; }

/* Jeu : barman */
.bar-scene { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.bar-title { text-align: center; }
.bar-title h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--mango); }
.bar-title p { margin: 2px 0 0; opacity: .9; }
.glass-wrap { position: relative; height: min(46vh, 360px); aspect-ratio: 0.62; }
.glass {
  position: absolute; inset: 0; border: 4px solid rgba(255,255,255,.85); border-top: 0;
  border-radius: 0 0 36px 36px; overflow: hidden; background: rgba(255,255,255,.08);
}
.layer { position: absolute; left: 0; right: 0; bottom: 0; }
.target { position: absolute; left: -14px; right: -14px; border-top: 3px dashed var(--mango); height: 0; z-index: 2; }
.target span { position: absolute; right: calc(100% + 4px); top: -12px; font-weight: 800; font-size: .85rem; color: var(--mango); white-space: nowrap; }
.stream { position: absolute; left: 50%; top: -60px; width: 10px; margin-left: -5px; border-radius: 6px; z-index: 1; opacity: 0; transition: opacity .1s; }
.stream.on { opacity: 1; }
.pour-btn {
  width: min(340px, 90%); padding: 18px; border-radius: 999px; border: 0; background: var(--hibiscus); color: var(--shell);
  font-weight: 800; font-size: 1.15rem; touch-action: none;
}
.pour-btn.active { background: var(--mango); color: var(--ink); }
.pour-btn:disabled { opacity: .5; }
.bar-feedback { min-height: 1.6em; font-weight: 800; font-size: 1.2rem; color: var(--mango); }

/* Jeu : memory */
.memory-grid {
  position: absolute; inset: 0; margin: auto; padding: 14px;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 10px;
  width: min(520px, 100%); height: min(520px, 100%); aspect-ratio: 1;
}
.card { perspective: 700px; border: 0; background: none; padding: 0; position: relative; display: block; min-width: 0; min-height: 0; }
.card-inner { position: absolute; inset: 0; transition: transform .35s; transform-style: preserve-3d; }
.card.flipped .card-inner, .card.matched .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; backface-visibility: hidden; font-size: clamp(1.6rem, 7vw, 2.8rem); }
.card-back { background: var(--hibiscus); border: 3px solid rgba(255,255,255,.35); }
.card-back::after { content: "🌺"; font-size: .7em; opacity: .35; }
.card-front { background: var(--shell); transform: rotateY(180deg); }
.card.matched .card-front { background: var(--lagoon-light); }

/* Jeu : quiz */
.quiz { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 20px 16px; }
.quiz-inner { width: min(620px, 100%); }
.q-timer { height: 8px; background: rgba(255,255,255,.15); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.q-timer div { height: 100%; background: var(--mango); width: 100%; }
.q-text { font-size: clamp(1.2rem, 3.4vw, 1.55rem); font-weight: 700; margin: 0 0 18px; }
.q-answers { display: grid; gap: 10px; }
.q-answers button {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.08); font-weight: 600; font-size: 1.05rem;
}
.q-answers button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.q-answers button.good { background: #2fb36c; border-color: #2fb36c; }
.q-answers button.bad { background: var(--hibiscus); border-color: var(--hibiscus); }
.q-fact { margin-top: 16px; padding: 12px 14px; background: rgba(0,0,0,.18); border-radius: 12px; min-height: 3em; }

/* Jeu : transat */
.beach { position: absolute; inset: 0; background: linear-gradient(#8fe3d8 0%, #5fcfc6 22%, #f3dcb4 22.5%, #f7e4c1 100%); display: grid; place-items: center; padding: 14px; }
.transat-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: clamp(8px, 2vw, 16px); width: min(480px, 100%); aspect-ratio: 1; }
.spot {
  position: relative; border: 0; border-radius: 18px; background: rgba(255,255,255,.35);
  display: grid; place-items: center; font-size: clamp(2rem, 9vw, 3.4rem); overflow: hidden; min-height: 0;
}
.spot::before { content: "🏖️"; position: absolute; bottom: 6%; font-size: .55em; opacity: .5; }
.spot .who { display: block; position: relative; transform: translateY(110%); transition: transform .12s ease-out; }
.spot.up .who { transform: translateY(-8%); }
.spot .bubble { position: absolute; top: 6%; right: 8%; font-size: .45em; }
.spot.hit { background: rgba(47,179,108,.45); }
.spot.ouch { background: rgba(224,58,108,.55); }
.combo { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-weight: 800; color: var(--ink); background: var(--mango); padding: 4px 12px; border-radius: 999px; }

/* Roue des défis */
.wheel-scene { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; text-align: center; }
.wheel-wrap { position: relative; width: min(340px, 78vw, 46vh); aspect-ratio: 1; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; }
.wheel-pointer { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font-size: 2rem; z-index: 2; }
.dare { max-width: 480px; min-height: 4.5em; font-size: 1.2rem; font-weight: 700; }
.dare small { display: block; font-weight: 600; color: var(--mango); font-size: .95rem; }

.float-pts { position: absolute; font-weight: 800; pointer-events: none; animation: rise .8s ease-out forwards; }
@keyframes rise { to { transform: translateY(-40px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; }
  .page { padding: 14px 12px 32px; }
  .pass { grid-template-columns: 1fr; }
  .pass-main { padding: 20px 18px 18px; }
  .pass-stub { border-left: 0; border-top: 3px dashed rgba(255, 250, 241, .7); padding: 20px 18px; }
  .pass-stub::before { top: -15px; left: -14px; }
  .pass-stub::after { top: -15px; bottom: auto; left: auto; right: -14px; }
  .pass-meta { grid-template-columns: repeat(2, auto); }
  .countdown span { font-size: 2rem; }
  .game-row { padding: 14px 14px; grid-template-columns: 44px 1fr; }
  .game-row .g-emoji { font-size: 2rem; }
  .g-name { font-size: 1.12rem; white-space: normal; }
  .stage-bar h2 { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
