/* CoinCoin Club — thème sombre. Toutes les couleurs sont ici : */
:root {
  --bg: #12131a;
  --bg-2: #171925;
  --surface: #1d2030;
  --surface-2: #262a3d;
  --border: #31364d;
  --text: #f5f1e6;
  --muted: #a0a6bd;
  --yellow: #ffc83d;
  --yellow-2: #ffd95a;
  --orange: #ff7a2f;
  --pond: #2ec4d6;
  --success: #4ade80;
  --danger: #ff5c7a;
  --on-yellow: #1a1407;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-title: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 200, 61, .10), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(46, 196, 214, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--pond); outline-offset: 2px; }

/* ---------- Marque ---------- */
.brand {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--text);
}
.brand span { color: var(--yellow); }
.brand-sm { font-size: 1.25rem; }

/* ---------- Boutons ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: .75rem 1.3rem;
  font-weight: 800;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
  color: var(--on-yellow);
  box-shadow: 0 4px 0 #c98f12, 0 10px 24px rgba(255, 200, 61, .25);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-secondary { background: var(--orange); color: #1b0d03; box-shadow: 0 4px 0 #b4521b; }
.btn-ghost { background: transparent; border: 2px solid var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-lg { padding: 1rem 1.5rem; font-size: 1.1rem; width: 100%; }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }
.btn-danger { background: transparent; border: 2px solid var(--danger); color: var(--danger); }

/* ---------- Panneaux & champs ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin: 0 0 .75rem;
  color: var(--muted);
  font-weight: 600;
}
.field { display: grid; gap: .4rem; }
.field > span { font-weight: 800; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--yellow); }
textarea { resize: none; min-height: 110px; line-height: 1.45; }

/* ---------- Accueil ---------- */
.home {
  flex: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 2.5rem 16px 1rem;
  display: grid;
  gap: 1.25rem;
  align-content: start;
}
.hero { text-align: center; }
.hero-logo {
  width: 150px;
  height: 150px;
  filter: drop-shadow(0 12px 30px rgba(255, 200, 61, .25));
  animation: bob 3.2s ease-in-out infinite;
}
.hero .brand { font-size: clamp(2.4rem, 9vw, 3.2rem); margin-top: .5rem; }
.tagline { color: var(--muted); margin: .25rem 0 0; }
.home-panel { display: grid; gap: 1rem; }
.divider {
  display: flex; align-items: center; gap: .75rem;
  color: var(--muted); font-size: .85rem; font-weight: 600;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.join-row { display: flex; gap: .6rem; }
.code-input {
  text-transform: uppercase;
  letter-spacing: .35em;
  font-family: var(--font-title);
  font-weight: 700;
  text-align: center;
  font-size: 1.25rem;
  min-width: 0;
}
.rules summary { cursor: pointer; font-weight: 800; color: var(--yellow); }
.rules ol { margin: .75rem 0 0; padding-left: 1.2rem; color: var(--muted); display: grid; gap: .4rem; }
.rules strong { color: var(--text); }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.more-games { display: grid; gap: .75rem; }
.more-games .panel-title { margin: .5rem 0 0; text-align: center; }
.game-link {
  display: flex; align-items: center; gap: 1rem;
  text-decoration: none; color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.game-link:hover { transform: translateY(-2px); border-color: var(--yellow); }
.game-link-icon {
  font-size: 1.8rem; width: 52px; height: 52px; flex: none;
  display: grid; place-items: center; border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, #1c8a4b, #0b4f2a);
}
.icon-p4 { background: radial-gradient(circle at 50% 30%, #3a6be0, #163a94); }
.icon-sdk { background: radial-gradient(circle at 50% 30%, #5a4bb5, #2a2266); }
.icon-ms { background: radial-gradient(circle at 50% 30%, #3d4466, #1d2030); }
.game-link strong { display: block; font-family: var(--font-title); font-size: 1.15rem; }
.game-link small { color: var(--muted); font-size: .9rem; }
.game-link-arrow { margin-left: auto; color: var(--yellow); font-size: 1.4rem; font-weight: 800; }

/* ---------- Partie ---------- */
.room { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 0;
}
.topbar-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.mini-logo { width: 40px; height: 40px; flex: none; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.code-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--surface-2); border: 2px dashed var(--yellow);
  border-radius: 999px; padding: .35rem .9rem;
}
.code-chip-label { font-size: .75rem; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.code-chip strong { font-family: var(--font-title); letter-spacing: .2em; color: var(--yellow); font-size: 1.1rem; }

.conn-banner {
  background: var(--danger); color: #1c0309; font-weight: 800;
  text-align: center; border-radius: var(--radius-sm); padding: .5rem; margin-bottom: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
  padding-bottom: 1.5rem;
}
.sidebar { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.stage { display: grid; gap: 1.25rem; min-width: 0; }

/* Joueurs */
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.player {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 2px solid transparent;
}
.player.me { border-color: rgba(255, 200, 61, .35); }
.player.judge { background: linear-gradient(90deg, rgba(255, 200, 61, .18), var(--bg-2)); }
.player.offline { opacity: .45; }
.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; font-size: 1.2rem;
  border-radius: 50%; background: var(--surface-2);
}
.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.player-tags { font-size: .75rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; }
.tag-host { color: var(--pond); }
.tag-judge { color: var(--yellow); }
.tag-done { color: var(--success); }
.player-score { font-family: var(--font-title); font-weight: 700; color: var(--yellow); white-space: nowrap; }
.kick {
  border: 0; background: transparent; color: var(--muted);
  width: 26px; height: 26px; border-radius: 50%; flex: none;
}
.kick:hover { background: var(--danger); color: #1c0309; }

/* Réactions */
.reactions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; padding: .75rem; }
.reactions button {
  border: 0; background: var(--bg-2); border-radius: var(--radius-sm);
  font-size: 1.35rem; padding: .35rem 0; transition: transform .1s;
}
.reactions button:hover { transform: scale(1.12); background: var(--surface-2); }

/* Bandeau de manche */
.round-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.round-label { font-family: var(--font-title); font-weight: 600; color: var(--muted); font-size: 1rem; }
.round-label strong { color: var(--text); }
.timer {
  font-family: var(--font-title); font-weight: 700; font-size: 1.1rem;
  background: var(--surface-2); padding: .3rem .9rem; border-radius: 999px;
  min-width: 4.5rem; text-align: center;
}
.timer.urgent { background: var(--danger); color: #1c0309; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* Carte situation */
.situation-card {
  position: relative;
  background: linear-gradient(160deg, var(--yellow-2), var(--yellow) 55%, #f6a91c);
  color: var(--on-yellow);
  border-radius: 24px;
  padding: 2rem 1.75rem 2.4rem;
  box-shadow: 0 6px 0 #b98314, 0 22px 50px rgba(255, 200, 61, .18);
  overflow: hidden;
  animation: deal .45s cubic-bezier(.2, 1.4, .4, 1);
}
.situation-card .card-tag {
  font-family: var(--font-title); font-weight: 700; text-transform: uppercase;
  font-size: .8rem; letter-spacing: .12em; opacity: .7;
}
.situation-card p {
  font-family: var(--font-title); font-weight: 600;
  font-size: clamp(1.35rem, 3.6vw, 1.9rem);
  line-height: 1.25; margin: .6rem 0 0;
}
.situation-card .card-duck {
  position: absolute; right: -10px; bottom: -22px;
  width: 110px; opacity: .16; transform: rotate(-12deg);
}
@keyframes deal {
  from { transform: translateY(20px) rotate(-3deg) scale(.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.callout {
  display: flex; gap: .9rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.callout-emoji { font-size: 2rem; flex: none; }
.callout h3 { margin: 0; font-family: var(--font-title); font-weight: 600; }
.callout p { margin: .15rem 0 0; color: var(--muted); }
.callout-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }

.answer-form { display: grid; gap: .75rem; }
.answer-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.char-count { color: var(--muted); font-size: .85rem; }

.progress {
  height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden;
}
.progress > div {
  height: 100%; background: linear-gradient(90deg, var(--pond), var(--success));
  border-radius: 999px; transition: width .3s ease;
}
.progress-label { color: var(--muted); font-size: .9rem; font-weight: 600; margin-top: .4rem; }

/* Réponses */
.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.answer {
  text-align: left;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.1rem 1rem;
  font-size: 1.05rem; font-weight: 600;
  display: flex; flex-direction: column; gap: .6rem;
  animation: deal .4s cubic-bezier(.2, 1.4, .4, 1) both;
  overflow-wrap: anywhere;
}
.answer.pickable { cursor: pointer; transition: transform .12s, border-color .12s; }
.answer.pickable:hover { transform: translateY(-3px); border-color: var(--muted); }
.answer.selected { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 200, 61, .25); }
.answer.winner {
  border-color: var(--yellow);
  background: linear-gradient(160deg, rgba(255, 200, 61, .22), var(--surface));
  box-shadow: 0 0 0 4px rgba(255, 200, 61, .2);
}
.answer-author { font-size: .85rem; color: var(--muted); font-weight: 800; margin-top: auto; }
.answer.winner .answer-author { color: var(--yellow); }

/* Lobby */
.lobby-grid { display: grid; gap: 1rem; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.invite-box {
  display: flex; gap: .5rem; align-items: center;
  background: var(--bg-2); border-radius: var(--radius-sm); padding: .5rem .5rem .5rem 1rem;
}
.invite-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.big-code {
  font-family: var(--font-title); font-weight: 700; font-size: clamp(3rem, 12vw, 4.5rem);
  letter-spacing: .25em; color: var(--yellow); text-align: center; line-height: 1;
  padding-left: .25em;
}
.hint { color: var(--muted); text-align: center; margin: 0; }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: .75rem; padding-top: 1rem; }
.podium-step { display: grid; justify-items: center; gap: .4rem; width: 110px; }
.podium-step .avatar { width: 56px; height: 56px; font-size: 1.8rem; }
.podium-name { font-weight: 800; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-block {
  width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: center;
  font-family: var(--font-title); font-weight: 700; font-size: 1.5rem; color: var(--on-yellow);
}
.podium-1 .podium-block { height: 130px; background: var(--yellow); }
.podium-2 .podium-block { height: 95px; background: #d9dce8; }
.podium-3 .podium-block { height: 70px; background: #e09a5c; }
.winner-title { text-align: center; font-family: var(--font-title); font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0; }
.winner-title span { color: var(--yellow); }

.center-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* Main de cartes (mode Cartes farfelues) */
.hand-head h3 { margin: 0; font-family: var(--font-title); font-weight: 600; }
.hand-head small { color: var(--muted); font-family: var(--font-body); font-weight: 600; font-size: .85rem; }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.hand-card { min-height: 110px; background: #f5f1e6; color: #1d1a12; border-color: #f5f1e6; }
.hand-card.pickable:hover { border-color: var(--yellow); }
.hand-card.selected { background: var(--yellow); border-color: var(--yellow); transform: translateY(-4px); }
.field-wide { grid-column: 1 / -1; }

/* Chat */
.chat { display: grid; gap: .6rem; }
.chat .panel-title { margin: 0; }
.chat-log {
  height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem;
  padding-right: .25rem; overscroll-behavior: contain;
}
.chat-msg {
  background: var(--bg-2); border-radius: var(--radius-sm); padding: .4rem .65rem;
  font-size: .92rem; overflow-wrap: anywhere; display: grid;
}
.chat-msg { transition: opacity .6s ease, transform .6s ease; }
.chat-msg.chat-fading { opacity: 0; transform: translateX(12px); }
.chat-log:empty::before { content: 'Les messages s’envolent après 30 secondes 🦆'; color: var(--muted); font-size: .8rem; text-align: center; margin: auto 0; }
.chat-mine { background: rgba(255, 200, 61, .12); }
.chat-author { font-weight: 800; font-size: .78rem; color: var(--yellow); }
.chat-system { background: transparent; color: var(--muted); font-size: .8rem; font-style: italic; text-align: center; padding: .1rem .4rem; }
.chat-form { display: flex; gap: .4rem; }
.chat-form input { padding: .55rem .8rem; min-width: 0; }

/* Réactions flottantes */
.floaters { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.floater {
  position: absolute; bottom: -60px; font-size: 2.2rem;
  animation: floatUp 2.6s ease-out forwards;
  display: grid; justify-items: center;
}
.floater small {
  font-size: .7rem; font-weight: 800; background: var(--surface-2);
  padding: .1rem .5rem; border-radius: 999px; color: var(--text);
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-80px) scale(1.1); }
  100% { transform: translateY(-75vh) scale(1); opacity: 0; }
}

/* Toasts */
.toasts {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  display: grid; gap: .5rem; z-index: 40; width: min(92vw, 420px);
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 5px solid var(--yellow);
  padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-weight: 700; animation: deal .3s ease;
}
.toast.error { border-left-color: var(--danger); }

/* Footer */
.footer {
  text-align: center; color: var(--muted); font-size: .9rem;
  padding: 1.25rem 16px 1.75rem;
}
.footer strong { color: var(--yellow); }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .topbar-brand .brand { display: none; }
}
@media (max-width: 480px) {
  .settings { grid-template-columns: 1fr; }
  .situation-card { padding: 1.5rem 1.25rem 2rem; }
  .podium-step { width: 92px; }
  .code-chip-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
