:root {
  --felt: #0f4a30;
  --felt-dark: #0a3321;
  --ink: #f4f1e6;
  --muted: #a9c3b3;
  --gold: #e3b341;
  --red: #c62828;
  --black: #15171a;
  --card: #fdfbf4;
  --trump: #4a2c85;
  --danger: #ff8a80;
  --cw: 52px;
  --ch: 76px;
  --radius: 7px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --felt: #1b6b45; --felt-dark: #12513a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--felt-dark); color: var(--ink);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app { min-height: 100%; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- écrans de menu ---------- */
.screen { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 28px; max-width: 560px; width: 100%; margin: 0 auto; }
h1 { margin: 8px 0 0; font-size: 28px; letter-spacing: .5px; }
h2 { margin: 0 0 6px; font-size: 19px; }
.sub { color: var(--muted); margin: 0; }
.panel { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.btn { background: var(--gold); color: #231a00; border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; min-height: 46px; }
.btn.alt { background: rgba(255,255,255,.12); color: var(--ink); font-weight: 600; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.danger { background: #7b2d2d; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.gamepick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gamepick button { background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.18); border-radius: 14px; padding: 18px 8px; text-align: center; }
.gamepick button[aria-pressed="true"] { border-color: var(--gold); background: rgba(227,179,65,.16); }
.gamepick .big { font-size: 34px; display: block; letter-spacing: 4px; }
.gamepick .t { display: block; font-weight: 800; font-size: 19px; }
.gamepick .d { display: block; color: var(--muted); font-size: 13px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="text"] { width: 100%; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.25); color: var(--ink);
  border-radius: 10px; padding: 11px 12px; font: inherit; }
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 9px 14px; min-width: 44px; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--gold); color: #231a00; font-weight: 700; }
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seats li { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px 10px; min-height: 48px; }
.seats .dot { width: 10px; height: 10px; border-radius: 50%; background: #7a8; flex: none; }
.seats .dot.off { background: #888; }
.seats .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seats .tag { color: var(--muted); font-size: 13px; }
.invite { word-break: break-all; font-size: 13px; background: rgba(0,0,0,.3); border-radius: 8px; padding: 8px; user-select: all; }
.note { color: var(--muted); font-size: 14px; }
.warn { color: var(--danger); }
.banner { background: #6b4e00; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.net { font-size: 13px; color: var(--muted); }
.appicon { border-radius: 12px; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.install { border-color: rgba(227,179,65,.55); background: rgba(227,179,65,.08); }
.install h2 { margin-bottom: 2px; }
.install p { margin: 0; }

/* ---------- table (paysage) ---------- */
.game-wrap { position: fixed; inset: 0; background: #0c4f1c; }
.game { position: absolute; inset: 0; overflow: hidden; }
.felt { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 38%, #228f3a 0%, #167029 58%, #0c4f1c 100%); }
.felt::before { content: ""; position: absolute; inset: 12px; border-radius: 26px; border: 2px solid rgba(0,40,10,.25); pointer-events: none; }
.felt::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 3px); pointer-events: none; }
.topbar { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 10px; padding: 10px 14px; align-items: center; z-index: 5; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.menubtn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(0,60,14,.55); display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; }
.menubtn i { width: 22px; height: 3px; background: #fff; border-radius: 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
.chipbar { background: rgba(0,60,14,.55); color: #fff; border-radius: 12px; padding: 4px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chipbar b { color: #ffd24a; font-size: 17px; }
.chipbar.redsuit { color: #ffb4b4; }

.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #0b3a14; font-weight: 800; font-size: 17px; max-width: 28%; text-align: center; }
.seat .tri { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 11px solid rgba(8,50,16,.7); }
.seat .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.seat.me { color: #fff; }
.seat.act .tri { border-top-color: #ffd24a; animation: bob 1.1s ease-in-out infinite; }
.seat.act .nm { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.seat.off { opacity: .55; }
.seat .meta { font-size: 12px; color: #e9f6e9; background: rgba(0,60,14,.55); border-radius: 10px; padding: 1px 8px; }
.seat .cnt { font-size: 12px; color: #d7efd7; }
.dchip { width: 26px; height: 26px; border-radius: 50%; background: #d62b2b; border: 2px dashed #fff; box-sizing: border-box; color: #fff; font-size: 13px; line-height: 22px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.bub { position: relative; margin-top: 6px; background: rgba(0,60,14,.8); color: #fff; border-radius: 12px; padding: 3px 14px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.bub::before { content: ""; position: absolute; left: 50%; top: -7px; margin-left: -7px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 8px solid rgba(0,60,14,.8); }
.pos-t { top: 54px; left: 50%; transform: translateX(-50%); }
.pos-l { left: 3%; top: 28%; }
.pos-r { right: 3%; top: 28%; }
.pos-tl { left: 20%; top: 54px; }
.pos-tr { right: 20%; top: 54px; }
.pos-b { left: 12px; top: 50%; z-index: 25; }
.n3 .pos-l { left: 12%; top: 54px; }
.n3 .pos-r { right: 12%; top: 54px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

.center { position: absolute; left: 26%; right: 26%; top: 24%; bottom: 44%; display: flex; align-items: center; justify-content: center; }
.upcard, .chien { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.trick { position: relative; width: 100%; height: 100%; }
.trick .tc { position: absolute; }
.tc.pos-t { top: 0; left: 50%; transform: translateX(-50%); }
.tc.pos-b { bottom: 0; left: 50%; transform: translateX(-50%); }
.tc.pos-l { left: 6%; top: 50%; transform: translateY(-50%) rotate(-8deg); }
.tc.pos-r { right: 6%; top: 50%; transform: translateY(-50%) rotate(6deg); }
.tc.pos-tl { left: 14%; top: 0; }
.tc.pos-tr { right: 14%; top: 0; }
.n3 .tc.pos-l { left: 6%; top: 0; transform: rotate(-8deg); }
.n3 .tc.pos-r { right: 6%; top: 0; transform: rotate(6deg); }
.tc.win .cw { filter: drop-shadow(0 0 8px #ffd24a); }

.acts { position: absolute; left: 0; right: 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; z-index: 30; pointer-events: none; }
.acts > * { pointer-events: auto; }
.pill { min-width: 120px; height: 48px; border: 0; border-radius: 24px; padding: 0 22px; background: #ffd24a; color: #2b2000; font-weight: 800; font-size: 18px; box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.pill.alt { background: rgba(0,60,14,.85); color: #fff; }
.pill:disabled { opacity: .5; cursor: not-allowed; }

.handbox { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; }
.handbox .hc { position: absolute; transition: top .15s ease, filter .15s ease; filter: drop-shadow(0 4px 5px rgba(0,0,0,.4)); }
.hc.playable, .hc.selected { filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.hc.dimmed { filter: brightness(.78) drop-shadow(0 4px 5px rgba(0,0,0,.35)); }
.hc.pick { filter: drop-shadow(0 0 4px rgba(255,210,74,.9)); }

.rotate { display: none; position: absolute; inset: 0; z-index: 60; background: rgba(0,30,10,.93); flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 20px; font-size: 18px; }
@media (orientation: portrait) { .rotate { display: flex; } }
.rot-icon { width: 56px; height: 92px; border: 4px solid #fff; border-radius: 10px; }
@media (prefers-reduced-motion: no-preference) { .rot-icon { animation: rot 2.4s ease-in-out infinite; } .seat.act .tri { animation: bob 1.1s ease-in-out infinite; } }
@media (prefers-reduced-motion: reduce) { .seat.act .tri { animation: none; } .hc { transition: none; } }
@keyframes rot { 0%, 25% { transform: rotate(0); } 65%, 100% { transform: rotate(90deg); } }

/* ---------- cartes dessinées ---------- */
.cw { position: relative; display: inline-block; padding: 0; border: 0; background: none; flex: none; font: inherit; color: inherit; }
button.cw { cursor: pointer; }
button.cw:disabled { cursor: default; }
.cf { position: absolute; left: 0; top: 0; width: 120px; height: 176px; transform-origin: 0 0; border-radius: 10px; overflow: hidden; box-sizing: border-box; background: #fffefa; border: 1px solid #cfc9b8; }
.cf.trump { background: #efe8fb; border-color: #b9a6dd; }
.cf.excuse { background: #fff4d6; border-color: #d1a640; }
.cf.back { background: #fdfbf4; }
.pp { position: absolute; line-height: 1; white-space: nowrap; font-family: "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", serif; }
.ix-box { position: absolute; inset: 0; }
.ix { position: absolute; width: 24px; text-align: center; line-height: 1; font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; font-weight: 700; }
.ix-box .ix { left: 6px; top: 7px; }
.panel { position: absolute; left: 24px; top: 30px; width: 72px; height: 116px; box-sizing: border-box; border: 1.5px solid rgba(0,0,0,.5); background: #f6ecd2; overflow: hidden; }
.sh { position: absolute; inset: 0; }
.mid-line { position: absolute; left: 0; right: 0; top: 57px; height: 1.5px; background: rgba(0,0,0,.4); }
.bk { position: absolute; inset: 6px; border-radius: 6px; background: repeating-linear-gradient(45deg, #233f8f 0 6px, #1a3175 6px 12px); box-shadow: 0 0 0 2px #fff inset, 0 0 0 4px #233f8f inset; }
.bk2 { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fdfbf4; box-shadow: 0 0 0 3px #233f8f; }
.tf1 { position: absolute; inset: 8px; border-radius: 7px; border: 2px solid #4a2c85; background: linear-gradient(160deg, #f7f2ff, #e4d9f7); }
.tf2 { position: absolute; inset: 14px; border-radius: 5px; border: 1px solid rgba(74,44,133,.45); }
.tnum { position: absolute; left: 0; right: 0; top: 66px; text-align: center; font: 800 64px/1 Georgia, "Times New Roman", serif; color: #4a2c85; }
.tstar { position: absolute; left: 0; right: 0; text-align: center; font-size: 12px; color: #4a2c85; letter-spacing: 6px; }
.ef1 { position: absolute; inset: 8px; border-radius: 7px; border: 2px solid #a8730a; background: linear-gradient(160deg, #fff8e0, #f4dc96); }
.estar { position: absolute; left: 24px; top: 48px; width: 72px; height: 80px; background: #d9a62e; clip-path: polygon(50% 0%, 60% 38%, 100% 50%, 60% 62%, 50% 100%, 40% 62%, 0% 50%, 40% 38%); }

/* ---------- fenêtres ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #17382a; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 16px; max-width: 460px; width: 100%; max-height: 90dvh; overflow: auto; }
.modal table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.modal td, .modal th { padding: 4px 6px; text-align: left; }
.modal td.num, .modal th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: #8fe3a8; }
.neg { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: #111; color: #fff; padding: 8px 14px; border-radius: 20px; z-index: 20; max-width: 90%; }
@media (prefers-reduced-motion: no-preference) { .card { transition: transform .12s ease; } }
