/* Tableau Tactikofoot (bêta) : direction artistique de la chaîne — fond #111, encre crème #F4EBD9, accent jaune
   #F2E21C, surfaces #232323 ; Roboto et Roboto Condensed (Apache 2.0, LICENCE-roboto-apache-2.0.txt). */
@font-face { font-family: 'Tactiko Roboto'; src: url('fonts/roboto-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Tactiko Roboto'; src: url('fonts/roboto-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Tactiko Roboto'; src: url('fonts/roboto-700.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Tactiko Roboto Condensed'; src: url('fonts/roboto-condensed-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root { --fond: #111111; --encre: #f4ebd9; --accent: #f2e21c; --surface: #1b1b1b; --surface-2: #232323; --trait: #333; --doux: #a8a296; --alerte: #ff6b5b; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--encre); font: 500 14px/1.4 'Tactiko Roboto', sans-serif; }
body { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }

.tb-app { position: fixed; inset: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr) 300px; grid-template-rows: 56px minmax(0, 1fr) 64px; }
.tb-app[data-panel="off"] { grid-template-columns: 64px minmax(0, 1fr) 0; }
.tb-app[data-panel="off"] .tb-side { display: none; }

/* En-tête : marque, titre du schéma, créateur, exports. */
.tb-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--trait); background: var(--fond); min-width: 0; }
.tb-brand { display: flex; align-items: center; gap: 10px; flex: none; }
.tb-brand img { width: 34px; height: 34px; }
.tb-brand b { font: 700 19px/1 'Tactiko Roboto Condensed', sans-serif; letter-spacing: 0.04em; }
.tb-beta { font: 700 11px/1 'Tactiko Roboto', sans-serif; color: #111; background: var(--accent); padding: 4px 6px; border-radius: 4px; letter-spacing: 0.06em; }
.tb-title { flex: 1 1 200px; min-width: 120px; max-width: 420px; height: 36px; padding: 0 10px; background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; }
/* Mode libre : entrée de la version créateurs et lien de la demande d'accès. */
.tb-btn.tb-code { border-color: var(--accent); color: var(--accent); white-space: nowrap; }
.tb-btn.tb-code:hover { background: var(--accent); color: #111; }
.tb-demande { color: var(--doux); font-size: 12.5px; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.tb-demande:hover { color: var(--encre); }
.tb-side .tb-demande { white-space: normal; }
.tb-who { color: var(--doux); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.tb-spacer { flex: 1; }

.tb-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; min-width: 36px; padding: 0 12px; border: 1px solid var(--trait); border-radius: 8px; background: var(--surface); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13px; }
.tb-btn:hover { border-color: #5c5c5c; background: var(--surface-2); }
.tb-btn:disabled { opacity: 0.4; cursor: default; }
.tb-btn[aria-pressed="true"] { background: var(--encre); color: #111; border-color: var(--encre); }
.tb-btn.tb-main { background: var(--accent); color: #111; border-color: var(--accent); }
.tb-btn.tb-main:hover { background: #fff04a; }
.tb-btn svg { width: 18px; height: 18px; flex: none; }
.tb-btn kbd { font: 600 10px/1 'Tactiko Roboto', sans-serif; color: var(--doux); border: 1px solid var(--trait); border-radius: 4px; padding: 2px 4px; }

/* Outils (colonne de gauche). */
.tb-tools { grid-row: 2 / 4; grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-right: 1px solid var(--trait); overflow-y: auto; }
.tb-tool { width: 46px; height: 46px; padding: 0; flex-direction: column; gap: 2px; font-size: 10px; }
.tb-tool span { font-size: 9.5px; font-weight: 600; }
.tb-sep { width: 36px; height: 1px; background: var(--trait); margin: 4px 0; flex: none; }
.tb-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--trait); cursor: pointer; padding: 0; flex: none; }
.tb-swatch[aria-pressed="true"] { border-color: var(--encre); box-shadow: 0 0 0 2px var(--fond), 0 0 0 4px var(--encre); }

/* Terrain. */
.tb-stage { grid-row: 2; grid-column: 2; position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: #0b0b0b; }
.tb-canvas { display: block; touch-action: none; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.tb-canvas[data-tool="move"] { cursor: default; }
.tb-canvas[data-tool="move"][data-hover="1"] { cursor: grab; }
.tb-canvas[data-drag="1"] { cursor: grabbing; }
.tb-canvas[data-tool="pass"], .tb-canvas[data-tool="run"], .tb-canvas[data-tool="zone"], .tb-canvas[data-tool="rect"] { cursor: crosshair; }
.tb-canvas[data-tool="erase"] { cursor: cell; }
.tb-canvas[data-tool="press"] { cursor: pointer; }
.tb-toast { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--encre); color: #111; padding: 9px 14px; border-radius: 8px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,0.5); pointer-events: none; max-width: 90%; }
.tb-toast[data-tone="warn"] { background: var(--alerte); color: #fff; }

/* Étapes (bas). */
.tb-steps { grid-row: 3; grid-column: 2; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-top: 1px solid var(--trait); overflow-x: auto; min-width: 0; }
.tb-chips { display: flex; gap: 6px; flex: none; }
.tb-step { min-width: 74px; }
.tb-step[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #111; }
/* Mode libre : plan précédent / suivant (pas de lecture animée). */
.tb-nav { min-width: 38px; padding: 0 8px; font-size: 20px; line-height: 1; flex: none; }
.tb-plan { display: none; min-width: 74px; text-align: center; font-weight: 700; white-space: nowrap; }
.tb-speed { display: flex; align-items: center; gap: 8px; color: var(--doux); font-size: 12px; flex: none; }
.tb-speed input { width: 110px; accent-color: var(--accent); }

/* Panneau de droite. */
.tb-side { grid-row: 2 / 4; grid-column: 3; border-left: 1px solid var(--trait); overflow-y: auto; padding: 6px 14px 20px; background: var(--fond); }
.tb-side h2 { font: 700 12px/1 'Tactiko Roboto', sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--doux); margin: 18px 0 10px; }
.tb-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.tb-row label { flex: 0 0 76px; color: var(--doux); font-size: 12.5px; }
.tb-row input[type="text"], .tb-row input[type="number"], .tb-row select { flex: 1; min-width: 0; height: 34px; padding: 0 9px; background: var(--surface); border: 1px solid var(--trait); border-radius: 7px; }
.tb-row input[type="number"] { flex: 0 0 70px; }
.tb-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-colors .tb-swatch { width: 24px; height: 24px; }
.tb-seg { display: flex; gap: 4px; flex: 1; }
.tb-seg .tb-btn { flex: 1; padding: 0 6px; }
.tb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tb-list li { display: flex; align-items: center; gap: 6px; }
.tb-list .tb-open { flex: 1; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; }
.tb-list .tb-open[aria-current="true"] { border-color: var(--accent); }
.tb-hint { color: var(--doux); font-size: 12px; margin: 6px 0; }
/* Coups de pied arrêtés (lot 2 de l'ardoise) : grilles de choix, pastilles de rôle comme sur l'image, légende. */
.tb-sub { font: 700 10.5px/1 'Tactiko Roboto', sans-serif; letter-spacing: 0.1em; text-transform: uppercase; color: var(--doux); margin: 14px 0 7px; }
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tb-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tb-grid .tb-btn { padding: 0 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-arret .tb-seg .tb-btn, .tb-analyse .tb-seg .tb-btn { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: #121416; border: 2.5px solid var(--encre); color: var(--encre); font: 700 11.5px/1 'Tactiko Roboto Condensed', sans-serif; }
.tb-role { justify-content: flex-start; gap: 6px; padding-left: 5px; }
.tb-role[aria-pressed="true"] .tb-chip { color: var(--encre); }
.tb-legende { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; }
.tb-legende-item { display: flex; align-items: center; gap: 8px; font: 700 14px/1.2 'Tactiko Roboto Condensed', sans-serif; }
.tb-legende .tb-hint { margin: 0; }
.tb-legal { color: var(--doux); font-size: 11.5px; margin-top: 24px; border-top: 1px solid var(--trait); padding-top: 12px; }

/* Nouveau match en 4 étapes (lot 3 de l'ardoise) : carte d'ardoise, pastilles numérotées puis cochées, aperçu vivant. */
.tb-match { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(8, 9, 10, 0.78); }
.tb-match-card { width: min(1080px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #1d2226; border: 1px solid #3a4248; border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,0.65); overflow: hidden; }
.tb-match-top { display: flex; align-items: center; gap: 18px; padding: 16px 20px; border-bottom: 1px dashed #4a535a; }
.tb-match-top h2 { margin: 0; font: 700 26px/1 'Tactiko Roboto Condensed', sans-serif; letter-spacing: 0.02em; flex: none; }
.tb-pastilles { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; }
.tb-pastille { appearance: none; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 5px; border: 1px solid #3a4248; border-radius: 18px; background: transparent; cursor: pointer; color: var(--doux); font-weight: 600; font-size: 13px; }
.tb-pastille i { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; font: 700 13px/1 'Tactiko Roboto Condensed', sans-serif; font-style: normal; }
.tb-pastille[data-fait="1"] { color: var(--encre); }
.tb-pastille[data-fait="1"] i { background: var(--encre); color: #1d2226; border-color: var(--encre); }
.tb-pastille[aria-current="step"] { color: #111; background: var(--accent); border-color: var(--accent); }
.tb-fermer { flex: none; width: 36px; padding: 0; }
.tb-match-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; padding: 18px 20px; overflow: auto; min-height: 0; }
.tb-match-form h3 { margin: 0 0 6px; font: 700 21px/1.1 'Tactiko Roboto Condensed', sans-serif; }
.tb-match-lead { color: var(--doux); margin: 0 0 12px; }
.tb-match-form .tb-row label { flex: 0 0 64px; }
.tb-match-form .tb-colors .tb-swatch { width: 30px; height: 30px; }
.tb-avis { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: rgba(242, 226, 28, 0.07); font-size: 13px; }
.tb-feuilles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tb-feuille-tete { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.tb-feuille-tete b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-feuille-tete small { color: var(--doux); font-size: 11.5px; white-space: nowrap; }
.tb-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--encre); flex: none; }
.tb-feuille textarea { width: 100%; resize: vertical; padding: 8px 10px; background: #15191c; border: 1px solid #3a4248; border-radius: 8px; font: 500 14px/1.45 'Tactiko Roboto', sans-serif; }
.tb-systeme { margin-bottom: 6px; }
.tb-coche { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: var(--encre); font-size: 13px; cursor: pointer; }
.tb-coche input { width: 18px; height: 18px; accent-color: var(--accent); }
.tb-match-apercu { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.tb-match-canvas { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); }
.tb-match-canvas[data-format="9:16"] { width: auto; height: min(52vh, 460px); }
.tb-match-apercu figcaption { color: var(--doux); font-size: 12px; text-align: center; }
.tb-match-bas { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px dashed #4a535a; }
.tb-btn.tb-lien { background: transparent; border-color: transparent; color: var(--doux); text-decoration: underline; text-underline-offset: 3px; }
.tb-btn.tb-lien:hover { color: var(--encre); background: transparent; }

/* Astuce du moment (3 fois chacune) : en haut à gauche du terrain, jamais sur la légende ni la marque. */
.tb-astuce { position: absolute; top: 22px; left: 22px; width: min(330px, calc(100% - 44px)); padding: 12px 14px 10px; background: #1d2226; border: 1px solid #4a535a; border-left: 4px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.55); z-index: 3; }
.tb-astuce b { display: block; font: 700 10.5px/1 'Tactiko Roboto', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.tb-astuce p { margin: 0 0 8px; font-size: 13.5px; }
.tb-astuce-bas { display: flex; justify-content: flex-end; gap: 6px; }
.tb-astuce-bas .tb-btn { height: 30px; font-size: 12.5px; }

/* Porte d'entrée : code d'accès. */
.tb-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 50% 30%, #1d1d1d, #0a0a0a 70%); z-index: 10; }
.tb-gate-card { width: min(440px, 100%); background: var(--fond); border: 1px solid var(--trait); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.tb-gate-card img { width: 72px; height: 72px; display: block; margin-bottom: 14px; }
.tb-gate-card h1 { font: 700 30px/1.05 'Tactiko Roboto Condensed', sans-serif; margin: 0 0 6px; letter-spacing: 0.02em; }
.tb-gate-card p { color: var(--doux); margin: 8px 0; }
.tb-gate-code { width: 100%; height: 50px; margin: 14px 0 10px; padding: 0 14px; background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; font: 700 20px/1 'Tactiko Roboto', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; }
.tb-gate-error, .tb-gate-card .tb-gate-error { color: var(--alerte); min-height: 20px; font-weight: 600; }
.tb-gate .tb-btn { width: 100%; height: 46px; font-size: 15px; }
.tb-gate .tb-btn.tb-lien { margin-top: 6px; height: 38px; font-size: 13.5px; }
.tb-gate small { display: block; color: var(--doux); margin-top: 16px; font-size: 12px; }

/* Export du clip : fenêtre d'attente. */
.tb-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 20; }
.tb-modal-card { background: var(--fond); border: 1px solid var(--trait); border-radius: 12px; padding: 22px 24px; width: min(420px, 92%); }
.tb-modal-card h2 { margin: 0 0 8px; font: 700 20px/1.1 'Tactiko Roboto Condensed', sans-serif; }
.tb-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 14px 0; }
.tb-bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* Page de confidentialité (texte qui défile). */
body.tb-doc { overflow: auto; }
.tb-doc main { max-width: 760px; margin: 0 auto; padding: 32px 18px 60px; }
.tb-doc h1 { font: 700 30px/1.1 'Tactiko Roboto Condensed', sans-serif; }
.tb-doc h2 { font: 700 18px/1.2 'Tactiko Roboto', sans-serif; color: var(--accent); margin-top: 28px; }
.tb-doc li { margin: 6px 0; }

@media (max-width: 900px) {
  .tb-match { padding: 0; }
  .tb-match-card { border-radius: 0; height: 100%; }
  .tb-match-top { flex-wrap: wrap; gap: 10px; }
  .tb-pastille span { display: none; }
  .tb-pastille { padding: 0 5px; }
  .tb-match-body { grid-template-columns: 1fr; }
  .tb-match-canvas[data-format="9:16"] { height: 300px; }
  .tb-app { grid-template-columns: 56px minmax(0, 1fr) 0; }
  .tb-app[data-panel="on"] .tb-side { display: block; position: fixed; right: 0; top: 56px; bottom: 0; width: min(320px, 90vw); z-index: 5; }
  .tb-app:not([data-panel="on"]) .tb-side { display: none; }
  .tb-who, .tb-brand b, .tb-top > .tb-demande { display: none; }
}

/* Libellés courts, montrés sur téléphone seulement. */
.tb-court { display: none; }

/* Téléphone : la barre du haut tient sur une ligne (titre qui rétrécit, libellés courts). */
@media (max-width: 600px) {
  .tb-top { gap: 6px; padding: 0 8px; }
  .tb-top .tb-beta { display: none; }
  .tb-title { min-width: 60px; flex: 1 1 60px; }
  .tb-top .tb-btn { padding: 0 8px; font-size: 12px; flex: 0 0 auto; }
  .tb-long { display: none; }
  .tb-court { display: inline; }
  /* Mode libre : « Plan 2 / 3 » entre les flèches à la place des pastilles, la barre tient sans défiler. */
  .tb-app[data-mode="libre"] .tb-chips { display: none; }
  .tb-app[data-mode="libre"] .tb-plan { display: inline; }
  .tb-app[data-mode="libre"] .tb-steps { gap: 6px; padding: 0 8px; }
}
