:root {
  --bg: #070b16;
  --bg-soft: #101a2f;
  --surface: rgba(20, 30, 53, 0.68);
  --surface-soft: rgba(34, 50, 84, 0.64);
  --text: #e9f0ff;
  --muted: #9eb0d5;
  --border: rgba(149, 176, 234, 0.25);
  --primary: #4f8cff;
  --primary-dark: #2f6bf0;
  --danger: #ff4d67;
  --danger-dark: #e73a54;
  --success: #22c55e;
  --glow: 0 14px 45px rgba(68, 128, 255, 0.25);
  --shadow: 0 18px 40px rgba(4, 10, 24, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 12% 18%, #1c2b4f 0%, transparent 35%),
              radial-gradient(circle at 88% 8%, #1d3d7a 0%, transparent 38%),
              radial-gradient(circle at 55% 100%, #12203c 0%, transparent 42%),
              var(--bg);
  min-height: 100vh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  filter: blur(44px);
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  animation: floatBlob 14s ease-in-out infinite;
}

body::before {
  top: -80px;
  left: -60px;
  background: rgba(79, 140, 255, 0.35);
}

body::after {
  right: -70px;
  bottom: -100px;
  background: rgba(105, 68, 255, 0.35);
  animation-delay: -5s;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.topbar {
  background: rgba(10, 16, 31, 0.75);
  border-bottom: 1px solid rgba(121, 155, 228, 0.2);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.24rem;
  letter-spacing: 0.01em;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #90a8d8;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.app-shell {
  padding-bottom: 36px;
}

.hero {
  margin-top: 24px;
  padding: 30px;
  border-radius: 20px;
  border: 1px solid rgba(110, 152, 248, 0.3);
  background: linear-gradient(130deg, rgba(23, 36, 65, 0.88), rgba(28, 49, 96, 0.7));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.14) 50%, transparent 64%);
  transform: translateX(-120%);
  animation: sheen 7s linear infinite;
}

.hero-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a4bcf0;
  font-weight: 700;
}

.hero h2 {
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 2.2vw, 1.9rem);
  line-height: 1.25;
}

.hero p {
  margin: 0;
  color: #bdd0f5;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 22px;
  margin: 22px auto 0;
}

.panel,
.auth-card,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-accent {
  background: linear-gradient(150deg, rgba(25, 39, 70, 0.86), rgba(30, 56, 112, 0.82));
  border-color: rgba(118, 157, 241, 0.45);
  box-shadow: var(--shadow), var(--glow);
}

.panel h2 {
  margin-top: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 24px auto;
}

label {
  font-weight: 600;
  font-size: 0.92rem;
  color: #d8e5ff;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.95rem;
  background: #fff;
  color: #162642;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.btn {
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  padding: 10px 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: translateX(-110%);
  transition: transform 0.45s ease;
}

.btn:hover::before {
  transform: translateX(120%);
}

.btn-light {
  background: rgba(161, 185, 233, 0.17);
  color: #dce7ff;
  box-shadow: none;
  border: 1px solid rgba(165, 191, 246, 0.35);
}

.btn-light:hover {
  background: rgba(172, 194, 237, 0.28);
  box-shadow: none;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.admin-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.feedback {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.feedback.success {
  color: #6ee7a3;
}

.feedback.error {
  color: #ff8ca0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cards {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.card {
  border: 1px solid rgba(149, 177, 230, 0.24);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(150deg, rgba(25, 37, 66, 0.92), rgba(21, 33, 58, 0.8));
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px) scale(1.005);
  border-color: rgba(145, 184, 255, 0.62);
  box-shadow: 0 16px 30px rgba(10, 18, 36, 0.55), 0 0 0 1px rgba(95, 152, 255, 0.18);
}

.card-header,
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card h3 {
  margin: 0 0 6px;
}

.card p {
  margin: 8px 0 12px;
}

.badge {
  background: rgba(79, 140, 255, 0.22);
  color: #b7d0ff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.rarity-unique {
  background: rgba(255, 215, 79, 0.22);
  color: #ffeaa5;
}

.rarity-mythique {
  background: rgba(167, 90, 255, 0.24);
  color: #dfbbff;
}

.rarity-legendaire {
  background: rgba(255, 155, 84, 0.24);
  color: #ffd2af;
}

.rarity-epique {
  background: rgba(255, 103, 184, 0.24);
  color: #ffc1e4;
}

.rarity-rare {
  background: rgba(84, 145, 255, 0.24);
  color: #bdd8ff;
}

.rarity-commun {
  background: rgba(148, 163, 184, 0.24);
  color: #d4dbe6;
}

.vote-actions {
  display: flex;
  gap: 8px;
}

.score {
  font-weight: 600;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-en-cours {
  background: rgba(79, 140, 255, 0.18);
  color: #c4ddff;
  border-color: rgba(79, 140, 255, 0.38);
}

.status-termine {
  background: rgba(34, 197, 94, 0.16);
  color: #b6f0c9;
  border-color: rgba(34, 197, 94, 0.35);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(420px, 92%);
  background: linear-gradient(160deg, rgba(26, 39, 70, 0.92), rgba(26, 47, 90, 0.84));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat-value {
  font-size: 2rem;
  margin: 10px 0 0;
  font-weight: 700;
  color: #9ac2ff;
  text-shadow: 0 0 20px rgba(114, 169, 255, 0.28);
}

.compact-list {
  margin: 10px 0 0;
  padding-left: 16px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-soft);
  border-radius: 12px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid rgba(136, 165, 219, 0.25);
  padding: 11px 9px;
  font-size: 0.92rem;
}

th {
  color: #dce9ff;
  background: rgba(85, 113, 171, 0.22);
}

.keyword-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.keyword-list li {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(150deg, rgba(37, 56, 92, 0.64), rgba(33, 49, 80, 0.48));
}

.chart-canvas {
  width: 100%;
  height: 320px;
  margin-top: 8px;
  border: 1px solid rgba(146, 175, 230, 0.32);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(24, 37, 66, 0.95), rgba(20, 31, 55, 0.92));
}

.chart-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.hidden {
  display: none;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: #dce8ff;
  background: rgba(19, 31, 56, 0.95);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-select-trigger::after {
  content: "▾";
  float: right;
  opacity: 0.8;
}

.custom-select.open .custom-select-trigger {
  border-color: #6da0ff;
  box-shadow: 0 0 0 3px rgba(93, 139, 255, 0.2);
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: rgba(16, 26, 49, 0.98);
  border: 1px solid rgba(126, 162, 236, 0.35);
  border-radius: 12px;
  padding: 8px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
  display: none;
  box-shadow: 0 16px 34px rgba(5, 10, 24, 0.65);
}

.custom-select.open .custom-select-menu {
  display: block;
  animation: fadeMenu 0.2s ease;
}

.custom-select-group {
  color: #9cb4e4;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 8px 8px 4px;
}

.custom-select-option {
  width: 100%;
  border: none;
  background: transparent;
  color: #ebf2ff;
  text-align: left;
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}

.custom-select-option:hover {
  background: rgba(90, 136, 233, 0.22);
}

@keyframes fadeMenu {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  min-width: 290px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(143, 172, 228, 0.35);
  background: linear-gradient(140deg, rgba(21, 32, 57, 0.96), rgba(28, 42, 74, 0.92));
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(24px) scale(0.95);
  transition: transform 0.34s ease, opacity 0.34s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.toast-content {
  display: grid;
  gap: 2px;
}

.toast-content strong {
  font-size: 0.92rem;
}

.toast-content span {
  color: #c6d8fb;
  font-size: 0.88rem;
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.18);
  color: #6cf1a4;
}

.toast-error .toast-icon {
  background: rgba(255, 77, 103, 0.2);
  color: #ff9caf;
}

.reveal {
  opacity: 0;
  transform: translateY(14px) scale(0.99);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, -18px); }
}

@keyframes sheen {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(130%); }
}

@media (max-width: 900px) {
  .main-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    min-height: 56px;
  }

  .card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding: 22px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: none;
    min-width: 0;
  }
}
