/* [99-zdeco-frames] Habillage art déco propre au jeu (refonte du 22/11/2026) : cadres à pans coupés et double filet laiton,
   cartouche de titre en plaque hexagonale, fond à éventails, croix sombre sur médaillon laiton.
   Chargé après les feuilles des fenêtres pour remplacer les formes reprises de l'original (trapèze, chevrons, croix rouge). */
:root {
  --deco-brass: #b98b4e;
  --deco-brass-hi: #e2c48f;
  --deco-charcoal: #15171a;
  --deco-bottle: #1f5a48;
  --deco-ivory: #e9dfc8;
  --deco-cut: 12px;
  --deco-fans: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20'%3E%3Cg fill='none' stroke='%23b98b4e' stroke-opacity='.16'%3E%3Cpath d='M0 20a20 20 0 0 1 40 0M6 20a14 14 0 0 1 28 0M12 20a8 8 0 0 1 16 0M-20 10a20 20 0 0 1 40 0M20 10a20 20 0 0 1 40 0'/%3E%3C/g%3E%3C/svg%3E");
}

/* Boîte des fenêtres : pans coupés, filet laiton, fond charbon à éventails */
.game-modal-box,
.custom-modal-box,
.leaderboard-panel:not(.tournament-folder),
#shop-modal .game-store-window {
  background: var(--deco-fans) 0 0 / 40px 20px, var(--deco-charcoal) !important;
  border: 1px solid var(--deco-brass) !important;
  border-radius: 0 !important;
  outline: 3px double var(--deco-brass);
  outline-offset: -7px;
  clip-path: polygon(var(--deco-cut) 0, calc(100% - var(--deco-cut)) 0, 100% var(--deco-cut), 100% calc(100% - var(--deco-cut)),
    calc(100% - var(--deco-cut)) 100%, var(--deco-cut) 100%, 0 calc(100% - var(--deco-cut)), 0 var(--deco-cut));
}

/* Bandeau de tête : charbon uni, double filet laiton en bas, plus de reflet en arc */
.modal-crown-trapezoid,
.store-head-crown,
.leaderboard-panel:not(.tournament-folder) > .leaderboard-header {
  background: var(--deco-charcoal) !important;
  border-bottom: 3px double var(--deco-brass) !important;
}
.modal-crown-trapezoid::before,
.store-head-crown::before,
.leaderboard-panel:not(.tournament-folder) > .leaderboard-header::before { display: none !important; }

/* Cartouche du titre : plaque hexagonale laiton, intérieur vert bouteille */
.modal-crown-title::before,
.leaderboard-panel:not(.tournament-folder) > .leaderboard-header h2::before,
.store-crown-trapezoid::before {
  background: var(--deco-brass) !important;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%) !important;
}
.modal-crown-title::after,
.leaderboard-panel:not(.tournament-folder) > .leaderboard-header h2::after,
.store-crown-trapezoid::after {
  inset: 2px 3px !important;
  background: var(--deco-bottle) !important;
  clip-path: polygon(17px 0, calc(100% - 17px) 0, 100% 50%, calc(100% - 17px) 100%, 17px 100%, 0 50%) !important;
}
.modal-crown-title,
.leaderboard-panel:not(.tournament-folder) > .leaderboard-header h2,
.store-crown-title {
  color: var(--deco-ivory) !important;
  font-weight: 400 !important;
  letter-spacing: 3px !important;
}

/* Fermer : médaillon laiton plat, croix charbon */
.modal-corner-close,
.leaderboard-panel:not(.tournament-folder) .leaderboard-close {
  background: var(--deco-brass) !important;
  border: 2px solid var(--deco-charcoal) !important;
  box-shadow: 0 0 0 1px var(--deco-brass) !important;
}
.modal-corner-close::before,
.modal-corner-close::after,
.leaderboard-panel:not(.tournament-folder) .leaderboard-close::before,
.leaderboard-panel:not(.tournament-folder) .leaderboard-close::after {
  width: 16px !important;
  height: 3px !important;
  margin: -1.5px 0 0 -8px !important;
  border-radius: 0 !important;
  background: var(--deco-charcoal) !important;
  box-shadow: none !important;
}

/* Règle commune des fenêtres à onglets (refonte du 22/11/2026) : onglets en colonne à gauche, contenu à droite.
   La boîte passe en grille : la plaque de titre sur toute la largeur, les onglets dans la première colonne,
   tout le reste empilé dans la seconde (le dernier bloc prend la hauteur restante). */
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs) {
  display: grid !important;
  grid-template-columns: 136px minmax(0, 1fr);
  grid-auto-rows: auto;
  grid-template-rows: auto;
}
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs) > * { grid-column: 2; min-width: 0; }
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs) > .modal-crown-trapezoid { grid-column: 1 / -1; }
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs) > :last-child { align-self: stretch; }
/* Déploiement : titre, puis le contenu sur toute la hauteur restante (sinon les rangées vides des onglets se partagent
   l'espace et les cartes de troupes n'ont plus de place pour leur image) */
html:not(.mobile-layout) :is(.game-modal-box.deploy-box, .game-modal-box.battle-report-box):has(> .modal-nav-tabs) { grid-template-rows: auto minmax(0, 1fr); }
html:not(.mobile-layout) :is(.game-modal-box.deploy-box, .game-modal-box.battle-report-box) > .modal-nav-tabs { grid-row: 2 !important; }
/* Onglets posés plus bas dans la fenêtre (Tapis vert, Marché noir…) : leur bloc parent suit la même règle */
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs),
html:not(.mobile-layout) .leaderboard-panel:has(> .modal-nav-tabs) {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  align-content: start;
}
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box):has(> .modal-nav-tabs) > *,
html:not(.mobile-layout) .leaderboard-panel:has(> .modal-nav-tabs) > * { grid-column: 2; min-width: 0; }
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box) > .modal-nav-tabs,
html:not(.mobile-layout) .leaderboard-panel > .modal-nav-tabs { grid-row: 1 / span 20 !important; margin: 0 12px 0 0 !important; }
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box) > .modal-nav-tabs,
html:not(.mobile-layout) :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box) > .modal-nav-tabs,
html:not(.mobile-layout) .leaderboard-panel > .modal-nav-tabs {
  grid-column: 1;
  grid-row: 2 / span 20;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 14px 0 14px 12px;
  background: none;
  border-bottom: none;
  border-right: 3px double var(--deco-brass);
}
html:not(.mobile-layout) .modal-nav-tabs:is(:is(.game-modal-box, .custom-modal-box, .leaderboard-panel) > *, :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box) > *) .modal-tab-btn {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  text-align: left;
  background: var(--deco-charcoal);
  border: 1px solid var(--deco-brass);
  border-right: none;
  border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%);
}
html:not(.mobile-layout) .modal-nav-tabs:is(:is(.game-modal-box, .custom-modal-box, .leaderboard-panel) > *, :is(.game-modal-box, .custom-modal-box, .leaderboard-panel) :not(.game-modal-box, .custom-modal-box) > *) .modal-tab-btn.active {
  background: var(--deco-bottle);
  color: var(--deco-ivory);
}

/* Panneau à bandeau (Marché noir…) : le bandeau de titre sur toute la largeur, les onglets dessous */
html:not(.mobile-layout) .leaderboard-panel:has(> .modal-nav-tabs) > .leaderboard-header { grid-column: 1 / -1; }
html:not(.mobile-layout) .leaderboard-panel:has(> .leaderboard-header) > .modal-nav-tabs { grid-row: 2 / span 20 !important; }
/* Libellés longs : sur deux lignes plutôt que coupés */
html:not(.mobile-layout) .modal-nav-tabs .modal-tab-btn { white-space: normal !important; height: auto !important; min-height: 32px; line-height: 1.15; padding-top: 6px !important; padding-bottom: 6px !important; }

/* Tripot et Salle du Conseil : le titre est dans un bloc centré (.council-crown) ; la bande charbon à double filet
   court sur toute la largeur, comme dans les autres fenêtres */
.council-crown { background: var(--deco-charcoal); border-bottom: 3px double var(--deco-brass); align-items: center; }
.council-crown > .modal-crown-trapezoid { background: transparent !important; border-bottom: none !important; }

/* Fenêtre de bâtiment : le contenu (2e rangée) prend toute la hauteur restante ; sinon les rangées vides sous les onglets
   se partagent l'espace et le contenu s'arrête avant le bas de la fenêtre (fiche des troupes coupée) */
html:not(.mobile-layout) :is(#building-modal, #profile-modal) .game-modal-box:has(> .modal-nav-tabs) { grid-template-rows: auto minmax(0, 1fr); }
html:not(.mobile-layout) :is(#building-modal, #profile-modal) .game-modal-box > .modal-nav-tabs { grid-row: 2 !important; }
