/* Arcade – Anzeige-/Barrierefreiheits-Einstellungen (arcade-display.js).
   Schwebender Zahnrad-Button (über dem „?"-Button) + Panel: Farbpalette,
   Markierung (Keine/Zahlen/Symbole/Beides) und eine Form je Farbe. Hilft bei
   Farbschwäche. Auswahl gilt spielübergreifend (localStorage). Nutzt
   --accent / --accent-2 des Spiels mit Neon-Fallback. */

:root {
  --ad-accent:   var(--accent, #00e5ff);
  --ad-accent-2: var(--accent-2, #ff00e5);
}

/* Schwebender Auslöser – fester Slot oben: über Hilfe („?") und Pokal (🏆). */
.ad-trigger {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.5rem);
  bottom: calc(clamp(0.9rem, 3vw, 1.5rem) + 7.2rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 3rem; height: 3rem; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--board-bg, rgba(255, 255, 255, 0.06));
  color: var(--ad-accent);
  font: 800 1.35rem/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.6), 0 0 26px -10px var(--ad-accent);
  transition: transform 0.2s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ad-trigger:hover { transform: rotate(45deg); border-color: var(--ad-accent); }
.ad-trigger:active { transform: rotate(45deg) scale(0.96); }

/* Platz unten reservieren, damit die zwei gestapelten Buttons nichts verdecken. */
body.ad-has-display { padding-bottom: calc(9rem + env(safe-area-inset-bottom, 0px)); }

.ad-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(6, 6, 14, 0.74); backdrop-filter: blur(4px);
  animation: ad-fade 0.18s ease;
}
.ad-backdrop[hidden] { display: none; }

.ad-panel {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--bg-2, #14142c), var(--bg, #0a0a14));
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px;
  box-shadow: 0 24px 70px -20px #000, 0 0 50px -22px var(--ad-accent);
  animation: ad-pop 0.18s ease; overflow: hidden;
}
.ad-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ad-title {
  margin: 0; font-size: 1.2rem; font-weight: 900; letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--ad-accent), var(--ad-accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ad-close {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05);
  color: var(--fg, #e8e8ff); font-size: 1rem; cursor: pointer; transition: border-color 0.15s ease;
}
.ad-close:hover { border-color: var(--ad-accent); }

.ad-body { padding: 1rem 1.1rem 1.2rem; }
.ad-custom:empty { display: none; }
/* Trennlinie nur, wenn Spiel-Optionen UND Anzeige-Sektion sichtbar sind. */
.ad-custom:not(:empty) + .ad-display:not([hidden]) { border-top: 1px solid rgba(255, 255, 255, 0.09); padding-top: 0.9rem; margin-top: 0.1rem; }
.ad-note { margin: 0 0 1rem; font-size: 0.82rem; line-height: 1.5; color: var(--muted, #9a9ac0); }

.ad-group { margin-bottom: 1rem; }
.ad-label {
  display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 800; color: var(--ad-accent); margin-bottom: 0.45rem;
}
.ad-seg {
  display: flex; gap: 0.3rem; padding: 0.25rem;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 11px;
}
.ad-seg button {
  flex: 1; font: inherit; font-weight: 700; font-size: 0.82rem; color: var(--muted, #9a9ac0);
  background: transparent; border: none; border-radius: 8px; padding: 0.42rem 0.3rem; cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.ad-seg button:hover { color: var(--fg, #e8e8ff); }
.ad-seg button.ad-on {
  color: #06121a; background: linear-gradient(90deg, var(--ad-accent), var(--ad-accent-2));
  box-shadow: 0 6px 16px -9px var(--ad-accent);
}

/* Legende: Farbe ↔ Form ↔ Zahl */
.ad-legend-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 800; color: var(--ad-accent); margin: 0.2rem 0 0.45rem;
}
.ad-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ad-chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 8px; background: var(--c);
  font-weight: 800; font-size: 1.15rem; box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}
.ad-chip small {
  position: absolute; right: 0.15rem; bottom: 0.05rem; font-size: 0.6rem; font-weight: 800; opacity: 0.9;
}

body.ad-open { overflow: hidden; }

@keyframes ad-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ad-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ad-backdrop, .ad-panel { animation: none; }
  .ad-trigger { transition: none; }
}
