/* ==========================================================================
   Smile Life — direction « autocollants »
   Les cartes sont des autocollants : contour épais et ombre portée nette.
   Couleurs par famille de cartes, cartes, main, plateaux, pioche et défausse,
   pouvoirs des métiers. La plateforme (public/style.css) fournit le reste.
   ========================================================================== */

:root {
  --c-pro: #2f5bd3;   --t-pro: #e6edff;
  --c-perso: #b81d5b; --t-perso: #fde6ef;
  --c-acq: #1b7f5c;   --t-acq: #ddf5ea;
  --c-malus: #c62828; --t-malus: #fde3e3;
  --c-special: #9a5b00; --t-special: #fff0d6;
  --c-dist: #6d3fd1;  --t-dist: #eee7fd;
  --head-text: #ffffff;
  --c-pro-2: #4a74e6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-pro: #8caeff;   --t-pro: #1e2b57;
    --c-perso: #ff8fb8; --t-perso: #4a1c33;
    --c-acq: #6fe0b0;   --t-acq: #173d30;
    --c-malus: #ff8a8a; --t-malus: #4a1c1c;
    --c-special: #ffc266; --t-special: #45310e;
    --c-dist: #bfa5ff;  --t-dist: #2f2458;
    --head-text: #1e1b3a;
  }
}


/* Tuile de jeu : chaque jeu y garde sa propre identité (ici, les autocollants de Smile Life) */
.game-tile {
  display: flex; gap: var(--sp-4); align-items: flex-start; padding: 18px;
  background: var(--sun-soft); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--lift-3);
}
.game-tile .face.big { flex: none; }
.game-info { display: grid; gap: var(--sp-2); min-width: 0; }
.game-info h4 { margin: 0; font: 800 var(--fs-lg)/1.1 var(--font-title); letter-spacing: -.01em; }
.game-info p { margin: 0; }
.game-meta { color: var(--muted); font-weight: 700; font-size: var(--fs-md); }
.game-info button { justify-self: start; margin-top: var(--sp-1); }
.ranking { margin: 0; padding-left: 24px; font-size: var(--fs-base); }
.ranking li:first-child { font-weight: 700; }

/* Main : les cartes en éventail */
.hand-zone { padding: 4px 2px; }
.hand-zone h2 { margin-bottom: 6px; }
.hand { list-style: none; margin: 0; padding: 12px 4px 8px; display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.hand-btn {
  padding: 0; border: 0; border-radius: var(--radius); background: none; min-height: 0; box-shadow: none;
  transition: transform .15s ease, rotate .15s ease;
}
.hand li:nth-child(4n + 1) .hand-btn { rotate: -2deg; }
.hand li:nth-child(4n + 2) .hand-btn { rotate: 1.2deg; }
.hand li:nth-child(4n + 3) .hand-btn { rotate: -.8deg; }
.hand li:nth-child(4n) .hand-btn { rotate: 2deg; }
.hand .hand-btn:hover { rotate: 0deg; transform: translateY(-6px); box-shadow: none; }
.hand .hand-btn[aria-expanded="true"] { rotate: 0deg; transform: translateY(-12px); }
.hand-btn[aria-expanded="true"] .cf { box-shadow: 0 0 0 4px var(--sun), 6px 6px 0 var(--drop); }
.hand-btn:active { box-shadow: none; }
/* Seuls l'illustration et le bandeau pâlissent : le texte garde tout son contraste. */
.hand-btn.dim .cf-head, .hand-btn.dim .cf-art { opacity: .4; filter: grayscale(.8); }
.hand-btn.dim .cf { border-style: dashed; box-shadow: 2px 2px 0 var(--border); }
.hand-btn.dim { position: relative; }
.hand-btn.dim::after {
  content: "Injouable"; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: var(--fs-xs); font-weight: 700;
  padding: 1px 9px; border-radius: var(--r-pill); letter-spacing: .04em; text-transform: uppercase;
}
.hand-btn.dim:hover::after, .hand-btn.dim[aria-expanded="true"]::after { display: none; }
.hand-btn.dim:hover :is(.cf-head, .cf-art), .hand-btn.dim[aria-expanded="true"] :is(.cf-head, .cf-art) { opacity: 1; filter: none; }

#card-panel:empty { display: none; }
.card-panel {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: var(--bw) solid var(--line); box-shadow: 4px 4px 0 var(--sun);
}
.card-panel h3 { margin-bottom: 4px; }
.card-panel .info { margin: 0 0 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Cartes autocollants
   -------------------------------------------------------------------------- */
.cf {
  --c: var(--c-pro); --t: var(--t-pro);
  width: 136px; min-height: 192px; border-radius: var(--radius);
  background: var(--surface); border: var(--bw) solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
  box-shadow: var(--lift-3); text-align: center; color: var(--text);
}
.cf-head {
  background: var(--c); color: var(--head-text); border-bottom: var(--bw) solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 5px 6px 5px 9px; min-height: 30px;
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-1);
}
/* Le libellé cède la place à la pastille de smiles, jamais l'inverse. */
.cf-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-smile {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px;
  background: var(--sun); color: var(--ink); border: var(--bw-2) solid var(--ink); border-radius: 50%;
  font: 800 var(--fs-sm)/1 var(--font-title); letter-spacing: 0;
}
.cf-art {
  flex: 1; display: grid; place-items: center; font-size: 2.6rem; line-height: 1;
  background: var(--t); margin: 7px; border-radius: var(--r-sm);
  border: var(--bw-2) solid color-mix(in srgb, var(--c) 35%, transparent);
}
.cf-name { font: 800 var(--fs-base)/1.1 var(--font-title); padding: 0 6px; letter-spacing: -.01em; hyphens: auto; overflow-wrap: break-word; }
.cf-stats { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); padding: 3px 6px 7px; min-height: 1.5em; }
.cf-stats.long {
  font-size: var(--fs-xs); font-weight: 400; line-height: 1.2; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.6em;
}
.cf-status {
  position: absolute; top: 36px; right: 11px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  background: var(--surface); color: var(--text); border: var(--bw-thin) solid var(--line); border-radius: var(--r-xs); padding: 0 4px;
}
.cf--small { width: 104px; min-height: 148px; box-shadow: var(--lift-2); }
.cf--small .cf-art { font-size: 1.9rem; margin: 5px; }
.cf--small .cf-name { font-size: var(--fs-md); }
.cf--small .cf-stats.long { -webkit-line-clamp: 2; min-height: 2.4em; }

.cat-etudes, .cat-metier, .cat-salaire { --c: var(--c-pro); --t: var(--t-pro); }
.cat-flirt, .cat-mariage, .cat-adultere, .cat-enfant { --c: var(--c-perso); --t: var(--t-perso); }
.cat-animal, .cat-voyage, .cat-maison { --c: var(--c-acq); --t: var(--t-acq); }
.cat-malus { --c: var(--c-malus); --t: var(--t-malus); }
.cat-speciale { --c: var(--c-special); --t: var(--t-special); }
.cat-distinction { --c: var(--c-dist); --t: var(--t-dist); }

/* Dos de carte (pioche) : rayons de soleil autour d'un smiley */
.cb {
  width: 104px; height: 148px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: repeating-conic-gradient(from 0deg, var(--c-pro) 0deg 15deg, var(--c-pro-2) 15deg 30deg);
  border: var(--bw) solid var(--line); box-shadow: var(--lift-2);
}
.cb.empty { background: var(--surface-2); border-style: dashed; color: var(--muted); font-size: var(--fs-md); box-shadow: none; }

/* Mini-cartes des plateaux */
/* Pas de couleur par défaut ici : elle viendrait écraser celle de la famille (.cat-*). */
.mc {
  display: inline-flex; align-items: center; gap: var(--sp-1); max-width: 100%; min-width: 0;
  padding: 3px 8px 3px 6px; border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 700;
  background: var(--t); border: var(--bw-thin) solid var(--line); border-left: 6px solid var(--c);
}
.mc .tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mc .ic { flex: none; font-size: 1rem; }
.mc .mc-smile {
  flex: none; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px;
  background: var(--sun); color: var(--ink); border: var(--bw-thin) solid var(--ink); border-radius: var(--r-pill);
  font: 800 var(--fs-xs)/1 var(--font-title);
}
/* Inactive : seuls l'icône et la pastille pâlissent, le texte barré garde son contraste. */
.mc.off { border-style: dashed; border-left-style: solid; text-decoration: line-through; }
.mc.off :is(.ic, .mc-smile) { opacity: .45; filter: grayscale(.8); }
.mc.big { font-size: var(--fs-md); padding: 5px 10px 5px 7px; }

/* --------------------------------------------------------------------------
   Plateaux des joueurs
   -------------------------------------------------------------------------- */
.boards { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.board {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  padding: 12px 14px; box-shadow: var(--lift-3); min-width: 0;
}
.board.me { grid-column: 1 / -1; }
.board.current { background: var(--sun-soft); box-shadow: var(--lift-3), 0 0 0 4px var(--sun); }
.board-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: 8px; }
.board-head h3 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score {
  display: inline-flex; align-items: center; gap: var(--sp-2); flex: none;
  font: 800 var(--fs-base)/1 var(--font-title); color: var(--ink);
  background: var(--sun); border: var(--bw) solid var(--line); border-radius: var(--r-pill);
  padding: 3px 12px 3px 3px; box-shadow: var(--lift-1);
}
.score .face { --s: 24px; border-width: 1.5px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 10px; }
.chip { font-size: var(--fs-sm); font-weight: 700; padding: 1px 9px; border-radius: var(--r-pill); background: var(--surface-2); border: var(--bw-thin) solid var(--border); }
.chip.warn { background: var(--t-malus); color: var(--c-malus); border-color: currentColor; }
.chip.turn { background: var(--ink); color: var(--sun); border-color: var(--ink); }
.zones { display: grid; gap: var(--sp-2); margin: 0; }
.zone-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--sp-2); align-items: start; }
.zone-row dt { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); padding-top: 5px; }
.zone-row dd { margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.zone-row .none { color: var(--muted); padding-top: 3px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Colonne latérale
   -------------------------------------------------------------------------- */
.piles { display: flex; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.pile { display: grid; gap: var(--sp-2); justify-items: center; font-size: var(--fs-md); font-weight: 700; color: var(--muted); }
.casino {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r-md); background: var(--t-special);
  border: var(--bw-thin) solid var(--line); border-left: 6px solid var(--c-special); font-size: var(--fs-md);
}
@media (max-width: 520px) {
  .hand { gap: var(--sp-3); }
  .cf { width: 98px; min-height: 142px; --fs-xs: .56rem; }
  .cf-head { font-size: var(--fs-xs); padding: 3px 4px 3px 6px; min-height: 24px; letter-spacing: .03em; }
  .cf-smile { width: 18px; height: 18px; font-size: var(--fs-xs); }
  .cf-art { font-size: 1.6rem; margin: 4px; }
  .cf-name { font-size: var(--fs-sm); }
  .cf-stats { font-size: var(--fs-xs); padding-bottom: 4px; }
  .cf-stats.long { -webkit-line-clamp: 2; min-height: 2.4em; font-size: var(--fs-xs); }
  .cf-status { top: 27px; right: 7px; font-size: var(--fs-xs); }
  .zone-row { grid-template-columns: 58px minmax(0, 1fr); gap: var(--sp-2); }
  .zone-row dt { font-size: var(--fs-xs); }
  .boards { grid-template-columns: 1fr; }
}

/* Pioche et défausse côte à côte dans la colonne latérale */
.pile { max-width: 128px; text-align: center; }
@media (max-width: 520px) {
  .cf-stats:not(.long) { white-space: nowrap; }
}

/* Étiquette « Injouable » posée sur l'illustration, jamais sur le nom */
/* Juste sous le bandeau : toujours sur l'illustration, même quand la carte porte un pouvoir. */
.hand-btn.dim::after { top: 60px; bottom: auto; }
@media (max-width: 520px) { .hand-btn.dim::after { top: 46px; }
}

/* Carte qui vient d'arriver sur un plateau */
.mc.arrive { animation: arrive .25s ease-out, arrive-ring 1.6s ease-out; }
@keyframes arrive { from { transform: translateY(-8px) scale(.7); opacity: 0; } }
@keyframes arrive-ring { from { box-shadow: 0 0 0 4px var(--sun); } }
@media (prefers-reduced-motion: reduce) {
  /* Pas de mouvement, seulement l'anneau qui s'estompe. */
  .mc.arrive { animation: arrive-ring 1.6s ease-out; }
}
.last-move .mc { font-size: var(--fs-sm); vertical-align: middle; margin-inline: 2px; }

/* Actions : la carte de la défausse dans son bouton, les actions coûteuses à part */
button.with-card { display: inline-flex; align-items: center; gap: var(--sp-2); text-align: left; }
button.with-card .mc { font-size: var(--fs-sm); padding-block: 1px; }

/* Légende des statistiques de la main */
.hand-legend { margin: 0; font-size: var(--fs-sm); color: var(--muted); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); }
.hand-legend[hidden] { display: none; }

/* Zones vides regroupées sur une ligne */
.zone-row.empty { display: flex; align-items: baseline; gap: var(--sp-2); }
.zone-row.empty dt { padding-top: 0; }

/* Pioche et défausse cliquables quand l'action est possible (doublon souris des boutons) */
.pile.can { cursor: pointer; }
.pile.can :is(.cb, .cf) { transition: transform .08s ease, box-shadow .08s ease; box-shadow: var(--lift-2), 0 0 0 3px var(--sun); }
.pile.can:hover :is(.cb, .cf) { transform: translate(-1px, -1px); box-shadow: var(--lift-3), 0 0 0 3px var(--sun); }

/* Pourquoi la défausse ne se prend pas (visible sans cliquer) */
.pile-note { display: block; margin-top: 4px; font-size: var(--fs-sm); font-weight: 700; color: var(--c-malus); }

/* Pouvoirs des métiers : sur la carte, sur le plateau, dans le panneau et dans l'aide */
.cf-perk {
  font-size: var(--fs-xs); line-height: 1.2; text-align: left; color: var(--text);
  padding: 0 6px 6px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.perk-note { margin: 6px 0 0; max-width: 136px; font-size: var(--fs-sm); font-weight: 700; color: var(--c-special); }
.zone-row .perk { font-size: var(--fs-md); font-weight: 700; color: var(--c-special); }
.perk-line { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-md); background: var(--t-special); border-left: 6px solid var(--c-special); }
.blocked { margin: 0 0 4px; font-weight: 700; }
.blocked-list { margin: 0 0 12px; padding-left: 22px; }
.jobs-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.jobs-list li { padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.jobs-list .perk { font-weight: 700; }
.jobs-help { margin-top: 0; }
.jobs-help > summary { padding: 10px 0; min-height: 44px; }
.cf-perk .perk-short { display: none; }
@media (max-width: 520px) {
  .cf-perk { padding: 0 4px 4px; text-align: center; font-weight: 700; }
  .cf-perk .perk-full { display: none; }
  .cf-perk .perk-short { display: inline; }
}
