/* ==========================================================================
   Poker en ligne — une salle de jeu privée : tapis vert bouteille, bordure d'acajou filetée de laiton,
   cartes crème, jetons colorés. Titres et montants en Limelight (années 1930), le reste en Nunito.
   ========================================================================== */
@font-face { font-family: "Limelight"; src: url("fonts/limelight.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --room: #15110e;
  --room-2: #221a14;
  --felt: #0f5a43;
  --felt-deep: #083627;
  --rail: #3d1f14;
  --rail-2: #5a2e1c;
  --brass: #d2ab62;
  --brass-dim: #8d7344;
  --paper: #fbf6ea;
  --chalk: #f1e8d2;
  --chalk-dim: #b9ad92;
  --ink: #1a1a1f;
  --red: #c3262f;
  --type: "Limelight", Georgia, serif;
  --card-w: 46px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
body {
  color: var(--chalk);
  font: 600 16px/1.45 "Nunito", system-ui, sans-serif;
  background:
    radial-gradient(80vw 60vh at 50% 0%, #f6c56b1c, transparent 70%),
    radial-gradient(120vw 90vh at 50% 120%, #00000080, transparent 60%),
    var(--room);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
h2 { font-family: var(--type); font-size: 22px; color: var(--brass); margin: 18px 0 8px; }
h3 { font-weight: 900; font-size: 16px; margin: 14px 0 4px; color: var(--brass); }
.small { font-size: 13px; color: var(--chalk-dim); font-weight: 600; }
.center { text-align: center; }

/* boutons */
button { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; background: #ffffff14; color: var(--chalk); box-shadow: inset 0 0 0 1px #ffffff26; }
button:hover { background: #ffffff22; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: linear-gradient(#e2bd72, #b98f45); color: #241708; box-shadow: 0 2px 0 #6f5326, inset 0 1px 0 #fff6; }
.primary:hover { background: linear-gradient(#ebc87e, #c29a50); }
.big { width: 100%; padding: 14px; font-size: 17px; }
.link { background: none; box-shadow: none; padding: 4px 6px; text-decoration: underline; text-underline-offset: 3px; color: var(--chalk-dim); font-weight: 700; }
.link:hover { background: none; color: var(--chalk); }
.iconBtn { width: 40px; height: 40px; padding: 0; font-size: 22px; line-height: 1; }

.field { display: grid; gap: 5px; font-size: 13px; font-weight: 800; color: var(--chalk-dim); }
.field input, .field select, #code, .botAdd select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid #ffffff30; background: #00000040; color: var(--chalk); font-weight: 700;
}
select option { background: #241c16; }
.check { display: flex; gap: 10px; align-items: center; margin: 8px 0; font-weight: 700; }

.hubLink { position: fixed; top: 14px; left: 14px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 7px 12px;
  border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 14px; color: #241708; background: var(--brass); box-shadow: 0 3px 0 #6f5326, 0 10px 20px #0009; }
.hubLink svg { width: 18px; height: 18px; }
body.playing .hubLink { display: none; }

.screen { min-height: 100vh; }

/* ---------- Accueil : la porte de la salle ---------- */
#home { display: grid; place-items: center; padding: 80px 16px 40px; }
.door { width: min(430px, 100%); text-align: center; }
.door h1 { font-family: var(--type); font-size: clamp(64px, 18vw, 104px); line-height: .9; color: var(--brass);
  text-shadow: 0 2px 0 #5d4420, 0 18px 40px #000; letter-spacing: .02em; }
.door .lead { margin: 14px 0 22px; color: var(--chalk); font-weight: 600; }
.door .field { text-align: left; margin-bottom: 12px; }
.or { margin: 18px 0 8px; color: var(--chalk-dim); font-size: 14px; }
.joinRow { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#code { text-align: center; letter-spacing: .35em; font-family: var(--type); font-size: 20px; text-transform: uppercase; }
.links { display: flex; justify-content: center; gap: 14px; margin-top: 18px; }
/* l'éventail des quatre As */
.fan { position: relative; height: 112px; margin-bottom: 8px; }
.mini { position: absolute; left: 50%; bottom: 0; width: 62px; height: 88px; margin-left: -31px; border-radius: 7px; background: var(--paper); color: var(--ink);
  font-weight: 900; font-size: 18px; padding: 4px 7px; text-align: left; box-shadow: 0 8px 18px #000a; transform-origin: 50% 140%; }
.mini b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 400; }
.mini.red { color: var(--red); }
.mini:nth-child(1) { transform: rotate(-24deg); }
.mini:nth-child(2) { transform: rotate(-8deg); }
.mini:nth-child(3) { transform: rotate(8deg); }
.mini:nth-child(4) { transform: rotate(24deg); }

/* ---------- Salon ---------- */
#lobby { display: grid; justify-items: center; padding: 70px 14px 40px; }
.board { width: min(640px, 100%); background: linear-gradient(#123f31, #0b2c22); border-radius: 20px; padding: 20px 20px 16px;
  box-shadow: 0 0 0 6px var(--rail), 0 0 0 7px var(--brass-dim), 0 30px 60px #000c; }
.lobbyHead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.code { font-family: var(--type); font-size: 40px; letter-spacing: .12em; margin: 0; color: var(--brass); line-height: 1; }
.lobbyHead .small { margin: 0 0 4px; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.players li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #00000033; min-height: 48px; flex-wrap: wrap; }
.players .who { font-weight: 800; flex: 1 1 auto; }
.badge { font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 99px; background: var(--brass); color: #241708; }
.badge.bot { background: #ffffff26; color: var(--chalk); }
.badge.off { background: #00000066; color: var(--chalk-dim); }
.players select { padding: 6px 8px; border-radius: 8px; background: #00000055; border: 1px solid #ffffff30; }
.players .remove { padding: 6px 10px; font-size: 13px; }
.botAdd { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.variants { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.variant { text-align: left; display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: #00000033; }
.variant strong { font-family: var(--type); font-weight: 400; font-size: 18px; color: var(--chalk); }
.variant span { font-size: 13px; font-weight: 600; color: var(--chalk-dim); }
.variant[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--brass); background: #d2ab621f; }
.variant[aria-checked="true"] strong { color: var(--brass); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#settingsInfo { margin: 12px 0; }
#start { margin-top: 6px; }

/* ---------- Table ---------- */
#table { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.topbar .info { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--chalk-dim); font-weight: 700; min-width: 0; }
.pill { font-family: var(--type); color: var(--brass); font-size: 18px; letter-spacing: .1em; }
.menu { position: absolute; right: 10px; top: 56px; z-index: 40; display: grid; gap: 4px; padding: 8px; border-radius: 12px; background: #241c16; box-shadow: 0 20px 40px #000c; min-width: 200px; }
.menu button { text-align: left; background: none; box-shadow: none; }
.menu button:hover { background: #ffffff14; }

.room { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; container-type: size; }
/* la table prend toute la place disponible entre la barre du haut et ma place, sans déborder */
.felt { position: relative; width: min(100cqw - 110px, (100cqh - 76px) * 2.05, 1100px); aspect-ratio: 2.05; border-radius: 50% / 50%;
  background: radial-gradient(70% 70% at 50% 45%, #177052, var(--felt) 55%, var(--felt-deep));
  box-shadow: 0 0 0 14px var(--rail), 0 0 0 15px var(--brass-dim), 0 0 0 22px var(--rail-2), 0 30px 70px #000d, inset 0 0 60px #0009; }
/* filet de laiton à l'intérieur du tapis */
.felt::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; border: 1px solid #d2ab6240; pointer-events: none; }
.feltCenter { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 6px; width: 60%; }
.pot { font-family: var(--type); font-size: 20px; color: var(--brass); margin: 0; min-height: 1.2em; text-shadow: 0 2px 6px #0008; }
.street { margin: 0; font-size: 12px; font-weight: 800; color: #ffffff8c; letter-spacing: .06em; min-height: 1.2em; }
.boardCards { display: flex; gap: 6px; min-height: calc(var(--card-w) * 1.4); }
.slot { width: var(--card-w); aspect-ratio: 5 / 7; border-radius: 6px; border: 1px dashed #ffffff2a; }

/* les cartes */
.card { position: relative; width: var(--card-w); aspect-ratio: 5 / 7; border-radius: 6px; background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 0 #00000040, 0 6px 14px #0007; font-weight: 900; user-select: none; flex: none; }
.card .r { position: absolute; left: 5%; top: 1%; font-size: calc(var(--card-w) * .36); line-height: 1.05; letter-spacing: -.04em; }
.card .s1 { position: absolute; left: 7%; top: 33%; font-size: calc(var(--card-w) * .26); line-height: 1; font-weight: 400; }
.card .s { position: absolute; right: 7%; bottom: 2%; font-size: calc(var(--card-w) * .55); line-height: 1; font-weight: 400; }
.card.red { color: var(--red); }
.card.back { background:
    repeating-linear-gradient(45deg, #d2ab6233 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, #d2ab6233 0 2px, transparent 2px 9px),
    linear-gradient(#7c1d24, #57121a);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px #d2ab6299, 0 4px 10px #0007; }
.card.dim { filter: brightness(.55) saturate(.6); }
.card.best { box-shadow: 0 0 0 3px var(--brass), 0 6px 16px #000a; transform: translateY(-4px); }
.card.dealt { animation: deal .32s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes deal { from { opacity: 0; transform: translateY(-18px) rotate(-6deg) scale(.9); } }

/* les places autour de la table */
.seat { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 0; width: 130px; z-index: 2; transition: opacity .2s; }
.seat .hole { display: flex; justify-content: center; margin-bottom: -10px; --card-w: 34px; }
.seat .hole .card + .card { margin-left: -14px; }
.seat.draw .hole { --card-w: 28px; }
.seat.draw .hole .card + .card { margin-left: -18px; }
.seat .hole .card:nth-child(odd) { transform: rotate(-4deg); }
.seat .hole .card:nth-child(even) { transform: rotate(4deg); }
.seat .hole .card.best { transform: translateY(-6px); }
.plate { position: relative; z-index: 1; min-width: 108px; max-width: 140px; padding: 5px 10px 6px; border-radius: 12px; text-align: center;
  background: linear-gradient(#2c221b, #1b1511); box-shadow: 0 0 0 1px #ffffff1f, 0 8px 16px #000a; }
.plate .n { display: block; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .c { display: block; font-family: var(--type); font-size: 15px; color: var(--brass); line-height: 1.1; }
.plate .tag { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -40%); font-size: 10px; font-weight: 900; padding: 1px 7px; border-radius: 99px;
  background: var(--chalk); color: var(--ink); white-space: nowrap; }
.plate .tag.allin { background: var(--red); color: #fff; }
.plate .tag.win { background: var(--brass); color: #241708; }
.seat.turn .plate { box-shadow: 0 0 0 2px var(--brass), 0 0 24px #d2ab6299, 0 8px 16px #000a; }
.seat.folded { opacity: .45; }
.seat.out { opacity: .3; }
.seat.me .plate { background: linear-gradient(#3a2c20, #241b14); }
.timer { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 3px; border-radius: 3px; background: #ffffff1a; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--brass); transform-origin: left; }
.handName { margin-top: 10px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 900; color: var(--chalk); background: #000000a0; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.dealer { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 900;
  display: grid; place-items: center; transform: translate(-50%, -50%); box-shadow: 0 2px 4px #0008; z-index: 3; }
.bet { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 5px; font-family: var(--type); font-size: 14px; color: var(--chalk);
  text-shadow: 0 1px 3px #000; z-index: 3; white-space: nowrap; }
.chips { position: relative; width: 18px; height: 18px; }
.chips i { position: absolute; left: 0; width: 18px; height: 18px; border-radius: 50%; border: 3px dashed #fff; box-shadow: 0 1px 2px #0009; }
.chips i:nth-child(1) { top: 0; background: var(--red); }
.chips i:nth-child(2) { top: -4px; background: #1f5fa8; }
.chips i:nth-child(3) { top: -8px; background: #222; }

.banner { position: absolute; left: 50%; top: 73%; transform: translate(-50%, -50%); z-index: 5; text-align: center; padding: 8px 16px; border-radius: 12px;
  background: #0d0a08e6; box-shadow: 0 0 0 1px var(--brass-dim), 0 12px 30px #000c; font-weight: 800; font-size: 14px; max-width: 80%;
  animation: pop .3s ease-out both; }
.banner b { color: var(--brass); font-weight: 900; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -40%); } }

/* ma place, en bas */
.me { flex: none; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(#2a1d14, #180f0a); box-shadow: 0 -1px 0 var(--brass-dim), 0 -12px 30px #0008;
  display: grid; gap: 8px; justify-items: center; }
.meTop { display: flex; align-items: center; gap: 16px; width: min(720px, 100%); justify-content: center; }
.myCards { display: flex; gap: 8px; --card-w: 66px; }
.myCards .card { cursor: default; transition: transform .15s; }
.myCards.drawing .card { cursor: pointer; }
.myCards .card.pick { transform: translateY(-14px); filter: brightness(.8); }
.myCards .card.pick::after { content: "changer"; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-size: 10px; font-weight: 900;
  background: var(--red); color: #fff; padding: 1px 6px; border-radius: 99px; }
.meInfo { min-width: 0; }
.meInfo p { margin: 0; }
.myName { font-weight: 800; }
.myStack { font-family: var(--type); color: var(--brass); font-size: 22px; line-height: 1.1; }
.myHand { font-size: 14px; color: var(--chalk-dim); font-weight: 800; }
.status { margin: 0; min-height: 1.4em; text-align: center; font-weight: 800; color: var(--chalk-dim); }
.status.mine { color: var(--brass); }
.actions { width: min(620px, 100%); display: grid; gap: 8px; }
.actions .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act { padding: 14px 8px; font-size: 16px; border-radius: 12px; }
.act.fold { background: #5c1a1f; box-shadow: inset 0 0 0 1px #ff8a8a33; }
.act.call { background: #1f4f3c; box-shadow: inset 0 0 0 1px #8affc833; }
.act.raise { background: linear-gradient(#e2bd72, #b98f45); color: #241708; box-shadow: 0 2px 0 #6f5326; }
.raiseBox { display: grid; gap: 8px; padding: 10px; border-radius: 12px; background: #00000055; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick button { padding: 8px 4px; font-size: 14px; }
.slideRow { display: grid; grid-template-columns: auto 1fr auto 96px; gap: 8px; align-items: center; }
.slideRow button { width: 40px; padding: 8px 0; }
#raiseRange { width: 100%; accent-color: var(--brass); }
#raiseNum { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #ffffff30; background: #00000055; font-family: var(--type); font-size: 16px; text-align: center; color: var(--brass); }
#rebuyBtn { width: min(420px, 100%); }

/* journal */
.logPanel { position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 90vw); z-index: 45; background: #1d1611f2; box-shadow: -20px 0 40px #000a;
  display: flex; flex-direction: column; }
.logPanel header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
.logPanel h2 { margin: 0; }
.logPanel ol { list-style: none; margin: 0; padding: 0 14px 20px; overflow-y: auto; font-size: 14px; font-weight: 600; color: var(--chalk-dim); }
.logPanel li { padding: 4px 0; border-bottom: 1px solid #ffffff10; }
.logPanel li:last-child { color: var(--chalk); }

/* fenêtres */
.overlay { position: fixed; inset: 0; z-index: 60; background: #000000b3; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.sheet { position: relative; width: min(460px, 100%); padding: 22px 20px; border-radius: 18px; background: linear-gradient(#123f31, #0b2c22);
  box-shadow: 0 0 0 5px var(--rail), 0 0 0 6px var(--brass-dim), 0 30px 60px #000; }
.sheet.long { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.sheet h2 { margin-top: 0; }
.sheet .close { position: absolute; right: 10px; top: 10px; }
.sheet ul, .sheet p { font-weight: 600; }
.hands { padding-left: 22px; display: grid; gap: 4px; }
.hands span { display: block; font-size: 13px; color: var(--chalk-dim); letter-spacing: .04em; }
.ranking { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; counter-reset: r; }
.ranking li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #00000040; font-weight: 800; }
.ranking li.first { box-shadow: inset 0 0 0 2px var(--brass); }
.ranking .amt { font-family: var(--type); color: var(--brass); font-weight: 400; }
.ranking .neg { color: #ff9a9a; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#finalTitle { font-size: 30px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; padding: 10px 16px; border-radius: 10px; background: #3a1216; color: #fff;
  font-weight: 800; box-shadow: 0 10px 30px #000c; max-width: calc(100% - 24px); }

/* ---------- Téléphone ---------- */
@media (max-width: 700px) {
  :root { --card-w: 33px; }
  .felt { width: min(100cqw - 40px, (100cqh - 46px) * .78); aspect-ratio: .78; border-radius: 46% / 40%;
    box-shadow: 0 0 0 9px var(--rail), 0 0 0 10px var(--brass-dim), 0 0 0 14px var(--rail-2), 0 20px 50px #000d, inset 0 0 40px #0009; }
  .feltCenter { width: 84%; top: 40%; }
  .topbar .info { font-size: 12px; }
  .longOnly { display: none; }
  .boardCards { gap: 4px; }
  .seat { width: 92px; }
  .plate { min-width: 80px; max-width: 98px; padding: 3px 6px 4px; border-radius: 10px; }
  .plate .n { font-size: 11px; }
  .plate .c { font-size: 13px; }
  .seat .hole { --card-w: 26px; margin-bottom: -8px; }
  .seat.draw .hole { --card-w: 20px; }
  .seat .hole .card + .card { margin-left: -11px; }
  .seat.draw .hole .card + .card { margin-left: -13px; }
  .bet { font-size: 12px; }
  .chips, .chips i { width: 14px; height: 14px; }
  .banner { font-size: 12px; max-width: 92%; top: 70%; }
  .myCards { --card-w: 54px; gap: 6px; }
  .myCards.five { --card-w: 50px; gap: 4px; }
  .meTop { gap: 10px; }
  .myStack { font-size: 18px; }
  .act { padding: 12px 4px; font-size: 15px; }
  .slideRow { grid-template-columns: auto 1fr auto 76px; }
  .grid2, .variants { grid-template-columns: 1fr; }
  .board { padding: 16px 14px; }
  .code { font-size: 32px; }
}
@media (max-width: 380px) {
  .myCards.five { --card-w: 44px; }
  .meTop { flex-direction: column; gap: 4px; }
  .meInfo { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* montants en Nunito (le zéro de Limelight se lit mal) */
.plate .c, .myStack, .pot, .bet, #raiseNum, .ranking .amt { font-family: "Nunito", system-ui, sans-serif; font-weight: 900; font-variant-numeric: tabular-nums; }
.pot { font-size: 19px; }
.myStack { font-size: 21px; }
