:root {
  --bg: #13201b;
  --surface: #1d2a24;
  --surface-2: #26362f;
  --text: #eef3ef;
  --muted: #a9b8af;
  --accent: #e9b949;
  --accent-text: #1b1606;
  --danger: #e06c5b;
  --light: #e8dcc0;
  --dark: #6f8f6a;
  --sel: rgba(233, 185, 73, 0.6);
  --last: rgba(233, 185, 73, 0.32);
  --check: rgba(224, 70, 50, 0.75);
  --radius: 14px;
  color-scheme: dark;
}
:root[data-color-theme="light"] {
  --bg: #f3f5ef;
  --surface: #ffffff;
  --surface-2: #e6ece6;
  --text: #1c2b22;
  --muted: #58675e;
  --accent: #d99c16;
  --accent-text: #2a2108;
  --danger: #c7473d;
  --sel: rgba(217, 156, 22, 0.45);
  --last: rgba(217, 156, 22, 0.27);
  --check: rgba(200, 55, 40, 0.65);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button[data-ui-icon]::before { content: attr(data-ui-icon); display: inline-block; margin-right: .48em; vertical-align: -.06em; }

.screen { display: none; min-height: 100%; padding: env(safe-area-inset-top) 16px calc(16px + env(safe-area-inset-bottom)); }
.screen.active { display: flex; flex-direction: column; }

/* Accueil */
#home { justify-content: center; align-items: center; gap: 14px; }
.hero { text-align: center; }
.hero-top { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.brand { display: flex; flex-direction: column; align-items: center; }
.brand-copy { text-align: center; }
.logo { width: 112px; height: 112px; }
.hero h1 { margin: 8px 0 0; font-size: 2.4rem; letter-spacing: 0.02em; }
.tagline { color: var(--muted); margin: 4px auto 0; max-width: 30ch; font-size: 0.78rem; line-height: 1.3; }
.menu { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); }
.menu .menu-icon { display: inline-grid; place-items: center; width: 1.35em; margin-right: 9px; font-size: 1.08em; line-height: 1; vertical-align: -0.08em; }
.menu-submenu .menu-icon { width: 1.3em; margin-right: 8px; font-size: 1em; }
.menu-group { display: flex; flex-direction: column; gap: 8px; }
.menu-submenu { display: flex; flex-direction: column; gap: 8px; margin-left: 12px; padding-left: 10px; border-left: 2px solid var(--accent); }
.menu-submenu .btn { background: var(--surface); font-size: 0.92rem; }
.mobile-menu-toggle, .mobile-menu-backdrop { display: none; }
.player-profile { width: min(340px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); text-align: left; }
.player-profile div { display: flex; flex-direction: column; min-width: 0; }
.player-profile strong { font-size: 1rem; }
.player-profile span { color: var(--accent); font-weight: 650; }
.player-profile small { color: var(--muted); line-height: 1.25; margin-top: 2px; }
.coach-program { width: min(430px, 100%); padding: 14px; border: 1px solid var(--surface-2); border-radius: var(--radius); background: var(--surface); text-align: left; }
.coach-program-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-kicker { color: var(--accent); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.coach-program h2 { margin: 2px 0 0; font-size: 1.05rem; }
.coach-program-badge { color: var(--muted); font-size: 0.78rem; text-align: right; }
.coach-program p { margin: 8px 0; line-height: 1.42; }
.coach-program-focus { color: var(--muted); font-size: 0.82rem; }
.coach-program-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coach-program-actions .btn { min-width: 0; padding: 10px 8px; font-size: 0.84rem; }
.program-view { width: min(960px, 100%); margin: 0 auto; }
.program-view .coach-program { width: 100%; max-width: none; }
.program-coach { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: start; }
.program-coach-identity { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.program-coach-identity strong { color: var(--accent); font-size: 0.86rem; }
.program-coach-portrait { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.program-coach-portrait img { width: 64px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); }
.program-coach-portrait .legend-link { font-size: 0.66rem; line-height: 1.2; }
.program-coach-message { min-width: 0; }
.program-coach-bubble { position: relative; margin-top: 8px; padding: 8px 38px 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface); line-height: 1.5; }
.program-coach-bubble > .mini { position: absolute; top: 6px; right: 6px; }
.program-coach-bubble p { margin: 0; }
.program-coach-bubble .coach-program-focus { margin-top: 8px; }
.program-coach-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-progress { margin-top: 12px; }
.coach-progress h3 { margin: 0 0 8px; font-size: 1rem; }
.coach-progress p { margin: 4px 0; line-height: 1.45; }
.profile-edit { border: 1px solid var(--surface-2); background: transparent; border-radius: 10px; padding: 7px 10px; flex: none; }
.profile-name-input { width: 100%; border: 1px solid var(--surface-2); border-radius: 10px; padding: 11px 12px; background: var(--surface); color: var(--text); font: inherit; }

.btn {
  border: 0; border-radius: var(--radius); padding: 14px 18px;
  background: var(--surface-2); font-weight: 600; font-size: 1.05rem;
  transition: transform 0.08s, filter 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.wide { width: 100%; margin-top: 24px; }
.btn.ghost { background: transparent; border: 1px solid var(--surface-2); }

/* Barres */
.bar { display: flex; align-items: center; gap: 8px; min-height: 56px; }
.bar h2 { flex: 1; margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terrain-label { flex: none; color: var(--muted); font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; width: 44px; height: 44px; border-radius: 50%; }
.icon-btn:active { background: var(--surface-2); }

.panel { width: min(520px, 100%); margin: 0 auto; }
.field-label { display: block; color: var(--muted); font-size: 0.9rem; margin: 20px 0 8px; }
.segmented { display: flex; background: var(--surface); border-radius: var(--radius); padding: 4px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: none; padding: 10px 6px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.segmented button.on { background: var(--surface-2); color: var(--text); }
.game-modes button { min-width: 0; padding: 9px 4px; font-size: 0.78rem; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; }

/* Partie */
#game { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
#game[data-nature-terrain="grass"], #puzzle[data-nature-terrain="grass"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(123, 180, 91, .18), transparent 58%); }
#game[data-nature-terrain="forest"], #puzzle[data-nature-terrain="forest"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(58, 116, 71, .2), transparent 62%); }
#game[data-nature-terrain="mud"], #puzzle[data-nature-terrain="mud"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(139, 105, 67, .2), transparent 60%); }
#game[data-nature-terrain="beach"], #puzzle[data-nature-terrain="beach"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(69, 188, 211, .2), transparent 62%); }
#game[data-nature-terrain="water"], #puzzle[data-nature-terrain="water"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(43, 141, 188, .22), transparent 65%); }
#game[data-nature-terrain="rock"], #puzzle[data-nature-terrain="rock"] { background-image: radial-gradient(ellipse at 50% 2%, rgba(130, 158, 161, .17), transparent 60%); }
.game-layout { display: flex; flex-direction: column; gap: 12px; flex: 1; align-items: center; }
.board-col { width: min(100%, 560px, calc(100vh - 260px)); min-width: 280px; }
.side-col { width: min(100%, 560px); display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 900px) {
  #game .game-layout { display: grid; grid-template-columns: minmax(320px, 1.2fr) minmax(250px, 1fr); justify-content: center; align-items: start; gap: 8px 12px; }
  #game .board-col { grid-column: 1; grid-row: 1; width: auto; min-width: 0; }
  #game .game-tools { grid-column: 2; grid-row: 1; width: 100%; display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; align-items: start; gap: 8px 12px; }
  #game .side-col { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; align-self: start; width: 100%; }
  #game .moves { width: 100%; max-height: 260px !important; }
  #game .chat { width: 100%; margin-top: 0; }
  #game .board-validation { grid-column: 1 / span 2; grid-row: 1; width: 100%; display: flex; flex-direction: column; gap: 4px; }
  #game .board-controls { grid-column: 1; grid-row: 2; width: 76px; }
  #game .actions { width: 100%; grid-template-columns: minmax(0, 1fr); }
  #game .online-switch { width: 100%; }
}
.player { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 2px 4px; }
.player .name { font-weight: 600; }
.player .name.turn::before { content: "●"; color: var(--accent); margin-right: 6px; }
.captured { font-size: 1.15rem; color: var(--muted); letter-spacing: -2px; font-family: "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", serif; }
.captured small { letter-spacing: 0; font-size: 0.8rem; margin-left: 6px; }
.captured-piece { display: inline-block; font-size: 1.35rem; line-height: 1; margin-right: -2px; vertical-align: -2px; font-family: "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", serif; }
.captured-piece.w { color: #fff; text-shadow: 0 0 1px #000, 0 0 2px #000; }
.captured-piece.k { color: #1b1b1f; text-shadow: 0 0 1px #fff; }

.board-wrap { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.board-wrap.is3d { box-shadow: none; border-radius: 18px; background: radial-gradient(ellipse at 50% 20%, #3c5a7a 0%, #1d2a24 75%); }
.board-wrap.is3d #board { display: none; }
.board-wrap.is3d.webgl-lost #board { display: grid; }
.board-wrap.is3d.webgl-lost .board3d,
.board-wrap.is3d.webgl-lost .minimap { display: none !important; }
/* Vue choisie : 2D seule (le plateau 2D remplace la 3D, qui ne se dessine plus) ou 3D seule (sans l'aperçu 2D) */
.board-wrap.is3d.view-2d #board { display: grid; }
.board-wrap.is3d.view-2d .board3d, .board-wrap.is3d.view-2d .minimap, .board-wrap.is3d.view-3d .minimap { display: none !important; }
.board-wrap.is3d.view-2d { background: none; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.view-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.view-switch[hidden] { display: none; }
.anim-switch { margin: 4px 0 10px; }
.skip-anim { position: absolute; right: 10px; bottom: 10px; z-index: 8; padding: 7px 13px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; background: rgba(15,22,18,.78); color: #fff; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; backdrop-filter: blur(3px); }
.skip-anim[hidden] { display: none; }
.view-switch button { min-height: 28px; padding: 3px 9px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; opacity: .75; }
.view-switch button[aria-pressed="true"] { background: var(--accent, #e9b949); color: #1b2a22; opacity: 1; }
.board3d { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.captured img { height: 26px; margin-right: -8px; vertical-align: middle; }
.promo-choices .pc { font-size: clamp(38px, 12vw, 52px); }
.promo-choices button { background: var(--surface-2) !important; }
#board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: 100%; height: 100%; touch-action: none; user-select: none; container-type: size; }
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.l { background: var(--light); }
.sq.d { background: var(--dark); }
.sq.last::after, .sq.sel::after, .sq.check::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sq.last::after { background: var(--last); }
.sq.sel::after { background: var(--sel); }
.sq.check::after { background: radial-gradient(circle, var(--check) 0%, rgba(224,70,50,0.35) 55%, transparent 75%); }
.sq.mate-fire::after { content: '🔥'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(22px, 7vw, 46px); background: radial-gradient(circle, rgba(255,75,12,0.48), rgba(255,20,0,0.12) 70%); animation: mate-flame 0.7s ease-in-out infinite alternate; z-index: 2; pointer-events: none; }
@keyframes mate-flame { from { filter: brightness(0.88); transform: scale(0.92); } to { filter: brightness(1.25); transform: scale(1.06); } }
.sq.hint-from, .sq.hint-to { box-shadow: inset 0 0 0 4px #4aa3df; }
.sq.coach-square-mark { box-shadow: inset 0 0 0 4px #35a9ff, inset 0 0 0 999px rgba(53,169,255,0.24); }
.sq.hint-from .pc { filter: drop-shadow(0 0 7px #74d4ff) drop-shadow(0 0 3px #1686c7); transform: scale(1.2); }
.sq.coach-piece-mark .pc { filter: drop-shadow(0 0 7px #ffd54f) drop-shadow(0 0 3px #ff9800); transform: scale(1.16); }
.sq .dot { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 30, 25, 0.28); pointer-events: none; z-index: 2; }
.sq .ring { position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(20, 30, 25, 0.28); pointer-events: none; z-index: 2; }
.coord { position: absolute; font-size: clamp(8px, 1.8vw, 12px); font-weight: 700; opacity: 0.8; pointer-events: none; z-index: 1; }
.coord.f.top { left: 50%; top: 1px; transform: translateX(-50%); }
.coord.f.bottom { left: 50%; bottom: 1px; transform: translateX(-50%); }
.coord.r.left { left: 3px; top: 50%; transform: translateY(-50%); }
.coord.r.right { right: 3px; top: 50%; transform: translateY(-50%); }
.sq.l .coord { color: var(--dark); }
.sq.d .coord { color: var(--light); }

.pc {
  position: relative; z-index: 3; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: min(10.5vw, 62px); line-height: 1;
  font-family: "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", serif;
  font-variant-emoji: text;
}
.pc.w { color: #fbf7ee; -webkit-text-stroke: 1.4px #26231c; paint-order: stroke fill; text-shadow: 0 2px 2px rgba(0,0,0,0.25); }
.pc.b { color: #22201c; -webkit-text-stroke: 0.6px #000; text-shadow: 0 2px 2px rgba(0,0,0,0.25); }
@media (min-width: 900px) { .pc { font-size: min(5.6vw, 64px, calc((100vh - 140px) / 8 * 0.82)); } }
.pc.drag { position: fixed; z-index: 50; pointer-events: none; width: auto; height: auto; transform: translate(-50%, -60%) scale(1.15); }
.pc.move-replay-token { position: absolute; z-index: 6; pointer-events: none; width: 12.5%; height: 12.5%; } /* une case, pas tout le plateau */
.sq.ghost .pc { opacity: 0.3; }

.status { text-align: center; color: var(--muted); min-height: 1.5em; margin-top: 6px; font-weight: 500; }
.status.alert { color: var(--accent); }

.moves {
  list-style: none; margin: 0; padding: 8px; background: var(--surface); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; gap: 2px 10px; max-height: 92px; overflow-y: auto; min-height: 44px;
  font-variant-numeric: tabular-nums; font-size: 0.95rem;
}
.moves li { white-space: nowrap; }
.moves li[hidden] { display: none !important; }
.moves li .n { color: var(--muted); margin-right: 4px; }
.moves li .cur { background: var(--surface-2); border-radius: 4px; padding: 0 3px; }
.moves:empty::before { content: "Aucun coup joué"; color: var(--muted); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act { border: 0; background: var(--surface); border-radius: var(--radius); padding: 8px 2px; font-size: 0.8rem; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.act span { font-size: 1.3rem; color: var(--text); }
.act:disabled { opacity: 0.4; }

/* Réglages */
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme { border: 2px solid transparent; border-radius: 10px; padding: 0; overflow: hidden; background: none; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; }
.theme.on { border-color: var(--accent); }
.theme i { display: block; }
.theme-name { grid-column: 1 / -1; font-size: 0.7rem; padding: 2px; background: var(--surface); }
.switch { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--surface-2); }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Stats */
.stats-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.stats-table th, .stats-table td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--surface-2); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.empty { color: var(--muted); text-align: center; margin-top: 40px; }

.prose h3 { margin: 22px 0 6px; color: var(--accent); font-size: 1.05rem; }
.prose p, .prose li { color: #d7e0da; }
.prose ul, .prose ol { padding-left: 20px; }

/* Modale */
.modal { position: fixed; inset: 0; background: rgba(5, 10, 8, 0.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { background: var(--surface); border-radius: 18px; padding: 22px; width: min(380px, 100%); text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.5); animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.sheet h3 { margin: 0 0 6px; font-size: 1.35rem; }
.sheet p { margin: 0 0 14px; color: var(--muted); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.promo-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.promo-choices button { border: 0; background: var(--light); border-radius: 12px; aspect-ratio: 1; padding: 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--surface-2); padding: 10px 16px; border-radius: 999px; z-index: 120; box-shadow: 0 4px 16px rgba(0,0,0,0.4); max-width: calc(100% - 32px); text-align: center; }
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Problèmes */
.pz-summary { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 18px; color: var(--muted); }
.pz-summary b { color: var(--text); }
.problems-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; position: sticky; top: 0; z-index: 3; padding: 6px 0; background: var(--bg); }
.problems-tab { min-height: 44px; padding: 8px 10px; border: 1px solid var(--surface-2); border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 650; line-height: 1.2; cursor: pointer; }
.problems-tab.active { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: var(--accent); color: var(--text); }
.problems-section-content { min-width: 0; }
.theme-training-card { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 9%, var(--surface))); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 18px; }
.theme-training-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.theme-training-head h3 { margin: 0; font-size: 1rem; }
.theme-training-level { color: var(--accent); font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.theme-training-progress { margin: 8px 0 12px; color: var(--muted); font-size: 0.85rem; }
.theme-training-card > .btn { margin-top: 4px; }
.path-continue { margin-bottom: 16px; }
.path-adventure-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.path-adventure-heading h3 { margin: 0 0 4px; font-size: 1.12rem; }
.path-adventure-heading .pz-cap { margin: 0; }
.path-level-badge { flex: none; padding: 8px 11px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--accent); font-weight: 800; white-space: nowrap; }
.path-progress-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.path-progress-stats > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 10px; border-radius: 14px; background: var(--surface-2); }
.path-progress-stats strong { color: var(--accent); font-size: 1.2rem; }
.path-progress-stats span { color: var(--muted); font-size: 0.78rem; line-height: 1.25; }
.path-cheer { display: flex; align-items: center; gap: 10px; padding: 11px 13px; margin: 12px 0 20px; border-radius: 14px; background: color-mix(in srgb, #ed80a5 17%, var(--surface)); }
.path-cheer > span { font-size: 1.55rem; }
.path-cheer p { margin: 0; }
.path-cheer strong, .path-cheer span { display: block; }
.path-cheer > p > span { margin-top: 2px; color: var(--muted); font-size: 0.86rem; }
.path-stage-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.path-stage-heading h4 { margin: 0; font-size: 1rem; }
.path-stage-heading > span { color: var(--muted); font-size: 0.84rem; }
.path-stage-intro { margin: 0 0 10px; color: var(--muted); font-size: 0.86rem; }
.path-stages { position: relative; display: grid; gap: 5px; list-style: none; margin: 0; padding: 0; }
.path-stages::before { position: absolute; top: 25px; bottom: 25px; left: 21px; width: 4px; border-radius: 4px; background: var(--surface-2); content: ""; }
.path-stage { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 7px 10px; min-height: 65px; padding: 8px; border-radius: 14px; }
.path-stage.complete { background: color-mix(in srgb, #72c891 10%, var(--surface)); }
.path-stage.current { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 55%, transparent); }
.path-stage-marker { z-index: 1; display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid var(--surface-2); border-radius: 50%; background: var(--surface); font-size: 1.2rem; }
.path-stage.complete .path-stage-marker { border-color: #72c891; color: #72c891; font-weight: 900; }
.path-stage.current .path-stage-marker { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }
.path-stage-content { min-width: 0; }
.path-stage-name { display: block; font-weight: 800; }
.path-stage-levels { color: var(--accent); font-size: 0.76rem; font-weight: 700; }
.path-stage-content p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.path-stage-state { color: var(--muted); font-size: 0.76rem; font-weight: 700; text-align: right; }
.path-stage.complete .path-stage-state { color: #72c891; }
.path-stage.current .path-stage-state { color: var(--accent); }
.path-stage-progress { grid-column: 2 / -1; padding: 0 8px 4px 0; }
.path-stage-progress-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 0.78rem; }
.path-stage-progress-label span { color: var(--muted); }
.path-stage-progress-label b { white-space: nowrap; }
.path-stage-track { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.path-stage-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #53b7dc, #b394f0); transition: width 250ms ease; }
.path-streak-count { margin-top: 6px; color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.theme-training-groups { display: grid; gap: 14px; margin-top: 12px; }
.theme-training-group h4 { margin: 0; color: var(--muted); font-size: 0.86rem; }
.theme-training-group .theme-training-choices { margin: 6px 0 0; }
.theme-training-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin: 14px 0 8px; }
.theme-training-choice { display: flex; align-items: center; gap: 9px; min-height: 42px; border: 1px solid transparent; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.theme-training-choice.mastery-good { border-color: rgba(110, 190, 130, 0.38); background: linear-gradient(100deg, rgba(110, 190, 130, 0.13), var(--surface-2) 78%); }
.theme-training-choice.mastery-warm { border-color: rgba(233, 185, 73, 0.4); background: linear-gradient(100deg, rgba(233, 185, 73, 0.12), var(--surface-2) 78%); }
.theme-training-choice.mastery-poor { border-color: rgba(224, 108, 91, 0.42); background: linear-gradient(100deg, rgba(224, 108, 91, 0.14), var(--surface-2) 78%); }
.theme-training-choice.mastery-unknown { border-color: rgba(150, 160, 160, 0.18); }
.theme-training-choice input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.theme-training-choice > span { min-width: 0; flex: 1; font-size: 0.9rem; }
.theme-training-choice small { color: var(--muted); white-space: nowrap; }
.theme-training-choice .theme-mastery { flex: none; border-radius: 999px; padding: 3px 7px; background: rgba(150, 160, 160, 0.12); font-weight: 700; }
.theme-training-choice.mastery-good .theme-mastery { background: rgba(110, 190, 130, 0.2); color: #8fd6a2; }
.theme-training-choice.mastery-warm .theme-mastery { background: rgba(233, 185, 73, 0.2); color: var(--accent); }
.theme-training-choice.mastery-poor .theme-mastery { background: rgba(224, 108, 91, 0.2); color: #f19a8c; }
.problem-theme-catalog { display: grid; gap: 18px; }
.problem-theme-catalog > .pz-cap { margin: 0; }
.problem-theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; margin-top: 8px; }
.problem-theme-card { display: grid; grid-template-columns: 38px 1fr auto; grid-template-rows: auto auto auto; align-items: center; gap: 4px 10px; width: 100%; padding: 12px; border: 1px solid transparent; border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.problem-theme-card.mastery-good { border-color: rgba(110, 190, 130, 0.38); }
.problem-theme-card.mastery-warm { border-color: rgba(233, 185, 73, 0.42); }
.problem-theme-card.mastery-poor { border-color: rgba(224, 108, 91, 0.45); }
.problem-theme-icon { grid-row: span 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); font-size: 1.25rem; }
.problem-theme-name { min-width: 0; font-weight: 700; }
.problem-theme-count { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.problem-theme-card .theme-mastery { grid-column: 2 / -1; justify-self: start; border-radius: 999px; padding: 3px 8px; background: var(--surface-2); color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.problem-theme-card.mastery-good .theme-mastery { background: rgba(110, 190, 130, 0.2); color: #8fd6a2; }
.problem-theme-card.mastery-warm .theme-mastery { background: rgba(233, 185, 73, 0.2); color: var(--accent); }
.problem-theme-card.mastery-poor .theme-mastery { background: rgba(224, 108, 91, 0.2); color: #f19a8c; }
.problem-theme-action { grid-column: 2 / -1; color: var(--accent); font-size: 0.82rem; font-weight: 700; }
.pz-settings { text-align: left; background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 18px; }
.pz-settings h3 { margin: 0 0 8px; font-size: 1rem; }
.pz-settings .field-label { margin: 14px 0 6px; }
.pz-settings input { width: 100%; }
.pz-settings small { display: block; margin-top: 12px; color: var(--muted); }
.pz-pref-error { color: var(--danger) !important; margin: 8px 0 0 !important; }
.sync-status { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .92rem; }
.sync-status.synced { color: #79d995; }
.sync-status.pending, .sync-status.offline { color: var(--accent); }
.sync-status.error { color: var(--danger); }
.pz-pref-actions { display: flex; gap: 8px; margin-top: 14px; }
.pz-pref-actions .btn { flex: 1; padding: 10px; font-size: 0.95rem; }
@media (max-width: 560px) { .problems-tabs { gap: 5px; } .problems-tab { padding: 7px 5px; min-height: 50px; font-size: 0.74rem; } .problem-theme-grid { grid-template-columns: 1fr; } .path-adventure-heading { align-items: flex-start; } .path-adventure-heading h3 { font-size: 1rem; } .path-level-badge { padding: 7px 8px; font-size: 0.76rem; } .path-progress-stats { gap: 5px; } .path-progress-stats > div { padding: 10px 7px; } .path-progress-stats span { font-size: 0.71rem; } .path-progress-stats strong { font-size: 1.02rem; } .path-stage { grid-template-columns: 40px minmax(0, 1fr); gap: 5px 8px; } .path-stage-marker { width: 38px; height: 38px; } .path-stages::before { left: 18px; } .path-stage-state { grid-column: 2; text-align: left; } .path-stage-progress { grid-column: 2; padding-right: 4px; } }
.pz-section { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 10px; }
.pz-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.pz-card .ico { grid-row: span 3; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.pz-card .t { font-weight: 600; }
.pz-card .d { grid-column: 2 / -1; color: var(--muted); font-size: 0.85rem; }
.pz-card .bar2 { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pz-card .bar2 i { display: block; height: 100%; border-radius: 3px; }
.chip { font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.chip.hot { background: rgba(224, 108, 91, 0.2); color: #f19a8c; }
.chip.warm { background: rgba(233, 185, 73, 0.18); color: var(--accent); }
.chip.ok { background: rgba(110, 190, 130, 0.18); color: #8fd6a2; }
.chip.free { background: var(--surface-2); color: var(--muted); }
.trend { font-size: 0.8rem; }
.trend.down { color: #8fd6a2; }
.trend.up { color: #f19a8c; }
.pz-mini { display: flex; flex-wrap: wrap; gap: 8px; }
.pz-mini button { background: var(--surface); border: 0; border-radius: 999px; padding: 8px 14px; color: var(--muted); }
.pz-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pz-stats div { background: var(--surface); border-radius: 12px; padding: 10px; text-align: center; }
.pz-stats b { display: block; font-size: 1.3rem; }
.pz-stats span { color: var(--muted); font-size: 0.75rem; }
.spark { width: 100%; height: 70px; background: var(--surface); border-radius: 12px; display: block; }
.pz-tip { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 0.92rem; }
.pz-err { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 0.9rem; }
.pz-err small { color: var(--muted); display: block; }
.pz-err button { background: var(--surface-2); border: 0; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.pz-err.done { opacity: 0.6; }
.capture-note { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
.capture-note b, .capture-note small { display: block; }
.capture-note small { color: var(--muted); margin-top: 3px; line-height: 1.4; }
.capture-note.advantageous { border-left-color: #6ebe82; }
.capture-note.counterplay { border-left-color: var(--danger); }
.pz-prompt { text-align: center; margin: 2px 0 10px; font-weight: 600; min-height: 1.4em; }
.pz-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
#puzzle-slot { width: 100%; }
.status.good { color: #8fd6a2; }
.status.bad { color: #f19a8c; }
.actions.three { grid-template-columns: repeat(3, 1fr); }
.replay-actions { grid-template-columns: repeat(3, 1fr); }
.replay-bar { display: flex; flex-direction: column; gap: 8px; }
.learning-coach-slot { width: min(100%, 560px); }
.learning-coach-slot:empty { display: none; }
.guided-learning .learning-coach-slot { display: block; }
@media (min-width: 900px) {
  #puzzle.guided-learning .game-layout { width: min(1440px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(300px, 1.4fr) minmax(240px, 0.8fr); align-content: start; align-items: start; justify-content: center; column-gap: clamp(12px, 1.5vw, 24px); row-gap: 0; }
  #puzzle.guided-learning .board-col { grid-column: 1; grid-row: 1; width: 100%; min-width: 0; }
  #puzzle.guided-learning .learning-controls { width: 100%; margin-top: 0; }
  #puzzle.guided-learning .learning-controls .actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; }
  #puzzle.guided-learning .learning-controls .act { width: max-content; min-height: 72px; flex-direction: column; justify-content: center; gap: 6px; padding: 8px 16px; text-align: center; font-size: 0.76rem; }
  #puzzle.guided-learning .learning-coach-slot { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; align-items: stretch; gap: 0; width: 100%; min-width: 0; }
  #puzzle.guided-learning .coach { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: start; gap: 8px; min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--surface-2); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 28px rgba(0,0,0,0.2); }
  #puzzle.guided-learning .coach img { width: 64px; height: 96px; object-fit: contain; object-position: center; border-radius: 0; }
  #puzzle.guided-learning .coach .bubble { position: relative; min-height: 190px; margin: 0; padding: 18px 44px 18px 18px; border: 1px solid var(--surface-2); border-radius: 14px; background: var(--surface-2); }
  #puzzle.guided-learning .coach .bubble b { font-size: 0.92rem; }
  #puzzle.guided-learning .coach .bubble p { margin: 0; line-height: 1.6; }
  #puzzle.guided-learning .coach-identity { gap: 6px; }
  #puzzle.guided-learning .coach-identity b { font-size: 0.92rem; }
  #puzzle.guided-learning .coach .voice-btn { top: 8px; right: 8px; }
  #puzzle.guided-learning .pz-prompt { text-align: left; }
  #game .replay-bar { align-self: start; width: 100%; }
  #game .replay-bar .actions { grid-column: auto; grid-row: auto; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #game .game-layout:has(.replay-bar:not([hidden])) { grid-template-columns: minmax(320px, 1.2fr) minmax(250px, 1fr); column-gap: 8px; }
  #game .game-tools:has(.replay-bar:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  #game .game-tools:has(.replay-bar:not([hidden])) .side-col { grid-column: 1; }
}
@media (max-width: 899px) {
  #game .replay-bar { order: 1; width: min(100%, 560px); gap: 5px; }
  #game .replay-bar .replay-actions { grid-template-columns: repeat(3, 1fr); }
  #game .replay-legend, #game .replay-info { font-size: 0.74rem; }
}
.replay-bar[hidden], #game-actions[hidden] { display: none; }
.replay-info { font-weight: 600; font-size: 0.92rem; }
.replay-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.replay-legend .lg { display: inline-block; width: 22px; height: 6px; border-radius: 3px; margin-left: 6px; }
.replay-legend .lg.green { background: #2ecc40; } .replay-legend .lg.red { background: #e53935; }
.moves span[data-ply] { cursor: pointer; }
.rp-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { border: 0; background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 10px; font-size: 0.74rem; cursor: pointer; }
.mini:disabled { opacity: 0.5; cursor: progress; }
.rp-review { display: flex; flex-direction: column; gap: 6px; }
.rp-review[hidden] { display: none; }
.rp-coach { display: flex; align-items: flex-start; gap: 8px; padding: 9px; border: 1px solid var(--surface-2); border-radius: 12px; background: var(--surface); }
.rp-coach-portrait { display: flex; flex: none; flex-direction: column; align-items: flex-start; gap: 2px; }
.rp-coach-portrait > img { width: 48px; height: 64px; object-fit: contain; object-position: center; }
.rp-coach-message { min-width: 0; flex: 1; padding: 9px 11px; border-radius: 10px; background: var(--surface-2); font-size: 0.8rem; line-height: 1.4; }
.rp-coach-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
.rp-coach-title strong { color: var(--accent); }
.rp-coach-title .mini { padding: 3px 7px; }
.rp-best-move { color: #2f7bff; font-weight: 700; }
.rp-review-nav .mini { color: var(--text); }
.rp-filter-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.76rem; }
.rp-filter-label select { max-width: 190px; min-width: 0; padding: 6px 8px; border: 1px solid var(--surface-2); border-radius: 8px; background: var(--surface); color: var(--text); }
.rp-graph { width: 100%; height: 64px; background: var(--surface); border-radius: 8px; cursor: pointer; display: block; }
.rp-graph .g-area { fill: rgba(240, 240, 235, 0.88); }
.rp-graph .g-mid { stroke: rgba(233, 185, 73, 0.55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rp-graph .g-cur { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.rp-graph .g-bad { stroke: #e53935; stroke-width: 2; vector-effect: non-scaling-stroke; }
.rp-acc, .rp-comment { font-size: 0.76rem; color: var(--muted); line-height: 1.35; }
.rp-comment b { color: var(--accent); }
.moves span.q-inaccuracy { box-shadow: inset 0 -3px 0 #f5d142; text-decoration: underline; text-decoration-color: #f5d142; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.moves span.q-mistake { box-shadow: inset 0 -3px 0 #ff9f1c; text-decoration: underline; text-decoration-color: #ff9f1c; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.moves span.q-blunder { box-shadow: inset 0 -3px 0 #e53935; text-decoration: underline; text-decoration-color: #e53935; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.moves span.q-excellent { box-shadow: inset 0 -3px 0 #50a7ff; text-decoration: underline; text-decoration-color: #50a7ff; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.moves span.q-brilliant { box-shadow: inset 0 -3px 0 #c879ff; text-decoration: underline; text-decoration-color: #c879ff; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.arrows-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
#board { position: relative; }
.replay-items { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.replay-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%; }
.replay-item span { font-size: 0.82rem; color: var(--muted); }
.replay-row { display: flex; gap: 8px; align-items: stretch; }
.replay-row .replay-item { flex: 1; }
.ext-text { width: 100%; box-sizing: border-box; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; padding: 10px; border-radius: var(--radius); border: 1px solid var(--surface); background: var(--surface); color: var(--text); resize: vertical; }
.pz-prompt.lesson { text-align: left; font-weight: 400; background: var(--surface); border-radius: 12px; padding: 10px 12px; line-height: 1.5; }
.coach { display: flex; gap: 10px; align-items: flex-end; margin: 2px 0 10px; }
.coach-identity { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; flex: none; }
.coach-identity b { color: var(--accent); font-size: 0.86rem; }
.coach-portrait, .rp-coach-portrait, .coach-dock-portrait { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.coach-portrait .legend-link, .rp-coach-portrait .legend-link, .coach-dock-portrait .legend-link { font-size: 0.66rem; line-height: 1.2; }
.coach img { width: 64px; height: 96px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); transform-origin: bottom center; }
.coach .bubble { position: relative; flex: 1; background: var(--surface); border-radius: 14px 14px 14px 4px; padding: 8px 12px; font-size: 0.93rem; line-height: 1.45; }
.coach .bubble b { display: block; color: var(--accent); font-size: 0.78rem; letter-spacing: 0.03em; }
.coach .bubble p { margin: 2px 0 0; }
.coach.talk img { animation: nod 0.5s ease-out; }
.coach.talk .bubble { animation: pop 0.2s ease-out; }
.coach.happy .bubble { box-shadow: inset 3px 0 0 #6ebe82; }
.coach.sad .bubble { box-shadow: inset 3px 0 0 var(--danger); }
@keyframes nod { 0% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 60% { transform: rotate(4deg); } 100% { transform: rotate(0); } }
.pz-next { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 8px 0 0; }
.pz-card.now { box-shadow: inset 0 0 0 2px var(--accent); }
.pz-cap { color: var(--muted); font-size: 0.8rem; margin: 4px 0 0; }

/* Grille des niveaux de jeu */
.level-grid { display: grid; gap: 6px; }
.level-row { display: grid; grid-template-columns: 7.5rem repeat(3, 1fr); gap: 6px; align-items: center; }
.level-row .tier { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.level-row.single button { grid-column: 2 / span 3; }
.level-grid button { border: 0; border-radius: 10px; padding: 9px 4px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.9rem; }
.level-grid button.on { background: var(--accent); color: #fff; }
.level-grid button.done::after { content: ' ✓'; color: #6ebe82; }
.level-grid button.on.done::after { color: #fff; }
.level-grid button:disabled { opacity: 0.4; }
.level-grid button:disabled::before { content: '🔒 '; font-size: 0.75em; }
.level-help { color: var(--muted); font-size: 0.8rem; margin: 6px 0 0; }
@media (max-width: 380px) { .level-row { grid-template-columns: 5.8rem repeat(3, 1fr); } .level-row .tier { font-size: 0.74rem; } }
#modal-text { white-space: pre-line; }

.coach .voice-btn { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 0.95rem; padding: 2px 4px; cursor: pointer; opacity: 0.8; }
.coach .bubble { padding-right: 34px; }

.coach-dock { position: fixed; z-index: 40; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: min(340px, calc(100vw - 24px)); pointer-events: none; }
.coach-dock > * { pointer-events: auto; }
.coach-dock-dot { width: 8px; height: 8px; margin-left: 2px; border-radius: 50%; background: #78c98c; }
.coach-dock-panel { width: 100%; padding: 12px; border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; background: #1d2a24; box-shadow: 0 10px 30px rgba(0,0,0,0.42); }
.coach-dock-layout { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: start; }
.coach-dock-identity { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.coach-dock-identity > strong { color: var(--accent); font-size: 0.86rem; }
.coach-dock-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-dock-head span { min-width: 0; color: var(--muted); font-size: 0.72rem; }
.coach-dock-head .icon-btn { width: 34px; height: 34px; font-size: 1.25rem; }
.coach-dock-content { min-width: 0; }
.coach-dock-bubble { position: relative; margin-top: 6px; padding: 8px 38px 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface); }
.coach-dock-panel p { max-height: 30vh; overflow: auto; margin: 0; font-size: 0.86rem; line-height: 1.42; }
.coach-dock-actions { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; gap: 6px; }
.coach-dock-actions .btn { flex: 1; margin: 0; padding: 8px 10px; font-size: 0.8rem; }
.coach-dock-actions .icon-btn { width: 32px; height: 32px; font-size: 1.1rem; }
@media (max-width: 380px) {
  .coach-program-actions { grid-template-columns: 1fr; }
  .coach-dock { width: min(310px, calc(100vw - 20px)); right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* Araignée des compétences */
.radar { display: block; width: 100%; max-width: 420px; margin: 4px auto 0; overflow: visible; }
.radar .rd-grid { fill: none; stroke: var(--surface-2); stroke-width: 1; }
.radar .rd-scale { fill: var(--muted); font-size: 8px; }
.radar .rd-area { fill: var(--accent); fill-opacity: 0.25; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.radar .rd-area.empty { fill-opacity: 0.08; stroke-dasharray: 4 4; }
.radar .rd-dot { fill: var(--accent); }
.radar .rd-label { fill: var(--text); font-size: 10.5px; }
.radar .rd-val { fill: var(--accent); font-size: 10px; font-weight: 700; }

/* Mini-échiquier 2D (vue 3D) */
.minimap { display: none; position: absolute; top: 8px; right: 8px; width: 36%; min-width: 120px; max-width: 180px; aspect-ratio: 1; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); border: 2px solid #5a3a22; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,0.45); pointer-events: auto; touch-action: none; z-index: 2; overflow: hidden; container-type: size; }
.mini-move-replay-token { position: absolute; z-index: 7; width: 12.5%; height: 12.5%; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: min(88cqi, 38px); line-height: 1; font-weight: 400 !important; }
.mini-move-replay-token.w { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 2px #000; }
.mini-move-replay-token.b { color: #1b1b1f; text-shadow: 0 0 1px #fff; }
.board-wrap.is3d .minimap { display: grid; }
.minimap.user-sized { width: var(--minimap-size); height: var(--minimap-size); min-width: 120px; max-width: none; aspect-ratio: auto; }
.minimap::after { content: ""; position: absolute; left: 0; bottom: 0; width: 17px; height: 17px; z-index: 6; pointer-events: auto; cursor: nwse-resize; background: linear-gradient(135deg, transparent 0 42%, rgba(55,45,30,0.65) 43% 49%, transparent 50% 59%, rgba(55,45,30,0.65) 60% 66%, transparent 67%); }
.minimap button { position: relative; min-width: 0; min-height: 0; border: 0; padding: 0; display: flex; align-items: center; justify-content: center; font: inherit; cursor: pointer; container-type: size; }
.minimap button.l { background: #eeeed2; } .minimap button.d { background: #769656; }
.minimap .mini-tutorial-star { position: absolute; z-index: 3; color: #ffd54a; font-size: 62cqi; line-height: 1; text-shadow: 0 0 2px #101714, 0 0 4px #101714; pointer-events: none; }
.minimap .mini-coord { position: absolute; z-index: 4; font-size: max(5px, min(38cqi, 8px)); line-height: 1; font-weight: 700; pointer-events: none; }
.minimap .mini-coord.l { color: #263024; text-shadow: 0 0 2px rgba(255,255,255,0.95); }
.minimap .mini-coord.d { color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.95); }
.minimap .mini-coord.file { left: 50%; transform: translateX(-50%); }
.minimap .mini-coord.file.top { top: 1px; }
.minimap .mini-coord.file.bottom { bottom: 1px; }
.minimap .mini-coord.rank { top: 50%; transform: translateY(-50%); }
.minimap .mini-coord.rank.left { left: 1px; }
.minimap .mini-coord.rank.right { right: 1px; }
.minimap button.last { box-shadow: inset 0 0 0 40px rgba(246, 210, 80, 0.55); }
.minimap button.sel { box-shadow: inset 0 0 0 3px #4fc3f7; }
.minimap button.hint-piece { box-shadow: inset 0 0 0 3px #24c8ff, inset 0 0 14px rgba(36,200,255,0.9); z-index: 2; }
.minimap button.hint-piece b { transform: scale(1.2); filter: drop-shadow(0 0 5px #00cfff) drop-shadow(0 0 3px #fff); }
.minimap button.target::after { content: ""; position: absolute; width: 32%; height: 32%; border-radius: 50%; background: rgba(20,30,25,0.45); pointer-events: none; }
.minimap button.target.capture::after { width: 78%; height: 78%; background: transparent; border: 2px solid rgba(20,30,25,0.5); }
.minimap button.mate-fire::after { content: '🔥'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(8px, 2.8vw, 16px); background: rgba(255,75,12,0.42); animation: mate-flame 0.7s ease-in-out infinite alternate; z-index: 1; pointer-events: none; }
.minimap button:focus-visible { outline: 2px solid #f1c232; outline-offset: -2px; z-index: 1; }

/* Disposition bureau : accueil en tableau de bord, partie en deux colonnes équilibrées. */
@media (min-width: 1000px) {
  :root { --desktop-menu-width: 340px; }
  body { overflow: hidden; }
  #home.active { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-columns: var(--desktop-menu-width) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: stretch; justify-content: stretch; gap: 0; width: auto; min-height: 0; margin: 0; padding: 0; pointer-events: none; }
  #home .hero { grid-column: 1; grid-row: 1; text-align: center; width: 100%; max-width: none; margin: 0; padding: 18px 0 12px; overflow-y: auto; background: var(--bg); pointer-events: auto; }
  #home .hero-top { display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; margin: 0 auto; }
  #home .coach-program { display: none !important; }
  #home .brand { flex-direction: column; align-items: center; gap: 4px; }
  #home .brand-copy { text-align: center; }
  #home .logo { width: 88px; height: 88px; }
  #home .hero h1 { font-size: 2.25rem; }
  #home .player-profile { width: 100%; max-width: none; margin: 0; }
  #home .coach-program { width: min(1440px, 100%); max-width: none; margin: 14px auto 0; }
  #home .menu { grid-column: 1; grid-row: 2; align-self: stretch; width: 100%; max-width: none; gap: 10px; padding: 16px 18px; overflow-y: auto; border-right: 1px solid var(--surface-2); background: var(--surface); pointer-events: auto; }
  #home .menu .btn { text-align: left; padding: 13px 16px; font-size: 0.98rem; }
  .screen.active:not(#home) { position: fixed; z-index: 10; inset: 0 0 0 var(--desktop-menu-width); width: auto; min-height: 0; padding: 24px clamp(24px, 4vw, 56px); overflow: auto; background: var(--bg); }
  #game .bar { width: min(1220px, 100%); margin: 0 auto 8px; }
  #game .game-layout { width: min(1220px, 100%); margin: 0 auto; justify-content: center; align-items: start; gap: 8px clamp(12px, 1.2vw, 20px); }
  #game .game-layout:has(.replay-bar:not([hidden])) { column-gap: 8px; }
  #game .board-col { flex: 0 1 auto; width: auto; min-width: 0; }
  #game .moves { max-height: 92px !important; }
  #game .actions { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  #game .act { flex-direction: column; justify-content: center; gap: 4px; padding: 7px 2px; text-align: center; font-size: 0.74rem; }
  #game .act span { min-width: 0; text-align: center; }
  .panel { width: min(680px, 100%); }
}

/* Disposition téléphone : priorité au plateau, puis coups et actions compacts. */
@media (max-width: 899px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  #home { justify-content: flex-start; padding-top: max(18px, env(safe-area-inset-top)); gap: 14px; }
  #home .hero { width: min(100%, 460px); }
  #home .hero-top { flex-direction: column; }
  #home .brand { align-items: center; }
  #home .logo { width: 84px; height: 84px; }
  #home .hero h1 { font-size: 2rem; }
  #home .menu, #home .player-profile, #home .coach-program { width: min(100%, 460px); }
  #home #btn-home { display: none; }
  #home .menu { gap: 8px; }
  #home .menu .btn { padding: 11px 14px; font-size: 0.94rem; }
  .coach-program { padding: 12px; }
  .coach-program-actions { grid-template-columns: 1fr 1fr; }
  .game-layout { gap: 6px; justify-content: flex-start; }
  #puzzle.guided-learning .game-layout { display: flex; flex-direction: column; align-items: center; }
  #puzzle.guided-learning .board-col { order: 0; width: min(100%, 560px, calc(100dvh - 235px)); }
  #puzzle.guided-learning .learning-controls { width: min(100%, 560px); }
  #puzzle.guided-learning .learning-controls .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #puzzle.guided-learning .learning-controls .act { min-height: 54px; }
  #puzzle.guided-learning .learning-coach-slot { order: 1; display: flex; flex-direction: column; gap: 0; width: min(100%, 560px); }
  #puzzle.guided-learning .coach { width: 100%; box-sizing: border-box; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; padding: 10px; }
  #puzzle.guided-learning .learning-controls { width: 100%; }
  #puzzle.guided-learning .coach .bubble { min-height: 120px; padding: 12px 34px 12px 12px; }
  .board-col { width: min(100%, 560px, calc(100dvh - 235px)); min-width: 0; }
  .side-col { width: min(100%, 560px); gap: 7px; }
  #game .game-tools { display: contents; }
  #game .side-col { display: contents; }
  #game .rp-review { order: -2; display: flex; width: min(100%, 560px); align-self: center; gap: 7px; margin-bottom: 0; }
  #game .rp-coach { width: 100%; box-sizing: border-box; padding: 8px; }
  #game .rp-coach > img { width: 52px; height: 68px; }
  #game .rp-coach-message { font-size: 0.82rem; }
  #game .rp-review-nav { display: flex; width: 100%; }
  #game .rp-review-nav .mini { flex: 1; min-height: 36px; }
  #game .moves { order: -1; width: min(100%, 560px); margin-top: -6px; }
  #game .board-col { order: 0; }
  #game .board-validation { order: 1; width: min(100%, 560px); display: flex; flex-direction: column; gap: 4px; }
  #game .board-controls { order: 2; width: min(100%, 560px); }
  #game .confirm-bar, #game .auto-confirm, #game .actions { width: 100%; }
  #game .chat { order: 4; width: min(100%, 560px); }
  #game .online-switch { order: 5; width: min(100%, 560px); }
  #game .replay-bar { order: 4; width: min(100%, 560px); }
  .moves { max-height: 76px; min-height: 38px; font-size: 0.85rem; padding: 6px; }
  .actions { gap: 5px; }
  .act { padding: 6px 2px; font-size: 0.74rem; }
  .act span { font-size: 1.1rem; }
  .coach-dock { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); width: min(300px, calc(100vw - 20px)); }
  .coach-dock-panel p { max-height: 24dvh; }
  #game .board-wrap.is3d { border-radius: 12px; }
  #game .bar { gap: 5px; }
  #game .terrain-label { max-width: 28vw; font-size: 0.62rem; }
}

@media (max-width: 899px) and (max-height: 700px) {
  #game .board-col { width: min(100%, calc(100dvh - 250px)); }
  #game .player { min-height: 27px; }
  #game .status { min-height: 1.2em; margin-top: 2px; font-size: 0.88rem; }
}

@media (max-width: 999px) {
  .screen .bar { padding-right: 52px; }
  .mobile-menu-toggle { position: fixed; z-index: 70; top: max(8px, env(safe-area-inset-top)); right: 10px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--surface-2); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 1.35rem; }
  body[data-screen="home"] .mobile-menu-toggle { display: none; }
  body[data-screen]:not([data-screen="home"]) #home.active { position: fixed; inset: 0; z-index: 40; display: block; width: auto; min-height: 0; margin: 0; padding: 0; background: transparent; pointer-events: none; }
  body[data-screen]:not([data-screen="home"]) #home .hero,
  body[data-screen]:not([data-screen="home"]) #home .menu { display: none; }
  .mobile-menu-backdrop:not([hidden]) { position: fixed; z-index: 50; inset: 0; display: block; width: 100%; height: 100%; border: 0; padding: 0; background: rgba(0,0,0,0.58); }
  body.mobile-menu-open #home.active { z-index: 60; }
  body.mobile-menu-open[data-screen]:not([data-screen="home"]) #home .menu { position: fixed; z-index: 61; inset: 0 auto 0 0; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; width: min(340px, calc(100vw - 56px)); max-width: none; height: 100dvh; margin: 0; padding: max(64px, calc(52px + env(safe-area-inset-top))) 18px max(18px, env(safe-area-inset-bottom)); overflow-y: auto; border-right: 1px solid var(--surface-2); background: var(--surface); pointer-events: auto; }
  body.mobile-menu-open[data-screen]:not([data-screen="home"]) #home .menu .btn { width: 100%; text-align: left; padding: 11px 14px; font-size: 0.94rem; }
}

/* Accueil accueillant : navigation stable et activités mises en avant. */
#home { justify-content: flex-start; align-items: stretch; gap: 0; }
.home-sidebar { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.home-sidebar .hero { width: 100%; }
.home-sidebar .hero-top { gap: 12px; }
.home-sidebar .brand { gap: 3px; }
.home-sidebar .logo { width: 76px; height: 76px; }
.home-sidebar .hero h1 { font-size: 1.8rem; }
.home-sidebar .player-profile { position: relative; flex-wrap: wrap; }
.home-sidebar .player-profile > div { flex: 1; }
.home-sidebar .player-profile .profile-edit { font-size: .76rem; padding: 6px 8px; }
.home-sidebar .player-profile .player-details { flex: 1 1 100%; min-width: 0; }
.home-sidebar .profile-actions { display: flex; flex: 1 1 100%; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 6px; width: 100%; }
.home-sidebar .profile-actions .profile-edit { flex: 1 1 0; min-width: 0; padding: 7px 5px; text-align: center; white-space: nowrap; font-size: .74rem; }
.home-sidebar .home-rewards { margin-top: 0; }
.home-dashboard { width: min(100%, 960px); margin: 0 auto; padding: 8px 24px 26px; }
.home-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); }
.home-topline strong { color: var(--text); }
.home-settings { width: 40px; height: 40px; border: 1px solid var(--surface-2); border-radius: 13px; background: var(--surface); font-size: 1.1rem; }
.home-welcome { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 205px; padding: 24px 28px; overflow: hidden; border: 1px solid #456d50; border-radius: 24px; background: radial-gradient(ellipse at 80% 10%, rgba(247, 204, 89, .2), transparent 36%), linear-gradient(115deg, #294e39, #1a3529 65%, #314d39); }
.home-welcome::after { content: '♞'; position: absolute; right: 25%; top: -36px; font-size: 180px; color: #fff; opacity: .045; transform: rotate(12deg); pointer-events: none; }
.home-welcome-copy { position: relative; z-index: 1; max-width: 620px; }
.home-kicker { color: #b5e9b7; font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.home-welcome h2 { max-width: 16ch; margin: 7px 0 6px; font-size: clamp(1.6rem, 3.2vw, 2.35rem); line-height: 1.12; }
.home-welcome p { margin: 0 0 15px; color: #d0dfcf; }
.home-adventure-cta { padding: 11px 15px; font-size: .95rem; }
.home-coach-art { z-index: 1; display: flex; flex: none; flex-direction: column; align-items: center; align-self: stretch; justify-content: end; width: 160px; min-height: 158px; margin: -24px -8px -24px 0; }
.home-coach-art img { width: 100%; height: 176px; object-fit: cover; object-position: 50% 22%; border: 2px solid rgba(245, 195, 72, .75); border-bottom: 0; border-radius: 90px 90px 10px 10px; box-shadow: 0 7px 22px #09160e88; }
.home-coach-art span { margin-top: -23px; padding: 4px 9px; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-size: .72rem; font-weight: 800; }
.home-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 21px 0 10px; }
.home-section-heading h2 { margin: 0; font-size: 1.18rem; }
.home-section-heading > span { color: var(--muted); font-size: .8rem; }
.home-activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-activity-card { position: relative; display: flex; min-height: 148px; flex-direction: column; align-items: flex-start; padding: 15px; overflow: hidden; border: 1px solid var(--surface-2); border-radius: 19px; background: var(--surface); color: var(--text); text-align: left; transition: transform .15s ease, border-color .15s ease, filter .15s ease; }
.home-activity-card:hover { transform: translateY(-2px); border-color: var(--accent); filter: brightness(1.08); }
.home-activity-card::after { position: absolute; right: -23px; bottom: -32px; width: 82px; height: 82px; border-radius: 50%; background: var(--activity-color); content: ''; opacity: .13; }
.progress-card { --activity-color: #91db9d; }.learn-card { --activity-color: #7bc8ef; }.play-card { --activity-color: #ff947f; }
.home-card-icon { font-size: 1.75rem; }
.home-activity-card strong { margin: 7px 0 3px; font-size: 1rem; }
.home-activity-card small { max-width: 29ch; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.home-card-arrow { position: absolute; right: 14px; top: 15px; color: var(--muted); font-size: 1.3rem; }
.home-progress-heading { margin-top: 20px; }
.home-progress-card { display: flex; width: 100%; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--surface-2); border-radius: 17px; background: var(--surface); color: inherit; text-align: left; }
.home-progress-card:hover { border-color: var(--accent); }
.home-progress-medal { font-size: 2rem; }
.home-progress-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.home-progress-copy small { color: var(--muted); font-size: .78rem; }
.home-progress-card > .home-card-arrow { position: static; font-size: 1.5rem; }
#home #coach-program { width: 100%; max-width: none; margin-top: 14px; }

@media (min-width: 1000px) {
  :root { --desktop-menu-width: 340px; }
  #home.active { grid-template-columns: var(--desktop-menu-width) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; }
  #home .home-sidebar { grid-column: 1; grid-row: 1; min-height: 0; padding: 18px 16px 16px; overflow-y: auto; border-right: 1px solid var(--surface-2); background: var(--surface); pointer-events: auto; }
  #home .home-sidebar .hero { padding: 0; overflow: visible; background: transparent; }
  #home .home-sidebar .menu { width: 100%; max-width: none; gap: 8px; padding: 0; overflow: visible; border: 0; background: transparent; }
  #home .home-sidebar .menu .btn { text-align: left; padding: 10px 13px; font-size: .9rem; }
  #home .home-sidebar .menu-submenu .btn { padding: 9px 12px; font-size: .84rem; }
  #home .home-dashboard { grid-column: 2; grid-row: 1; width: 100%; max-width: none; max-height: 100vh; margin: 0; padding: 22px clamp(24px, 4vw, 54px) 28px; overflow-y: auto; pointer-events: auto; }
  #home .home-sidebar .player-profile { padding: 10px; }
  #home .home-sidebar .player-profile .profile-edit { font-size: .72rem; }
  body[data-screen]:not([data-screen="home"]) #home .home-dashboard { display: none; }
}
@media (max-width: 999px) {
  #home.active { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 15px; padding-top: max(14px, env(safe-area-inset-top)); }
  #home .home-sidebar { display: contents; }
  #home .home-sidebar .hero { order: -2; width: min(100%, 560px); }
  #home .home-sidebar .hero-top { display: grid; grid-template-columns: 1fr; justify-items: center; }
  #home .home-sidebar .brand { flex-direction: row; gap: 12px; }
  #home .home-sidebar .brand-copy { text-align: left; }
  #home .home-sidebar .logo { width: 60px; height: 60px; }
  #home .home-sidebar .hero h1 { margin: 0; font-size: 1.65rem; }
  #home .home-sidebar .player-profile, #home .home-sidebar .home-rewards { width: 100%; max-width: 560px; }
  #home .home-dashboard { order: -1; width: min(100%, 600px); padding: 0 0 12px; }
  #home .home-welcome { min-height: 180px; padding: 18px; border-radius: 20px; }
  #home .home-coach-art { width: 112px; min-height: 140px; margin: -18px -7px -18px 0; }
  #home .home-coach-art img { height: 151px; }
  #home .home-welcome p { max-width: 34ch; font-size: .88rem; }
  #home .home-activity-grid { gap: 9px; }
  #home .home-activity-card { min-height: 134px; padding: 12px; }
  #home .home-section-heading { margin-top: 16px; }
  #home .home-progress-heading { margin-top: 15px; }
  #home .home-sidebar .menu { order: 0; width: min(100%, 560px); max-width: 560px; gap: 8px; }
  #home .home-sidebar .menu .btn { padding: 10px 13px; font-size: .9rem; }
  body[data-screen]:not([data-screen="home"]) #home .home-sidebar { display: contents; }
  body[data-screen]:not([data-screen="home"]) #home .home-dashboard { display: none; }
}
@media (max-width: 480px) {
  #home .home-welcome { gap: 5px; }
  #home .home-coach-art { width: 88px; }
  #home .home-coach-art img { height: 126px; }
  #home .home-welcome h2 { font-size: 1.42rem; }
  #home .home-welcome p { font-size: .8rem; }
  #home .home-adventure-cta { padding: 9px 10px; font-size: .82rem; }
  #home .home-activity-grid { grid-template-columns: 1fr 1fr; }
  #home .home-activity-card:last-child { grid-column: 1 / -1; min-height: 112px; }
  #home .home-section-heading > span { font-size: .7rem; }
}

/* Jardin tropical et réserve de riz de l'accueil. */
.home-tropical-welcome { background: radial-gradient(ellipse at 72% 95%, rgba(156, 202, 82, .26), transparent 37%), linear-gradient(112deg, #315936, #24523b 57%, #194a3c); }
.home-tropical-welcome .home-kicker { color: #c8f2a6; }
/* fond d'écran du thème choisi, assombri à gauche pour garder le texte lisible */
.home-welcome[data-theme-bg] { background-size: 100% auto; background-position: center top; background-repeat: no-repeat; background-color: #1b2a22; } /* image à la largeur du cadre, proportions gardées, calée en haut */
.home-welcome[data-theme-bg="ocean"] { background-image: linear-gradient(100deg, rgba(4,28,40,.86) 0%, rgba(4,28,40,.55) 48%, rgba(4,28,40,.05) 85%), url(fond_ecran/ocean.webp); }
.home-welcome[data-theme-bg="plants"] { background-image: linear-gradient(100deg, rgba(10,30,14,.86) 0%, rgba(10,30,14,.55) 48%, rgba(10,30,14,.05) 85%), url(fond_ecran/plants.webp); }
.home-welcome[data-theme-bg="modern"] { background-image: linear-gradient(100deg, rgba(14,16,22,.88) 0%, rgba(14,16,22,.58) 48%, rgba(14,16,22,.08) 85%), url(fond_ecran/modern.webp); }
.home-welcome[data-theme-bg="land"] { background-image: linear-gradient(100deg, rgba(12,26,10,.86) 0%, rgba(12,26,10,.55) 48%, rgba(12,26,10,.05) 85%), url(fond_ecran/land.webp); background-position: center top; }
.home-welcome[data-theme-bg="birds"] { background-image: linear-gradient(100deg, rgba(8,24,36,.86) 0%, rgba(8,24,36,.55) 48%, rgba(8,24,36,.05) 85%), url(fond_ecran/birds.webp); background-position: center top; }
.home-welcome[data-theme-bg="ninjas"] { background-image: linear-gradient(100deg, rgba(10,8,22,.78) 0%, rgba(10,8,22,.45) 48%, rgba(10,8,22,0) 85%), url(fond_ecran/ninjas.webp); background-position: center top; }
.home-welcome[data-theme-bg="ancient"] { background-image: linear-gradient(100deg, rgba(30,14,6,.86) 0%, rgba(30,14,6,.55) 48%, rgba(30,14,6,.05) 85%), url(fond_ecran/ancient.webp); background-position: center top; }
.home-welcome[data-theme-bg]::after { display: none; }
.home-garden-heading { margin-top: 22px; }
.home-tropical-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(235px, .75fr); gap: 12px; }
.home-garden-card { position: relative; display: flex; min-height: 242px; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 14px; border: 1px solid #66895a; border-radius: 20px; color: #183222; background: linear-gradient(180deg, #8bd7ce 0%, #b7e5a0 51%, #89a64e 52%, #486b3c 100%); isolation: isolate; }
.home-garden-sky { position: absolute; inset: 0 0 48% 0; z-index: -1; overflow: hidden; }
.home-garden-sun { position: absolute; top: 12px; right: 15%; font-size: 29px; filter: drop-shadow(0 0 13px #fff2a6); }
.home-garden-cloud { position: absolute; font-size: 24px; opacity: .8; }
.cloud-one { top: 25px; left: 34%; }.cloud-two { top: 55px; right: 38%; font-size: 18px; }
.home-garden-ground { position: absolute; z-index: -1; right: -7%; bottom: -67px; left: -6%; height: 135px; border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 0%, #77944b, #456a3b 75%); box-shadow: inset 0 8px 0 rgba(208, 224, 125, .3); }
.home-garden-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.home-collection-tabs { display: flex; gap: 8px; margin: 0 0 10px; padding: 2px 2px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
/* carrousel des thèmes : une vignette illustrée par thème */
.home-collection-tab { flex: 0 0 auto; width: 118px; height: 72px; padding: 0; display: flex; align-items: flex-end; border: 2px solid rgba(255,255,255,.4); border-radius: 12px; background: #2f5a37 center top / cover no-repeat; color: #fff; font-size: .68rem; font-weight: 800; cursor: pointer; scroll-snap-align: center; overflow: hidden; transition: transform .15s, border-color .15s; }
.home-collection-tab span { width: 100%; padding: 14px 6px 5px; text-align: left; line-height: 1.15; background: linear-gradient(transparent, rgba(0,0,0,.75)); text-shadow: 0 1px 2px #000; }
.home-collection-tab.selected { border-color: #ffe58e; transform: scale(1.04); box-shadow: 0 0 0 2px rgba(255,229,142,.45), 0 4px 12px rgba(0,0,0,.3); }
.home-collection-tab.locked { opacity: .6; cursor: default; filter: grayscale(.6); }
.home-garden-intro h3 { margin: 0 0 2px; font-size: 1.16rem; }
.home-garden-intro p { margin: 0; color: #344b34; font-size: .77rem; }
.home-grade-badge { flex: none; padding: 6px 9px; border: 1px solid rgba(68, 92, 49, .16); border-radius: 99px; background: #fff8dc; color: #384923; font-size: .76rem; font-weight: 900; }
.home-garden-plants { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; gap: 6px; margin-top: auto; padding-top: 10px; }
.home-garden-plant { display: flex; min-width: 0; min-height: 82px; flex-direction: column; align-items: center; justify-content: end; gap: 3px; padding: 6px 3px; border-radius: 13px 13px 8px 8px; background: rgba(30, 72, 40, .28); color: #fff9e8; text-align: center; text-shadow: 0 1px 3px #203b24; }
.home-garden-plant .plant-icon { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.05; filter: drop-shadow(0 3px 2px rgba(35, 52, 25, .4)); }
.home-garden-plant small { max-width: 100%; overflow: hidden; font-size: .62rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.home-garden-plant.locked { opacity: .66; filter: grayscale(.55); background: rgba(32, 49, 30, .19); }
.home-garden-plant.baobab-plant.unlocked { min-height: 92px; background: rgba(255, 219, 114, .3); box-shadow: inset 0 0 0 1px rgba(255, 245, 195, .65); }
.home-garden-plant.baobab-plant.unlocked .plant-icon { font-size: clamp(2.4rem, 4vw, 3.2rem); }
.home-garden-plant.whale-plant.unlocked { min-height: 92px; background: rgba(109,218,233,.34); box-shadow: inset 0 0 0 1px rgba(214,250,255,.65); }
.home-garden-plant.whale-plant.unlocked .plant-icon { font-size: clamp(2.4rem, 4vw, 3.2rem); }
.home-garden-next { margin-top: 8px; color: #f8f5dd; font-size: .71rem; font-weight: 700; text-shadow: 0 1px 3px #203b24; }
.home-rice-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; min-width: 0; padding: 17px; border: 1px solid var(--surface-2); border-radius: 20px; background: var(--surface); }
.home-rice-top { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; }
.home-rice-kicker { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.home-rice-top h3 { margin: 2px 0 0; font-size: 1rem; }
.home-rice-sack { font-size: 1.8rem; }
.home-rice-amount { color: #d3a332; font-size: clamp(1.15rem, 2.4vw, 1.55rem); line-height: 1.2; }
:root[data-color-theme="light"] .home-rice-amount { color: #8c6509; }
.home-rice-conversion { min-height: 1.1em; color: var(--muted); font-size: .78rem; }
.home-rice-progress { width: 100%; height: 9px; margin-top: 2px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.home-rice-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #83d798, #f2d876); transition: width .25s ease; }
.home-rice-next { min-height: 2.4em; color: var(--muted); font-size: .72rem; line-height: 1.25; }
.home-rice-shop { width: 100%; padding: 9px 10px; font-size: .82rem; }
.home-rice-shop:hover { border-color: var(--accent); }
.home-progress-card { cursor: pointer; }
@media(max-width:999px) { #home .home-tropical-layout { width: 100%; grid-template-columns: minmax(0, 1fr) minmax(220px, .72fr); } }
@media(max-width:700px) { #home .home-tropical-layout { grid-template-columns: 1fr; } #home .home-garden-card { min-height: 225px; } #home .home-rice-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; } #home .home-rice-top, #home .home-rice-amount, #home .home-rice-conversion, #home .home-rice-progress, #home .home-rice-next { grid-column: 1; } #home .home-rice-sack { grid-column: 2; grid-row: 1; } #home .home-rice-shop { grid-column: 2; grid-row: 2 / span 4; width: auto; } }
@media(max-width:480px) { #home .home-garden-card { min-height: 212px; padding: 11px; } #home .home-garden-plants { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; } #home .home-garden-plant { min-height: 72px; padding: 5px 1px; } #home .home-garden-plant small { font-size: .54rem; } #home .home-rice-card { display: flex; } #home .home-rice-shop { width: 100%; } }
.minimap b { font-size: min(88cqi, 38px); line-height: 1; font-weight: 400; pointer-events: none; }
.minimap b.w { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 2px #000; }
.minimap b.k { color: #1b1b1f; text-shadow: 0 0 1px #fff; }

.level-grid button small { display: block; font-size: 0.68rem; font-weight: 500; opacity: 0.75; }
.data-actions { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 24px; }

/* Comme un champion */
.champ-card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.champ-head { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; }
.champ-head .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.champ-head small { display: block; color: var(--muted); font-size: 0.8rem; }
.champ-tag { margin: 10px 0 2px; font-weight: 600; }
.champ-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.champ-actions .btn { flex: 1 1 140px; }
.player-profile .player-style { color: var(--text); font-weight: 600; font-size: 0.85rem; margin-top: 2px; }
.player-profile .player-style[hidden] { display: none; }
/* Aperçu 2D déplacé par le joueur */
.minimap.user-placed { right: auto; }
.minimap.dragging, .minimap.dragging button { cursor: grabbing; }
.minimap.dragging { box-shadow: 0 8px 22px rgba(0,0,0,0.55); }
/* Promotion d'un pion noir : fenêtre blanche pour bien voir les pièces noires */
.sheet.light-sheet { background: #ffffff; color: #1b1b1f; }
.sheet.light-sheet .promo-choices button { background: #f1f1ee !important; box-shadow: inset 0 0 0 1px #d8d8d2; }
.sheet.light-sheet .btn.ghost { color: #1b1b1f; border-color: #c9c9c4; }

:root[data-color-theme="light"] .prose p,
:root[data-color-theme="light"] .prose li { color: #34453a; }
:root[data-color-theme="light"] .theme-training-choice.mastery-good .theme-mastery,
:root[data-color-theme="light"] .problem-theme-card.mastery-good .theme-mastery,
:root[data-color-theme="light"] .sync-status.synced,
:root[data-color-theme="light"] .status.good { color: #2e7742; }
:root[data-color-theme="light"] .theme-training-choice.mastery-poor .theme-mastery,
:root[data-color-theme="light"] .problem-theme-card.mastery-poor .theme-mastery,
:root[data-color-theme="light"] .status.bad { color: #a33a31; }
:root[data-color-theme="light"] .btn.ghost { color: var(--text); }

/* Photos des champions */
.coach img.photo { width: 64px; height: 80px; object-fit: cover; border-radius: 12px; filter: none; box-shadow: 0 3px 8px rgba(0,0,0,0.4); }
.coach-dock-img { width: 64px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); }
.coach-dock-portrait { align-items: flex-start; }
.player-photo { width: 26px; height: 30px; object-fit: cover; border-radius: 7px; vertical-align: middle; margin-right: 8px; }
.champ-head .champ-photo { width: 44px; height: 52px; object-fit: cover; border-radius: 12px; }
.photo-credit { color: var(--muted); font-size: 0.7rem; margin: 6px 0 0; }
.photo-credit a { color: inherit; }

/* Construire une position */
.editor { width: min(680px, 100%); }
.ed-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.ed-board-column, .ed-controls-column { min-width: 0; }
.editor .ed-palette { display: flex; gap: 6px; margin: 8px 0; }
.ed-tool { flex: 1; min-width: 0; aspect-ratio: 1; border: 2px solid transparent; border-radius: 10px; background: var(--surface); font-size: 1.3rem; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--text); }
.ed-tool .pc { font-size: clamp(22px, 6vw, 34px); }
.ed-tool.on { border-color: var(--accent, #e9b949); background: var(--surface-2); }
.ed-board-wrap { width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,0.35); margin: 10px 0; }
.ed-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; user-select: none; }
.ed-board .sq { border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer; }
.ed-board .pc { font-size: clamp(26px, 8vw, 50px); pointer-events: none; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-actions .btn { flex: 1; min-width: 0; }
.ed-seg { display: flex; background: var(--surface); border-radius: var(--radius); padding: 4px; gap: 4px; }
.ed-seg button { flex: 1; border: 0; background: none; padding: 10px 6px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.ed-seg button.on { background: var(--surface-2); color: var(--text); }
.ed-castles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.ed-check { display: flex; align-items: center; gap: 8px; }
.ed-check.off { opacity: 0.45; }
.ed-error { color: #ff8a7a; min-height: 1.2em; margin: 14px 0 0; }

@media (min-width: 900px) {
  #editor-body.editor { width: min(1180px, 100%); max-width: none; }
  .ed-layout { grid-template-columns: minmax(320px, 1.7fr) minmax(300px, 0.85fr); gap: clamp(16px, 2vw, 28px); }
}

/* Apprendre */
.train-h { font-size: 1rem; margin: 22px 0 6px; }
.sq.tutorial-star::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; color: #ffd54a; font-size: clamp(18px, 5vw, 34px); line-height: 1; text-shadow: 0 1px 5px #101714, 0 0 3px #101714; pointer-events: none; }

/* Maître Sissa et sa légende */
.coach img.photo, .coach-dock-img { object-position: 50% 12%; }
.legend-link { background: none; border: 0; padding: 0; color: var(--accent, #e9b949); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.legend-figure { margin: 0 0 12px; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.legend-figure { background: #120d08; }
.legend-figure img { display: block; width: 100%; max-height: 56vh; object-fit: contain; }
.legend-board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; width: min(100%, 52vh); margin: 0 auto; }
.legend-board span { display: flex; align-items: center; justify-content: center; font-size: clamp(8px, 2vw, 13px); font-weight: 700; color: #3a2a14; }
.legend-board .l { background: #f1dfb4; }
.legend-board .d { background: #b8874f; color: #fff6e0; }
.legend-coach .bubble p { margin: 4px 0 0; }

/* En ligne */
.menu-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 8px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 0.75rem; line-height: 18px; text-align: center; }
#online-body .replay-row { display: flex; gap: 8px; align-items: stretch; }
#online-body .replay-row .replay-item { flex: 1; }
.player-profile .profile-edit + .profile-edit { margin-top: 6px; }
.legend-figure img.wide { width: 100%; height: auto; max-height: none; object-fit: contain; }

/* Tournois */
.tour-code { letter-spacing: 0.15em; font-size: 1.1rem; color: var(--accent, #e9b949); }
.tour-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 0.92rem; }
.tour-table th, .tour-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
.tour-table th { color: var(--muted); font-weight: 600; }
.tour-table tr.me td { color: var(--accent, #e9b949); font-weight: 700; }
.tour-scroll { overflow-x: auto; }
.tour-table td.c, .tour-table th.c { text-align: center; white-space: nowrap; }
.tour-table td.x { color: var(--muted); }

/* Photo de profil et parties de tournoi à regarder */
.profile-photo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.profile-photo.big { width: 84px; height: 84px; }
.photo-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.tour-game { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.tour-watch { padding: 4px 10px; font-size: 0.78rem; flex: none; }
.player-profile { flex-wrap: wrap; }
.player-profile > div { flex: 1 1 150px; }
.player-profile .profile-photo { width: 44px; height: 44px; }

/* Profil et grades */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.profile-head div { display: flex; flex-direction: column; gap: 2px; }
.profile-head b { font-size: 1.2rem; }
.profile-head span { color: var(--accent, #e9b949); font-weight: 650; }
.profile-photo.placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 2.2rem; }
.profile-badges-line { font-size: 1.2rem; letter-spacing: 2px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--surface); opacity: 0.38; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; box-shadow: inset 0 0 0 2px rgba(233,185,73,0.55); }
.badge-icon { font-size: 1.7rem; line-height: 1.2; }
.badge b { font-size: 0.85rem; }
.badge small { color: var(--muted); font-size: 0.72rem; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.stat-card { background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.stat-card h4 { margin: 0 0 6px; font-size: 0.95rem; }
.stat-card div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.88rem; }
.stat-card span { color: var(--muted); }
.tour-table a { color: inherit; text-decoration: underline dotted; }

/* Récompenses : grades nature, grains de riz, quêtes, boutique */
.home-rewards { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--surface); color: inherit; font: inherit; font-size: 0.85rem; cursor: pointer; text-align: left; }
.home-rewards:hover { filter: brightness(1.12); }
.lvl-badge { background: var(--accent, #e9b949); color: #1b1b1b; font-weight: 750; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.lvl-badge.big { font-size: 1.05rem; padding: 6px 14px; }
.xp-bar { flex: 1; min-width: 50px; height: 7px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #e9b949, #ffd97a); }
.player-title { color: var(--accent, #e9b949); font-style: italic; font-size: 0.85rem; }
.reward-pops { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 999; pointer-events: none; }
.reward-pop { background: rgba(28,32,26,0.94); color: #ffe39a; border: 1px solid rgba(233,185,73,0.6); padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: 0.9rem; animation: rewardPop 3s ease forwards; }
.reward-pop.big { font-size: 1.05rem; background: linear-gradient(90deg, #8a5d12, #c9952d); color: #fff; animation-duration: 4.2s; }
@keyframes rewardPop { 0% { opacity: 0; transform: translateY(-12px) scale(0.9); } 10% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.shop-head { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.shop-xp { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.shop-xp small { color: var(--muted); }
.shop-rice { max-width: 42%; font-size: 1.1rem; font-weight: 750; text-align: right; }
.shop-welcome { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; margin: 4px 0 14px; padding: clamp(16px,3vw,26px); border: 1px solid rgba(233,185,73,.25); border-radius: 20px; background: radial-gradient(ellipse at 85% 0%, rgba(233,185,73,.2), transparent 45%), linear-gradient(125deg, #263d31, #1d2a24 70%); box-shadow: 0 10px 28px rgba(0,0,0,.15); }
:root[data-color-theme="light"] .shop-welcome { background: radial-gradient(ellipse at 85% 0%, rgba(233,185,73,.25), transparent 45%), linear-gradient(125deg, #e6f1e4, #fff9e9 78%); }
.shop-welcome-copy { min-width: 0; }
.shop-kicker { color: var(--accent); font-size: .7rem; font-weight: 850; letter-spacing: .12em; }
.shop-welcome h3 { margin: 3px 0 4px; font-size: clamp(1.3rem,3vw,1.8rem); line-height: 1.15; }
.shop-welcome p { max-width: 55ch; margin: 0; color: var(--muted); font-size: .88rem; }
.shop-welcome-wallet { min-width: 148px; padding: 12px 15px; border: 1px solid rgba(233,185,73,.3); border-radius: 16px; background: rgba(10,18,14,.24); text-align: center; }
.shop-welcome-wallet span,.shop-welcome-wallet small { display: block; color: var(--muted); font-size: .76rem; }
.shop-welcome-wallet strong { display: block; margin: 2px 0; color: var(--accent); font-size: 1.2rem; }
.shop-head { margin: 8px 0 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface); }
.quest-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.quest { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--surface-2); border-radius: 14px; background: linear-gradient(145deg,var(--surface),color-mix(in srgb,var(--surface) 82%,var(--accent))); font-size: .86rem; }
.quest-copy { display: grid; min-width: 0; flex: 1; gap: 5px; }
.quest-copy span { font-weight: 650; }
.quest-copy small { color: var(--muted); font-size: .72rem; }
.quest strong { flex: none; color: var(--accent); white-space: nowrap; font-size: .8rem; }
.quest-progress { display: block; height: 5px; overflow: hidden; border-radius: 9px; background: var(--surface-2); }
.quest-progress b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#76c883,var(--accent)); transition: width .35s ease; }
.quest.done { border-color: rgba(118,200,131,.45); }
.quest.chest { border-color: rgba(233,185,73,.45); background: linear-gradient(135deg,rgba(233,185,73,.12),var(--surface)); }
.shop-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 24px; }
.shop-section-title small { color: var(--muted); font-size: .74rem; font-weight: 500; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 11px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; padding: 12px 10px; border: 1px solid var(--surface-2); border-radius: 16px; background: linear-gradient(155deg,var(--surface),color-mix(in srgb,var(--surface) 90%,var(--accent))); text-align: center; transition: transform .16s ease,border-color .16s ease,box-shadow .16s ease; }
.shop-item:hover { transform: translateY(-2px); border-color: rgba(233,185,73,.55); box-shadow: 0 8px 20px rgba(0,0,0,.16); }
.shop-item.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent),0 0 18px rgba(233,185,73,.12); }
.shop-item.owned { border-color: rgba(118,200,131,.36); }
.shop-item.locked { opacity: .78; }
.shop-item-preview { display: grid; place-items: center; width: 100%; min-height: 62px; border-radius: 12px; background: color-mix(in srgb,var(--surface-2) 75%,transparent); }
.shop-item > b { min-height: 2.7em; display: grid; place-items: center; line-height: 1.3; }
.shop-item-state { display: grid; place-items: center; min-height: 1.5em; color: var(--muted); font-size: .7rem; line-height: 1.2; }
.shop-item-state.equipped { color: var(--accent); font-weight: 750; }
.shop-item.owned .shop-item-state { color: #79cf8e; }
.shop-item .btn { width: 100%; padding: 7px; min-height: 0; }
.shop-tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 22px 0 12px; padding: 7px 0; background: var(--bg); }
.shop-tab { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; padding: 10px 12px; border: 1px solid var(--surface-2); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 700; text-align: left; }
.shop-tab > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-tab small { flex: none; color: var(--muted); font-size: .7rem; }
.shop-tab.active { border-color: var(--accent); background: linear-gradient(135deg,rgba(233,185,73,.2),var(--surface)); box-shadow: inset 0 0 0 1px rgba(233,185,73,.24); }
.shop-tab.active small { color: var(--accent); }
.shop-equipped { display: flex; align-items: center; gap: 11px; min-height: 68px; margin: 0 0 14px; padding: 8px 12px; border: 1px solid var(--surface-2); border-radius: 14px; background: var(--surface); }
.shop-equipped-caption { color: var(--muted); font-size: .73rem; }
.shop-equipped-preview { display: grid; flex: none; place-items: center; width: 68px; height: 52px; overflow: hidden; border-radius: 9px; background: var(--surface-2); }
.shop-equipped-preview .shop-board { width: 48px; height: 48px; }
.shop-equipped-preview .shop-frame { width: 42px; height: 42px; }
.shop-equipped-preview .shop-title-art { width: 68px; height: 52px; border-radius: 9px; }
.shop-equipped-preview .shop-title-art > b { font-size: 2.2rem; }
.shop-equipped > b { margin-left: auto; text-align: right; }
.shop-no-title { color: var(--muted); font-size: 1.8rem; }
.shop-title-path { margin: 8px 0 14px; padding: 12px 14px; border: 1px solid var(--surface-2); border-radius: 14px; background: var(--surface); }
.shop-title-path > b { font-size: .82rem; }
.shop-title-path > div { position: relative; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; margin-top: 7px; }
.shop-title-path > div::before { content: ""; position: absolute; top: 17px; left: 10%; right: 10%; height: 3px; border-radius: 4px; background: var(--surface-2); }
.shop-title-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.shop-title-step i { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--surface-2); border-radius: 50%; background: var(--bg); font-size: 1.15rem; font-style: normal; }
.shop-title-step.reached i { border-color: #79cf8e; background: rgba(91,175,108,.17); }
.shop-title-step.current i { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,185,73,.18); }
.shop-title-step small { font-size: .65rem; }
.shop-tier-details { margin-top: 18px; padding: 10px 12px; border: 1px solid var(--surface-2); border-radius: 12px; background: var(--surface); }
.shop-tier-details summary { cursor: pointer; font-weight: 700; }
.shop-tier-details .train-h { margin-top: 12px; }
.shop-board { display: grid; grid-template-columns: 1fr 1fr; width: 46px; height: 46px; border-radius: 6px; overflow: hidden; }
.shop-title { font-style: italic; color: var(--accent, #e9b949); min-height: 46px; display: flex; align-items: center; }
.shop-title-art { position: relative; isolation: isolate; display: grid; place-items: center; width: 100%; height: 104px; overflow: hidden; border-radius: 12px; }
.shop-title-art::before { content: ""; position: absolute; z-index: -1; left: -8%; right: -8%; bottom: -35%; height: 72%; border-radius: 50% 50% 0 0; background: var(--title-ground,#408052); }
.shop-title-art::after { content: ""; position: absolute; z-index: -1; width: 42px; height: 42px; top: 9px; right: 14px; border-radius: 50%; background: rgba(255,240,177,.68); filter: blur(1px); }
.shop-title-art > i { position: absolute; z-index: -1; left: 13%; bottom: 23%; width: 74%; height: 1px; background: rgba(255,255,255,.38); box-shadow: 0 7px rgba(255,255,255,.2),0 14px rgba(255,255,255,.13); }
.shop-title-art > b { z-index: 1; font: 3.6rem/1 system-ui,sans-serif; filter: drop-shadow(0 5px 4px rgba(12,23,20,.38)); transform: translateY(2px); }
.shop-title-art > small { position: absolute; right: 7px; bottom: 6px; color: rgba(255,255,255,.88); font-size: .62rem; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.65); }
.shop-title-art.plants { --title-ground:#3b8d4d; background: linear-gradient(#9ad9ad 0%,#d8f1b5 67%,#8dc978 100%); }
.shop-title-art.land { --title-ground:#527a38; background: linear-gradient(#9dd8e7 0%,#f2d89b 66%,#a3bb67 100%); }
.shop-title-art.birds { --title-ground:#34845b; background: linear-gradient(#61bde3 0%,#c2e9da 62%,#71b879 100%); }
.shop-title-art.ocean { --title-ground:#087b9a; background: linear-gradient(#83dfdf 0%,#38b8c9 52%,#177baf 100%); }
.shop-title-art.ocean > i { bottom: 28%; transform: rotate(-4deg); box-shadow: 0 8px rgba(255,255,255,.26),0 16px rgba(255,255,255,.16); }
.shop-title-art.ancient { --title-ground:#a47a45; background: linear-gradient(#f6d79a 0%,#e9be7c 62%,#b98a52 100%); }
.shop-title-art.modern { --title-ground:#5d6b4a; background: linear-gradient(#a9b8c2 0%,#c9c6a5 62%,#7d8a5f 100%); }
.shop-title-art.ninjas { --title-ground:#473a61; background: radial-gradient(ellipse at 75% 20%,#8765a4 0%,transparent 37%),linear-gradient(#202341 0%,#484067 65%,#252a3e 100%); }
.shop-title-art.ninjas::after { width: 54px; height: 54px; background: rgba(242,187,76,.5); }
.shop-frame { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; background: var(--surface-2); font-size: 1.4rem; }
#shop #shop-body { width: min(960px,100%); max-width: none; margin: 0 auto; }
#shop .bar { width: min(960px,100%); margin: 0 auto 10px; }
@media (max-width: 520px) { .shop-welcome { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 14px; } .shop-welcome-wallet { min-width: 112px; padding: 10px; } .shop-welcome-wallet strong { font-size: 1rem; } .quest-list { grid-template-columns: 1fr; } .shop-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; } .shop-item { padding: 10px 8px; } .shop-tab { flex-direction: column; align-items: center; justify-content: center; padding: 9px 5px; text-align: center; } .shop-tab > span { max-width: 100%; } .shop-equipped { gap: 7px; padding: 8px; } .shop-equipped > b { font-size: .82rem; } }
.profile-shop { width: 100%; margin-bottom: 8px; }
.profile-photo.frame-bronze { box-shadow: 0 0 0 3px #b0793f; }
.profile-photo.frame-argent { box-shadow: 0 0 0 3px #c9d0d8, 0 0 8px rgba(220,230,240,0.5); }
.profile-photo.frame-or { box-shadow: 0 0 0 3px #e9b949, 0 0 12px rgba(233,185,73,0.7); }
.profile-photo.frame-feu { box-shadow: 0 0 0 3px #ff7a1a, 0 0 14px #ff4d00; animation: frameFire 1.4s ease-in-out infinite alternate; }
@keyframes frameFire { from { box-shadow: 0 0 0 3px #ff7a1a, 0 0 10px #ff4d00; } to { box-shadow: 0 0 0 3px #ffc23d, 0 0 20px #ff6a00; } }

/* Joueurs et chat */
.on-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #6b6f6a; margin-right: 7px; vertical-align: middle; }
.on-dot.on { background: #4cd07d; box-shadow: 0 0 6px #4cd07d; }
.players-tools { display: flex; gap: 8px; margin-top: 10px; }
.players-tools input { flex: 1; margin: 0; }
.player-row[hidden] { display: none; }
.player-row .btn.ghost { min-width: 46px; }
.chat { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 8px; border-radius: 12px; background: var(--surface); }
.chat[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; }
.chat-log { max-height: 180px; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.chat-msg { padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.05); word-break: break-word; }
.chat-msg.me { background: rgba(233,185,73,0.14); }
.chat-msg b { color: var(--accent, #e9b949); margin-right: 4px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.25); color: inherit; font: inherit; }
.chat-form .btn { min-height: 0; padding: 6px 14px; }

/* Face-à-face */
.h2h-total { display: flex; gap: 14px; font-weight: 700; margin: 4px 0 8px; }
.h2h-table td.win, .h2h-total .win { color: #4cd07d; }
.h2h-table td.loss, .h2h-total .loss { color: #e8705f; }
.h2h-table .mini { padding: 3px 8px; }

/* Tournois : menu par rubrique */
.tour-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tour-menu-btn { display: flex; align-items: center; gap: 10px; padding: 16px 14px; text-align: left; }
.tour-menu-btn b { flex: 1; }
.tour-menu-icon { font-size: 1.4rem; }
.tour-menu-count { background: var(--accent, #e9b949); color: #1b1b1b; border-radius: 999px; padding: 1px 9px; font-weight: 750; font-size: 0.85rem; }

.tour-menu-sub { display: block; font-weight: 500; font-size: 0.75rem; color: var(--muted); }
.tour-menu-count.hot { background: #e8705f; color: #fff; }

.pgn-preview { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 0.8rem; background: rgba(0,0,0,0.25); padding: 10px; border-radius: 8px; user-select: text; }

#game-actions { grid-template-columns: repeat(6, 1fr); }

/* Écran « Reprendre » */
.welcome-list { display: flex; flex-direction: column; gap: 8px; }
.welcome-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; }
.welcome-card.hot { box-shadow: inset 0 0 0 2px rgba(233,185,73,0.6); }
.welcome-icon { font-size: 1.6rem; }
.welcome-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.welcome-text small { color: var(--muted); font-weight: 500; }
.welcome-go { color: var(--accent, #e9b949); font-weight: 700; white-space: nowrap; }
.welcome-actions { display: flex; gap: 8px; margin: 4px 0 10px; }
.welcome-actions .btn { flex: 1; }

/* Suppression du compte */
.danger-zone { margin-top: 18px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(232,112,95,0.45); }
.danger-zone summary { cursor: pointer; color: #e8705f; font-weight: 650; }
.btn.danger { background: #b9443a; color: #fff; }

/* Mode administrateur : pas de jeu */
body.admin-mode #home-menu > :not(#btn-admin):not(#btn-settings):not(#btn-about),
body.admin-mode #home-rewards, body.admin-mode #coach-program, body.admin-mode #btn-profile, body.admin-mode #btn-player-name { display: none !important; }
.admin-table td { font-size: 0.85rem; }
.admin-table tr.banned td { opacity: 0.55; }
.admin-actions { display: flex; gap: 4px; }
.mini.danger { color: #e8705f; }

/* comptes inactifs depuis au moins un an */
.admin-table tr.inactive td { color: #e8705f; background: rgba(232,112,95,0.10); }
.admin-table tr.inactive a { color: #e8705f; }

/* logo Ata Wawé (image carrée aux coins arrondis) */
.logo { border-radius: 22%; object-fit: cover; }

/* Parties en différé : passer d'une partie à l'autre */
.online-switch { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 8px; border-radius: 12px; background: var(--surface); }
.online-switch[hidden] { display: none; }
.switch-game { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; min-height: 0; text-align: left; }
.switch-game small { color: var(--muted); }
.switch-game.hot { box-shadow: inset 0 0 0 2px rgba(233,185,73,0.6); }
.switch-game.hot small { color: var(--accent, #e9b949); font-weight: 650; }

/* Validation du coup (parties en ligne en différé) */
.confirm-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; margin: 6px 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 2px rgba(233,185,73,0.6); }
.confirm-bar[hidden], .auto-confirm[hidden] { display: none; }
.confirm-bar span { flex: 1; font-weight: 650; }
.confirm-bar .btn { min-height: 0; padding: 7px 12px; }
.auto-confirm { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); margin: 4px 0; }

/* Paliers par mode et grade */
.tier-list { display: flex; flex-direction: column; gap: 6px; }
.tier-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--surface); }
.tier-icon { font-size: 1.4rem; }
.tier-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tier-main small { color: var(--muted); }
.tier-medals i { font-style: normal; opacity: 0.25; filter: grayscale(1); margin-left: 2px; }
.tier-medals i.on { opacity: 1; filter: none; }
.grade-line { color: var(--text, #fff) !important; font-weight: 650; }

/* Programme personnalisé : rappel des réglages d'analyse */
.program-prefs { display: block; width: 100%; margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--surface-2); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; }
.program-prefs:hover { color: inherit; border-color: var(--accent, #e9b949); }

/* Classement du défi du jour et de la saison */
.daily-board { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.daily-board li { display: grid; grid-template-columns: 2.2em 1fr auto 3em; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(127,127,127,.12); }
.daily-board li.me { outline: 2px solid #e8b84a; }
.daily-board li small { opacity: .7; }
.daily-board li strong { text-align: right; }
#daily-board-box .train-h { margin-top: 16px; }
#daily-board-box .train-h small { display: block; margin-top: 2px; font-weight: 400; }
.opt-select { width: 100%; max-width: 320px; padding: 8px 10px; border: 1px solid var(--surface-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
body.recording-video #rp-video { background: #c62828; color: #fff; }
.home-season { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; background: rgba(255,229,142,.92); color: #3b2f12; font-size: .72rem; font-weight: 700; }
.home-season span { flex: 1 1 180px; }
.home-season .btn { padding: 4px 10px; min-height: 0; font-size: .72rem; }
.home-season:empty { display: none; }
.club-form { display: flex; gap: 8px; margin: 0 0 12px; }
.club-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--surface-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
#club-code { text-transform: uppercase; letter-spacing: .15em; }
.club-table td:nth-child(n+2), .club-table th:nth-child(n+2) { text-align: center; }
.club-kick { padding: 2px 8px; min-height: 0; }
/* Tournoi en réel */
.otb-input { width: 100%; padding: 9px 11px; border: 1px solid var(--surface-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; margin-bottom: 6px; }
textarea.otb-input { resize: vertical; line-height: 1.5; }
.otb-small { max-width: 110px; }
.otb-tabs { margin: 8px 0 12px; }
.otb-no { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 4px; border-radius: 6px; background: var(--surface-2); font-size: .78em; font-weight: 800; }
.otb-tables { display: grid; gap: 8px; }
.otb-table { background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.otb-table.bye { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; opacity: .85; }
.otb-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.otb-match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.otb-match.board { grid-template-columns: 1fr auto 1fr auto; padding: 4px 0; border-top: 1px solid rgba(127,127,127,.15); font-size: .9rem; }
.otb-match .otb-side:last-of-type { text-align: right; }
.otb-board { opacity: .6; }
.otb-res { display: inline-flex; gap: 4px; }
.otb-res button { min-width: 44px; padding: 7px 6px; border: 1px solid var(--surface-2); border-radius: 8px; background: transparent; color: var(--text); font-weight: 800; cursor: pointer; }
.otb-res button.on { background: var(--accent, #e8b84a); border-color: transparent; color: #241b05; }
.otb-adv { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: .9rem; }
.otb-out { opacity: .55; }
.otb-person { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.otb-person .btn { margin-left: auto; padding: 4px 10px; min-height: 0; }
.otb-tools { flex-wrap: wrap; }
.otb-link { margin-top: 10px; }
.otb-podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; align-items: end; margin: 6px 0 14px; text-align: center; }
.otb-podium div { background: var(--surface); border-radius: 12px; padding: 12px 6px; display: grid; gap: 2px; }
.otb-podium .p1 { order: 2; padding-top: 22px; } .otb-podium .p2 { order: 1; } .otb-podium .p3 { order: 3; }
.otb-podium span { font-size: 1.8rem; }
.otb-big { position: fixed; inset: 0; z-index: 9999; background: #0d1512; color: #fff; padding: 4vh 4vw; overflow: auto; font-size: clamp(18px, 2.6vw, 34px); }
.otb-big h1 { font-size: 1.4em; margin: 0 0 .6em; }
.otb-big table { width: 100%; border-collapse: collapse; }
.otb-big td { padding: .35em .4em; border-bottom: 1px solid rgba(255,255,255,.15); }
.otb-big td:first-child { color: #e8b84a; font-weight: 800; width: 2.5em; }
.otb-big p { opacity: .5; font-size: .6em; margin-top: 1.5em; }
@media (max-width: 560px) { .otb-match { grid-template-columns: 1fr; } .otb-match .otb-side:last-of-type { text-align: left; } .otb-match.board { grid-template-columns: 1fr auto; } }
.otb-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.otb-info-grid label { display: block; min-width: 0; }
.otb-info-grid .wide { grid-column: 1 / -1; }
.otb-info { margin: 0 0 6px; padding: 8px 12px; border-radius: 10px; background: var(--surface); font-weight: 600; line-height: 1.7; }
.otb-big-info { font-size: .6em; opacity: .75; margin: -.4em 0 1em; }
.otb-shared-note { margin: 0 0 6px; padding: 8px 12px; border-radius: 10px; background: rgba(232,184,74,.18); font-weight: 600; }
.otb-shares { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.otb-shares span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface); font-weight: 600; }
.otb-shares .btn { padding: 2px 8px; min-height: 0; }
.otb-tb { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(232,184,74,.12); display: grid; gap: 4px; }
.otb-tb-win { font-weight: 700; }
.otb-ro button:disabled { cursor: default; }
.otb-ro .otb-res button:disabled { opacity: 1; }
.otb-ro .otb-res button:disabled:not(.on), .otb-ro .actions button:disabled, .otb-ro .otb-adv button:disabled, .otb-ro .otb-person button:disabled { opacity: .55; }
.menu-badge.menu-count { background: var(--surface-2); color: var(--text); }
.otb-count { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #e8b84a; color: #241b05; font-size: .8em; font-weight: 800; vertical-align: middle; }
.otb-best-btn { margin-top: 8px; }
.otb-best-tools { display: flex; gap: 6px; margin-bottom: 6px; }
.otb-best-tools .btn { padding: 4px 10px; min-height: 0; }
.otb-best-list { display: grid; gap: 2px; margin-bottom: 8px; }
.otb-best td:nth-child(n+3), .otb-best th:nth-child(n+3) { text-align: center; }
.otb-late-rule { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.otb-late-rule .otb-input { margin: 0; width: 80px; }
.otb-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; max-height: 260px; overflow: auto; }
.otb-pick button { padding: 6px 12px; border: 1px solid var(--surface-2); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.otb-pick button small { display: block; font-weight: 400; opacity: .7; font-size: .78em; }
.otb-pick button.on { background: #e8b84a; border-color: transparent; color: #241b05; }
.otb-dir td:nth-child(n+2), .otb-dir th:nth-child(n+2) { text-align: center; }
.otb-dir-del { padding: 2px 8px; min-height: 0; }
/* Mode deux joueurs : les pièces du camp du haut sont tournées vers le joueur assis en face */
#board.face-to-face[data-top="b"] .pc.b:not(.drag), #board.face-to-face[data-top="w"] .pc.w:not(.drag) { transform: rotate(180deg); }
#board.face-to-face .coord.top { transform: rotate(180deg); }
/* Les pièces 2D suivent la taille réelle du plateau (vue 2D seule comprise) : sinon une case trop petite
   pour la pièce élargissait les colonnes, le plateau débordait et les clics tombaient sur la mauvaise case */
@supports (font-size: 1cqi) { #board .pc:not(.drag) { font-size: 10cqi; } }
#minimap.face-to-face[data-top="b"] button b.k, #minimap.face-to-face[data-top="w"] button b.w { display: inline-block; transform: rotate(180deg); }
/* Accueil : le trésor passe sous la collection, en bandeau sur toute la largeur */
#home .home-tropical-layout { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 481px) {
  #home .home-rice-card { display: grid; grid-template-columns: minmax(150px, auto) minmax(0, 1fr) auto; align-items: center; gap: 4px 22px; padding: 14px 20px; }
  #home .home-rice-top { grid-column: 1; grid-row: 1 / span 4; width: auto; gap: 14px; justify-content: flex-start; }
  #home .home-rice-sack { grid-column: auto; grid-row: auto; order: -1; font-size: 2.2rem; }
  #home .home-rice-amount { grid-column: 2; grid-row: 1; }
  #home .home-rice-progress { grid-column: 2; grid-row: 2; }
  #home .home-rice-conversion { grid-column: 2; grid-row: 3; min-height: 0; }
  #home .home-rice-next { grid-column: 2; grid-row: 4; min-height: 0; }
  #home .home-rice-shop { grid-column: 3; grid-row: 1 / span 4; width: auto; padding: 10px 16px; }
}
/* bouton « Jouer ce thème » du bandeau de saison : texte lisible sur fond sombre */
.home-season .btn { background: #24382c; color: #fff; border-color: transparent; }
/* Accueil sur mobile : pas de carte « Programme personnalisé » (il reste accessible par Progresser > Programme personnalisé) */
@media (max-width: 999px) { #coach-program { display: none !important; } }
/* Bannière d'accueil : l'image couvre tout le cadre (plus de bande vide sur mobile, plus de seul ciel sur grand écran),
   centrée sur le sujet de chaque illustration */
.home-welcome[data-theme-bg] { background-size: cover; }
.home-welcome[data-theme-bg="ninjas"] { background-position: center 40%; }
.home-welcome[data-theme-bg="ocean"] { background-position: center 45%; }
.home-welcome[data-theme-bg="plants"] { background-position: center 35%; }
.home-welcome[data-theme-bg="land"] { background-position: center 35%; }
.home-welcome[data-theme-bg="birds"] { background-position: center 40%; }
.home-welcome[data-theme-bg="ancient"] { background-position: center 45%; }
.home-welcome[data-theme-bg="modern"] { background-position: center 40%; }
/* Bannières panoramiques (format 3:1, sujet à droite, zone calme à gauche pour le texte) */
.home-welcome[data-theme-bg="ninjas"] { background-image: linear-gradient(100deg, rgba(10,8,22,.7) 0%, rgba(10,8,22,.35) 42%, rgba(10,8,22,0) 70%), url(fond_ecran/banniere/ninjas.webp); background-position: 62% center; }
.home-welcome[data-theme-bg="ocean"] { background-image: linear-gradient(100deg, rgba(4,28,40,.72) 0%, rgba(4,28,40,.38) 42%, rgba(4,28,40,0) 70%), url(fond_ecran/banniere/ocean.webp); background-position: 62% center; }
.home-welcome[data-theme-bg="plants"] { background-image: linear-gradient(100deg, rgba(10,30,14,.72) 0%, rgba(10,30,14,.38) 42%, rgba(10,30,14,0) 70%), url(fond_ecran/banniere/plants.webp); background-position: 62% center; }
.home-welcome[data-theme-bg="land"] { background-image: linear-gradient(100deg, rgba(30,16,4,.72) 0%, rgba(30,16,4,.38) 42%, rgba(30,16,4,0) 70%), url(fond_ecran/banniere/land.webp); }
.home-welcome[data-theme-bg="birds"] { background-image: linear-gradient(100deg, rgba(8,24,36,.72) 0%, rgba(8,24,36,.38) 42%, rgba(8,24,36,0) 70%), url(fond_ecran/banniere/birds.webp); }
.home-welcome[data-theme-bg="ancient"] { background-image: linear-gradient(100deg, rgba(30,14,6,.72) 0%, rgba(30,14,6,.38) 42%, rgba(30,14,6,0) 70%), url(fond_ecran/banniere/ancient.webp); }
.home-welcome[data-theme-bg="modern"] { background-image: linear-gradient(100deg, rgba(20,10,6,.72) 0%, rgba(20,10,6,.38) 42%, rgba(20,10,6,0) 70%), url(fond_ecran/banniere/modern.webp); }
/* Maître Sissa n'est plus dans la bannière : sur un écran étroit, on montre surtout la droite de l'image, où se trouve le sujet */
.home-welcome[data-theme-bg] { background-position: 72% center; }
/* Sur PC : la bannière prend les proportions des images (3:1), qui se voient donc en entier */
@media (min-width: 1000px) {
  #home .home-welcome[data-theme-bg] { aspect-ratio: 2172 / 724; min-height: 0; background-position: center; }
}

/* Plein écran en partie : le plateau et ses commandes occupent seuls la fenêtre. */
#game.game-fullscreen {
  position: fixed !important; inset: 0 !important; z-index: 1000 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  min-height: 0 !important; box-sizing: border-box; overflow: hidden !important;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
  background: var(--bg) !important;
}
#game.game-fullscreen > .bar { display: contents; }
#game.game-fullscreen > .bar > :not(#btn-game-fullscreen) { display: none !important; }
#game.game-fullscreen #btn-game-fullscreen {
  position: fixed; z-index: 1002; top: max(8px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  min-width: 42px; min-height: 42px; font-size: 1.25rem; background: var(--surface-2);
}
body:has(#game.game-fullscreen) .mobile-menu-toggle { display: none !important; }
#game.game-fullscreen .game-layout {
  display: flex !important; flex-direction: column !important; justify-content: center; align-items: center;
  width: 100%; height: 100%; min-height: 0; margin: 0; gap: clamp(4px, 1vh, 10px); overflow: hidden;
}
#game.game-fullscreen .board-col { width: min(94vw, calc(100dvh - 190px), 900px) !important; max-width: 100%; min-width: 0; flex: 0 1 auto; }
#game.game-fullscreen .board-wrap { width: 100%; max-height: calc(100dvh - 170px); aspect-ratio: 1; }
#game.game-fullscreen .player, #game.game-fullscreen #status, #game.game-fullscreen #moves,
#game.game-fullscreen #chat, #game.game-fullscreen .online-switch { display: none !important; }
#game.game-fullscreen .game-tools { display: flex !important; flex-direction: column; width: min(94vw, calc(100dvh - 190px), 900px); gap: 5px; flex: 0 0 auto; }
#game.game-fullscreen .board-validation, #game.game-fullscreen .board-controls { display: flex !important; flex-direction: column; width: 100%; }
#game.game-fullscreen .board-validation { gap: 3px; }
#game.game-fullscreen .board-controls .actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; width: 100%; }
#game.game-fullscreen .board-controls .act { min-width: 0; min-height: 44px; padding: 5px 2px; }
#game.game-fullscreen .side-col { display: none !important; }
#game.game-fullscreen .side-col:has(.replay-bar:not([hidden])) { display: flex !important; width: 100%; gap: 4px; }
#game.game-fullscreen .side-col:has(.replay-bar:not([hidden])) > :not(.replay-bar) { display: none !important; }
#game.game-fullscreen .replay-bar { display: flex; flex-direction: column; gap: 4px; }
#game.game-fullscreen .replay-info, #game.game-fullscreen .replay-legend, #game.game-fullscreen .rp-tools { display: none !important; }
@media (max-height: 560px) {
  #game.game-fullscreen .game-layout { flex-direction: row !important; gap: 10px; }
  #game.game-fullscreen .board-col { width: min(calc(100dvh - 16px), 72vw) !important; }
  #game.game-fullscreen .board-wrap { max-height: calc(100dvh - 16px); }
  #game.game-fullscreen .game-tools { width: min(24vw, 260px); max-height: 100%; overflow-y: auto; }
  #game.game-fullscreen .board-controls .actions { display: grid; grid-template-columns: max-content; width: max-content; }
}
@media (min-width: 900px) and (min-height: 561px) {
  #game.game-fullscreen .game-layout { flex-direction: row !important; gap: clamp(12px, 2vw, 28px); }
  #game.game-fullscreen .board-col { width: min(calc(100dvh - 16px), calc(100vw - 390px)) !important; flex: 0 1 auto; }
  #game.game-fullscreen .board-wrap { max-height: calc(100dvh - 16px); }
  #game.game-fullscreen .game-tools { width: min(340px, 28vw); max-height: calc(100dvh - 24px); overflow-y: auto; }
  #game.game-fullscreen .board-controls .actions { display: grid; grid-template-columns: max-content; width: max-content; }
  #game.game-fullscreen .board-controls .act { align-self: stretch; width: 100%; min-width: 0; padding-inline: 10px; }
}

/* Royaume des animaux : la même illustration source sert au bandeau et à sa vignette. */
#home .home-welcome[data-theme-bg="kingdom"] {
  background-image: linear-gradient(100deg, rgba(17, 49, 28, .22) 0%, rgba(17, 49, 28, .08) 48%, rgba(17, 49, 28, .04) 100%), url("fond_ecran/kingdom.png");
  background-size: cover; background-position: center;
}
#home .home-welcome[data-theme-bg="wood"] {
  background-image: linear-gradient(100deg, rgba(45, 24, 9, .16) 0%, rgba(45, 24, 9, .05) 48%, rgba(45, 24, 9, .02) 100%), url("fond_ecran/wood.png");
  background-size: cover; background-position: center;
}
@media (max-width: 999px) {
  #home .home-welcome[data-theme-bg="kingdom"] { background-position: 58% center; }
  #home .home-welcome[data-theme-bg="wood"] { background-position: 58% center; }
}
