/* Grand format, fort contraste, gros boutons : pensé pour être confortable à tout âge. */
:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #5a5853;
  --line: #ddd7cb;
  --accent: #1f5fae;
  --accent-text: #ffffff;
  --felt: #1e6b45;
  --felt-dark: #17573a;
  --card: #ffffff;
  --red: #c4161c;
  --black: #1b1b1b;
  --good: #1d7a3e;
  --bad: #c4161c;
  --radius: 10px;
  --base: 19px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171816; --surface: #22231f; --text: #f1eee6; --muted: #b9b4a8; --line: #3a3b35;
    --accent: #5b9be6; --accent-text: #0e1a2a; --felt: #1a4d34; --felt-dark: #143d29;
  }
}
:root[data-theme="dark"] {
  --bg: #171816; --surface: #22231f; --text: #f1eee6; --muted: #b9b4a8; --line: #3a3b35;
  --accent: #5b9be6; --accent-text: #0e1a2a; --felt: #1a4d34; --felt-dark: #143d29;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--base)/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; }

.site-header {
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.site-header .in { max-width: 1180px; margin: 0 auto; padding: 10px 16px 6px; display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.3rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--accent); }
.site-nav { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; width: 100%; min-width: 0; scrollbar-width: thin; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding-bottom: 2px; }
.site-nav a { text-decoration: none; color: var(--text); padding: 6px 10px; border-radius: 8px; font-size: 0.95rem; white-space: nowrap; flex: none; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--bg); }

main { max-width: 1180px; margin: 0 auto; padding: 12px 16px 40px; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 10px 0 4px; }
.lead { color: var(--muted); margin: 0 0 12px; }

/* Barre d'outils */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.btn {
  font: inherit; font-size: 1rem; font-weight: 600; min-height: 48px; padding: 8px 16px;
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.done { border-color: var(--good); color: var(--good); }
.btn .ico { font-size: 1.15em; line-height: 1; }
.tb-select { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1rem; }
.tb-select select {
  font: inherit; font-size: 1rem; min-height: 48px; padding: 6px 10px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
}
.game-status { color: var(--muted); font-size: 1rem; min-height: 1.6em; margin: 2px 0 6px; }

/* Table de cartes */
.card-board {
  position: relative; background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--felt-dark));
  border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; min-height: 300px;
  overflow: hidden;
}
.slot {
  position: absolute; border: 2px dashed rgba(255,255,255,.35); border-radius: calc(var(--cw) * 0.08);
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.4);
  font-weight: 700; font-size: calc(var(--cw) * 0.4);
}
.slot-stock { border-style: solid; cursor: pointer; }
.slot-recycle::after { content: "↻"; color: rgba(255,255,255,.7); font-size: calc(var(--cw) * 0.6); }
.card {
  position: absolute; border-radius: calc(var(--cw) * 0.08); transition: left .18s ease, top .18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.35); cursor: pointer;
}
.card.up { background: var(--card); border: 1px solid #b9b4a8; }
.card.down {
  border: 1px solid #0d2c57;
  background: repeating-linear-gradient(45deg, #2a5ea8 0 6px, #2f68b8 6px 12px);
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.05) #f5f1e6, 0 1px 2px rgba(0,0,0,.35);
}
.card.red { color: var(--red); }
.card.black { color: var(--black); }
.c-rank { position: absolute; left: 6%; top: 1%; font-weight: 800; font-size: calc(var(--cw) * 0.36); line-height: 1; letter-spacing: -0.04em; }
.c-suit { position: absolute; right: 7%; top: 2%; font-size: calc(var(--cw) * 0.3); line-height: 1; }
.c-big { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: calc(var(--cw) * 0.62); line-height: 1; }
.card.dragging { transition: none; box-shadow: 0 8px 18px rgba(0,0,0,.45); }
.card.flash, .slot.flash { animation: flash 0.5s ease 3; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px #ffd54a, 0 0 18px #ffd54a; } }
.card.shake { animation: shake .3s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Fenêtres */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 5000; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border-radius: 16px; padding: 24px; max-width: 460px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.modal h2 { margin: 0 0 8px; font-size: 1.5rem; }
.modal-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .25s;
  background: #222; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 6000; font-size: 1rem; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Contenu éditorial */
.content { max-width: 760px; margin-top: 28px; }
.content h2 { font-size: 1.35rem; margin: 28px 0 8px; }
.content h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.content li { margin: 4px 0; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.game-tile {
  display: block; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 16px;
  text-decoration: none; color: var(--text);
}
.game-tile:hover { border-color: var(--accent); }
.game-tile .t-ico { font-size: 2.2rem; line-height: 1; }
.game-tile strong { display: block; font-size: 1.15rem; margin: 8px 0 2px; }
.game-tile span { color: var(--muted); font-size: .95rem; }
.ad-slot { margin: 18px 0; min-height: 0; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.site-footer .in { max-width: 1180px; margin: 0 auto; padding: 18px 16px; display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* Sudoku */
.sudoku-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.sudoku { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 560px); aspect-ratio: 1; border: 3px solid var(--text); background: var(--surface); user-select: none; touch-action: manipulation; }
.sudoku .cell {
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 5.4vw, 34px); font-weight: 600; cursor: pointer; position: relative; color: var(--accent);
}
.sudoku .cell.given { color: var(--text); font-weight: 800; }
.sudoku .cell.c3 { border-right: 2px solid var(--text); }
.sudoku .cell.r3 { border-bottom: 2px solid var(--text); }
.sudoku .cell.peer { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.sudoku .cell.same { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.sudoku .cell.sel { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.sudoku .cell.err { color: var(--bad); }
.sudoku .notes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; font-size: clamp(9px, 1.8vw, 13px); color: var(--muted); font-weight: 500; }
.sudoku .notes span { display: flex; align-items: center; justify-content: center; }
.numpad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.numpad .btn { justify-content: center; font-size: 1.5rem; min-height: 60px; padding: 0; }
.numpad .btn.wide { grid-column: span 3; font-size: 1rem; }
.numpad .btn.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.numpad .btn .left { font-size: .7rem; color: var(--muted); margin-left: 2px; }
@media (max-width: 640px) { .numpad { grid-template-columns: repeat(5, 1fr); width: 100%; } .numpad .btn.wide { grid-column: span 5; } }

/* Mots mêlés */
.ws-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.ws-grid { display: grid; width: min(100%, 600px); aspect-ratio: 1; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 6px; touch-action: none; user-select: none; position: relative; }
.ws-grid .l { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: clamp(14px, 4vw, 28px); border-radius: 50%; cursor: pointer; text-transform: uppercase; position: relative; z-index: 1; }
.ws-grid .l.sel { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.ws-grid .l.start { outline: 3px solid var(--accent); }
.ws-grid svg { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); pointer-events: none; z-index: 0; }
.ws-words { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; font-size: 1.1rem; min-width: 260px; }
.ws-words li { padding: 3px 0; text-transform: uppercase; letter-spacing: .03em; }
.ws-words li.found { text-decoration: line-through; color: var(--muted); }

/* 2048 */
.g2048 {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 10px; width: min(100%, 480px); aspect-ratio: 1;
  background: #bbada0; padding: 10px; border-radius: 12px; touch-action: none; user-select: none;
}
.g2048 .tile {
  border-radius: 8px; background: rgba(238, 228, 218, .35); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: clamp(22px, 8vw, 44px); color: #776e65;
}
.g2048 .v2 { background: #eee4da; } .g2048 .v4 { background: #ede0c8; }
.g2048 .v8 { background: #f2b179; color: #fff; } .g2048 .v16 { background: #f59563; color: #fff; }
.g2048 .v32 { background: #f67c5f; color: #fff; } .g2048 .v64 { background: #f65e3b; color: #fff; }
.g2048 .v128, .g2048 .v256, .g2048 .v512 { background: #edcf72; color: #fff; font-size: clamp(20px, 7vw, 38px); }
.g2048 .v1024, .g2048 .v2048, .g2048 .v4096 { background: #edc22e; color: #fff; font-size: clamp(16px, 5.6vw, 32px); }
.g2048 .new { animation: appear .18s ease; } .g2048 .pop { animation: pop .18s ease; }
@keyframes appear { from { transform: scale(.4); opacity: 0; } }
@keyframes pop { 50% { transform: scale(1.12); } }

/* Démineur */
.mines { display: grid; gap: 2px; width: min(100%, calc(var(--cols) * 46px)); background: var(--line); padding: 2px; border-radius: 8px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mines .m {
  aspect-ratio: 1; border: 0; border-radius: 3px; background: #9fb3c8; font: inherit; font-weight: 800;
  font-size: clamp(13px, 3.6vw, 22px); padding: 0; cursor: pointer; color: var(--text);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.15), inset 2px 2px 0 rgba(255,255,255,.4);
}
.mines .m.open { background: var(--surface); box-shadow: none; cursor: default; }
.mines .m.flagged { color: var(--bad); }
.mines .m.mine { color: #111; } .mines .m.boom { background: var(--bad); color: #fff; }
.mines .n1 { color: #1f5fae; } .mines .n2 { color: #1d7a3e; } .mines .n3 { color: #c4161c; } .mines .n4 { color: #3a1f8f; }
.mines .n5 { color: #8a1c1c; } .mines .n6 { color: #0f7a7a; } .mines .n7 { color: #111; } .mines .n8 { color: #666; }

/* Mahjong */
.mj-board { position: relative; background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--felt-dark)); border-radius: 14px; user-select: none; -webkit-user-select: none; }
.mj {
  position: absolute; background: linear-gradient(160deg, #fffdf6, #efe7d3); border: 1px solid #a89f88; border-radius: calc(var(--tw) * 0.12);
  box-shadow: 3px 3px 0 #c9bfa5, 4px 4px 0 #8f866e, 5px 6px 6px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; line-height: 1;
}
.mj b { font-size: calc(var(--tw) * 0.56); font-weight: 800; font-style: normal; }
.mj i { font-size: calc(var(--tw) * 0.24); font-style: normal; margin-top: 2px; }
.mj.t-c { color: #1f5fae; } .mj.t-b { color: #1d7a3e; } .mj.t-k { color: #b3121a; }
.mj.t-w { color: #222; } .mj.t-d { color: #b3121a; } .mj.t-f { color: #a0428a; } .mj.t-s { color: #b06a00; }
.mj.blocked { filter: brightness(.72) saturate(.7); cursor: default; }
.mj.sel { background: linear-gradient(160deg, #fff3b0, #ffe066); outline: 3px solid #e0a800; }

/* Reversi */
.rv-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: min(100%, 560px); background: #0b3d22; padding: 4px; border-radius: 10px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.rv-cell { aspect-ratio: 1; border: 0; padding: 0; border-radius: 3px; background: var(--felt, #1f7a45); cursor: default; display: flex; align-items: center; justify-content: center; position: relative; font: inherit; }
.rv-cell.legal { cursor: pointer; }
.rv-cell.legal::after { content: ''; width: 26%; height: 26%; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.rv-cell.legal:hover::after { background: rgba(255,255,255,.85); }
.rv-disc { width: 82%; height: 82%; border-radius: 50%; box-shadow: 0 3px 4px rgba(0,0,0,.45); animation: appear .2s ease; }
.rv-disc.black { background: radial-gradient(circle at 35% 30%, #555, #0a0a0a 70%); }
.rv-disc.white { background: radial-gradient(circle at 35% 30%, #fff, #d6d6d6 70%); }
.rv-disc.last { outline: 3px solid #ffd54a; outline-offset: 2px; }

/* Dames */
.dm-board { display: grid; grid-template-columns: repeat(10, 1fr); width: min(100%, 600px); border: 6px solid #5a3a1e; border-radius: 8px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.dm-sq { aspect-ratio: 1; border: 0; padding: 0; display: flex; align-items: center; justify-content: center; font: inherit; }
.dm-sq.light { background: #f0dcb4; }
.dm-sq.dark { background: #8b5a2b; cursor: default; }
.dm-sq.last { background: #a8743c; }
.dm-sq.movable { cursor: pointer; }
.dm-sq.movable .dm-pc { box-shadow: 0 0 0 3px #ffd54a, 0 3px 4px rgba(0,0,0,.45); }
.dm-sq.sel { background: #c9952e; }
.dm-sq.target { cursor: pointer; }
.dm-sq.target::after { content: ''; width: 32%; height: 32%; border-radius: 50%; background: rgba(255, 230, 120, .85); box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.dm-pc { width: 80%; height: 80%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: clamp(14px, 3.4vw, 30px); line-height: 1; box-shadow: 0 3px 4px rgba(0,0,0,.45); }
.dm-pc.w { background: radial-gradient(circle at 35% 30%, #fff, #e3d9c6 70%); color: #8b5a2b; border: 2px solid #cbbd9f; }
.dm-pc.b { background: radial-gradient(circle at 35% 30%, #555, #111 70%); color: #ffd54a; border: 2px solid #000; }

/* Yams */
.yams { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); max-width: 980px; }
@media (min-width: 820px) { .yams { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: start; } }
.yd-zone { background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--felt-dark)); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.yd-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.yd { width: clamp(46px, 13vw, 82px); aspect-ratio: 1; border: 0; padding: 0; border-radius: 14%; background: #fffdf6; box-shadow: 0 4px 0 #c9bfa5, 0 6px 8px rgba(0,0,0,.35); cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; }
.yd.idle { opacity: .55; cursor: default; }
.yd.held { background: #ffe066; box-shadow: 0 0 0 4px #e0a800, 0 6px 8px rgba(0,0,0,.35); transform: translateY(-4px); }
.yd small { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; font-size: .8rem; }
.yd-face { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 76%; height: 76%; }
.yd-face i { display: block; margin: 16%; border-radius: 50%; }
.yd-face i.on { background: #1b1b1b; }
.yd-roll { margin-top: 12px; font-size: 1.1rem; min-width: 220px; }
.yd-roll:disabled { opacity: .5; cursor: default; }
.yd-help { color: #fff; margin: 0; text-align: center; font-weight: 600; }
.ys { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.ys th, .ys td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.ys td { text-align: right; font-weight: 800; font-size: 1.15rem; width: 70px; }
.ys th small { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.ys th span { font-weight: 700; }
.ys-head th { background: var(--bg); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ys-row.can { cursor: pointer; }
.ys-row.can td { color: var(--accent); }
.ys-row.can:hover, .ys-row.can:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
.ys-row.zero td { color: var(--muted); }
.ys-row.done td { color: var(--text); }
.ys-row.done th span { color: var(--muted); }
.ys-sub th { font-weight: 600; } .ys-sub.total th, .ys-sub.total td { font-size: 1.25rem; font-weight: 800; border-bottom: 0; }

/* Bubble shooter */
.bs-wrap { width: min(100%, 520px); background: radial-gradient(ellipse at 50% 20%, #2b4a7a, #142640); border-radius: 14px; overflow: hidden; }
.bs-canvas { display: block; touch-action: none; cursor: crosshair; }
.bs-canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.bs-help { color: var(--muted); font-size: .95rem; max-width: 520px; }

/* Puzzle */
.pz-area { position: relative; width: 100%; user-select: none; -webkit-user-select: none; touch-action: none; }
.pz-frame { position: absolute; left: 0; top: 0; background: #e9e4d8 center / 100% 100% no-repeat; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.15); }
.pz-frame::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55); border-radius: 6px; }
.pz-piece { position: absolute; cursor: grab; filter: drop-shadow(1px 2px 2px rgba(0,0,0,.35)); }
.pz-piece.ok { cursor: default; filter: none; }
.pz-piece.drag { cursor: grabbing; filter: drop-shadow(3px 6px 6px rgba(0,0,0,.4)); }
@media (min-width: 1000px) { .site-nav { flex-wrap: wrap; overflow: visible; } }

/* Backgammon */
.bg-board { --pw: max(22px, min(calc((100vw - 52px) / 14.1), 52px, calc((100vh - 300px) / 12.4))); width: calc(var(--pw) * 14.1 + 16px); max-width: 100%; background: #6b4423; border-radius: 12px; padding: 8px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.bg-half { display: flex; height: calc(var(--pw) * 5.4); background: #e9d8b0; }
.bg-half.top { border-radius: 6px 6px 0 0; } .bg-half.bot { border-radius: 0 0 6px 6px; }
.bg-pt { position: relative; width: var(--pw); flex: none; border: 0; padding: 0; background: none; cursor: default; display: flex; flex-direction: column; align-items: center; font: inherit; }
.bg-half.bot .bg-pt { flex-direction: column-reverse; }
.bg-tri { position: absolute; inset: 0 2px; clip-path: polygon(0 0, 100% 0, 50% 88%); }
.bg-half.bot .bg-tri { clip-path: polygon(0 100%, 100% 100%, 50% 12%); }
.bg-pt.a .bg-tri { background: #b5452f; } .bg-pt.b .bg-tri { background: #2f5d50; }
.bg-pt.target .bg-tri { background: #ffd54a; }
.bg-pt.target { cursor: pointer; }
.bg-pt.from .bg-tri, .bg-pt.last .bg-tri { filter: brightness(1.25); }
.bg-stack { position: relative; display: flex; flex-direction: inherit; align-items: center; padding: 2px 0; }
.bg-num { position: absolute; font-size: 10px; color: #7a6040; } .bg-half.top .bg-num { bottom: -1px; } .bg-half.bot .bg-num { top: -1px; }
.bg-ck { width: calc(var(--pw) * 0.92); height: calc(var(--pw) * 0.92); border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: calc(var(--pw) * 0.42); box-shadow: 0 2px 2px rgba(0,0,0,.4); margin: 0 0 -1px; }
.bg-ck.w { background: radial-gradient(circle at 35% 30%, #fff, #e3d9c6 70%); border: 2px solid #b9ab8e; color: #6b4423; }
.bg-ck.k { background: radial-gradient(circle at 35% 30%, #555, #111 70%); border: 2px solid #000; color: #ffd54a; }
.bg-pt.movable { cursor: pointer; }
.bg-half.top .bg-pt.movable .bg-ck:last-child, .bg-half.bot .bg-pt.movable .bg-ck:last-child, .bg-bar.movable .bg-ck:last-child { box-shadow: 0 0 0 3px #ffd54a, 0 2px 2px rgba(0,0,0,.4); }
.bg-pt.sel .bg-ck:last-child, .bg-bar.sel .bg-ck:last-child { box-shadow: 0 0 0 4px #e0a800 !important; transform: scale(1.06); }
.bg-bar { width: calc(var(--pw) * 0.9); flex: none; background: #5a3a1e; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bg-half.bot .bg-bar { flex-direction: column-reverse; }
.bg-bar .bg-ck { width: calc(var(--pw) * 0.78); height: calc(var(--pw) * 0.78); }
.bg-off { width: calc(var(--pw) * 1.2); flex: none; background: #4a2f18; border: 0; color: #f0dcb4; font: inherit; font-size: 11px; font-weight: 700; display: flex; flex-direction: column; align-items: center; padding: 4px 2px; gap: 4px; }
.bg-half.bot .bg-off { flex-direction: column-reverse; }
.bg-off.target { background: #ffd54a; color: #222; cursor: pointer; }
.bg-offn { white-space: pre; text-align: center; line-height: 1.2; }
.bg-offbars { display: flex; flex-direction: column; gap: 1px; width: 80%; }
.bg-offbars i { display: block; height: 4px; border-radius: 2px; } .bg-offbars.w i { background: #f3ead8; } .bg-offbars.k i { background: #111; }
.bg-mid { height: calc(var(--pw) * 1.5 + 8px); background: #6b4423; display: flex; align-items: center; justify-content: center; gap: 16px; }
.bg-dice { display: flex; gap: 8px; } .bg-dice.cpu .bg-die { background: #222; } .bg-dice.cpu .bg-die i.on { background: #fff; }
.bg-die { width: calc(var(--pw) * 1.05); height: calc(var(--pw) * 1.05); min-width: 30px; min-height: 30px; background: #fffdf6; border-radius: 16%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 3px; box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.bg-die i { border-radius: 50%; margin: 18%; } .bg-die i.on { background: #1b1b1b; }
.bg-die.used { opacity: .35; }
.bg-roll { min-height: 44px; }
.modal p { white-space: pre-line; }

/* Belote */
.bl-table { --cw: clamp(46px, 11.5vw, 78px); position: relative; display: grid; grid-template-columns: 1fr 2.4fr 1fr; grid-template-rows: auto auto minmax(calc(var(--cw) * 3.3), auto) auto;
  grid-template-areas: "info info info" ". top ." "left center right" "hand hand hand"; gap: 8px; max-width: 900px; padding: 12px; border-radius: 14px;
  background: radial-gradient(ellipse at 50% 40%, var(--felt), var(--felt-dark)); color: #fff; user-select: none; -webkit-user-select: none; }
.bl-table .card { position: relative; display: inline-block; width: var(--cw); height: calc(var(--cw) * 1.4); padding: 0; font: inherit; flex: none; transition: transform .15s ease; }
.bl-info { grid-area: info; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 16px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 6px 12px; }
.bl-score b { font-size: 1.15rem; } .bl-score small { opacity: .8; }
.bl-contract { font-weight: 600; } .bl-trump { display: inline-block; background: #fff; color: #111; border-radius: 6px; padding: 0 6px; font-size: 1.2rem; } .bl-trump.red { color: var(--red); }
.bl-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border-radius: 10px; }
.bl-seat.top { grid-area: top; } .bl-seat.left { grid-area: left; align-self: center; } .bl-seat.right { grid-area: right; align-self: center; }
.bl-seat.active { background: rgba(255, 213, 74, .25); box-shadow: 0 0 0 2px #ffd54a; }
.bl-name { font-weight: 700; font-size: .95rem; }
.bl-said { background: #fff; color: #222; border-radius: 8px; padding: 2px 8px; font-size: .85rem; font-weight: 700; }
.bl-backs { display: flex; }
.bl-backs .card { --cw: clamp(22px, 4.5vw, 34px); margin-left: calc(var(--cw) * -0.6); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.bl-backs .card:first-child { margin-left: 0; }
.bl-center { grid-area: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.bl-trick { position: relative; width: calc(var(--cw) * 2.9); height: calc(var(--cw) * 3.2); }
.bl-spot { position: absolute; } .bl-spot.s { left: calc(var(--cw) * 0.95); bottom: 0; } .bl-spot.n { left: calc(var(--cw) * 0.95); top: 0; }
.bl-spot.w { left: 0; top: calc(var(--cw) * 0.9); } .bl-spot.e { right: 0; top: calc(var(--cw) * 0.9); }
.bl-spot .card { animation: appear .18s ease; } .bl-spot .card.win { box-shadow: 0 0 0 3px #ffd54a, 0 4px 10px rgba(0,0,0,.4); }
.bl-bid { text-align: center; } .bl-bid p { margin: 0 0 8px; font-weight: 600; }
.bl-bidbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; } .bl-bidbtns .btn.red { color: var(--red); }
.bl-hand { grid-area: hand; display: flex; justify-content: center; padding: 10px 0 4px; }
.bl-hand .card { margin-left: calc(var(--cw) * -0.22); box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.bl-hand .card:first-child { margin-left: 0; }
@media (max-width: 560px) { .bl-hand .card { margin-left: calc(var(--cw) * -0.42); } .bl-table { grid-template-columns: 0.8fr 2.4fr 0.8fr; padding: 8px; } }
.bl-hand.myturn .card.playable { transform: translateY(-10px); cursor: pointer; }
.bl-hand.myturn .card.playable:hover { transform: translateY(-16px); }
.bl-hand .card.dim { filter: brightness(.62); }
.bl-hand .card.trumpcard::after { content: '★'; position: absolute; left: 6%; bottom: 3%; font-size: calc(var(--cw) * 0.22); color: #c9952e; }
