/*!
 * TriDés — feuille de style partagée
 */
:root {
  --felt-dark: #0b5c41;
  --felt: #0f7a56;
  --felt-light: #12905f;
  --gold: #d4af37;
  --gold-dark: #8a6d1f;
  --cream: #f5efe6;
  --red: #b1272c;
  --ink: #1a1a1a;
  --panel: rgba(11, 30, 24, 0.55);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(circle at 20% -10%, rgba(212,175,55,0.15), transparent 45%),
    linear-gradient(160deg, var(--felt-dark), #073d2b 70%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: rgba(0,0,0,0.18);
  border-bottom: 1px solid rgba(212,175,55,0.25);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand img { width: 42px; height: 36px; display: block; }

.brand__name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.brand__tagline {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--cream);
  opacity: 0.75;
}

.nav {
  display: flex;
  gap: 0.4rem;
}

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

.nav a:hover { background: rgba(255,255,255,0.08); }

.nav__link--active {
  border-color: var(--gold);
  background: rgba(212,175,55,0.15);
  color: var(--gold);
}

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.footer {
  text-align: center;
  padding: 1rem 1rem 1.4rem;
  font-size: 0.78rem;
  color: rgba(245,239,230,0.6);
  border-top: 1px solid rgba(212,175,55,0.15);
}

/* ---------- Boutons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  box-shadow: var(--shadow);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn--primary { background: linear-gradient(135deg, var(--gold), #b9902b); color: #241a05; }
.btn--secondary { background: rgba(255,255,255,0.1); color: var(--cream); border: 1px solid rgba(255,255,255,0.25); }
.btn--ghost { background: transparent; color: var(--cream); border: 1px solid rgba(255,255,255,0.3); box-shadow: none; }

/* ---------- Accueil ---------- */
.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}
.hero h1 { font-size: 2.4rem; margin: 0.4rem 0; color: var(--gold); }
.hero p { font-size: 1.05rem; max-width: 560px; margin: 0.6rem auto 1.6rem; opacity: 0.9; }
.hero .actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-top: 2.5rem;
}
.feature-card {
  background: var(--panel);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: var(--radius);
  padding: 1.2rem;
}
.feature-card h3 { margin-top: 0; color: var(--gold); font-size: 1.05rem; }
.feature-card p { margin-bottom: 0; font-size: 0.92rem; opacity: 0.9; }

/* ---------- Dés ---------- */
.dice-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  min-height: 76px;
}
.dice--hidden .die__face { visibility: hidden; }
.dice--hidden .die { background: repeating-linear-gradient(45deg, #234a3c, #234a3c 6px, #1c3c31 6px, #1c3c31 12px); }

.die {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  background: var(--cream);
  border: 2px solid #cbbfa9;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  padding: 0;
  cursor: default;
  display: grid;
  place-items: center;
}
.die:disabled { cursor: default; }
button.die:not(:disabled) { cursor: pointer; }
button.die:not(:disabled):hover { border-color: var(--gold); }

.die--held {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.5), 0 4px 10px rgba(0,0,0,0.35);
}

.die__face {
  width: 52px;
  height: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 4px;
}

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  align-self: center;
  justify-self: center;
}
.pip--tl { grid-area: 1 / 1; }
.pip--tr { grid-area: 1 / 3; }
.pip--ml { grid-area: 2 / 1; }
.pip--mid { grid-area: 2 / 2; }
.pip--mr { grid-area: 2 / 3; }
.pip--bl { grid-area: 3 / 1; }
.pip--br { grid-area: 3 / 3; }

/* ---------- Jeu ---------- */
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.score-pill {
  background: var(--panel);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-weight: 700;
}
.score-pill span { color: var(--gold); }
.round-pill {
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.85;
}

.player-panel {
  background: var(--panel);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin-bottom: 1.2rem;
  text-align: center;
}
.player-panel h2 { margin: 0 0 0.8rem; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85; }
.hand-label { min-height: 1.4rem; margin-top: 0.8rem; font-weight: 700; color: var(--gold); }
.throws-info { font-size: 0.82rem; opacity: 0.75; margin-top: 0.4rem; }

.controls {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.result-panel {
  text-align: center;
  background: rgba(212,175,55,0.12);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin: 1.2rem 0;
}
.result-panel p { margin: 0 0 0.9rem; font-weight: 600; }

.log-panel {
  margin-top: 2rem;
}
.log-panel h3 { font-size: 0.85rem; text-transform: uppercase; opacity: 0.75; letter-spacing: 0.04em; }
.log-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.86rem;
  opacity: 0.85;
}
.log-panel li { padding: 0.35rem 0; border-bottom: 1px dashed rgba(255,255,255,0.1); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: linear-gradient(160deg, #0f7a56, #073d2b);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; color: var(--gold); }

/* ---------- Tutoriel ---------- */
.tutorial-shell {
  background: var(--panel);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  margin-bottom: 1.4rem;
}
.progress-bar { height: 100%; background: var(--gold); transition: width 0.25s ease; }

.tutorial-step { display: none; }
.tutorial-step--active { display: block; }
.tutorial-step h2 { color: var(--gold); margin-top: 0; }

.rank-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  counter-reset: rank;
}
.rank-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px dashed rgba(255,255,255,0.12);
}
.rank-list li::before {
  content: counter(rank);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: #241a05;
  font-weight: 800;
  font-size: 0.78rem;
  display: grid;
  place-items: center;
  flex: none;
}
.rank-list strong { color: var(--gold); }
.rank-list.rank-list--worst li::before { background: var(--red); color: var(--cream); }

.quiz-hands {
  display: flex;
  gap: 1.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.2rem 0;
}
.quiz-hand {
  background: rgba(0,0,0,0.2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  min-width: 160px;
}
.quiz-hand:hover { border-color: rgba(212,175,55,0.5); }
.quiz-hand--correct { border-color: #4caf50 !important; background: rgba(76,175,80,0.15); }
.quiz-hand--wrong { border-color: var(--red) !important; background: rgba(177,39,44,0.15); }
.quiz-hand .dice-row { margin-bottom: 0.6rem; }
.quiz-feedback { min-height: 1.4rem; text-align: center; font-weight: 700; margin-top: 0.6rem; }

.tutorial-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.6rem;
}

.badge-63 {
  display: inline-block;
  background: var(--red);
  color: var(--cream);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-weight: 800;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .header { padding: 0.9rem 1rem; }
  .brand__name { font-size: 1.15rem; }
  .die { width: 56px; height: 56px; }
  .die__face { width: 42px; height: 42px; }
  .hero h1 { font-size: 1.8rem; }
}
