/* DUEL — habillage façon salle de poker mobile : fond anthracite, ovale de
   feutre, grandes cartes héros, barre d'action à trois gros boutons colorés
   (rouge / vert / orange), panneau de relance avec curseur et préréglages. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0e0e12;
  --panel: #17171d;
  --line: #26262e;
  --ink: #f2f3f5;
  --dim: #9aa0ab;
  --or: #ffb02e;          /* jetons */
  --rouge: #d92b2b;       /* se coucher */
  --vert: #1f9d55;        /* parole / suivre */
  --orange: #f07800;      /* miser / relancer */
  --feutre1: #1d5c33;
  --feutre2: #0c2a17;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
  min-height: 100dvh;
  user-select: none;
  overflow-x: hidden;
}

/* ── Bandeau haut ── */
.topbar {
  padding: calc(7px + env(safe-area-inset-top)) 12px 7px;
  text-align: center;
  background: #101014;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 6;
}
.score-line { font-size: 16px; font-weight: 800; letter-spacing: .4px; }
.score-line .lead { color: var(--or); }
.score-line small { color: var(--dim); font-weight: 500; }
.level-line { font-size: 12px; color: var(--dim); margin-top: 2px; font-weight: 600; }
.level-line .sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: #3a3a44; margin: 2px 8px; }
#level-timer.chaud { color: var(--or); }

/* ── Scène ── */
.scene {
  flex: 1;
  display: flex; flex-direction: column;
  max-width: 520px; width: 100%; margin: 0 auto;
  padding: 10px 10px 0;
}

/* L'ovale de feutre */
.felt {
  position: relative;
  flex: 1;
  min-height: 340px;
  border-radius: 46% 46% 42% 42% / 26% 26% 30% 30%;
  background: radial-gradient(ellipse at 50% 32%, var(--feutre1) 0%, var(--feutre2) 78%);
  border: 10px solid #23232b;
  box-shadow: inset 0 0 46px #000a, 0 6px 24px #0009;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 12px 10px 30px;
}

/* ── Adversaire ── */
.opp { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #101014; border: 2px solid #3a3a44;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  transition: border-color .25s, box-shadow .25s;
}
.avatar.is-turn { border-color: var(--or); box-shadow: 0 0 16px #ffb02e66; }
.cap {
  background: #101014e6; border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 14px;
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13px;
}
.cap.winner { border-color: var(--vert); box-shadow: 0 0 14px #1f9d5566; }
.cap-name { font-weight: 800; }
.cap-stack { color: var(--or); font-weight: 700; }
.cap.folded { opacity: .5; }

/* ── Cartes ── */
.cards { display: flex; justify-content: center; }
.card, .card-slot {
  width: 44px; height: 62px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; line-height: 1;
}
.card {
  background: linear-gradient(160deg, #ffffff, #e9e7df);
  color: #16161a; font-weight: 900; font-size: 19px;
  box-shadow: 0 2px 6px #000a;
}
.card .r { font-size: 20px; }
.card .s { font-size: 15px; margin-top: 1px; }
.card.rouge { color: #cf1f1f; }
.card.back {
  background:
    radial-gradient(circle at 50% 50%, #24406e 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, #1c3054, #1c3054 5px, #16263f 5px, #16263f 10px);
  border: 2px solid #e6e6ee;
}
.card.dealt { animation: pose .3s ease-out; }
@keyframes pose { from { transform: translateY(-16px) scale(.82); opacity: 0; } }
.card-slot { border: 1.5px dashed #ffffff2b; }

.opp-cards { gap: 5px; margin-top: 2px; }
.opp-cards .card, .opp-cards .card-slot { width: 38px; height: 54px; }
.opp-cards .card .r { font-size: 16px; } .opp-cards .card .s { font-size: 12px; }

.board { gap: 6px; margin: 8px 0 2px; }

/* ── Centre ── */
.middle { display: flex; flex-direction: column; align-items: center; margin-top: 10px; }
.pot-pill {
  background: #0b0b0ecc; border: 1px solid #ffffff1f;
  color: var(--or); font-weight: 900; font-size: 14px; letter-spacing: .5px;
  border-radius: 999px; padding: 4px 16px;
}
.phase { color: #8fd0a6; font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; margin-top: 6px; min-height: 14px; }

.bet { min-height: 22px; color: var(--or); font-weight: 800; font-size: 14px;
  display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.bet .chip { width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd97a, #a8720a);
  border: 2px dashed #fff8; }
.me-bet { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); }

/* ── Héros ── */
.hero {
  display: flex; flex-direction: column; align-items: center;
  margin-top: -26px; z-index: 2; gap: 6px;
  padding-bottom: 4px;
}
.hero-cards { gap: 0; }
.hero-cards .card, .hero-cards .card-slot {
  width: 74px; height: 104px; border-radius: 9px;
  box-shadow: 0 6px 14px #000c;
}
.hero-cards .card .r { font-size: 34px; }
.hero-cards .card .s { font-size: 24px; }
.hero-cards .card:first-child { transform: rotate(-5deg) translateX(6px); }
.hero-cards .card:last-child { transform: rotate(5deg) translateX(-6px); }
.hero-cap { font-size: 14px; padding: 4px 18px; }
.hero-cap .cap-name { color: #fff; }
.avatar.mini { width: 0; }

/* ── Journal ── */
.log-line {
  color: #6d7480; font-size: 12px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 8px 6px; cursor: pointer; min-height: 20px;
}
.log-full {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  font-size: 12.5px; color: var(--dim); padding: 8px 12px; margin: 0 4px 6px;
  max-height: 150px; overflow-y: auto;
}
.log-full div { padding: 1px 0; }
.hidden { display: none !important; }

/* ── Barre d'action ── */
.actionbar {
  position: sticky; bottom: 0; z-index: 6;
  background: #101014f5; border-top: 1px solid var(--line);
  padding: 5px 10px calc(10px + env(safe-area-inset-bottom));
}
.timer { height: 3px; background: #22222a; border-radius: 2px; margin-bottom: 7px; overflow: hidden; }
#turn-timer-fill { height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--vert), var(--or), var(--rouge));
  transition: width .25s linear; }

.controls-inner { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.abtn {
  flex: 1; min-height: 58px;
  border: none; border-radius: 10px;
  font: 900 15px/1.15 system-ui, sans-serif; letter-spacing: .4px;
  color: #fff; cursor: pointer; touch-action: manipulation;
  text-transform: uppercase;
  box-shadow: 0 3px 0 #0006;
}
.abtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0006; }
.abtn:disabled { opacity: .32; }
.abtn small { display: block; font-size: 12px; font-weight: 700; opacity: .9; }
.abtn.fold  { background: linear-gradient(180deg, #e33d3d, #b31f1f); }
.abtn.check { background: linear-gradient(180deg, #27b465, #157a41); }
.abtn.raise { background: linear-gradient(180deg, #ff8c1a, #d06400); }
.abtn.confirm { min-height: 54px; }
.msg { color: var(--dim); text-align: center; font-size: 13.5px; padding: 12px 0; flex: 1; }
.mini-btn { background: none; border: none; color: #565e6a; font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 6px; }

/* ── Panneau de relance ── */
.raise-panel {
  position: sticky; bottom: 0; z-index: 7;
  background: #15151b; border-top: 1px solid var(--line);
  padding: 10px 14px 8px;
  display: flex; flex-direction: column; gap: 9px;
  max-width: 520px; width: 100%; margin: 0 auto;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 24px #000a;
}
.raise-head { display: flex; align-items: center; justify-content: space-between; }
.raise-amount { font-size: 24px; font-weight: 900; color: var(--or); }
.raise-close { background: #22222a; border: none; color: var(--dim);
  width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--orange); height: 36px; touch-action: pan-x; }
.preset-row { display: flex; gap: 7px; }
.preset-btn {
  flex: 1; min-height: 40px;
  background: #22222a; color: var(--ink);
  border: 1px solid #32323c; border-radius: 9px;
  font: 800 12.5px system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
.preset-btn:active { background: #2c2c36; }

/* ── Voiles ── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: #0a0a0ee8; backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
}
.overlay-card {
  background: var(--panel); border: 1px solid #2c2c36; border-radius: 18px;
  padding: 28px 22px; max-width: 380px; width: 100%;
  text-align: center; display: flex; flex-direction: column; gap: 14px;
}
.lobby-logo { font-size: 44px; }
.overlay-card h1 { font-size: 24px; letter-spacing: 3px; }
.lobby-sub { color: var(--dim); font-size: 13.5px; line-height: 1.5; }
.name-input {
  background: #0e0e12; color: var(--ink);
  border: 1px solid #32323c; border-radius: 10px;
  padding: 13px 14px; font-size: 16px; text-align: center; font-weight: 700;
}
.big-btn {
  min-height: 56px; border: none; border-radius: 11px;
  background: linear-gradient(180deg, #27b465, #157a41); color: #fff;
  font: 900 17px system-ui, sans-serif; letter-spacing: 2px;
  cursor: pointer; touch-action: manipulation;
  box-shadow: 0 3px 0 #0006;
}
.big-btn:active { transform: translateY(2px); }
.sit-error { color: #ff6b6b; font-size: 13px; min-height: 16px; }
.conn-note { color: #565e6a; font-size: 11.5px; }

@media (min-width: 700px) {
  .felt { min-height: 420px; }
}

/* « réfléchit… » — les gros pots font compter le bot plus longtemps (jusqu'à
   ~24 000 simulations) : le silence doit se VOIR, sinon il ressemble à un bug. */
.pense { color: var(--or); font-size: 13px; font-weight: 700; }
.pense .pts i { font-style: normal; animation: pt 1.2s infinite; }
.pense .pts i:nth-child(2) { animation-delay: .2s; }
.pense .pts i:nth-child(3) { animation-delay: .4s; }
@keyframes pt { 0%, 60%, 100% { opacity: .15; } 30% { opacity: 1; } }
