/* Magic Églantine — thème « table de jeu » : feutrine sombre, accents dorés. */
:root {
  --bg: #101511;
  --bg-raise: #1a221b;
  --bg-panel: #161d17;
  --line: #2b362c;
  --ink: #e8e4d8;
  --ink-dim: #9aa694;
  --gold: #d4af37;
  --gold-soft: #b9962f;
  --danger: #d4756b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% -10%, #1c2a1e 0%, transparent 60%);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1, h2, h3, .brand { font-family: Georgia, "Times New Roman", serif; letter-spacing: .01em; }
h1 { font-size: 2rem; margin: 1.2rem 0 .3rem; }
h2 { font-size: 1.3rem; margin: 0 0 .8rem; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- barre de navigation ---- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1.2rem;
  background: rgba(10, 14, 11, .92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 1.25rem; color: var(--ink); font-weight: 700; }
.brand span { color: var(--gold); }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { color: var(--ink-dim); padding: .2rem .4rem; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); text-decoration: none; }
.topbar nav a.active { box-shadow: inset 0 -2px 0 var(--gold); }
.session a, .linklike { color: var(--ink-dim); font-size: .9rem; }
.linklike { background: none; border: none; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

.foot { text-align: center; color: var(--ink-dim); font-size: .85rem; padding: 2rem 1rem; border-top: 1px solid var(--line); }
.hint { color: var(--ink-dim); font-size: .95rem; }
.empty { color: var(--ink-dim); font-size: 1.05rem; padding: 2rem 0; }
.error { color: var(--danger); }

/* ---- panneaux / formulaires ---- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin: 1rem 0;
}
.panel.narrow { max-width: 26rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--ink-dim); }
input[type="text"], input[type="password"], input[type="date"], select {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  padding: .55rem .7rem;
  font: inherit;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--gold-soft); outline-offset: 1px; border-color: transparent; }
button.primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-soft));
  color: #1c1607;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: .65rem 1.4rem;
  font: inherit;
  cursor: pointer;
  margin-top: 1rem;
}
button.primary:disabled { opacity: .4; cursor: not-allowed; }
button.primary:not(:disabled):hover { filter: brightness(1.08); }

/* ---- page Parties ---- */
.games { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
details.game {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
details.game[open] { border-color: #3d4c3e; }
details.game summary {
  list-style: none;
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: .85rem 1.1rem;
  cursor: pointer;
}
details.game summary::-webkit-details-marker { display: none; }
details.game summary::before {
  content: "▸"; color: var(--ink-dim); transition: transform .15s;
}
details.game[open] summary::before { transform: rotate(90deg); }
.game .date { font-weight: 600; white-space: nowrap; text-transform: capitalize; }
.game .players { flex: 1; color: var(--ink-dim); font-size: .92rem; min-width: 12rem; }
.game .players .p.win { color: var(--gold); }
.game .players em { font-style: normal; opacity: .75; }
.chip {
  font-size: .78rem; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.chip.winner { border-color: var(--gold-soft); color: var(--gold); }
.chip.draft { border-color: var(--danger); color: var(--danger); }
.game .edit { font-size: .85rem; }

.game .detail {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  padding: 1.1rem 1.2rem 1.4rem;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,.18);
}
.seat { margin: 0; width: 180px; }
.seat .cards { position: relative; display: flex; gap: 4px; }
.seat .cards img, .seat .placeholder {
  width: 100%; aspect-ratio: 488 / 680; border-radius: 4.75% / 3.5%;
  object-fit: cover; display: block;
  background: var(--bg-raise);
}
.seat .cards.duo img, .seat .cards.duo .placeholder { width: calc(50% - 2px); }
.seat .placeholder {
  border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--ink-dim); font-size: .8rem; padding: .5rem;
}
.seat.is-winner .cards img, .seat.is-winner .placeholder {
  box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(212, 175, 55, .45);
}
.seat .crown {
  position: absolute; right: -8px; bottom: -8px;
  width: 34px; height: 34px; color: var(--gold);
  background: #14180f;
  border: 2px solid var(--gold);
  border-radius: 50%;
  padding: 5px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}
.seat figcaption { margin-top: .55rem; font-size: .88rem; display: flex; flex-direction: column; gap: .15rem; }
.seat figcaption .cmd { color: var(--ink-dim); }
.seat .meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.tag {
  font-size: .72rem; border: 1px solid var(--line); border-radius: 999px;
  padding: .05rem .5rem; color: var(--ink-dim);
}

/* ---- page Soirée ---- */
.selects { display: flex; flex-wrap: wrap; gap: .6rem; }
.selects select { min-width: 11rem; }
.pods { display: flex; flex-wrap: wrap; gap: 1rem; }
.pod {
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; min-width: 14rem;
}
.pod h3 { margin: 0 0 .6rem; }
.pod h3 small { color: var(--ink-dim); font-weight: 400; }
.pod ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.pod li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.pod select { font-size: .8rem; padding: .25rem .4rem; }

/* ---- page Compléter ---- */
.seatForm { border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; padding: .9rem 1rem; }
.seatForm legend { font-weight: 700; font-size: 1.05rem; padding: 0 .5rem; }
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin: .5rem 0; }
.row .grow { flex: 1; min-width: 14rem; position: relative; }
.hiddenField { display: none; }
.winnerField { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); font-size: 1rem; padding-bottom: .5rem; }
.winnerField input { accent-color: var(--gold); width: 1.1rem; height: 1.1rem; }
.dateField { max-width: 14rem; }
.linklike.danger { color: var(--danger); }
.removeSeat { margin-left: auto; padding-bottom: .5rem; font-size: .85rem; }
.addSeatRow { margin: 1rem 0; }
.addSeatRow select { min-width: 13rem; }
.dangerZone { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--line); text-align: right; }
.suggest {
  position: absolute; z-index: 5; top: 100%; left: 0; right: 0;
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: 8px;
  max-height: 300px; overflow-y: auto;
  box-shadow: 0 10px 24px rgba(0,0,0,.5);
}
.suggest button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: none; border: none; color: var(--ink); font: inherit;
  padding: .4rem .6rem; cursor: pointer; text-align: left;
}
.suggest button:hover { background: rgba(212, 175, 55, .12); }
.suggest img { width: 32px; border-radius: 3px; }

/* ---- page Statistiques ---- */
.statsGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--ink-dim); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: right; }
.cmdCell { display: flex; align-items: center; gap: .55rem; }
.cmdCell img { width: 30px; aspect-ratio: 488/680; object-fit: cover; border-radius: 3px; }
.rate { position: relative; display: inline-block; min-width: 5.5rem; padding: .1rem .4rem; }
.rate .bar {
  position: absolute; inset: 0; background: rgba(212, 175, 55, .18); border-radius: 4px;
}
.matrix td, .matrix th { text-align: center; }
.matrix td.zero { color: #4d584c; }
.matrix td.self { color: var(--line); }
.scrollX { overflow-x: auto; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .5rem .9rem; }
  .seat { width: 140px; }
}
