/* =========================
   ADD GAMES PAGE – scoped (Dark Glass)
   Ergänzt create-event.css (ceEditHeader).
========================= */

.agPage{
  --agAccent: var(--brand-primary);
  --agSoft: rgba(255,30,45,.12);

  --agLine: rgba(255,255,255,.12);
  --agLineStrong: rgba(255,255,255,.16);

  --agCard: rgba(255,255,255,.04);
  --agCard2: rgba(255,255,255,.06);
  --agCardHover: rgba(255,255,255,.06);

  --agText: var(--ui-text);
  --agMuted: var(--ui-text-muted);

  --agShadow: 0 18px 60px rgba(0,0,0,.45);
  --agBlur: blur(14px);
}

.agHeaderHint{
  font-size: 12px;
  line-height: 1.45;
  max-width: 72ch;
  margin-top: 8px;
}
.agHeaderHint__accent{
  color: rgba(255,90,100,.95);
}

/* Kategorie-Leiste + Eigenes Spiel nebeneinander */
.agCatNavWrap{
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}

.agCatTabsWrap{
  --cat-scroll-btn-size: 32px;
  --cat-scroll-gap: 6px;
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: var(--cat-scroll-btn-size) minmax(0, 1fr) var(--cat-scroll-btn-size);
  gap: var(--cat-scroll-gap);
  align-items: center;
}

.agCatTabsWrap::before,
.agCatTabsWrap::after{
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease;
  z-index: 2;
}

.agCatTabsWrap::before{
  left: calc(var(--cat-scroll-btn-size) + var(--cat-scroll-gap));
  background: linear-gradient(90deg, rgba(10, 14, 20, 0.36), rgba(10, 14, 20, 0));
}

.agCatTabsWrap::after{
  right: calc(var(--cat-scroll-btn-size) + var(--cat-scroll-gap));
  background: linear-gradient(270deg, rgba(10, 14, 20, 0.36), rgba(10, 14, 20, 0));
}

.agCatTabsWrap.is-scroll-left::before{
  opacity: 1;
}

.agCatTabsWrap.is-scroll-right::after{
  opacity: 1;
}

.agCatScrollBtn{
  width: var(--cat-scroll-btn-size);
  height: var(--cat-scroll-btn-size);
  align-self: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ui-text);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.agCatScrollBtn:hover:not(:disabled){
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.agCatScrollBtn:disabled{
  opacity: 0.28;
  cursor: default;
}

.agModeSwitchWrap{
  display: flex;
  justify-content: center;
  margin: 8px 0 10px;
}

.agModeSwitch{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.agModeSwitch__btn{
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.05);
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

.agModeSwitch__btn:hover{
  border-color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.10);
  color: var(--ui-text);
}

.agModeSwitch__btn.is-active{
  border-color: rgba(255,35,50,.55);
  color: #fff;
  background: linear-gradient(180deg, rgba(255,35,50,.34), rgba(255,35,50,.2));
  box-shadow: 0 0 0 1px rgba(255,35,50,.2), 0 8px 18px rgba(255,35,50,.2);
}

.agEmptyState{
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agCatTabs{
  flex: 1 1 280px;
  min-width: 0;
  position: relative;
  margin-top: 0;

  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-shadow: none;
  padding: 2px 0;
  scroll-behavior: smooth;
}

.agCatTabs::-webkit-scrollbar{
  width: 0;
  height: 0;
  display: none;
}

.agCatTabs a{
  text-decoration: none;
  color: var(--agMuted);
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease, color 120ms ease;
}
.agCatTabs a:hover{
  background: rgba(255,255,255,.06);
  color: var(--agText);
  border-color: rgba(255,255,255,.14);
  transform: translateY(-1px);
}
.agCatTabs a.active{
  background: rgba(255,30,45,.18);
  border-color: rgba(255,30,45,.40);
  color: #fff;
}

/* Gesondert: Eigenes Spiel (immer sichtbar, nicht im Scroll der Kategorien) */
.agCustomQuick{
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
}

.agCustomTabBtn{
  appearance: none;
  cursor: pointer;
  text-align: left;
  min-width: min(100%, 220px);
  max-width: 280px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,30,45,.45);
  background: linear-gradient(145deg, rgba(255,30,45,.14), rgba(255,255,255,.04));
  color: var(--agText);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.agCustomTabBtn:hover{
  border-color: rgba(255,30,45,.65);
  background: linear-gradient(145deg, rgba(255,30,45,.22), rgba(255,255,255,.06));
  transform: translateY(-1px);
}
.agCustomTabBtn.active{
  border-color: rgba(255,30,45,.85);
  background: rgba(255,30,45,.22);
  box-shadow: 0 0 0 1px rgba(255,30,45,.35), 0 14px 44px rgba(0,0,0,.4);
}
.agCustomTabBtn__kicker{
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,160,168,.95);
  margin-bottom: 4px;
}
.agCustomTabBtn__title{
  display: block;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.agCustomTabBtn__sub{
  display: block;
  font-size: 12px;
  color: var(--agMuted);
  margin-top: 4px;
  line-height: 1.35;
}

.agMainShell .agSection{
  padding: 0;
}

.agSection{
  padding: 0;
}

/* Nur Listen scrollen: stabiler als globales Viewport-Locking */
#templates{
  max-height: calc(100dvh - 340px);
  overflow-y: auto;
  overflow-x: hidden;
}

#customGamesList{
  max-height: calc(100dvh - 360px);
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-height: 860px){
  #templates{
    max-height: calc(100dvh - 320px);
  }
  #customGamesList{
    max-height: calc(100dvh - 340px);
  }
}

/* Main grid (legacy) */
.agGrid{
  display:grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 980px){
  .agGrid{ grid-template-columns: 1fr; }
}

/* Buttons konsistent (brand primary) */
.agPage .btn--primary{
  background: rgba(255,30,45,.22) !important;
  border-color: rgba(255,30,45,.55) !important;
  color: #fff !important;
}
.agPage .btn--primary:hover{
  background: rgba(255,30,45,.28) !important;
  border-color: rgba(255,30,45,.65) !important;
}

.agPage .pageTop{ display:none; }

/* Premium depth (scoped) */
.agPage{
  --agLine: rgba(255,255,255,.14);
  --agLineStrong: rgba(255,255,255,.20);
  --agShadow: 0 26px 90px rgba(0,0,0,.55);
}

/* Platzierungspunkte: möglichst nebeneinander */
.placementBuilder{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 6px;
  align-content: start;
  width: 100%;
}

.placementBuilder__row{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.placementBuilder__label{
  font-size: 11px;
  font-weight: 800;
  color: var(--agMuted, var(--ui-text-muted));
  white-space: nowrap;
}

.placementBuilder .placementInput{
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 8px 10px;
  font-size: 14px;
}

@media (max-width: 520px){
  .placementBuilder{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 360px){
  .placementBuilder{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px){
  .agCatNavWrap{
    flex-direction: column;
    align-items: stretch;
  }
  /* Eigenes Spiel zuerst, Kategorie-Scroll darunter */
  .agCustomQuick{
    order: -1;
    width: 100%;
  }
  .agCustomTabBtn{
    max-width: none;
    width: 100%;
  }
}

/* =========================================================
   tplModal (Add Games) -> optisch wie Katalog-Popup angleichen
   ========================================================= */
#tplModal{
  align-items: center;
  overflow: hidden;
  padding: 8px;
  background: rgba(4, 7, 11, 0.82);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#customModal{
  align-items: center;
  overflow: hidden;
  padding: 8px;
  background: rgba(4, 7, 11, 0.82);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#tplModal .modal__card{
  position: relative;
  max-height: none;
  overflow: visible;
  margin: 0 auto;
  border-radius: 20px;
  padding: 10px;
  background: linear-gradient(165deg, rgba(22,28,36,.98) 0%, rgba(10,12,16,.99) 55%, rgba(8,10,14,1) 100%);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow:
    0 28px 100px rgba(0,0,0,.72),
    0 0 0 1px rgba(255,255,255,.06),
    inset 0 1px 0 rgba(255,255,255,.07);
}

#customModal .modal__card{
  position: relative;
  max-height: none;
  overflow: visible;
  margin: 0 auto;
  border-radius: 20px;
  padding: 10px;
  background: linear-gradient(165deg, rgba(22,28,36,.98) 0%, rgba(10,12,16,.99) 55%, rgba(8,10,14,1) 100%);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow:
    0 28px 100px rgba(0,0,0,.72),
    0 0 0 1px rgba(255,255,255,.06),
    inset 0 1px 0 rgba(255,255,255,.07);
}

#tplModal .modal__card::before,
#customModal .modal__card::before{
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 2px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,35,50,.95) 0%, rgba(255,90,70,.45) 42%, rgba(96,165,250,.25) 100%);
  pointer-events: none;
  z-index: 0;
}

#tplModal .modal__header,
#tplModal .modal__body,
#customModal .modal__header,
#customModal .modal__body{
  position: relative;
  z-index: 1;
}

#tplModal .modal__kicker,
#customModal .modal__kicker{
  color: rgba(255,255,255,.52);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 900;
}

#tplModal .modal__title{
  font-weight: 950;
  letter-spacing: -0.03em;
  font-size: clamp(1.05rem, 2.1vw, 1.28rem);
}

#tplModal .modal__header{
  align-items: flex-start;
  gap: 8px;
}

#tplModal .modal__body{
  margin-top: 6px;
}

#customModal .modal__title{
  font-weight: 950;
  letter-spacing: -0.03em;
  font-size: clamp(1.05rem, 2.1vw, 1.28rem);
}

#customModal .modal__header{
  align-items: flex-start;
  gap: 8px;
}

#customModal .modal__body{
  margin-top: 6px;
}

#customModal .grid2{
  gap: 8px;
}

#customModal .field{
  margin: 6px 0;
}

#customModal .field__label{
  font-size: 11px;
  margin-bottom: 3px;
}

#customModal .input,
#customModal select.input{
  min-height: 34px;
  height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
  background: rgba(14, 18, 24, 0.98) !important;
  border-color: rgba(255,255,255,.12) !important;
}

#customModal textarea.input{
  height: auto;
  min-height: 64px;
  max-height: 84px;
  line-height: 1.35;
  background: rgba(14, 18, 24, 0.98) !important;
  border-color: rgba(255,255,255,.12) !important;
}

#customModal #cRules{
  min-height: 74px;
  max-height: 90px;
}

#customModal .placementBuilder{
  gap: 8px 10px;
}

#customModal .placementBuilder__label{
  font-size: 10.5px;
}

#customModal .placementBuilder .placementInput{
  padding: 7px 10px;
  font-size: 13.5px;
  background: rgba(14, 18, 24, 0.98) !important;
  border-color: rgba(255,255,255,.12) !important;
}

#customModal .panel--inner,
#tplModal .panel--inner{
  background: rgba(11, 15, 21, 0.92);
}

#customModal #closeCustomBtn{
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14) !important;
  background: rgba(255,255,255,.07) !important;
  color: rgba(255,255,255,.9) !important;
  font-weight: 800;
  padding: 6px 12px;
}

#customModal #closeCustomBtn:hover{
  border-color: rgba(255,45,55,.45) !important;
  background: rgba(255,45,55,.18) !important;
  color: #fff !important;
}

#tplModal #closeTplBtn{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.14) !important;
  background: rgba(255,255,255,.07) !important;
  color: rgba(255,255,255,.88) !important;
  line-height: 1 !important;
  font-size: 16px;
  font-weight: 900;
}

#tplModal #closeTplBtn:hover{
  border-color: rgba(255,45,55,.45) !important;
  background: rgba(255,45,55,.18) !important;
  color: #fff !important;
}

/* Panel-Inner Optik etwas dunkler/ruhiger (wie Katalog-Facts) */
#tplModal .panel--inner{
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  padding: 10px !important;
}

#tplModal .panel--inner h3{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.70);
}

#tplModal .rules{
  margin: 0;
  padding-left: 0;
  list-style: none;
}

#tplModal .rules li{
  color: rgba(255,255,255,.86);
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 0;
  border-top: 1px solid rgba(255,255,255,.10);
}

#tplModal .rules li:first-child{
  border-top: 0;
}

/* Compact: Katalog-Parameter unter „Beschreibung“ */
#tplModal .tplMeta{
  margin-top: 2px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

#tplModal .tplMeta__item{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#tplModal .tplMeta__lab{
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.48);
  margin-bottom: 2px;
}

#tplModal .tplMeta__val{
  font-size: 12.5px;
  font-weight: 650;
  color: rgba(255,255,255,.92);
  line-height: 1.35;
  word-break: break-word;
}

#tplModal .tplMeta__item--tags{
  grid-column: 1 / -1;
}

#tplModal .tplMetaTags{
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

#tplModal .tplMetaTag{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

/* Weniger Platz in Eingabe-Feldern */
#tplModal .grid2{
  gap: 8px;
}

#tplModal .field{
  margin: 6px 0;
}

#tplModal .field__label{
  font-size: 11px;
  margin-bottom: 3px;
}

/* Beschreibung kürzer anzeigen (weniger Scroll, mehr Fokus auf Konfiguration) */
#tplModal #tDesc{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  margin: 0;
  padding: 0;
}

/* Wenn Text/Badges innerhalb der Panel-Inner noch Standard-Abstände haben */
#tplModal .panel--inner > h3.u-mt-0{ margin-bottom: 4px; }

/* Beschreibungskachel kompakter: kein „stretch“-Platz */
#tplModal .modal__body > .grid2{
  align-items: start;
}

#tplModal .modal__body > .grid2 > .panel--inner:first-child{
  padding: 12px !important;
  display: flex;
  flex-direction: column;
}

/* Fokus auf Konfiguration: Placement Builder kompakter */
#tplModal .placementBuilder{
  gap: 8px 10px;
}

#tplModal .placementBuilder__label{
  font-size: 10.5px;
}

#tplModal .placementBuilder .placementInput{
  padding: 7px 10px;
  font-size: 13.5px;
}

/* 1) Regeln sollen als Zeilen die volle Breite nutzen */
#tplModal .modal__body > .grid2{
  grid-template-columns: 1fr !important;
  gap: 8px;
}

/* 2) Eingabefelder im Konfig-Bereich gleich groß & weniger „Luft“ */
#tplModal .panel--inner.u-mt-12 .grid2{
  align-items: stretch;
  gap: 8px;
}
#tplModal .panel--inner.u-mt-12 .grid2 .field{
  margin: 0;
  min-width: 0;
}
#tplModal .panel--inner.u-mt-12 .grid2 .field__label{
  margin-bottom: 5px;
}
#tplModal .panel--inner.u-mt-12 .grid2 .input,
#tplModal .panel--inner.u-mt-12 .grid2 select.input{
  min-height: 34px;
  height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* =========================================================
   Add-Games: Kacheln kompakter (wie Games-Overview, aber kleiner)
========================================================= */
#agGamesPane .goCatGamesList--grid,
#agCustomPane .goCatGamesList--grid{
  gap: 12px 14px !important;
}

#agGamesPane .goCatGameCard,
#agCustomPane .goCatGameCard{
  padding: 12px 12px 10px !important;
  border-radius: 14px !important;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 34px !important;
  box-shadow:
    0 10px 26px rgba(0,0,0,.33),
    inset 0 1px 0 rgba(255,255,255,.06) !important;
}

#agGamesPane .goCatGameCard__head,
#agCustomPane .goCatGameCard__head{
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0 !important;
  min-height: 16px !important;
}

#agGamesPane .goCatGameCard__headLeft,
#agCustomPane .goCatGameCard__headLeft{
  gap: 4px !important;
}

#agGamesPane .goCatGameCard__fav,
#agCustomPane .goCatGameCard__fav{
  width: 20px !important;
  height: 16px !important;
  font-size: 11px !important;
}

/* Globales Athlon-Badge-::before Icon in Add-Games: kleiner + weniger Abstand,
   damit der Text (z.B. "Reaktionsspiele") nicht zu weit rechts startet. */
#agGamesPane .goCatGameCard__badge::before,
#agCustomPane .goCatGameCard__badge::before{
  width: 10px !important;
  height: 10px !important;
  margin-right: 6px !important;
  background-size: 100% 100% !important;
  box-shadow: none !important;
}

#agGamesPane .goCatGameCard__title,
#agCustomPane .goCatGameCard__title{
  margin: 0 0 6px !important;
  padding-right: 155px;
  display: block;
}

#agGamesPane .goCatGameCard__desc,
#agCustomPane .goCatGameCard__desc{
  margin: 0 0 8px !important;
  padding-right: 155px;
  line-height: 1.42;
  min-height: calc(1.42em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#agGamesPane .goCatGameCard__stats,
#agCustomPane .goCatGameCard__stats{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 120px;
  border-top: 1px solid rgba(255,255,255,.10) !important;
  padding-top: 8px !important;
}

#agGamesPane .goCatGameCard__stats::before,
#agCustomPane .goCatGameCard__stats::before{
  content: none !important;
}

#agGamesPane .goCatGameCard__stats::after,
#agCustomPane .goCatGameCard__stats::after{
  content: none !important;
}

#agGamesPane .goCatGameCard__cta,
#agCustomPane .goCatGameCard__cta{
  position: absolute;
  right: 12px;
  bottom: 10px;
}

#agGamesPane .goCatGameCard__stat,
#agCustomPane .goCatGameCard__stat{
  font-size: 11.5px !important;
}
