/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0608;
  --bg2:       #120b10;
  --surface:   #1c1220;
  --surface2:  #241729;
  --border:    #3a2545;
  --gold:      #c9963a;
  --gold-lt:   #e8b96a;
  --rose:      #c0384a;
  --rose-lt:   #e05068;
  --text:      #f0e6f0;
  --text-dim:  #9a8aaa;
  --innocent:  #7bc47e;
  --coquin:    #f4a261;
  --torride:   #e63946;
  --dechaine:  #9b2226;

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  --radius:    16px;
  --radius-lg: 28px;
  --shadow:    0 8px 40px rgba(0,0,0,.7);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
}

/* PARTICLES */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .4;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px);
  transition: opacity .45s ease, transform .45s ease;
  overflow-y: auto;
  padding: 1.5rem;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.screen.exit {
  opacity: 0;
  transform: translateY(-30px);
  transition: opacity .3s ease, transform .3s ease;
}

.screen-inner {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 2rem;
}

/* ===== LOGO ===== */
.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .5rem;
}
.logo h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}
.logo h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.logo em { color: var(--gold); font-style: normal; }
.suit {
  font-size: 2.2rem;
  color: var(--rose);
  line-height: 1;
  animation: pulse-suit 3s ease-in-out infinite;
}
.suit.gold { color: var(--gold); }
@keyframes pulse-suit {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: .8; }
}

.tagline {
  font-size: .9rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

/* ===== CARD PANEL ===== */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 2rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.04);
}

/* ===== TYPOGRAPHY ===== */
.field-label {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-lt);
  align-self: flex-start;
}
h2 { font-family: var(--font-serif); font-size: 2rem; font-weight: 900; }
h2 em { color: var(--gold); font-style: normal; }

.hint { font-size: .8rem; color: var(--text-dim); }
.hint-small { font-size: .78rem; color: var(--text-dim); align-self: flex-start; margin-top: -.6rem; }

/* ===== NUMBER PICKER ===== */
.number-picker {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.number-picker span {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 900;
  color: var(--text);
  min-width: 2.5ch;
  text-align: center;
  line-height: 1;
}
.btn-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--gold-lt);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.btn-circle:hover { background: var(--border); }
.btn-circle:active { transform: scale(.9); }

/* ===== BUTTONS ===== */
.btn-primary {
  width: 100%;
  padding: .9rem 2rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-lt) 100%);
  color: #0a0608;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 20px rgba(201,150,58,.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(201,150,58,.45); }
.btn-primary:active { transform: scale(.97); }

/* ===== PLAYER NAME INPUTS ===== */
#names-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: .3rem;
}
.name-row {
  display: flex;
  align-items: center;
  gap: .8rem;
}
.name-row .player-num {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-dim);
  min-width: 1.5rem;
  text-align: right;
}
.name-row input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.name-row input:focus { border-color: var(--gold); }
.name-row input::placeholder { color: var(--text-dim); }

/* ===== CATEGORIES ===== */
.categories-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.category-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: border-color .2s, transform .15s, background .2s;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  user-select: none;
}
.category-card:hover { transform: translateY(-2px); }
.category-card.selected { background: rgba(201,150,58,.1); }
.category-card .cat-emoji { font-size: 1.6rem; }
.category-card .cat-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.category-card .cat-desc { font-size: .72rem; color: var(--text-dim); line-height: 1.3; }
.category-card .cat-pts { font-size: .72rem; font-weight: 600; margin-top: .2rem; }

.cat-innocent  { --cat-c: var(--innocent); }
.cat-coquin    { --cat-c: var(--coquin); }
.cat-torride   { --cat-c: var(--torride); }
.cat-dechaine  { --cat-c: var(--dechaine); }

.category-card { border-color: var(--border); }
.category-card.selected { border-color: var(--cat-c); }
.category-card .cat-pts { color: var(--cat-c); }

/* ===== GAME LAYOUT ===== */
.game-layout {
  gap: .8rem;
}

/* TOP BAR */
.top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.progress-info {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex: 1;
}
.progress-info span {
  font-size: .8rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.progress-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  width: 0%;
  transition: width .4s ease;
}
.level-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .8rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--gold-lt);
  transition: color .4s, border-color .4s;
}

/* PLAYER TURN */
.player-turn {
  text-align: center;
  line-height: 1.2;
}
.turn-label {
  display: block;
  font-size: .75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.turn-player {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 900;
  color: var(--gold-lt);
  animation: name-pop .4s cubic-bezier(.17,.67,.35,1.3);
}
@keyframes name-pop {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* CHOICE BUTTONS */
.choice-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  transition: opacity .3s, transform .3s;
}
.choice-buttons.hidden { opacity: 0; pointer-events: none; transform: scale(.95); }

.btn-choice {
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  transition: transform .15s, box-shadow .15s;
}
.btn-choice:active { transform: scale(.96); }
.btn-choice.truth {
  background: linear-gradient(145deg, #1e2d5a, #162347);
  border: 2px solid #2e4a8a;
  box-shadow: 0 4px 20px rgba(46,74,138,.3);
}
.btn-choice.dare {
  background: linear-gradient(145deg, #5a1e22, #3d1418);
  border: 2px solid #a03040;
  box-shadow: 0 4px 20px rgba(160,48,64,.3);
}
.btn-choice:hover.truth { box-shadow: 0 8px 28px rgba(46,74,138,.5); transform: translateY(-2px); }
.btn-choice:hover.dare  { box-shadow: 0 8px 28px rgba(160,48,64,.5); transform: translateY(-2px); }

.choice-icon { font-size: 2rem; }
.choice-label {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .5px;
}

/* PLAYING CARD */
.card-scene {
  perspective: 1200px;
  width: 100%;
  max-width: 360px;
  align-self: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(.85);
  transition: opacity .4s ease, transform .4s cubic-bezier(.17,.67,.35,1.2);
}
.card-scene.visible {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

.playing-card {
  position: relative;
  width: 100%;
  padding-bottom: 0;
  transform-style: preserve-3d;
}

.card-front {
  background: linear-gradient(155deg, #1e1428 0%, #130e1c 100%);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
  animation: card-appear .5s cubic-bezier(.17,.67,.35,1.2);
}
@keyframes card-appear {
  from { transform: rotateY(90deg) scale(.8); opacity: 0; }
  to   { transform: rotateY(0)    scale(1);   opacity: 1; }
}
.card-front::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201,150,58,.2);
  border-radius: 14px;
  pointer-events: none;
}
.card-front::after {
  content: '♠ ♥ ♦ ♣';
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  font-size: 5rem;
  opacity: .03;
  pointer-events: none;
  white-space: nowrap;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.card-corner.bottom-right {
  align-self: flex-end;
  align-items: flex-end;
  transform: rotate(180deg);
}
.card-type-mini { font-size: .65rem; font-weight: 700; letter-spacing: 1px; color: var(--gold); }
.card-suit-mini { font-size: 1rem; color: var(--gold); }

.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  padding: .5rem 0;
  flex: 1;
  justify-content: center;
}
.card-type-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: .25rem .8rem;
  border-radius: 20px;
  background: rgba(201,150,58,.15);
  color: var(--gold-lt);
  border: 1px solid rgba(201,150,58,.3);
}
.card-type-label.dare-label { background: rgba(224,80,104,.15); color: var(--rose-lt); border-color: rgba(224,80,104,.3); }

.card-text {
  font-family: var(--font-serif);
  font-size: clamp(.95rem, 3vw, 1.15rem);
  text-align: center;
  line-height: 1.5;
  color: var(--text);
  padding: 0 .5rem;
}

.card-points {
  font-size: .75rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}

/* CARD ACTIONS */
.card-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .3s, transform .3s;
}
.card-actions.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.btn-pass, .btn-done {
  flex: 1;
  padding: .8rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  letter-spacing: .5px;
}
.btn-pass {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-pass:hover { background: var(--border); color: var(--text); }
.btn-done {
  background: linear-gradient(135deg, var(--gold), var(--gold-lt));
  border: none;
  color: #0a0608;
  box-shadow: 0 4px 16px rgba(201,150,58,.3);
}
.btn-done:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,150,58,.45); }

/* SCOREBOARD STRIP */
.scoreboard-strip {
  width: 100%;
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .3rem;
}
.score-chip {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .8rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  white-space: nowrap;
}
.score-chip .sc-name { color: var(--text-dim); }
.score-chip .sc-pts { font-weight: 700; color: var(--gold); font-family: var(--font-serif); }
.score-chip.current { border-color: var(--gold); background: rgba(201,150,58,.08); }
.score-chip.current .sc-name { color: var(--text); }

/* ===== END SCREEN ===== */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .8rem;
  margin: 1rem 0 .5rem;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.podium-block {
  width: 80px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.podium-place:nth-child(1) .podium-block { height: 100px; border-color: var(--gold); background: rgba(201,150,58,.15); }
.podium-place:nth-child(2) .podium-block { height: 70px; border-color: #aaa; background: rgba(180,180,180,.08); }
.podium-place:nth-child(3) .podium-block { height: 50px; border-color: #a0522d; background: rgba(160,82,45,.1); }
.podium-medal { font-size: 1.5rem; }
.podium-name { font-size: .8rem; font-weight: 600; text-align: center; color: var(--text); max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.podium-score { font-family: var(--font-serif); font-size: .9rem; font-weight: 700; color: var(--gold); }

.final-scores {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 35vh;
  overflow-y: auto;
}
.final-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1rem;
}
.final-row .fr-rank { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 900; color: var(--text-dim); min-width: 1.8rem; }
.final-row .fr-name { flex: 1; font-weight: 500; color: var(--text); margin-left: .5rem; }
.final-row .fr-pts { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--gold); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1.5rem;
  font-size: .85rem;
  color: var(--text);
  z-index: 100;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }