@font-face { font-family: "Archivo Black"; src: url("/fonts/ArchivoBlack-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Mada"; src: url("/fonts/Mada-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mada"; src: url("/fonts/Mada-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Mada"; src: url("/fonts/Mada-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Mada"; src: url("/fonts/Mada-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  --ink: #0b0a0f;
  --ink-2: #15121d;
  --ink-3: #201c2b;
  --cream: #f4eee2;
  --cream-dim: #d9d1c2;
  --muted: #9a91a8;
  --coral: #ff4d3d;
  --yellow: #f5ce47;
  --violet: #b79cff;
  --mint: #54e0a8;
  --sky: #5bc8f5;
  --radius: 22px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: "Mada", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 85% -5%, rgba(255, 77, 61, 0.22), transparent 70%),
    radial-gradient(55% 45% at -10% 105%, rgba(183, 156, 255, 0.2), transparent 70%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 470px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}

/* ---------- Barre haute ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 2px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(var(--ink) 62%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.brand-eyes { width: 26px; height: 26px; object-fit: contain; }

.brand-word {
  font-family: "Archivo Black", sans-serif;
  font-size: 21px;
  letter-spacing: 0.1em;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(244, 238, 226, 0.16);
  background: rgba(244, 238, 226, 0.06);
  color: var(--cream);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 21px; height: 21px; fill: currentColor; }
.icon-btn-sm { width: 36px; height: 36px; font-size: 15px; }

.main { flex: 1; display: flex; flex-direction: column; }

/* ---------- Écrans ---------- */
.screen { display: none; flex: 1; flex-direction: column; padding-bottom: 8px; }
.screen.active { display: flex; animation: fade 0.28s ease both; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Accueil ---------- */
.hero { padding: 18px 2px 22px; }

.hero-title {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(30px, 9vw, 40px);
  line-height: 0.96;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.hero-title em { font-style: normal; color: var(--coral); }

.hero-sub { margin: 0; color: var(--muted); font-size: 14.5px; font-weight: 600; }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode {
  position: relative;
  border: 0;
  padding: 0;
  aspect-ratio: 1 / 1.06;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  color: var(--cream);
  text-align: left;
  background: var(--ink-2);
  box-shadow: var(--shadow);
  transition: transform 0.14s ease;
  isolation: isolate;
}
.mode:active { transform: scale(0.965); }

.mode img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  z-index: -2;
  filter: saturate(1.05);
  transition: transform 0.4s ease;
}
.mode:hover img { transform: scale(1.04); }

.mode::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 10, 15, 0.05) 30%, rgba(11, 10, 15, 0.9) 78%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 26%, transparent), transparent 55%);
}

.mode-text {
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 11px;
  display: grid;
  gap: 2px;
}

.mode-name {
  font-family: "Archivo Black", sans-serif;
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.mode-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent) 78%, white);
  letter-spacing: 0.01em;
}

.mode-dot {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.footnote {
  margin: 20px 2px 4px;
  font-size: 12px;
  color: rgba(154, 145, 168, 0.75);
}

/* ---------- Joueurs ---------- */
.screen-title {
  font-family: "Archivo Black", sans-serif;
  font-size: 28px;
  margin: 14px 0 6px;
  letter-spacing: -0.01em;
}
.screen-sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.add-player { display: flex; gap: 8px; margin-bottom: 16px; }

.add-player input {
  flex: 1;
  min-width: 0;
  background: var(--ink-2);
  border: 1px solid rgba(244, 238, 226, 0.14);
  border-radius: 14px;
  padding: 14px 15px;
  color: var(--cream);
  font-family: inherit;
  font-size: 16px;
}
.add-player input:focus { outline: 2px solid var(--coral); outline-offset: 1px; }
.add-player input::placeholder { color: rgba(154, 145, 168, 0.8); }

.player-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }

.player-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(244, 238, 226, 0.05);
  border: 1px solid rgba(244, 238, 226, 0.08);
  border-radius: 15px;
  padding: 10px 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: "Archivo Black", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--accent, var(--yellow));
  flex: none;
}

.player-name { flex: 1; font-weight: 700; font-size: 15.5px; }

.player-pen {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-del {
  border: 0;
  background: none;
  color: rgba(154, 145, 168, 0.85);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

.empty-hint {
  padding: 26px 16px;
  border: 1px dashed rgba(244, 238, 226, 0.16);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  line-height: 1.5;
}

/* ---------- Switch ---------- */
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(244, 238, 226, 0.05);
  border: 1px solid rgba(244, 238, 226, 0.08);
  border-radius: 16px;
  padding: 13px 14px;
  margin-bottom: 16px;
  cursor: pointer;
}
.switch > span:first-child { flex: 1; display: grid; gap: 2px; }
.switch strong { font-size: 15px; }
.switch small { color: var(--muted); font-size: 12.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-track {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(244, 238, 226, 0.16);
  padding: 3px;
  transition: background 0.2s;
  flex: none;
}
.switch-knob {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cream);
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.switch input:checked + .switch-track { background: var(--mint); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(20px); }

/* ---------- Boutons ---------- */
.btn {
  font-family: inherit;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.02em;
  border: 0;
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s;
}
.btn:active { transform: translateY(2px) scale(0.99); }

.btn-primary {
  background: var(--coral);
  color: #1a0503;
  box-shadow: 0 5px 0 #a82a1f;
}
.btn-primary:active { box-shadow: 0 3px 0 #a82a1f; }

.btn-ghost {
  background: rgba(244, 238, 226, 0.07);
  color: var(--cream);
  border: 1px solid rgba(244, 238, 226, 0.14);
}

.btn-block { width: 100%; margin-top: 10px; }
.btn-small { padding: 0 18px; font-size: 14.5px; border-radius: 14px; background: var(--cream); color: var(--ink); }

/* ---------- Jeu ---------- */
.game-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 14px;
}
.game-mode {
  flex: 1;
  font-family: "Archivo Black", sans-serif;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent, var(--cream));
}
.game-count {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; min-height: 0; }

.card {
  position: relative;
  background: var(--cream);
  color: #12100f;
  border-radius: 26px;
  padding: 26px 22px 30px;
  box-shadow: 0 26px 60px -26px rgba(0, 0, 0, 0.9), inset 0 -4px 0 rgba(0, 0, 0, 0.08);
  animation: cardIn 0.32s cubic-bezier(0.22, 1.1, 0.4, 1) both;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--accent, var(--coral));
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) rotate(-1.2deg); }
  to { opacity: 1; transform: none; }
}

.card-badge {
  align-self: flex-start;
  font-family: "Archivo Black", sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #12100f;
  background: var(--accent, var(--yellow));
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 100%;
}

.card-text {
  margin: 0;
  font-size: clamp(20px, 5.6vw, 25px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -0.008em;
  text-wrap: pretty;
}

.card-text.small { font-size: clamp(17px, 4.6vw, 20px); font-weight: 600; }

.card-note {
  margin: 0;
  font-size: 13px;
  color: #6b6257;
  font-weight: 600;
}

.chip {
  display: inline;
  background: var(--accent, var(--yellow));
  border-radius: 7px;
  padding: 1px 6px 2px;
  font-weight: 900;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  white-space: nowrap;
}

.chip-pen {
  background: var(--coral);
  color: #1a0503;
  font-family: "Archivo Black", sans-serif;
  font-size: 0.82em;
  letter-spacing: 0.04em;
  padding: 2px 7px 3px;
  border-radius: 7px;
}

.reveal {
  background: rgba(244, 238, 226, 0.08);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 15.5px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--cream);
  animation: fade 0.25s ease both;
}
.reveal b {
  display: block;
  font-family: "Archivo Black", sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.pick-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b6257;
  margin: 0;
}

.pick-row { display: flex; flex-wrap: wrap; gap: 7px; }

.pick {
  border: 1.5px solid rgba(18, 16, 15, 0.16);
  background: rgba(18, 16, 15, 0.04);
  color: #12100f;
  font-family: inherit;
  font-weight: 800;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pick[aria-pressed="true"] {
  background: var(--accent, var(--coral));
  border-color: transparent;
  color: #12100f;
  transform: translateY(-1px);
}

/* ---------- Fiche du mode ---------- */
.screen.sheet-open .stage,
.screen.sheet-open .penalties,
.screen.sheet-open .game-actions { display: none; }

.sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
  animation: fade 0.24s ease both;
}
.sheet[hidden] { display: none; }

.sheet-head {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  min-height: 168px;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow);
}
.sheet-head img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}
.sheet-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 10, 15, 0.15), rgba(11, 10, 15, 0.94));
}
.sheet-headtext { position: relative; z-index: 2; padding: 15px 17px 16px; }

.sheet-kicker {
  margin: 0 0 5px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent, var(--coral));
}
.sheet-title {
  font-family: "Archivo Black", sans-serif;
  font-size: 25px;
  line-height: 1;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.sheet-tag { margin: 0; font-size: 13px; line-height: 1.4; color: rgba(244, 238, 226, 0.72); font-weight: 600; }

.sheet-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.sheet-rules li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--cream-dim);
}
.sheet-rules li::before {
  content: "→";
  flex: none;
  color: var(--accent, var(--coral));
  font-weight: 900;
}

.sheet-actions { margin-top: auto; padding-top: 10px; }

/* ---------- Pénalités ---------- */
.penalties {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 12px 2px 4px;
  scrollbar-width: none;
}
.penalties::-webkit-scrollbar { display: none; }
.penalties:empty { display: none; }

.pen {
  flex: none;
  border: 1px solid rgba(244, 238, 226, 0.13);
  background: rgba(244, 238, 226, 0.05);
  color: var(--cream);
  border-radius: 13px;
  padding: 7px 11px 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.1s, background 0.2s;
}
.pen:active { transform: scale(0.94); }
.pen b {
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  color: var(--ink);
  background: var(--accent, var(--yellow));
  border-radius: 6px;
  padding: 1px 5px 2px;
  min-width: 16px;
  text-align: center;
}
.pen.bump { animation: bump 0.3s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.pen-hint {
  flex: none;
  align-self: center;
  font-size: 11.5px;
  color: rgba(154, 145, 168, 0.8);
  padding-left: 4px;
  white-space: nowrap;
}

.game-actions { padding-top: 10px; }

/* ---------- Fin ---------- */
.end-head { padding: 22px 2px 20px; }
.end-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral);
}
.end-title {
  font-family: "Archivo Black", sans-serif;
  font-size: 30px;
  line-height: 1.02;
  margin: 0;
}

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(244, 238, 226, 0.05);
  border: 1px solid rgba(244, 238, 226, 0.08);
}
.rank-row:first-child {
  background: linear-gradient(100deg, rgba(255, 77, 61, 0.18), rgba(244, 238, 226, 0.04));
  border-color: rgba(255, 77, 61, 0.4);
}
.rank-pos {
  font-family: "Archivo Black", sans-serif;
  font-size: 14px;
  color: var(--muted);
  width: 20px;
}
.rank-row:first-child .rank-pos { color: var(--coral); }
.rank-name { flex: 1; font-weight: 800; font-size: 15.5px; }
.rank-pts { font-weight: 900; font-size: 14px; color: var(--muted); }
.rank-row:first-child .rank-pts { color: var(--cream); }

.end-actions { margin-top: auto; padding-top: 22px; }

/* ---------- Aide ---------- */
.help-head { padding: 18px 2px 16px; }
.help-head .screen-title { margin: 6px 0 0; font-size: 27px; }

.steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }

.steps li {
  display: flex;
  gap: 12px;
  background: rgba(244, 238, 226, 0.05);
  border: 1px solid rgba(244, 238, 226, 0.08);
  border-radius: 16px;
  padding: 13px 14px;
}
.steps strong { font-size: 14.5px; display: block; margin-bottom: 3px; }
.steps p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

.step-n {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--cream);
  color: var(--ink);
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
}

.help-sub {
  font-family: "Archivo Black", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  margin: 22px 2px 10px;
}

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.legend li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(244, 238, 226, 0.04);
  border-radius: 14px;
  padding: 11px 13px;
}
.legend p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.legend strong { color: var(--cream); }
.legend-chip { flex: none; min-width: 74px; display: grid; place-items: center; }

.pen-badge {
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 6px;
  padding: 2px 7px 3px;
}

.mode-help { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.mode-help-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 15px;
  background: rgba(244, 238, 226, 0.04);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.mode-help-row img {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  object-fit: cover;
}
.mode-help-row strong { font-size: 14px; display: block; }
.mode-help-row p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

.help-actions { margin-top: auto; padding-top: 22px; }

@media (min-width: 560px) {
  .app { padding-bottom: 26px; }
  .mode-grid { gap: 14px; }
}
