:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --line: #d6d6d6;
  --text: #303030;
  --muted: #666666;
  --primary: #0c71c3;
  --danger: #ff5d5d;
  --accent: #6497c1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Open Sans", "Avenir Next", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-logo {
  width: 110px;
  height: auto;
  display: block;
}

.brand-name {
  font-family: "Audiowide", "Open Sans", sans-serif;
  color: #0c71c3;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

h1 {
  margin: 0;
  color: #0c71c3;
  font-family: "Audiowide", "Open Sans", sans-serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px;
}

.card, .panel {
  background: linear-gradient(180deg, rgba(100,151,193,0.08), rgba(255,255,255,0.95));
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card {
  padding: 10px;
  text-align: center;
}

.card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.card strong {
  font-size: 1.35rem;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input, select, button {
  font: inherit;
}

input, select {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:not(:disabled) {
  cursor: pointer;
}

.primary {
  background: var(--primary);
  color: #ffffff;
}

.primary:not(:disabled):hover {
  background: #6497c1;
}

.secondary {
  background: var(--accent);
  color: #ffffff;
}

.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.danger {
  border-color: #7c2c2c;
  color: #ffb7b7;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border: none;
}

.btn.danger:hover:not(:disabled) {
  opacity: 0.9;
}

.btn.danger:disabled {
  background: var(--danger);
  opacity: 0.45;
  cursor: not-allowed;
}

.arena {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line);
  min-height: 390px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(24,31,42,0.95) 0%, rgba(35,43,58,0.98) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03), rgba(255,255,255,0.03) 1px, transparent 1px, transparent 28px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(12, 17, 24, 0.75);
  z-index: 3;
  padding: 20px;
  color: #fff;
}

.overlay.hidden {
  display: none;
}

.target {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  animation: pop 0.22s ease;
  border: 2px solid transparent;
  transition: box-shadow 0.1s;
}

.target:hover {
  transform: scale(1.1);
}

.target:active {
  transform: scale(0.95);
}

/* Types de cibles */
.target-normal {
  background: radial-gradient(circle at 30% 30%, #9dffcb, #00c877);
  color: #042013;
  box-shadow: 0 0 0 2px rgba(0, 208, 132, 0.35);
}

.target-bonus {
  background: radial-gradient(circle at 30% 30%, #e0b3ff, #c476ff);
  color: #1a0030;
  box-shadow: 0 0 12px rgba(196, 118, 255, 0.5);
  animation: pop 0.22s ease, pulse-bonus 0.8s ease-in-out infinite;
}

.target-fast {
  background: radial-gradient(circle at 30% 30%, #b3ffd6, #7dffb0);
  color: #00260f;
  box-shadow: 0 0 0 2px rgba(125, 255, 176, 0.35);
  animation: pop 0.22s ease, pulse-fast 0.4s ease-in-out infinite;
}

.target-rare {
  background: radial-gradient(circle at 30% 30%, #7ff3ff, #2fc9ff);
  color: #001d29;
  box-shadow: 0 0 16px rgba(47, 201, 255, 0.6);
  animation: pop 0.22s ease, pulse-rare 1.2s ease-in-out infinite;
}

.target-penalty {
  background: radial-gradient(circle at 30% 30%, #ff9b9b, #c92a2a);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(201, 42, 42, 0.35);
  animation: pop 0.22s ease, pulse-penalty 0.6s ease-in-out infinite;
}

/* Animations de pulsation */
@keyframes pulse-bonus {
  0%, 100% { box-shadow: 0 0 12px rgba(196, 118, 255, 0.5); }
  50% { box-shadow: 0 0 20px rgba(196, 118, 255, 0.9); }
}

@keyframes pulse-fast {
  0%, 100% { box-shadow: 0 0 0 2px rgba(125, 255, 176, 0.35); }
  50% { box-shadow: 0 0 8px rgba(125, 255, 176, 0.7); }
}

@keyframes pulse-rare {
  0%, 100% { box-shadow: 0 0 16px rgba(47, 201, 255, 0.6); }
  50% { box-shadow: 0 0 24px rgba(47, 201, 255, 0.9); }
}

@keyframes pulse-penalty {
  0%, 100% { box-shadow: 0 0 0 2px rgba(201, 42, 42, 0.35); }
  50% { box-shadow: 0 0 10px rgba(201, 42, 42, 0.7); }
}

@keyframes pop {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Guide des cibles dans l'aide */
.targets-guide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
}

.guide-item {
  display: flex;
  gap: 12px;
  align-items: start;
}

.guide-target {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-target.normal {
  background: radial-gradient(circle at 30% 30%, #9dffcb, #00c877);
  color: #042013;
}

.guide-target.bonus {
  background: radial-gradient(circle at 30% 30%, #e0b3ff, #c476ff);
  color: #1a0030;
}

.guide-target.fast {
  background: radial-gradient(circle at 30% 30%, #b3ffd6, #7dffb0);
  color: #00260f;
}

.guide-target.rare {
  background: radial-gradient(circle at 30% 30%, #7ff3ff, #2fc9ff);
  color: #001d29;
}

.guide-target.penalty {
  background: radial-gradient(circle at 30% 30%, #ff9b9b, #c92a2a);
  color: #fff;
}

.guide-info {
  font-size: 0.9rem;
}

.guide-info strong {
  display: block;
  color: var(--text);
}

.guide-info .effect {
  color: var(--primary);
  font-weight: 600;
}

.guide-info .desc {
  color: var(--muted);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Admin Dialog */
#adminDialog input,
#adminDialog button {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}

#adminSubmitBtn {
  margin-bottom: 8px;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#adminSubmitBtn:not(:disabled) {
  opacity: 1;
  cursor: pointer;
}

#adminContent {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

#adminContent.hidden {
  display: none;
}

#adminCloseBtn {
  background: var(--muted);
  color: var(--bg);
  border: none;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  pointer-events: auto !important;
  opacity: 1 !important;
}

#adminCloseBtn:hover {
  background: var(--text);
}

#adminClearBoardBtn {
  background: var(--danger);
  color: #fff;
  border: none;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 0;
}


#adminClearBoardBtn:hover {
  opacity: 0.9;
}

#adminMessage {
  margin-top: 8px;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: start;
  gap: 14px;
}

.panel {
  padding: 14px;
}

.panel h3 {
  margin-top: 0;
}

.cta-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 2px;
}

.leaderboard {
  margin: 8px 0 0;
  padding-left: 20px;
}

.leaderboard-panel summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  color: #0c71c3;
  user-select: none;
}

.leaderboard-panel summary::-webkit-details-marker {
  display: none;
}

.leaderboard-panel summary::after {
  content: "Afficher";
  float: right;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.leaderboard-panel[open] summary::after {
  content: "Masquer";
}

.lead form {
  display: grid;
  gap: 8px;
  max-width: 420px;
}

.consent {
  display: flex;
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 0.92rem;
}

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--text);
  max-width: 560px;
}

dialog::backdrop {
  background: rgba(5, 8, 12, 0.55);
}

@media (max-width: 860px) {
  .hud {
    grid-template-columns: repeat(3, minmax(95px, 1fr));
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .arena {
    min-height: 340px;
  }
}
