/* =====================================================================
   Migs Space – Spielhalle (V25 E1/E2): Hub + Minispiele „Migs Crush“ & „Schluckloch“.
   Präfix .ac- · eigenständig; nutzt die Variablen aus style.css, falls vorhanden.
   ===================================================================== */

.ac-overlay {
  --a-cyan: var(--cyan, #4fe3ff);
  --a-pink: var(--pink, #ff4fd8);
  --a-yellow: var(--yellow, #ffd23f);
  --a-green: var(--green, #5dff9e);
  --a-red: var(--red, #ff5470);
  --a-text: var(--text, #f4f1ff);
  --a-muted: var(--muted, #a49fcf);
  --a-glass: rgba(28, 24, 62, 0.72);
  --a-line: rgba(255, 255, 255, 0.1);
  --a-back: cubic-bezier(.34, 1.56, .64, 1);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  color: var(--a-text);
  font-family: var(--font, 'Fredoka', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-weight: 500;
  opacity: 0;
  transition: opacity .25s ease;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.ac-overlay.ac-open { opacity: 1; }
.ac-overlay[hidden], .ac-overlay [hidden] { display: none !important; }
.ac-overlay *, .ac-overlay *::before, .ac-overlay *::after { box-sizing: border-box; }
.ac-overlay button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ac-overlay button:disabled { cursor: default; opacity: .55; }
.ac-overlay h2, .ac-overlay h3, .ac-overlay p { margin: 0; }
.ac-overlay :focus { outline: none; }
.ac-overlay :focus-visible:not(.gp-focus) { outline: 3px solid var(--a-cyan); outline-offset: 2px; }
body.ac-is-open { overflow: hidden; }

.ac-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 65% 55% at 12% 8%, rgba(255, 79, 216, .22), transparent 62%),
    radial-gradient(ellipse 70% 55% at 90% 92%, rgba(79, 227, 255, .18), transparent 60%),
    linear-gradient(180deg, #1c1243 0%, #110d2b 55%, #0b0918 100%);
}
.ac-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%);
}

.ac-shell {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 1320px; height: 100%; margin: 0 auto; min-height: 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
  transform: translateY(14px) scale(.985);
  transition: transform .4s var(--a-back);
}
.ac-open .ac-shell { transform: none; }

/* ---------- Kopfzeile ---------- */
.ac-head { display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; }
.ac-back {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: rgba(255, 255, 255, .08) !important; border: 1px solid var(--a-line) !important;
  font-size: 30px !important; line-height: 1; font-weight: 700; display: grid; place-items: center; padding-bottom: 4px !important;
  transition: background .15s, transform .15s var(--a-back);
}
.ac-back:hover { background: rgba(255, 255, 255, .16) !important; transform: scale(1.06); }
.ac-title { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.ac-title-ico { font-size: 28px; filter: drop-shadow(0 0 10px rgba(255, 79, 216, .6)); }
.ac-title-tx {
  display: flex; flex-direction: column; line-height: 1.05; min-width: 0;
  background: linear-gradient(90deg, #fff, var(--a-pink) 45%, var(--a-cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-title-tx small { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--a-muted); -webkit-text-fill-color: var(--a-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-head-r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.ac-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: rgba(10, 8, 28, .55); border: 1px solid var(--a-line); font-size: 15px; font-weight: 600; white-space: nowrap;
}
.ac-chip-cap { border-color: rgba(255, 210, 63, .45); color: var(--a-yellow); box-shadow: 0 0 18px rgba(255, 210, 63, .15); }
.ac-chip-score { border-color: rgba(79, 227, 255, .45); color: var(--a-cyan); font-variant-numeric: tabular-nums; }

.ac-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Knöpfe ---------- */
.ac-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 11px 20px; border-radius: 14px; font-weight: 700 !important; font-size: 16px;
  background: rgba(255, 255, 255, .1) !important; border: 1px solid var(--a-line) !important;
  transition: transform .15s var(--a-back), box-shadow .2s, background .15s; white-space: nowrap;
}
.ac-btn:not(:disabled):hover { transform: translateY(-2px); background: rgba(255, 255, 255, .16) !important; }
.ac-btn:not(:disabled):active { transform: translateY(1px) scale(.98); }
.ac-btn-go {
  color: #0b0918 !important; border: 0 !important;
  background: linear-gradient(180deg, #7ff0ff, var(--a-cyan) 45%, #22b8e0) !important;
  box-shadow: 0 6px 22px rgba(79, 227, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.ac-btn-go:not(:disabled):hover { background: linear-gradient(180deg, #a6f5ff, #5fe8ff 45%, #2cc4ec) !important; box-shadow: 0 10px 28px rgba(79, 227, 255, .5); }
.ac-btn-pink {
  color: #fff !important; border: 0 !important;
  background: linear-gradient(180deg, #ff7fe4, var(--a-pink) 50%, #c22aa4) !important;
  box-shadow: 0 6px 22px rgba(255, 79, 216, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.ac-btn-pink:not(:disabled):hover { background: linear-gradient(180deg, #ff9be9, #ff63de 50%, #d136b3) !important; }

/* ---------- Auswahlseite: zwei große Spielkarten ---------- */
.ac-cards {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  align-content: center;
}
.ac-card {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  background: var(--a-glass);
  border: 1px solid var(--a-line);
  border-radius: var(--radius, 22px);
  cursor: pointer;
  transition: transform .2s var(--a-back), box-shadow .25s, border-color .2s;
  overflow: hidden;
  max-height: 520px;
  margin: 0 auto;
  width: 100%;
  max-width: 560px;
}
.ac-card:hover, .ac-card:focus-visible {
  transform: translateY(-4px) scale(1.012);
  border-color: rgba(79, 227, 255, .55);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .4), 0 0 34px rgba(79, 227, 255, .22);
}
.ac-card-hole:hover, .ac-card-hole:focus-visible { border-color: rgba(255, 79, 216, .55); box-shadow: 0 14px 44px rgba(0, 0, 0, .4), 0 0 34px rgba(255, 79, 216, .22); }
.ac-pv {
  width: 100%; height: auto; aspect-ratio: 560 / 300; display: block;
  border-radius: 14px;
  background: rgba(10, 8, 24, .65);
  border: 1px solid var(--a-line);
}
.ac-card-tx h3 { font-size: 22px; font-weight: 700; }
.ac-card-tx p { font-size: 14.5px; color: var(--a-muted); margin-top: 4px; line-height: 1.35; }
.ac-card .ac-btn-go { width: 100%; }
.ac-cap-line { flex: none; text-align: center; font-size: 15px; color: var(--a-muted); padding-bottom: 4px; }
.ac-cap-line b { color: var(--a-yellow); }

/* ---------- Spielseite ---------- */
.ac-host { flex: 1; min-height: 0; display: flex; }
.ac-stage {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 980px; margin: 0 auto;
}
.ac-ghud { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; flex: none; }
.ac-ghud > span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 14px; border-radius: 999px;
  background: rgba(10, 8, 28, .6); border: 1px solid var(--a-line); font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ac-ghud-score { color: var(--a-cyan); }
.ac-ghud-moves, .ac-ghud-time { color: var(--a-yellow); }
.ac-ghud-size { color: var(--a-green); }
.ac-ghud-place { color: var(--a-pink); }
.ac-ghud-combo { color: #0b0918 !important; background: linear-gradient(180deg, #ffe489, var(--a-yellow)) !important; border: 0 !important; box-shadow: 0 0 18px rgba(255, 210, 63, .5); }
.ac-cvbox {
  position: relative; flex: 1; min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(79, 227, 255, .35);
  box-shadow: 0 0 0 1px rgba(79, 227, 255, .08), 0 0 34px rgba(79, 227, 255, .18), inset 0 0 60px rgba(13, 11, 26, .6);
  background: rgba(10, 8, 24, .55);
  overflow: hidden;
}
.ac-ho .ac-cvbox { border-color: rgba(255, 79, 216, .35); box-shadow: 0 0 0 1px rgba(255, 79, 216, .08), 0 0 34px rgba(255, 79, 216, .16), inset 0 0 60px rgba(13, 11, 26, .6); }
.ac-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.ac-banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  padding: 12px 26px; border-radius: 999px;
  background: rgba(13, 11, 26, .88); border: 1px solid rgba(255, 210, 63, .6);
  color: var(--a-yellow); font-size: clamp(17px, 2.4vw, 24px); font-weight: 700; white-space: nowrap;
  box-shadow: 0 0 30px rgba(255, 210, 63, .25);
  pointer-events: none;
}
.ac-gnote { flex: none; text-align: center; font-size: 13.5px; color: var(--a-muted); }

/* ---------- Ergebnis-Panel ---------- */
.ac-result {
  margin: auto; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 24px;
  background: var(--a-glass); border: 1px solid var(--a-line); border-radius: var(--radius, 22px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45), 0 0 40px rgba(79, 227, 255, .12);
  text-align: center;
  animation: acRise .45s var(--a-back);
}
@keyframes acRise { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.ac-res-head { font-size: 52px; line-height: 1; filter: drop-shadow(0 0 16px rgba(255, 210, 63, .5)); }
.ac-result h2 { font-size: 26px; font-weight: 700; }
.ac-res-score { font-size: 54px; font-weight: 700; line-height: 1; color: var(--a-cyan); text-shadow: 0 0 24px rgba(79, 227, 255, .45); font-variant-numeric: tabular-nums; }
.ac-res-score small { display: block; font-size: 14px; color: var(--a-muted); font-weight: 600; margin-top: 4px; }
.ac-res-stats { font-size: 15px; color: var(--a-muted); }
.ac-res-got { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 19px; font-weight: 700; }
.ac-res-coin { color: var(--a-yellow); }
.ac-res-xp { color: var(--a-green); }
.ac-res-lvl { color: var(--a-pink); }
.ac-res-cap { font-size: 14.5px; color: var(--a-muted); }
.ac-res-guest {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 210, 63, .08); border: 1px dashed rgba(255, 210, 63, .4);
}
.ac-res-guest p { font-size: 14.5px; line-height: 1.4; color: var(--a-text); }
.ac-res-guest b { color: var(--a-yellow); }
.ac-res-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }

/* ---------- Kleinkram ---------- */
.ac-pop-in { animation: acPop .4s var(--a-back); }
@keyframes acPop { from { opacity: 0; transform: scale(.6); } }

/* ---------- Responsive: 1280×720 bis 5K, Handy hoch/quer ---------- */
@media (min-width: 2200px) {
  .ac-shell { max-width: 1680px; }
  .ac-stage { max-width: 1240px; }
  .ac-card { max-width: 720px; max-height: 640px; }
}
@media (max-width: 860px), (max-height: 540px) {
  .ac-shell { gap: 8px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .ac-title { font-size: 20px; }
  .ac-title-ico { font-size: 22px; }
  .ac-back { width: 44px; height: 44px; }
  .ac-chip { font-size: 13px; padding: 5px 10px; }
  .ac-card { padding: 12px; gap: 8px; }
  .ac-card-tx h3 { font-size: 18px; }
  .ac-card-tx p { font-size: 13px; }
  .ac-gnote { display: none; }
  .ac-result { padding: 18px 16px; gap: 9px; }
  .ac-res-score { font-size: 42px; }
}
/* Handy hochkant: Karten untereinander, Seite darf scrollen */
@media (max-width: 700px) and (orientation: portrait) {
  .ac-cards { grid-template-columns: 1fr; align-content: start; overflow-y: auto; padding-right: 2px; }
  .ac-card { max-height: none; }
  .ac-head-r .ac-chip-cap { display: none; }
}
/* Handy quer: flache Karten nebeneinander, Vorschau kleiner */
@media (max-height: 460px) {
  .ac-cards { gap: 10px; }
  .ac-pv { aspect-ratio: 560 / 200; }
  .ac-ghud > span { min-height: 30px; font-size: 13px; padding: 3px 10px; }
  .ac-res-head { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ac-overlay *, .ac-overlay { animation: none !important; transition: none !important; }
}

/* V30 (Prüfer M): Spiele-Overlay hängt am body → Zoom-Stufen von #ui mitspiegeln (V26.2), sonst wirkt
   Crush/Schluckloch auf Ultrawide/5K winzig. Crush/Schluckloch rechnen Zeiger über getBoundingClientRect (zoom-fest). */
@media (min-width: 1600px) and (min-height: 1000px) { .ac-overlay { zoom: 1.12; } }
@media (min-width: 2200px) and (min-height: 1200px) { .ac-overlay { zoom: 1.28; } }
@media (min-width: 3000px) and (min-height: 1400px) { .ac-overlay { zoom: 1.45; } }
