@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #14152B;
  --panel: #1E2044;
  --panel-2: #262A56;
  --accent: #FFC845;
  --accent-dim: #6b5a1f;
  --coral: #FF5D5D;
  --green: #6BCB77;
  --text: #F4F2ED;
  --muted: #9A9AC0;
  --radius: 18px;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255,200,69,0.08), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(107,203,119,0.06), transparent 45%);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: 'Archivo Black', 'Inter', sans-serif;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

a { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header / tape counter ---------- */
.tape-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.counter {
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 999px;
  padding: 8px 16px;
  letter-spacing: 0.05em;
}

/* ---------- Cards / panels ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

/* ---------- Grille de sélection de compte ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
.account-btn {
  background: var(--panel-2);
  border: 2px solid var(--panel-2);
  border-radius: 12px;
  padding: 14px 10px;
  color: var(--text);
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.account-btn:hover { border-color: var(--accent); transform: translateY(-2px); }

select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(32px, 6vw, 48px);
  margin-bottom: 12px;
}

.hero-sub {
  color: var(--muted);
  font-size: 17px;
  margin-bottom: 28px;
  max-width: 46ch;
}

label {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="file"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 18px;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 15px 28px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 15px;
  cursor: pointer;
  background: var(--accent);
  color: var(--bg);
  transition: transform 0.15s ease, filter 0.15s ease;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-2);
}

.btn.danger { background: var(--coral); color: #2b0d0d; }

/* ---------- Play button (signature element) ---------- */
/* ---------- Barre de volume ---------- */
.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 15px;
}
.volume-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  outline: none;
}
.volume-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.volume-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.play-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 0 30px;
}

.play-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(255,200,69,0.5);
  transition: transform 0.15s ease;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn.playing {
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,200,69,0.45); }
  70%  { box-shadow: 0 0 0 22px rgba(255,200,69,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,200,69,0); }
}

.waveform {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 26px;
}
.waveform span {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.35;
  height: 6px;
}
.waveform.active span {
  opacity: 1;
  animation: bounce 0.9s ease-in-out infinite;
}
.waveform span:nth-child(1) { animation-delay: 0s; }
.waveform span:nth-child(2) { animation-delay: 0.1s; }
.waveform span:nth-child(3) { animation-delay: 0.2s; }
.waveform span:nth-child(4) { animation-delay: 0.3s; }
.waveform span:nth-child(5) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 100% { height: 6px; }
  50% { height: 24px; }
}

/* ---------- Choices grid ---------- */
.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.choice {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--panel-2);
  background: var(--panel-2);
  cursor: pointer;
  aspect-ratio: 16 / 10;
  padding: 0;
  touch-action: manipulation;
  transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.choice .label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  color: #fff;
  font-size: 13px;
  padding: 18px 10px 8px;
  text-align: left;
}

.choice:hover { border-color: var(--accent); }
.choice.selected {
  border-color: var(--accent);
  animation: selectPulse 0.4s ease;
}
.choice.dimmed { opacity: 0.35; transform: scale(0.98); }
.choice:disabled { cursor: default; }

@keyframes selectPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---------- Transition entre questions ---------- */
.fade-in {
  animation: fadeIn 0.35s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Confettis (fin de partie, bon score) ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0.4; }
}

/* ---------- Recap list ---------- */
.recap-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-2);
}
.recap-item:last-child { border-bottom: none; }
.recap-thumb {
  width: 56px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.recap-status {
  margin-left: auto;
  font-size: 20px;
}
.recap-replay {
  border: none;
  background: var(--panel-2);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: auto;
}
.recap-replay:hover { background: var(--accent); color: var(--bg); }
.recap-item .recap-status { margin-left: 10px; }
.detail-replay { margin: 8px auto 0; display: block; }

/* ---------- Leaderboard table ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--panel-2); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
tr:first-child td { font-family: 'Archivo Black', sans-serif; color: var(--accent); }

.score-big {
  font-family: 'Archivo Black', sans-serif;
  font-size: 56px;
  color: var(--accent);
}

.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 22px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Hub : grille de jeux ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.game-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.game-card-emoji {
  font-size: 34px;
  margin-bottom: 14px;
}
.game-card-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  margin-bottom: 8px;
}
.game-card-desc {
  color: var(--muted);
  font-size: 14px;
}
.progress-row { margin-top: 14px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Détail d'une partie (classement) ---------- */
.detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--panel-2);
}
.detail-row:last-child { border-bottom: none; }
.detail-col {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.detail-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 6px;
}
.detail-title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-status {
  font-size: 22px;
  flex-shrink: 0;
}

/* ---------- Succès ---------- */
.achievement-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.achievement-emoji {
  font-size: 32px;
  flex-shrink: 0;
}
.achievement-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 17px;
  margin-bottom: 4px;
}
.achievement-holders {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.holder-badge {
  background: var(--panel-2);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: 'Archivo Black', sans-serif;
}

/* ---------- Onglets de paramètres ---------- */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--panel-2);
}
.settings-tab {
  padding: 12px 20px;
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  text-decoration: none;
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  background: transparent;
  border: 1px solid transparent;
}
.settings-tab.active {
  color: var(--accent);
  background: var(--panel);
  border-color: var(--panel-2);
  border-bottom-color: var(--panel);
  margin-bottom: -1px;
}
.settings-tab:hover:not(.active) { color: var(--text); }

.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--panel-2);
}
.item-row img {
  width: 64px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
}
.item-row .title { flex: 1; }

.alert {
  background: rgba(255,93,93,0.12);
  border: 1px solid rgba(255,93,93,0.4);
  color: #ffb3b3;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 14px;
}
.alert.ok {
  background: rgba(107,203,119,0.12);
  border-color: rgba(107,203,119,0.4);
  color: #b8f0be;
}

footer.hint {
  margin-top: auto;
  padding-top: 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 480px) {
  .wrap { padding: 20px 14px 60px; }
  .tape-header { flex-wrap: wrap; gap: 10px; }
  .brand-name { font-size: 13px; }
  .choices { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 18px; }
  .hero-title { font-size: 28px; }
  .play-btn { width: 80px; height: 80px; font-size: 28px; }
  .btn { padding: 14px 22px; font-size: 14px; }
  .row-actions { flex-direction: column; }
  .row-actions .btn { width: 100%; }
}
