/*
 * Chat Minispiele — Übersicht (Karten-Raster) & Detailansicht
 * Ergänzt design-v3.css; wird nach diesem geladen.
 */

/* ── Ansichten ───────────────────────────────────────────────── */
.mg-view.hidden {
  display: none;
}

#minigames-tab .mg-view {
  animation: mgViewIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mgViewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Zähler in der Kopfzeile ─────────────────────────────────── */
.mg-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 15px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mg-active-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.mg-active-pill.has-active {
  border-color: rgba(72, 233, 226, 0.28);
  background: var(--accent-dim);
  color: #b9f6f2;
}

.mg-active-pill.has-active::before {
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
}

/* ── Karten-Raster ───────────────────────────────────────────── */
.mg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.35rem;
}

.mg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 46%),
    var(--bg-surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

/* Akzentkante oben — leuchtet, sobald das Minispiel aktiv ist */
.mg-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.32), transparent);
  transition: background 0.3s ease, opacity 0.3s ease;
}

.mg-card:hover {
  transform: translateY(-2px);
  border-color: rgba(72, 233, 226, 0.2);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24), 0 0 22px rgba(72, 233, 226, 0.045);
}

.mg-card.is-active::before {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.mg-card.is-active {
  border-color: rgba(72, 233, 226, 0.22);
}

/* ── Chat-Vorschau ───────────────────────────────────────────── */
/* Feste Höhe + Stapeln von unten: liest sich wie ein mitlaufender Chat
   und hält gleichzeitig alle Karten im Raster auf einer Linie. */
.mg-chat {
  display: flex;
  height: 176px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  overflow: hidden;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 12% 0%, rgba(72, 233, 226, 0.05), transparent 16rem),
    rgba(6, 9, 15, 0.5);
  mask-image: linear-gradient(to bottom, transparent, #000 15%);
  user-select: none;
}

.mg-chat-line {
  margin: 0;
  color: #b9c6d6;
  font-size: 0.795rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.mg-chat-line.is-bot {
  color: #93a3b8;
}

.mg-user {
  color: var(--mg-user, #9b7bff);
  font-weight: 750;
}

.mg-user.is-bot {
  color: var(--accent);
}

.mg-badge {
  display: inline-grid;
  width: 15px;
  height: 15px;
  margin-right: 6px;
  place-items: center;
  border-radius: 4px;
  color: #05070c;
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
  vertical-align: 1px;
}

.mg-badge.is-sub {
  background: #9b7bff;
}

.mg-badge.is-mod {
  background: #51e89a;
}

.mg-badge.is-vip {
  background: #f6c85f;
}

.mg-badge.is-bot {
  background: var(--accent);
  font-size: 0.5rem;
}

/* Gedimmt, solange das Minispiel deaktiviert ist */
.mg-card:not(.is-active) .mg-chat {
  opacity: 0.45;
  filter: saturate(0.5);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* ── Karten-Inhalt ───────────────────────────────────────────── */
.mg-card-main {
  flex: 1 1 auto;
  padding: 17px 20px 0;
}

.mg-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.mg-card-title h3 {
  margin: 0;
  color: var(--text-primary);
  font-family: 'Outfit', var(--font-main);
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.mg-card-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.06);
  font-size: 0.95rem;
}

.mg-card.is-active .mg-card-icon {
  border-color: rgba(72, 233, 226, 0.28);
  background: var(--accent-dim);
}

.mg-card-desc {
  margin: 8px 0 0;
  min-height: 2.55em; /* hält die Info-Chips über alle Karten auf einer Linie */
  color: var(--text-secondary);
  font-size: 0.845rem;
  line-height: 1.5;
}

/* Konfigurations-Kurzinfos (per JS befüllt) */
.mg-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
  min-height: 22px;
}

.mg-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.045);
  color: var(--text-muted);
  font-size: 0.715rem;
  font-weight: 600;
  white-space: nowrap;
}

.mg-meta-chip .mg-meta-value {
  color: var(--text-secondary);
  font-weight: 700;
}

/* ── Karten-Fußzeile ─────────────────────────────────────────── */
.mg-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border-subtle);
}

.mg-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mg-state {
  color: var(--text-muted);
  font-size: 0.79rem;
  font-weight: 650;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.mg-state.is-on {
  color: var(--accent);
}

.mg-state.is-saving {
  color: var(--text-secondary);
}

.mg-edit-btn {
  flex-shrink: 0;
  padding: 0.5rem 0.95rem;
  font-size: 0.82rem;
}

/* ── Detailansicht ───────────────────────────────────────────── */
.mg-breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 1.1rem;
  font-size: 0.79rem;
  font-weight: 650;
}

.mg-crumb-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition: color 0.18s ease;
}

.mg-crumb-link:hover {
  color: var(--accent);
}

.mg-crumb-sep {
  color: #3d4859;
}

.mg-crumb-current {
  color: var(--text-secondary);
}

.mg-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

#minigames-form {
  display: flex;
  max-width: 950px;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0 auto;
}

.mg-panel {
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 100% 2px no-repeat,
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 44%),
    var(--bg-surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.mg-panel.hidden {
  display: none;
}

.mg-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem;
}

.mg-panel-id {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.9rem;
}

.mg-panel-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid rgba(72, 233, 226, 0.22);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(72, 233, 226, 0.13), rgba(155, 123, 255, 0.11));
  font-size: 1.2rem;
}

.mg-panel-id h3 {
  margin: 0 0 5px;
  color: var(--text-primary);
  font-family: 'Outfit', var(--font-main);
  font-size: 1.1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.mg-panel-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .mg-grid {
    grid-template-columns: 1fr;
  }

  .mg-card-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .mg-edit-btn {
    justify-content: center;
  }

  .mg-panel-head {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.25rem;
  }

  .mg-detail-actions {
    width: 100%;
  }
}
