:root {
  --bg-0: #0d1022;
  --bg-1: #171b38;
  --panel: rgba(255, 255, 255, .06);
  --panel-2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .14);
  --text: #f7f1ec;
  --muted: #a9a5c2;
  --ham: #ff9fa8;
  --ham-dark: #e0586b;
  --gold: #ffcf5a;
  --good: #35c27a;
  --bad: #ef4b4b;
  --zero: #f3b61f;
  --font: "Fredoka", "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); }
body {
  font-family: var(--font);
  line-height: 1.4;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, #2a2f66 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 100%, #3a1d3f 0%, transparent 55%),
    linear-gradient(var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
body.in-game { overflow: hidden; overscroll-behavior: none; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 2.2rem; letter-spacing: .02em; }
h2 { font-size: 1.1rem; }
button { font-family: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
em { color: var(--muted); font-style: normal; font-size: .85em; }

.conn { position: sticky; top: 0; z-index: 100; background: var(--bad); text-align: center; padding: .4rem; font-size: .9rem; }
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 200%);
  background: #000d; color: #fff; padding: .7rem 1.1rem; border-radius: 999px; backdrop-filter: blur(6px);
  transition: transform .25s; z-index: 200; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

.screen { max-width: 560px; margin: 0 auto; padding: 1rem 16px 3rem; display: flex; flex-direction: column; gap: 1rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.room-code { letter-spacing: .2em; font-size: 1.4rem; color: var(--gold); }

/* boutons & champs */
.btn {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: .65rem 1rem; cursor: pointer; transition: transform .1s, background .15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .17); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #ff8b97, var(--ham-dark)); border-color: #ffb1b9; font-weight: 600;
  box-shadow: 0 6px 18px rgba(224, 88, 107, .35);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ff9ea8, #ea6578); }
.btn.gold { background: linear-gradient(180deg, #ffe08a, #f2b630); border-color: #fff0b8; color: #3b2a00; font-weight: 600; }
.btn.big { padding: .9rem 1rem; font-size: 1.1rem; width: 100%; }
.btn.small { padding: .3rem .7rem; font-size: .9rem; border-radius: 10px; }
.btn.ghost { background: transparent; }
.share { width: 100%; }
input {
  font: inherit; color: var(--text); background: rgba(0, 0, 0, .3); border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .9rem; width: 100%;
}
input:focus { outline: 2px solid var(--ham); border-color: transparent; }

/* accueil */
.home { padding-top: 2.5rem; }
.hero { text-align: center; }
.hero-cards { height: 110px; position: relative; margin-bottom: .5rem; }
.hc {
  position: absolute; left: 50%; top: 10px; width: 64px; height: 92px; border-radius: 10px; border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45); transform-origin: 50% 120%;
}
.hc1 { background: var(--good); transform: translateX(-50%) rotate(-18deg) translateX(-46px); animation: bob 3.2s ease-in-out infinite; }
.hc2 { background: linear-gradient(160deg, #c9485b, #7c1e34); transform: translateX(-50%) translateY(-6px); z-index: 2; animation: bob 3.2s .4s ease-in-out infinite; }
.hc3 { background: var(--bad); transform: translateX(-50%) rotate(18deg) translateX(46px); animation: bob 3.2s .8s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -8px; } }

.card-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1rem;
  display: flex; flex-direction: column; gap: .8rem; backdrop-filter: blur(8px);
}
.card-panel h2 { margin: 0; }
.card-panel label { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: .6rem; }
.code-input { text-transform: uppercase; letter-spacing: .25em; text-align: center; max-width: 9rem; font-weight: 600; }
.or { text-align: center; color: var(--muted); font-size: .85rem; }

/* salon */
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.players li { display: flex; justify-content: space-between; align-items: center; background: var(--panel); padding: .4rem .6rem; border-radius: 12px; }
.players li.offline { opacity: .5; }
.lp-name { display: flex; align-items: center; gap: .5rem; }
.lp-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; border: 2px solid #fff4; }
.games { display: flex; flex-direction: column; gap: .5rem; }
.game-tile {
  font: inherit; color: var(--text); text-align: left; display: flex; flex-direction: column; gap: .15rem;
  background: var(--panel); border: 2px solid transparent; border-radius: 14px; padding: .8rem 1rem; cursor: pointer;
}
.game-tile.active { border-color: var(--ham); background: rgba(255, 159, 168, .12); }
.game-tile:disabled { cursor: default; }
.opts { margin-top: .4rem; display: flex; flex-direction: column; gap: .5rem; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.stepper { display: flex; align-items: center; gap: .6rem; }
.stepper strong { min-width: 1.6rem; text-align: center; }
