/* ===============================================================================================
   Arcade - Prism Pop

   Grundsatz: DIE SEITE folgt dem Themensystem, DIE BUEHNE nicht.
   Kopfzeile, Rahmen und Bestenliste nehmen die Variablen aus includes/theme.css und sind im
   Hellmodus hell. Der Spielbereich bleibt dagegen fest dunkel - das Spiel ist als dunkler
   "Automat" gedacht, eine halb umgefaerbte Fassung waere schlechter als eine klare Kante.
   Die Kante verlaeuft an genau einer Stelle: dem Rand von .arcade-buehne.

   Die vier Farbwerte unten sind aus der Engine abgeschrieben (arcade/prismPop.js, draw() und
   drawField()). Wer dort etwas aendert, muss hier nachziehen - sonst passt der Rahmen nicht
   mehr zum Canvas. Gleiche Doppelwahrheit-Falle wie bei theme-color in appLayout.inc.php.
   =============================================================================================== */

.arcade-rahmen {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 0.75rem 1.5rem;
}

/* ------------------------------------------------------------------------------------------- */
/* Die Buehne: fest dunkel, unabhaengig vom Theme                                                */
/* ------------------------------------------------------------------------------------------- */

.arcade-buehne {
  --arcade-bg: #0a0a0c;       /* prismPop.js draw()      */
  --arcade-flaeche: #121216;  /* prismPop.js drawField() */
  --arcade-linie: rgba(244, 244, 245, 0.1);
  --arcade-text: #f2f1ee;
  --arcade-text-schwach: #9a9aa3;

  background: var(--arcade-bg);
  color: var(--arcade-text);
  border: 1px solid #24242b;
  border-radius: 20px;
  box-shadow: 0 18px 38px -20px rgba(0, 0, 0, 0.55);
  overflow: hidden;

  /* Befund aus der Vorlage: radius = fieldW / (COLS*2) kennt keine Obergrenze. Ohne diese
     Breitenbegrenzung werden die Kugeln auf einem grossen Monitor grotesk gross - in der
     React-Fassung verhinderte das nur deren Tailwind-Klasse w-[min(100%,480px)]. */
  max-width: 30rem;
  margin: 0.75rem auto 0;

  display: flex;
  flex-direction: column;
  /* Hoehe des Spielfelds: fuellt den Rest des Fensters, laesst aber der Kopfzeile ihren Platz. */
  height: min(78vh, 46rem);
}

/* ------------------------------------------------------------------------------------------- */
/* HUD - gewoehnliches DOM UEBER dem Canvas, nicht darauf                                        */
/* ------------------------------------------------------------------------------------------- */

.arcade-hud {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--arcade-linie);
  /* Feste Hoehe: die Engine hoert nur auf window.resize. Springt die HUD-Zeile in der Hoehe
     (Umbruch bei langem Uebersetzungstext), rechnet der Canvas nicht nach. */
  min-height: 3.1rem;
  align-items: center;
  flex: 0 0 auto;
}

.arcade-hud__gruppe {
  display: flex;
  gap: 0.4rem;
}

.arcade-wert {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--arcade-linie);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.arcade-wert__name {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--arcade-text-schwach);
}

.arcade-wert__zahl {
  font-size: 0.9rem;
  font-weight: 600;
  /* Ziffern gleich breit, sonst zappelt die Punktzahl bei jedem Treffer und schiebt das
     Layout - was wiederum die Canvas-Hoehe antasten wuerde. */
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------------------------------- */
/* Canvas                                                                                        */
/* ------------------------------------------------------------------------------------------- */

.arcade-canvas-huelle {
  position: relative;
  flex: 1 1 auto;
  /* Ohne min-height:0 waechst ein Flex-Kind ueber seinen Container hinaus (unter iOS sichtbar). */
  min-height: 0;
  background: var(--arcade-flaeche);
}

#arcadeCanvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Wischgesten sollen das Spielfeld nicht scrollen - die Engine liest Pointer-Events selbst. */
  touch-action: none;
}

/* ------------------------------------------------------------------------------------------- */
/* Dialoge                                                                                       */
/* ------------------------------------------------------------------------------------------- */

.arcade-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 10, 12, 0.82);
  overflow-y: auto;
}

.arcade-overlay[hidden] {
  display: none;
}

.arcade-karte {
  width: 100%;
  max-width: 22rem;
  border: 1px solid #2a2a31;
  border-radius: 18px;
  background: #141418;
  padding: 1.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.arcade-karte__kopfzeile {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--arcade-text-schwach);
}

.arcade-karte__titel {
  margin: 0.35rem 0 0;
  font-size: 1.7rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.arcade-karte__text,
.arcade-karte__hinweis,
.arcade-karte__status,
.arcade-karte__platz {
  margin: 0.6rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--arcade-text-schwach);
}

.arcade-karte__status {
  color: var(--arcade-text);
}

.arcade-karte__zwischentitel {
  margin: 1rem 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--arcade-text-schwach);
}

.arcade-karte__liste {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--arcade-text-schwach);
}

.arcade-knopf {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--arcade-text);
  color: #101014;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.arcade-knopf--zweit {
  margin-top: 0.5rem;
  background: transparent;
  color: var(--arcade-text);
  border: 1px solid #2a2a31;
}

.arcade-knopf:focus-visible,
.arcade-symbolknopf:focus-visible {
  outline: 2px solid #7aa7ff;
  outline-offset: 2px;
}

/* ------------------------------------------------------------------------------------------- */
/* Rangliste im Ende-Dialog                                                                      */
/* ------------------------------------------------------------------------------------------- */

.arcade-rangliste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.arcade-rangliste__zeile {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.arcade-rangliste__zeile.ist-selbst {
  background: rgba(122, 167, 255, 0.16);
}

.arcade-rangliste__rang {
  min-width: 1.6rem;
  color: var(--arcade-text-schwach);
  font-variant-numeric: tabular-nums;
}

.arcade-rangliste__name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-rangliste__punkte {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------------------------------- */
/* Fussleiste der Buehne                                                                         */
/* ------------------------------------------------------------------------------------------- */

.arcade-fussleiste {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--arcade-linie);
  min-height: 2.9rem;
  flex: 0 0 auto;
}

.arcade-symbolknopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--arcade-linie);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--arcade-text);
  cursor: pointer;
}

.arcade-symbolknopf[hidden] {
  display: none;
}

/* Der Lautsprecher zeigt genau einen der beiden Zusaetze - Bogen (Ton an) oder Kreuz (stumm). */
.arcade-symbolknopf .arcade-ton-aus {
  display: none;
}

.arcade-symbolknopf.ist-stumm .arcade-ton-an {
  display: none;
}

.arcade-symbolknopf.ist-stumm .arcade-ton-aus {
  display: inline;
}

.arcade-kombo {
  margin: 0 0 0 auto;
  font-size: 0.8rem;
  color: var(--arcade-text-schwach);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------------------------------- */
/* Seitenteile im normalen Theme (Einstieg und Bestenliste)                                      */
/* ------------------------------------------------------------------------------------------- */

.arcade-tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.arcade-tabelle th,
.arcade-tabelle td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.arcade-tabelle th {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-emphasis);
}

.arcade-tabelle td.zahl,
.arcade-tabelle th.zahl {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.arcade-tabelle tr.ist-selbst {
  background: var(--row-highlight-bg);
  color: var(--row-highlight-text);
}

/* Breite Tabellen scrollen in ihrem eigenen Kasten, nie die ganze Seite. */
.arcade-tabelle-huelle {
  overflow-x: auto;
}

/* Am Handy tragen "Partien" und "Erreicht am" am wenigsten bei - sie verschwinden zuerst,
   damit Platz, Name und Punkte ohne seitliches Schieben lesbar bleiben. Der Kasten scrollt
   weiterhin, falls auch das noch nicht reicht. */
@media (max-width: 30rem) {
  .arcade-tabelle th:nth-child(5),
  .arcade-tabelle td:nth-child(5),
  .arcade-tabelle th:nth-child(6),
  .arcade-tabelle td:nth-child(6) {
    display: none;
  }
}

.arcade-leer {
  margin: 1rem 0;
  color: var(--text-emphasis);
}

.arcade-spielliste {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.arcade-spielkachel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
}

.arcade-spielkachel:hover {
  background: var(--hover-bg);
}

.arcade-spielkachel__text strong {
  display: block;
}

.arcade-spielkachel__text span {
  font-size: 0.85rem;
  color: var(--text-emphasis);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
