:root {
  --felt-dark: #0a4d2e;
  --felt: #0f6b41;
  --gold: #d9b25c;
  --gold-light: #f3d27a;
  --cream: #faf7ef;
  --navy: #1b2a4a;
  --red: #b3222c;
  --black: #16181d;
  --muted: #cfe7da;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #123b28, #06241a 70%);
  color: var(--cream);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(180deg, #0d3823, #0a2c1c);
  border-bottom: 2px solid var(--gold);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand img {
  width: 44px;
  height: 44px;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--gold-light);
  letter-spacing: 0.03em;
}

.brand-text p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-nav a {
  color: var(--cream);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--gold);
  color: var(--navy);
}

main {
  flex: 1;
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.pill {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(217, 178, 92, 0.5);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.pill strong { color: var(--gold-light); }

.table-felt {
  background: radial-gradient(circle at 50% 35%, var(--felt), var(--felt-dark) 80%);
  border: 10px solid #5a3a1c;
  border-radius: 24px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.45), var(--shadow);
  padding: 1rem;
  display: grid;
  grid-template-areas:
    ".    north .   "
    "west center east"
    ".    south .   ";
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.5rem;
  min-height: 520px;
}

.seat { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.seat-north { grid-area: north; }
.seat-south { grid-area: south; }
.seat-west { grid-area: west; align-self: center; }
.seat-east { grid-area: east; align-self: center; }

.seat-label {
  font-size: 0.8rem;
  color: var(--gold-light);
  background: rgba(0,0,0,0.35);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.hand {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 64px;
}

.seat-west .hand, .seat-east .hand { flex-direction: column; }

.card {
  width: 46px;
  height: 64px;
  border-radius: 8px;
  background: var(--cream);
  color: var(--black);
  border: 1px solid #c9c2a8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.card.red { color: var(--red); }
.card.black { color: var(--black); }
.card.disabled { cursor: not-allowed; opacity: 0.55; }
.card:not(.disabled):hover { transform: translateY(-6px); }

.card.back {
  background: repeating-linear-gradient(45deg, #1b2a4a, #1b2a4a 6px, #223a6b 6px, #223a6b 12px);
  border: 1px solid var(--gold);
}

.center-area {
  grid-area: center;
  display: grid;
  grid-template-areas:
    ".    tn   ."
    "tw   info te"
    ".    ts   .";
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  justify-items: center;
  gap: 0.4rem;
  min-height: 220px;
}

.trick-slot { width: 46px; height: 64px; }
#trick-N { grid-area: tn; }
#trick-S { grid-area: ts; }
#trick-W { grid-area: tw; }
#trick-E { grid-area: te; }

.center-info {
  grid-area: info;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.controls-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

button.primary {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

button.primary:hover { background: var(--gold-light); }

.log-panel {
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.log-panel ul { margin: 0; padding-left: 1.1rem; }

.site-footer {
  text-align: center;
  padding: 0.9rem 1rem 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid rgba(217, 178, 92, 0.35);
}

/* ---------- Tutoriel ---------- */
.tutorial-shell {
  max-width: 760px;
  margin: 0 auto;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.tutorial-progress {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tutorial-progress .dot {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
}

.tutorial-progress .dot.active { background: var(--gold); }
.tutorial-progress .dot.done { background: var(--felt); }

.tutorial-step { display: none; }
.tutorial-step.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutorial-step h2 { color: var(--gold-light); margin-top: 0; }
.tutorial-step .demo-hand { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.75rem 0; }
.tutorial-step .quiz-feedback { margin-top: 0.6rem; font-weight: 600; min-height: 1.4em; }
.tutorial-step .quiz-feedback.ok { color: #7ee1a1; }
.tutorial-step .quiz-feedback.ko { color: #ff9b9b; }

.tutorial-nav { display: flex; justify-content: space-between; margin-top: 1.25rem; gap: 0.5rem; }
.tutorial-nav button { min-width: 110px; }
button.secondary {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--muted);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
}
button.secondary:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 720px) {
  .table-felt { grid-template-columns: 1fr 1.6fr 1fr; min-height: 420px; }
  .card { width: 38px; height: 54px; font-size: 0.85rem; }
}
