@font-face { font-family: Bricolage; src: url(/fonts/Bricolage.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --jungle: #10231c; --canopy: #173127; --moss: #25493a; --lichen: #3a6a55;
  --bone: #eef1e3; --dim: #9fb5a7;
  --blue: #58b0ff; --red: #ff6257; --gold: #f4c95d;
  --blue-wash: rgba(88, 176, 255, .13); --red-wash: rgba(255, 98, 87, .13);
  --r: 8px;
}
* { box-sizing: border-box; }
html { background: var(--jungle); color: var(--bone); font: 400 16px/1.5 Bricolage, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.4rem, 8vw, 4.2rem); font-weight: 800; line-height: .95; letter-spacing: -.035em; }
h2 { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
h3 { font-size: 1rem; font-weight: 650; }
a { color: inherit; }
img { display: block; }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.blue { color: var(--blue); } .red { color: var(--red); } .gold { color: var(--gold); }
.up { color: #7ddc9a; } .down { color: var(--red); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: 0 1.1rem; border: 1px solid var(--lichen); border-radius: var(--r); background: var(--canopy); font-weight: 600; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--bone); }
.btn.go { background: var(--gold); border-color: var(--gold); color: #1c1503; }
.btn.go:hover:not(:disabled) { background: #ffd978; }
.btn.b { background: var(--blue); border-color: var(--blue); color: #04192b; }
.btn.r { background: var(--red); border-color: var(--red); color: #2b0603; }
.btn.small { min-height: 34px; padding: 0 .7rem; font-size: .875rem; }
.btn.ghost { background: none; border-color: transparent; color: var(--dim); }
.btn.ghost:hover:not(:disabled) { color: var(--bone); border-color: var(--moss); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.stack > * + * { margin-top: 1rem; }
.field { display: grid; gap: .3rem; }
.field > span { font-size: .875rem; color: var(--dim); }
input[type=text], input[type=number], select { min-height: 44px; padding: 0 .8rem; border: 1px solid var(--lichen); border-radius: var(--r); background: var(--jungle); width: 100%; }
input[type=number] { font-variant-numeric: tabular-nums; }

/* Structure */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1.5rem; padding: .7rem max(1rem, env(safe-area-inset-left)); background: var(--jungle); border-bottom: 1px solid var(--moss); }
.mark { font-weight: 800; font-size: 1.25rem; letter-spacing: -.04em; text-decoration: none; line-height: 1; }
.mark i { font-style: normal; font-weight: 800; display: inline-block; margin-left: .35rem; padding: .1rem .35rem; border-radius: 4px; font-size: .75rem; letter-spacing: 0; color: #1c1503; background: linear-gradient(105deg, var(--blue) 50%, var(--red) 50%); }
.nav { display: flex; gap: .25rem; }
.nav a { padding: .45rem .8rem; border-radius: var(--r); text-decoration: none; color: var(--dim); font-weight: 600; }
.nav a[aria-current] { color: var(--bone); background: var(--moss); }
.me { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.coins { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.coins::before { content: ''; display: inline-block; width: .7em; height: .7em; margin-right: .35em; border-radius: 50%; background: var(--gold); box-shadow: inset 0 0 0 2px #b88d22; }
main { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
main > * + * { margin-top: 2.25rem; }
@media (max-width: 640px) {
  .nav { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; justify-content: space-around; padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom)); background: var(--canopy); border-top: 1px solid var(--moss); }
  .nav a { flex: 1; text-align: center; padding: .6rem .2rem; font-size: .9rem; }
}

.av { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--moss); }
span.av { display: grid; place-items: center; font-weight: 800; color: #0d1a15; background: hsl(var(--h) 55% 68%); }
.av.s { width: 28px; height: 28px; font-size: .8rem; }
.who { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.who b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; color: var(--dim); font-size: .8125rem; white-space: nowrap; }

.panel { padding: 1.1rem; border: 1px solid var(--moss); border-radius: 14px; background: var(--canopy); }
.panel > * + * { margin-top: .9rem; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.status { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .8125rem; font-weight: 650; background: var(--moss); }
.status.live { background: var(--red); color: #2b0603; }
.status.bets { background: var(--gold); color: #1c1503; }

/* Accueil */
.login { min-height: 100dvh; display: grid; align-content: center; gap: 1.5rem; padding: 2rem 1.25rem; max-width: 620px; margin: 0 auto; }
.login h1 { font-size: clamp(3.2rem, 14vw, 6.5rem); }
.login h1 span { display: block; }
.login p { max-width: 34ch; font-size: 1.125rem; color: var(--dim); }
.alert { padding: .8rem 1rem; border-left: 3px solid var(--red); background: var(--red-wash); border-radius: 0 var(--r) var(--r) 0; }
.hero { display: grid; gap: 1.25rem; }
.list { display: grid; gap: .5rem; padding: 0; margin: 0; list-style: none; }
.game { display: grid; grid-template-columns: 1fr auto 1fr; gap: .25rem .8rem; align-items: center; padding: .7rem .9rem; border-radius: var(--r); background: var(--canopy); text-decoration: none; border: 1px solid transparent; }
.game:hover { border-color: var(--lichen); }
.game .t { font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game .t:last-child { text-align: right; }
.game .t.lost { color: var(--dim); }
.game .t.won { font-weight: 700; }
.game time { font-size: .8125rem; color: var(--dim); }
.open { display: grid; gap: .75rem; }
.open a { text-decoration: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.stackav { display: flex; }
.stackav .av { margin-left: -8px; border: 2px solid var(--canopy); }
.stackav .av:first-child { margin-left: 0; }

/* Lobby */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .5rem; }
.slot { display: flex; align-items: center; gap: .6rem; min-height: 60px; padding: .5rem .7rem; border-radius: var(--r); background: var(--jungle); border: 1px solid var(--moss); min-width: 0; }
.slot.free { border-style: dashed; color: var(--dim); justify-content: center; font-size: .875rem; }
.slot .x { margin-left: auto; background: none; border: 0; color: var(--dim); font-size: 1.2rem; line-height: 1; padding: .3rem; }
.slot .x:hover { color: var(--red); }
.opts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.seg { display: grid; gap: .3rem; }
.seg > span { font-size: .875rem; color: var(--dim); }
.seg div { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg button { flex: 1 1 auto; min-height: 38px; padding: 0 .7rem; border: 1px solid var(--moss); border-radius: var(--r); background: var(--jungle); font-size: .875rem; font-weight: 600; color: var(--dim); }
.seg button[aria-pressed=true] { background: var(--bone); border-color: var(--bone); color: var(--jungle); }
.seg p { font-size: .8125rem; color: var(--dim); min-height: 2.4em; }

/* Plateau : chaque ligne est un duel de lane */
.board { border-radius: 14px; overflow: hidden; border: 1px solid var(--moss); background: linear-gradient(90deg, var(--blue-wash) 0 calc(50% - 34px), transparent calc(50% - 34px) calc(50% + 34px), var(--red-wash) calc(50% + 34px)); }
.sides { display: grid; grid-template-columns: 1fr 68px 1fr; align-items: end; padding: 1rem 1rem .6rem; }
.sides h2 { font-size: clamp(1.3rem, 5vw, 2rem); }
.sides h2:last-child { text-align: right; }
.sides .mid { text-align: center; color: var(--dim); font-size: .8125rem; }
.gauge { height: 6px; margin: 0 1rem; border-radius: 3px; background: var(--red); overflow: hidden; }
.gauge i { display: block; height: 100%; background: var(--blue); border-right: 2px solid var(--jungle); transition: width .5s; }
.gaugelab { display: flex; justify-content: space-between; padding: .35rem 1rem .5rem; font-size: .875rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.lane { display: grid; grid-template-columns: 1fr 68px 1fr; align-items: stretch; border-top: 1px solid var(--moss); }
.lane .role { display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--dim); background: var(--jungle); }
.cell { display: flex; align-items: center; gap: .65rem; padding: .65rem 1rem; min-width: 0; min-height: 64px; background: none; border: 0; text-align: left; width: 100%; }
.cell.rt { flex-direction: row-reverse; text-align: right; }
.cell .who { flex: 1; display: block; }
.cell .who b { display: block; }
button.cell:hover { background: rgba(255, 255, 255, .05); }
button.cell[aria-pressed=true] { background: rgba(244, 201, 93, .18); box-shadow: inset 0 0 0 2px var(--gold); }
.cell.empty { color: var(--dim); font-size: .875rem; }
.champ { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; font-weight: 600; flex: none; }
.champ img { width: 36px; height: 36px; border-radius: 6px; }
.cell.won-side .who b::after { content: ''; }
.board.deal .cell { animation: deal .45s both cubic-bezier(.2, .9, .3, 1.2); animation-delay: calc(var(--i) * 55ms); }
@keyframes deal { from { opacity: 0; transform: translateX(var(--from)) scale(.9); } }
.banner { padding: 1.25rem 1rem; text-align: center; font-size: clamp(1.6rem, 7vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.banner.w0 { background: var(--blue); color: #04192b; } .banner.w1 { background: var(--red); color: #2b0603; }
@media (max-width: 520px) {
  .board { background: linear-gradient(90deg, var(--blue-wash) 0 calc(50% - 22px), transparent calc(50% - 22px) calc(50% + 22px), var(--red-wash) calc(50% + 22px)); }
  .sides, .lane { grid-template-columns: 1fr 44px 1fr; }
  .lane .role { font-size: .625rem; }
  .cell { flex-direction: column; align-items: flex-start; gap: .3rem; padding: .6rem .7rem; }
  .cell.rt { flex-direction: column; align-items: flex-end; }
  .cell .av { width: 32px; height: 32px; }
  .champ img { width: 28px; height: 28px; }
}
.pool { display: flex; flex-wrap: wrap; gap: .5rem; }
.pool button { display: flex; align-items: center; gap: .5rem; padding: .4rem .8rem .4rem .4rem; border-radius: 99px; border: 1px solid var(--lichen); background: var(--jungle); font-weight: 600; }
.pool button:hover:not(:disabled) { border-color: var(--gold); }

/* Défis, paris, roue */
.secret { border-color: var(--gold); background: linear-gradient(180deg, rgba(244, 201, 93, .1), transparent), var(--canopy); }
.secret h3 + p { font-size: 1.125rem; font-weight: 600; }
.sidepick { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.sidepick button { padding: .7rem; border-radius: var(--r); border: 2px solid var(--moss); background: var(--jungle); text-align: left; }
.sidepick button b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sidepick button[aria-pressed=true].s0 { border-color: var(--blue); background: var(--blue-wash); }
.sidepick button[aria-pressed=true].s1 { border-color: var(--red); background: var(--red-wash); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips button { padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--moss); background: none; font-size: .875rem; font-variant-numeric: tabular-nums; }
.lines { display: grid; gap: .1rem; padding: 0; margin: 0; list-style: none; }
.lines li { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-top: 1px solid var(--moss); }
.lines li:first-child { border-top: 0; }
.lines .grow { flex: 1; min-width: 0; }
.lines .end { margin-left: auto; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tick { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--lichen); background: none; font-weight: 800; color: transparent; }
.tick[aria-pressed=true] { background: #7ddc9a; border-color: #7ddc9a; color: #0d1a15; }
.wheelbox { display: grid; justify-items: center; gap: 1rem; }
.wheelwrap { position: relative; width: min(280px, 70vw); aspect-ratio: 1; }
.wheelwrap::before { content: ''; position: absolute; z-index: 1; top: -6px; left: 50%; translate: -50%; border: 11px solid transparent; border-top: 20px solid var(--bone); }
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 5px solid var(--bone); position: relative; transition: rotate 5s cubic-bezier(.12, .7, .12, 1); }
.wheel span { position: absolute; inset: 0; display: grid; justify-items: center; padding-top: 9%; font-weight: 800; font-size: 1.25rem; color: #0d1a15; }
.verdict { text-align: center; max-width: 40ch; }
.verdict b { display: block; font-size: 1.25rem; }

/* Classement */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8125rem; font-weight: 600; color: var(--dim); padding: .4rem .5rem; }
td { padding: .55rem .5rem; border-top: 1px solid var(--moss); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.pos { width: 2rem; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
tr:nth-child(1) td.pos { color: var(--gold); }
td.elo { font-weight: 800; font-size: 1.125rem; }
.scroll { overflow-x: auto; }
@media (max-width: 560px) { .hide-s { display: none; } }
.titles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.title { padding: .9rem; border-radius: var(--r); background: var(--canopy); border-left: 3px solid var(--gold); }
.title.shame { border-left-color: var(--red); }
.title h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.title .who { margin-top: .5rem; }
.duos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; }

/* Profil, admin */
.order { display: grid; gap: .35rem; padding: 0; margin: 0; list-style: none; counter-reset: r; }
.order li { counter-increment: r; display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem .35rem .8rem; border-radius: var(--r); background: var(--jungle); border: 1px solid var(--moss); font-weight: 600; }
.order li::before { content: counter(r); color: var(--dim); font-variant-numeric: tabular-nums; width: 1ch; }
.order li span { flex: 1; }
.order button { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--moss); background: none; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .3rem .25rem .25rem; border-radius: 99px; background: var(--jungle); border: 1px solid var(--moss); font-size: .875rem; font-weight: 600; }
.tag img { width: 26px; height: 26px; border-radius: 50%; }
.tag button { border: 0; background: none; color: var(--dim); font-size: 1.1rem; line-height: 1; padding: 0 .3rem; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.copy { display: flex; gap: .5rem; }
.copy input { font-size: .875rem; }
.adm input[type=number] { width: 6.5rem; min-height: 36px; }

#toast { position: fixed; z-index: 9; left: 50%; bottom: 5.5rem; translate: -50% 1rem; padding: .7rem 1.1rem; border-radius: var(--r); background: var(--bone); color: var(--jungle); font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 2rem); }
#toast.on { opacity: 1; translate: -50% 0; }

@media (prefers-reduced-motion: reduce) {
  .board.deal .cell { animation: none; }
  .wheel, .gauge i, #toast { transition: none; }
}
