/* =========================================================================
   Quartett - Stylesheet
   Mobil zuerst; ab 720px breitet sich das Spielfeld auf zwei Spalten aus.
   ========================================================================= */

:root {
  --bg:        #0e1017;
  --bg-soft:   #171a25;
  --panel:     #1c2030;
  --panel-2:   #232839;
  --line:      #2e3448;
  --text:      #e8ecf5;
  --muted:     #98a1b8;
  --accent:    #f0b429;
  --accent-2:  #ffd66b;
  --win:       #3ecf8e;
  --lose:      #ef5f6b;
  --tie:       #7f8bab;
  --radius:    14px;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --tap:       44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Ein gesetztes display: in einer Klassenregel wuerde das hidden-Attribut
   sonst aushebeln - deshalb hier einmal verbindlich. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(1100px 620px at 50% -12%, #232a44 0%, transparent 62%),
    radial-gradient(700px 500px at 92% 108%, #1d2740 0%, transparent 60%);
  background-attachment: fixed;
}

/* --------------------------------- Views -------------------------------- */

.view { display: none; height: 100dvh; flex-direction: column; }
.view.active { display: flex; }

.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 24px;
}
/* "safe center" ist hier kein Schmuck: Ein zentrierter Flex-Container, dessen
   Inhalt hoeher ist als er selbst, laesst den Ueberhang nach BEIDEN Seiten
   herauslaufen. Der obere Teil landet dann vor dem Anfang des Scrollbereichs
   und ist nicht mehr erreichbar - beim Registrierformular lief so der
   Absenden-Knopf aus dem Bild, ohne dass eine Scrollleiste erschien. Mit
   "safe" faellt die Zentrierung weg, sobald es eng wird. */
.center-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: 16px;
}
/* Ohne das staucht der Flex-Container zu hohe Tafeln zusammen, statt sie
   ueberstehen zu lassen. Zusammen mit dem overflow:hidden der Anmeldetafel
   verschwand so der Absenden-Knopf - und weil nichts ueberstand, erschien
   auch keine Scrollleiste. */
.center-col > * { flex-shrink: 0; }

.topbar, .matchbar, .actionbar, .statusbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(14,16,23,.82);
  backdrop-filter: blur(12px);
}
.topbar  { border-bottom: 1px solid var(--line); padding-top: max(10px, env(safe-area-inset-top)); }
.actionbar, .statusbar {
  border-top: 1px solid var(--line);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .2px; margin-right: auto; }

/* Das Wortzeichen stoesst in der Datei bis an den Rand - der Abstand hier
   verschafft ihm den fehlenden Luftraum, ohne die Vorlage anzufassen. */
.brand-logo { display: flex; align-items: center; padding: 0 4px; }
.brand-logo img { height: 19px; width: auto; display: block; }
.topbar .chip:first-child + .brand { margin-right: 0; margin-left: auto; }

/* Der Weg ins Spiel ist von jeder Ansicht aus einen Griff entfernt. */
.btn.go-play {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 999px;
}

/* Auf schmalen Geraeten weichen erst der Name, dann das Wort im Titel -
   der Spielen-Knopf bleibt in jedem Fall stehen. */
@media (max-width: 560px) {
  .topbar .name-chip { display: none; }
}
@media (max-width: 470px) {
  .topbar .brand-word { display: none; }
  .topbar .chip { padding: 0 9px; font-size: 12.5px; }
  .brand-logo img { height: 16px; }
}

/* Fassungsangabe: da, wenn man sie sucht, sonst unauffaellig. */
.fassung {
  margin: 22px auto 4px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  opacity: .5;
  font-variant-numeric: tabular-nums;
  user-select: text;
}

/* ------------------------------- Bausteine ------------------------------ */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
}
.scroller > .panel:not(.stake) { margin-left: auto; margin-right: auto; }
.panel h2 { font-size: 17px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; }
.hint  { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 12px; }

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, filter .15s, opacity .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #241a02; }
.btn.ghost   { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.danger  { color: var(--lose); border-color: #4a2730; }
.btn.wide    { width: 100%; margin-top: 10px; }
.actionbar .btn { flex: 1; padding: 0 10px; white-space: nowrap; }
.actionbar .btn.primary { flex: 1.4; }

.chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.danger { color: var(--lose); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #241a02; font-weight: 600; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------- Sammlung ------------------------------- */

.intro p { margin-bottom: 12px; }
.tally { display: flex; flex-wrap: wrap; gap: 8px; }
.tally span {
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid currentColor;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 10px;
  max-width: 1080px;
  margin: 0 auto;
}
/* Am Schreibtisch fuenf statt sechs. Die Karten sind das Herzstueck - lieber
   weniger und groesser als eine dichte Kachelwand. */
@media (min-width: 900px) {
  .card-grid { grid-template-columns: repeat(5, 1fr); gap: 14px; }
}

/* -------------------------------- Karte --------------------------------- */
/* Das Bild traegt die Karte, nicht die Tabelle. Es hat ein festes
   Seitenverhaeltnis (3:2, dasselbe wie die Dateien), damit der Zuschnitt
   ueberall gleich ist und nichts nachtraeglich beschnitten wird.
   Die Aufmachung staffelt sich ueber --stufe, den Rang der Seltenheit. */

.card {
  --wucht: max(0, calc(var(--stufe) - 1));
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(168deg, #1b2030, #10131c);
  border: 1px solid color-mix(in srgb, var(--rar) calc(30% + var(--stufe) * 18%), var(--line));
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  box-shadow:
    0 3px 14px rgba(0,0,0,.5),
    0 0 calc(var(--wucht) * 16px) color-mix(in srgb, var(--rar) 50%, transparent);
  transition: transform .12s, box-shadow .18s;
}
button.card { cursor: pointer; }
button.card:active { transform: scale(.985); }

/* ---- Bildflaeche ---- */

.card-bild-flaeche {
  position: relative;
  aspect-ratio: 3 / 2;
  flex: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #232a3d, #171b28);
}
.card-bild {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 42%;
  display: block;
}
.card-rays {
  position: absolute; inset: -40% -10%;
  background: repeating-conic-gradient(from 0deg at 50% 100%,
    color-mix(in srgb, var(--rar) 55%, transparent) 0deg 5deg,
    transparent 5deg 14deg);
  opacity: calc(var(--wucht) * .18);
}
.card-emoji {
  position: relative;
  font-size: 3.4em; line-height: 1;
  filter: drop-shadow(0 3px 7px rgba(0,0,0,.65));
}

/* Verlauf, auf dem Name und Seltenheit liegen. */
.card-schleier {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(8,10,16,.34) 0%, transparent 26%),
    linear-gradient(0deg, rgba(8,10,16,.92) 0%, rgba(8,10,16,.6) 26%, transparent 52%);
  pointer-events: none;
}

/* ---- Name und Seltenheit, auf dem Bild ---- */

.card-schild {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 10px 8px;
  display: flex; flex-direction: column; gap: 1px;
}
.card-name {
  font-size: 14px; font-weight: 800; line-height: 1.15;
  letter-spacing: .1px;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-rar {
  font-size: 9.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--rar);
  text-shadow: 0 1px 3px rgba(0,0,0,.95);
  line-height: 1.1;
}

/* ---- Werte: zwei Spalten statt sechs Zeilen ---- */

.card-werte {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid color-mix(in srgb, var(--rar) 40%, var(--line));
}

/* Bezeichnung ueber dem Wert: Nebeneinander passt es in den schmalen Zellen
   des Sammlungsrasters nicht - dort waeren "Tempo 180 km/h" und Verwandte
   abgeschnitten. Uebereinander bleibt beides lesbar, bei gleicher Hoehe. */
.wert {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 5px 6px 6px;
  background: #141824;
  border: 0;
  color: inherit;
  font-family: inherit;
  text-align: left;
}
.wert .k {
  font-size: 9.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wert .v {
  font-size: 12.5px; font-weight: 800; line-height: 1.2;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Wo die Karte breiter ist, darf der Wert groesser werden. */
.card.showcase .wert .v,
.view-match .wert .v { font-size: 13.5px; }
.card.showcase .wert, .view-match .wert { padding-left: 8px; padding-right: 8px; }

/* Im Raster sind die Zellen am schmalsten - dort muessen auch die laengsten
   Werte hineinpassen ("5.000 Jahre"), sonst brechen sie ab. */
.card-grid .wert .v { font-size: 11.5px; letter-spacing: -.1px; }
.wert .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--rar) 24%, transparent),
    color-mix(in srgb, var(--rar) 4%, transparent));
  pointer-events: none;
}

button.wert { cursor: pointer; min-height: 38px; }
button.wert:hover  { background: #1b2132; }
button.wert:active { background: #222a3f; }

.wert.chosen { background: rgba(240,180,41,.16); box-shadow: inset 0 2px 0 var(--accent); }
.wert.chosen .k { color: var(--accent-2); }
.wert.result-win  .v { color: var(--win); }
.wert.result-lose .v { color: var(--lose); }

/* ---- Glanz und Zustaende ---- */

.card-sheen {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none;
  background: linear-gradient(105deg,
    transparent 38%, rgba(255,255,255,.16) 47%,
    rgba(255,255,255,.03) 52%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
  opacity: calc(var(--wucht) * 1);
}
.card.showcase .card-sheen,
button.card:hover .card-sheen { animation: sheen 2.6s ease-in-out infinite; }
@keyframes sheen {
  0%   { background-position: 130% 0; }
  55%  { background-position: -60% 0; }
  100% { background-position: -60% 0; }
}

.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 6px 20px rgba(0,0,0,.55);
}
.card.selected::after {
  content: "✓";
  position: absolute; top: 7px; left: 8px; z-index: 4;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #241a02;
  font-size: 13px; font-weight: 800;
  display: grid; place-items: center;
}
.card-dupe {
  position: absolute; top: 7px; right: 8px; z-index: 4;
  background: rgba(8,10,16,.8); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 7px; font-size: 11px;
}
.card.compact .card-name { white-space: normal; }

/* ------------------------------- Deckbau -------------------------------- */

.stake { display: flex; align-items: center; gap: 18px; max-width: 460px; margin-inline: auto; }
.stake-count { text-align: center; line-height: 1.15; }
.stake-count strong { font-size: 30px; color: var(--accent); }
.stake-count span   { font-size: 18px; color: var(--muted); }
.stake-count small  { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.stake-risk { flex: 1; }
.risk-bar { height: 9px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--line); }
.risk-bar i { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--win), var(--accent) 55%, var(--lose));
  transition: width .3s ease; }
.stake-risk small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---- Form des Decks ---- */

.panel.deck-form { max-width: 460px; margin-inline: auto; }
.panel.deck-form h2 { margin-bottom: 2px; }
.panel.deck-form .muted { font-size: 13px; margin-bottom: 12px; }

.form-liste { display: flex; flex-direction: column; gap: 7px; }
.form-zeile {
  display: grid;
  grid-template-columns: 4.4em 1fr 2.8em 5.2em;
  align-items: center;
  gap: 8px;
}
.form-name {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.form-balken {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.form-fuellung {
  display: block; height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b6ed8, var(--accent));
  transition: width .25s ease;
}
/* Strich: so stark ist der Kartensatz im Mittel - erst dadurch laesst sich
   ablesen, ob ein Balken gut oder nur lang ist. */
/* Strich bei 50 % - dem Durchschnitt. Erst dadurch laesst sich ablesen,
   ob ein Balken gut ist oder nur lang. */
.form-marke {
  position: absolute; top: -2px; bottom: -2px; left: 50%;
  width: 2px;
  background: rgba(232,236,245,.7);
  transform: translateX(-1px);
}
.form-quote {
  font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums; text-align: right;
}
.form-wert {
  font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.form-zeile.gut     .form-quote { color: var(--win); }
.form-zeile.schwach .form-quote { color: var(--lose); }
.form-zeile.gut     .form-fuellung { background: linear-gradient(90deg, #2e8f68, var(--win)); }
.form-zeile.schwach .form-fuellung { background: linear-gradient(90deg, #8f3a44, var(--lose)); }
.form-legende { margin: 12px 0 0; text-align: left; font-size: 11.5px; }

/* -------------------------------- Lobby --------------------------------- */

.uebung-hinweis { margin: 8px 0 0; font-size: 12.5px; }

.join-form { display: flex; gap: 10px; }
.code-input {
  flex: 1; min-width: 0;
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font: 700 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .28em;
  text-align: center;
  text-transform: uppercase;
}
.code-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.code-display {
  margin: 14px 0;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px dashed var(--accent);
  border-radius: 12px;
  font: 800 40px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .3em;
  text-indent: .3em;
  text-align: center;
  color: var(--accent-2);
}
.waiting { text-align: center; }

.mm-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 12px 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.mm-stats span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mm-stats strong {
  font-size: 19px; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.mm-stats small { font-size: 10.5px; color: var(--muted); }
.spinner {
  width: 26px; height: 26px; margin: 18px auto 8px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------- Partie -------------------------------- */

.view-match { overflow: hidden; }

/* Im Spiel: Karten so breit, dass zwei samt Urteilsband ohne Scrollen
   aufs Handy passen. Die Bildflaeche waechst mit der Breite mit. */
.view-match .lane { max-width: 252px; }
.view-match button.wert { min-height: 36px; }

/* Im Spiel: Karten so breit, dass zwei samt Urteilsband ohne Scrollen aufs
   Handy passen. Die Bildflaeche waechst mit der Breite mit. */
.view-match .lane { max-width: 252px; }
.view-match button.wert { min-height: 36px; }

.matchbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-top: max(10px, env(safe-area-inset-top));
  font-size: 13px;
}
.side { display: flex; align-items: center; gap: 7px; min-width: 0; }
.side.meta { flex-direction: column; gap: 2px; color: var(--muted); font-size: 11px; }
.pname { color: var(--muted); max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilecount {
  min-width: 28px; padding: 3px 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background .25s, color .25s;
}
.pilecount.bump { background: var(--accent); color: #241a02; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--win); }
.dot.off { background: var(--lose); }
.pot { color: var(--accent); font-weight: 700; }

.arena {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  padding: 12px;
  align-content: center;
  align-items: start;
  justify-items: center;
}

/* Das VS fuellt die Luecke zwischen den Karten - aber nur dort, wo es eine
   gibt. Mobil liegen die Karten uebereinander, da stuende es im Weg. */
.vs { display: none; }
.lane { width: 100%; max-width: 320px; display: flex; align-items: center; justify-content: center; }
.lane .card { width: 100%; }

/* Die verdeckte Karte bildet die Hoehe der Vorderseite exakt nach:
   Bildflaeche (Breite geteilt durch 1,5) plus das Werteraster. Ein festes
   Seitenverhaeltnis ginge nicht - das der Karte haengt an ihrer Breite. */
.card-back {
  --werte-hoehe: 122px;
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: calc(66.667% + var(--werte-hoehe));
  border-radius: 14px;
  border: 1px solid #2b3450;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 45%, #1d2540 0%, #10131f 62%, #0b0e16 100%),
    repeating-linear-gradient(45deg,  rgba(255,255,255,.028) 0 7px, transparent 7px 14px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.028) 0 7px, transparent 7px 14px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 3px 14px rgba(0,0,0,.5);
}

/* Strahlenkranz hinter dem Zeichen - dieselbe Sprache wie auf den Karten. */
.ruecken-strahlen {
  position: absolute; inset: -20%;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(240,180,41,.075) 0deg 3.5deg, transparent 3.5deg 12deg);
  /* Nach aussen auslaufen lassen - bis in die Ecken wirkt es unruhig. */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 22%, transparent 62%);
          mask-image: radial-gradient(circle at 50% 50%, #000 22%, transparent 62%);
  pointer-events: none;
}
.ruecken-ring {
  position: absolute; top: 50%; left: 50%;
  width: 58%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(240,180,41,.3);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(240,180,41,.05), inset 0 0 24px rgba(240,180,41,.07);
  pointer-events: none;
}
.ruecken-zeichen {
  position: absolute; top: 50%; left: 50%;
  width: 46%; height: auto;
  transform: translate(-50%, -50%);
  opacity: .62;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.8));
  pointer-events: none;
}

.card-back.leer {
  display: grid; place-items: center;
  height: auto; padding-bottom: 0; aspect-ratio: 9 / 10;
  color: var(--muted); font-size: 30px;
  background: rgba(20,24,36,.4);
  border-style: dashed;
}

.verdict {
  max-width: 100%;
  text-align: center;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel);
  animation: pop .25s ease-out;
}
.verdict.win  { color: var(--win);  border-color: var(--win); }
.verdict.lose { color: var(--lose); border-color: var(--lose); }
.verdict.tie  { color: var(--tie); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* Eine wertvolle Karte zu schlagen ist der Moment, fuer den man sein Deck
   baut. Das Urteil bekommt dafuer eine zweite Zeile und mehr Gewicht. */
.verdict.tat {
  border-radius: 14px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 18px;
}
.urteil-tat { font-size: 12px; font-weight: 800; letter-spacing: .01em; }
.verdict.errungen .urteil-tat { color: var(--accent); }
.verdict.verloren .urteil-tat { color: var(--muted); }
.verdict.tat.legendaer {
  border-color: var(--accent);
  box-shadow: 0 0 22px rgba(240,180,41,.22);
}
.verdict.tat.legendaer.errungen { animation: tat .6s cubic-bezier(.2,.9,.3,1.3); }
@keyframes tat {
  0%   { transform: scale(.8); opacity: 0; }
  55%  { transform: scale(1.05); }
  100% { transform: none; opacity: 1; }
}

/* Die geschlagene wertvolle Karte bekommt einen Riss, die siegreiche einen
   kurzen Schein. Beides klingt aus - es soll auffallen, nicht stoeren. */
.card.erlegt  { animation: erlegt .7s ease-out; }
@keyframes erlegt {
  0%   { transform: none; filter: none; }
  18%  { transform: translateX(-4px) rotate(-1.4deg); filter: grayscale(.5) brightness(.75); }
  38%  { transform: translateX(3px) rotate(1deg); }
  58%  { transform: translateX(-2px); filter: grayscale(.3) brightness(.85); }
  100% { transform: none; filter: none; }
}
.card.triumph { animation: triumph .7s ease-out; }
@keyframes triumph {
  0%   { box-shadow: none; }
  30%  { box-shadow: 0 0 0 3px rgba(240,180,41,.5), 0 0 26px rgba(240,180,41,.45); }
  100% { box-shadow: none; }
}

.loot-fanfare {
  margin: 8px 0 0; text-align: center;
  font-size: 13px; font-weight: 800;
  color: var(--accent);
}
.loot-fanfare.schmerz { color: var(--lose); }
.loot.wertvoll .card { box-shadow: 0 0 26px rgba(240,180,41,.28); }
.loot.legendaer .card { animation: triumph 1.2s ease-out .2s; }

@media (prefers-reduced-motion: reduce) {
  .card.erlegt, .card.triumph, .verdict.tat.legendaer.errungen,
  .loot.legendaer .card, .arena.aufgedeckt .vs,
  .ende-karte.an, h2.ende-wort, .overlay.ende.sieg .ende-strahlen { animation: none; }
}

.statusbar { justify-content: space-between; }
.status { font-size: 14px; color: var(--muted); line-height: 1.3; }
.status.turn { color: var(--accent-2); font-weight: 600; }

.dealt { animation: dealt .3s ease-out; }
@keyframes dealt { from { transform: translateY(10px) scale(.96); opacity: 0; } }

/* ------------------------------ Dekoration ------------------------------ */
/* Freisteller als Schmuck. Sie liegen HINTER dem Inhalt, nehmen keine Klicks
   entgegen und sind fuer Vorlesewerkzeuge unsichtbar (leeres alt). */

.deko {
  position: absolute;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  height: auto;

  /* Weiche Kante rundum.
   *
   * Vorher lief die Maske nur senkrecht, waehrend die Figuren mit negativen
   * Abstaenden ueber den Rand ragten - quer schnitt das overflow:hidden der
   * Tafel sie dann glatt durch. Ein Freisteller mit halbem Arm sieht nicht
   * nach Schmuck aus, sondern nach Fehler. Die Ellipse laesst sie stattdessen
   * nach allen Seiten ausklingen; wo nichts ueberragt, weicht sie nur die
   * Silhouette auf - was Freistellern ohnehin gut steht.
   */
  -webkit-mask-image: radial-gradient(ellipse 82% 82% at 50% 44%,
    #000 52%, rgba(0,0,0,.55) 78%, transparent 100%);
          mask-image: radial-gradient(ellipse 82% 82% at 50% 44%,
    #000 52%, rgba(0,0,0,.55) 78%, transparent 100%);
}
.panel { position: relative; }
.panel > *:not(.deko) { position: relative; z-index: 1; }

/* Die Figuren stehen jetzt vollstaendig INNERHALB ihrer Tafel. Ueber den Rand
   ragt nichts mehr - und wo doch, klingt es aus statt abzureissen. */

/* Der Phoenix rahmt das Wortzeichen: Fluegel links und rechts davon. Er darf
   die Tafel fuellen, aber nicht ueberragen, sonst kappt sie die Schwingen. */
.deko-phoenix {
  top: 6px; left: 50%;
  width: 100%;
  transform: translateX(-50%);
  opacity: .34;
  -webkit-mask-image: radial-gradient(ellipse 88% 96% at 50% 34%,
    #000 40%, rgba(0,0,0,.5) 68%, transparent 92%);
          mask-image: radial-gradient(ellipse 88% 96% at 50% 34%,
    #000 40%, rgba(0,0,0,.5) 68%, transparent 92%);
}
.panel.auth { overflow: hidden; }

/* Die Figur STEHT UEBER DER TAFEL, nicht in ihrer Ecke.
 *
 * Vorher sass sie klein und blass in einem eigenen Streifen unten - sichtbar,
 * aber bedeutungslos: eher Wasserzeichen als Wache. Jetzt ragt sie in voller
 * Groesse ueber die Tafel hinaus, taucht mit den Fuessen dahinter ab und
 * bleibt oben vom Scrollbereich beschnitten. Das darf sie: Ein angeschnittener
 * Riese wirkt gross, ein vollstaendiger, der auf 100 Pixel geschrumpft wurde,
 * wirkt nur klein.
 *
 * Weil sie ausserhalb der Tafel liegt, darf diese NICHT mehr overflow:hidden
 * tragen - sonst waere die Figur wieder weg.
 */
.panel.waiting, .panel.shop, .panel.profile, [data-bind="lobbyChoice"] {
  overflow: visible;
}
.panel.waiting, .panel.shop, .panel.profile,
[data-bind="lobbyChoice"], .panel.halle-kopf {
  /* Platz nach oben, damit die Figur nicht in die vorige Tafel laeuft - und
     innen so viel, dass ihre Fuesse nicht auf der Ueberschrift stehen. */
  /* Hoechste Figur 285, minus 46 Eintauchen = 239 Platzbedarf, plus Luft. */
  margin-top: 252px;
  padding-top: 56px;
}

/* Vorgegeben wird die HOEHE, nicht die Breite.
 *
 * Die Freisteller haben sehr verschiedene Seitenverhaeltnisse - der Waldgeist
 * ist 220x391, der Eisriese 240x205. Bei fester Breite wurden sie damit
 * unterschiedlich hoch, und die hohen ragten oben aus dem Scrollbereich: Dem
 * Eisriesen war der Kopf abgeschnitten. Ein angeschnittener Kopf liest sich
 * als Fehler, nicht als Bildausschnitt. Ueber die Hoehe passen alle in
 * denselben Platz, und der Abstand darueber ist danach bemessen.
 */
.deko.wache {
  bottom: calc(100% - 46px);      /* Fuesse tauchen hinter der Tafel ab */
  left: 50%;
  transform: translateX(-50%);
  /* Die Hoehe kommt aus einer Variablen, die jede Figur mit EINER Klasse
     setzt. Vorher stand sie in `.deko.wache.deko-eisriese` - drei Klassen, und
     damit spezifischer als die schmale Fassung in der Media Query, die nur
     zwei hatte. Media Queries erhoehen die Spezifitaet nicht: Der Eisriese
     blieb deshalb auf voller Hoehe und ragte auf dem Telefon oben heraus. */
  height: var(--wache-hoehe, 260px);
  width: auto;
  opacity: .92;
  /* Unten weich in die Tafel hinein, oben und seitlich nur die Silhouette
     aufweichen - der Anschnitt oben besorgt der Scrollbereich. */
  -webkit-mask-image: linear-gradient(180deg, #000 76%, rgba(0,0,0,.35) 93%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 76%, rgba(0,0,0,.35) 93%, transparent 100%);
  filter: drop-shadow(0 12px 30px rgba(0,0,0,.6));
}

/* Der Waldgeist wartet mit. */
.deko-waldgeist { --wache-hoehe: 285px; }

/* Der Erzlich haelt die brennende Schriftrolle hin - er bewacht die Pakete. */
.deko-erzlich { --wache-hoehe: 265px; }

/* Der Eisengolem als Wachfigur im Profil: massig und unbewegt.
   Dunkler Stahl auf dunklem Grund braucht mehr Deckkraft als die feurigen
   Gestalten, sonst verschwindet er einfach. */
/* Zwei Klassen: .deko.wache setzt die Deckkraft und ist spezifischer als eine
   einzelne Klasse - dunkler Stahl auf dunklem Grund braucht hier mehr. */
.deko-golem { --wache-hoehe: 250px; }
/* Dunkler Stahl auf dunklem Grund braucht mehr Deckkraft. */
.deko.wache.deko-golem { opacity: 1; }

/* Der Eisriese wartet auf den naechsten Gegner. */
.deko-eisriese { --wache-hoehe: 255px; }

.panel.halle-kopf { overflow: visible; }
.panel.profile .muted, .panel.profile .hint { text-align: left; }

/* Auf schmalen Geraeten kleiner - aber nicht klein: Sie soll auch dort noch
   eine Figur sein und kein Symbol. */
@media (max-width: 470px) {
  /* Dieselbe Spezifitaet wie oben (eine Klasse), nur weiter unten - deshalb
     gewinnen diese Werte. */
  .deko.wache { bottom: calc(100% - 34px); }
  .deko-eisriese  { --wache-hoehe: 165px; }
  .deko-erzlich   { --wache-hoehe: 172px; }
  .deko-golem     { --wache-hoehe: 160px; }
  .deko-waldgeist { --wache-hoehe: 188px; }
  .panel.waiting, .panel.shop, .panel.profile,
  [data-bind="lobbyChoice"], .panel.halle-kopf { margin-top: 162px; padding-top: 42px; }
  .panel.waiting, .panel.shop, .panel.profile,
  [data-bind="lobbyChoice"] { padding-bottom: 86px; }
  .halle-kopf > .muted,
  .halle-kopf > h2 { padding-right: 96px; }
}

@media (prefers-reduced-motion: no-preference) {
  .deko { transition: opacity .4s; }
}

/* ------------------------------ Anmeldung ------------------------------- */

.panel.auth { max-width: 380px; text-align: center; overflow: hidden; }
.auth-brand { margin: 14px 0 10px; padding: 0 6px; }
.auth-brand img { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto; }
.auth-claim { margin-bottom: 20px; }

.tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
}
.tab {
  flex: 1; min-height: 38px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab.on { background: var(--panel-2); color: var(--text); box-shadow: var(--shadow); }

.stack { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.feld { display: flex; flex-direction: column; gap: 5px; }
.feld > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.feld input {
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font: inherit;
}
.feld input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.uebernahme {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 13.5px;
  cursor: pointer;
}
.uebernahme input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.hint.bad { color: var(--lose); }

/* -------------------------- Rangliste & Profil -------------------------- */

.chip.rating strong { color: var(--accent); }

.profile-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-elo {
  margin-left: auto;
  font-size: 26px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.table { display: flex; flex-direction: column; }
.table .row {
  display: grid;
  grid-template-columns: 2.2em 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(46,52,72,.6);
  font-size: 14px;
}
.table .row:last-child { border-bottom: 0; }
.table .row.self { background: rgba(240,180,41,.08); border-radius: 8px; }
.table .rank   { color: var(--muted); font-variant-numeric: tabular-nums; }
.table .who    { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .record { color: var(--muted); font-size: 12.5px; text-align: right; }
.table .elo    { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: right; }
.table .elo.plus  { color: var(--win); }
.table .elo.minus { color: var(--lose); }
.table .row.sieg   .rank { color: var(--win); }
.table .row.pleite .rank { color: var(--lose); }

.logout { max-width: 460px; margin: 4px auto 20px; display: block; }

.matchbar .elo {
  font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------- Wertungsaenderung -------------------------- */

.elo-change {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 0; padding: 9px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.elo-change .elo-value {
  font-size: 26px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.elo-change .elo-delta { font-size: 15px; font-weight: 700; color: var(--muted); }
.elo-change.plus  .elo-delta { color: var(--win); }
.elo-change.minus .elo-delta { color: var(--lose); }
.elo-change small { color: var(--muted); font-size: 11px; }

/* ------------------------------ Kartenladen ----------------------------- */

.chip.coins strong { color: var(--accent-2); }

.panel.shop { max-width: 400px; text-align: center; }
.purse {
  font-size: 15px; color: var(--muted);
  padding-bottom: 14px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.purse strong { font-size: 24px; color: var(--accent); font-variant-numeric: tabular-nums; }

.pack-offer { padding-top: 16px; }
/* ---- Eingangshalle ---- */

.logo-knopf {
  background: none; border: 0; padding: 0; cursor: pointer;
  display: block; line-height: 0;
}
.logo-knopf img { display: block; }

/* Kopf und Raster teilen sich eine Breite und eine Mitte - sonst steht der
   Willkommensblock schmal ueber einem breiten Raster und alles wirkt lose. */
.halle-kopf, .halle-raster { max-width: 940px; margin-inline: auto; }
.halle-kopf { position: relative; overflow: hidden; max-width: 940px; }
.halle-kopf h2 { margin-bottom: 4px; }
.halle-knoepfe {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.halle-knoepfe .btn { flex: 1 1 auto; }

/* Eine Spalte auf dem Telefon, zwei ab Tablet - die Halle soll nicht zum
   Scrollmarathon werden. */
.halle-raster {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
  /* Ohne start wuerden die Kacheln einer Zeile auf gleiche Hoehe gezogen -
     unter einer kurzen Bestenliste klafft dann ein leeres Feld. */
  align-items: start;
  margin-top: 12px;
}
.halle-raster .panel { margin: 0; max-width: none; }

.table.klein .row { padding: 7px 2px; font-size: 13.5px; }
.table.klein .row:last-child { border-bottom: 0; }
.btn.klein { font-size: 12.5px; padding: 7px 10px; margin-top: 10px; }
p.klein, span.klein { font-size: 12px; }

/* Ergebniszeile: oben wer gegen wen, darunter Beute und Laenge der Partie. */
.ergebnis {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(46,52,72,.6);
  font-size: 13.5px;
}
.ergebnis:last-child { border-bottom: 0; }
.ergebnis-zeit  { text-align: right; white-space: nowrap; }
.ergebnis-beute { grid-column: 1; }
.zuege { grid-column: 2; text-align: right; white-space: nowrap; }

.platz {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  font-size: 11px; font-weight: 800;
  background: rgba(255,255,255,.06); color: var(--muted);
}
.platz-1 { background: rgba(240,180,41,.2);  color: var(--accent); }
.platz-2 { background: rgba(200,208,222,.16); color: #c8d0de; }
.platz-3 { background: rgba(190,120,60,.2);   color: #d09a63; }
.rang-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rang-name.ich { color: var(--accent); font-weight: 700; }

.funde { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.fund { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
/* Der Punkt traegt die Farbe der Seltenheit - dieselbe wie auf der Karte. */
.fund-punkt {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--farbe);
  box-shadow: 0 0 8px var(--farbe);
}
.fund-text { flex: 1; min-width: 0; }
.fund-zeit { flex: none; white-space: nowrap; }

.ergebnis-namen { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zuege { white-space: nowrap; }

.neuigkeiten { display: flex; flex-direction: column; gap: 11px; margin-top: 8px; }
.notiz { padding-left: 11px; border-left: 2px solid var(--line); }
.notiz-neu       { border-left-color: var(--accent); }
.notiz-aenderung { border-left-color: #3b9dd8; }
.notiz-behoben   { border-left-color: var(--win); }
.notiz-kopf { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.notiz p { margin: 2px 0 0; line-height: 1.45; }


/* ---- Startschirm ---- */

.startschirm {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: var(--bg);
  text-align: center; padding: 24px;
}
.start-zeichen { width: 150px; height: auto; opacity: .9; }
.start-text { color: var(--muted); font-size: 14px; margin: 0; max-width: 34ch; line-height: 1.5; }
.startschirm.fehler .start-text { color: var(--lose); }
.startschirm .spinner { margin: 0; }

/* ---- Tauziehen um die Karten ---- */

.tau {
  position: relative;
  flex: none;
  display: flex;
  /* Nicht randlos ueber die ganze Breite, sondern ein abgegrenztes Stueck -
     eine Lebensanzeige, kein Ladebalken. Dafuer hoch genug, um sie zu sehen. */
  width: min(360px, 76vw);
  height: 15px;
  margin: 10px auto 2px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.tau-teil { display: block; height: 100%; transition: width .45s cubic-bezier(.3,.8,.35,1); }
/* Der Gegner links, du rechts - wie die Karten liegen. */
.tau-opp  { background: linear-gradient(90deg, #6b7488, #8a93a8); }
.tau-du   { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
/* Der Bock gehoert noch niemandem und sieht auch so aus. */
.tau-topf {
  background: repeating-linear-gradient(45deg,
    rgba(255,255,255,.28) 0 4px, rgba(255,255,255,.08) 4px 8px);
}
/* Eine feine Marke bei der Haelfte: Ohne sie sieht man nicht, wer vorn liegt. */
.tau-mitte {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: rgba(255,255,255,.4);
}
/* Wer vorn liegt, dessen Seite glimmt - das macht den Stand auf einen Blick
   lesbar, auch ohne den Strich in der Mitte zu suchen. */
.tau.vorn   .tau-du  { box-shadow: 0 0 12px rgba(240,180,41,.55); }
.tau.hinten .tau-opp { box-shadow: 0 0 12px rgba(138,147,168,.5); }

/* ---- Wer ist am Zug ---- */

/* Marke neben dem Namen in der Kopfzeile. */
.zugmarke {
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--accent); color: #241a02;
  animation: pop .25s ease-out;
}

/* Das Wort in der Mitte der Arena - dort schaut man ohnehin hin. */
.zugzeiger {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  text-align: center;
}
.zug-wort {
  font-size: 15px; font-weight: 800;
  letter-spacing: .02em;
}
.zugzeiger.du .zug-wort { color: var(--accent); }
.zugzeiger.gegner .zug-wort { color: var(--muted); font-weight: 700; }
.zug-grund { font-size: 11.5px; font-weight: 700; color: var(--accent-2); }
.zug-grund:empty { display: none; }
.zugzeiger.neu { animation: zugwechsel .5s cubic-bezier(.2,.9,.3,1.35); }
@keyframes zugwechsel {
  0%   { opacity: 0; transform: translateY(6px) scale(.9); }
  60%  { opacity: 1; transform: scale(1.06); }
  100% { transform: none; }
}

/* Und ein Leuchten an der Spur dessen, der waehlt. Das verbindet die Ansage
   mit den Karten, auf die sie sich bezieht. */
.lane.am-zug .card {
  box-shadow: 0 0 0 2px rgba(240,180,41,.45), 0 0 26px rgba(240,180,41,.2);
}
.lane-opp.am-zug .card-back,
.lane-opp.am-zug .card {
  box-shadow: 0 0 0 2px rgba(232,236,245,.22), 0 0 22px rgba(232,236,245,.1);
}

@media (prefers-reduced-motion: reduce) {
  .zugmarke, .zugzeiger.neu { animation: none; }
}

/* ---- Gegner gefunden ---- */

.gefunden {
  margin: 0 0 10px;
  font-size: 13px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.gefunden.an { animation: gefunden .6s cubic-bezier(.2,.9,.3,1.35); }
@keyframes gefunden {
  0%   { opacity: 0; transform: scale(.85); }
  55%  { opacity: 1; transform: scale(1.04); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gefunden.an { animation: none; } }

/* ---- Erfolge ---- */

.erfolg-liste { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.erfolg {
  display: grid; grid-template-columns: 1.4em 1fr auto;
  align-items: baseline; gap: 9px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(46,52,72,.5);
  font-size: 13.5px;
  opacity: .55;
}
.erfolg:last-child { border-bottom: 0; }
.erfolg.offen { opacity: 1; }
.erfolg-zeichen { color: var(--muted); font-size: 15px; }
.erfolg.offen .erfolg-zeichen { color: var(--accent); }
.erfolg-text { min-width: 0; }
.erfolg-stand {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.erfolg.offen .erfolg-stand { color: var(--accent-2); }

/* Die Feier beim Freischalten - kleiner als der Endscreen, aber aus
   derselben Familie. */
.result-card.erfolg-schau { max-width: 400px; }
.erfolg-marke {
  display: block; font-size: 40px; line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 26px rgba(240,180,41,.5);
  animation: fanfare .5s cubic-bezier(.2,.9,.3,1.4);
}
.erfolg-oben {
  margin: 6px 0 0; font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.erfolg-schau h2 { margin: 2px 0 4px; color: var(--accent); }
.erfolg-lohn {
  margin: 12px 0 0; font-size: 15px; font-weight: 800; color: var(--accent-2);
}
.erfolg-schau .pack-cards { margin: 12px 0 4px; }
.erfolg-schau .pack-cards:empty { display: none; }

/* ---- Deckwahl ---- */

.deckwahl { max-width: 460px; margin: 0 auto 12px; }
.deckreiter-reihe {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px;
}
.deckreiter-reihe::-webkit-scrollbar { display: none; }

.deckreiter {
  flex: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 8px 13px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel); color: var(--muted);
  font: inherit; cursor: pointer; text-align: left;
  transition: border-color .15s, color .15s, background .15s;
}
.deckreiter:hover { color: var(--text); border-color: rgba(255,255,255,.16); }
.deckreiter.an {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(240,180,41,.09);
}
.deckname { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.deckzahl { font-size: 11px; font-variant-numeric: tabular-nums; }
/* Ein unfertiges Deck kann nicht spielen - das soll man sehen, bevor man
   auf Spielen drueckt. */
.deckreiter.unfertig .deckzahl { color: var(--lose); }
.deckreiter.neu { justify-content: center; align-items: center; border-style: dashed; }

.deckwerkzeug { display: flex; gap: 6px; margin-top: 8px; }

/* ---- Hauptnavigation ----
 *
 * Vorher trug jede Ansicht eine eigene Reihe Pillen: Zurueck-Knopf, Name,
 * Muenzstand, alles gleich aussehend und damit gleich unwichtig. Jetzt gibt es
 * vier Orte, ueberall dieselben, und rechts zwei Zahlen, die keine Knoepfe
 * sein wollen.
 */

.topbar[data-nav] {
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}
.topbar[data-nav] .brand-logo { flex: none; margin: 0; }
.topbar[data-nav] .brand-logo img { width: 78px; height: auto; display: block; }

.hauptnav {
  display: flex; align-items: center; gap: 4px;
  flex: 1; min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.hauptnav::-webkit-scrollbar { display: none; }

.navpunkt {
  position: relative;
  flex: none;
  padding: 8px 13px;
  border: 0; border-radius: 9px;
  background: none; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.navpunkt:hover { color: var(--text); background: rgba(255,255,255,.05); }
.navpunkt.an { color: var(--text); }
/* Ein Strich unter dem aktiven Punkt statt einer gefuellten Pille - das sagt
   "hier bist du", ohne wie ein Knopf auszusehen. */
.navpunkt.an::after {
  content: "";
  position: absolute; left: 13px; right: 13px; bottom: 1px;
  height: 2px; border-radius: 2px;
  background: var(--accent);
}
/* Spielen ist die eine Handlung, um die es geht. */
.navpunkt.haupt {
  color: #1b1400;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  font-weight: 800;
  padding: 8px 17px;
}
.navpunkt.haupt:hover { filter: brightness(1.06); background: var(--accent); }
.navpunkt.haupt.an::after { display: none; }

.stand { display: flex; align-items: center; gap: 6px; flex: none; }
.standwert {
  display: flex; align-items: baseline; gap: 5px;
  padding: 5px 9px;
  border: 0; border-radius: 8px;
  background: none; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.standwert:hover { background: rgba(255,255,255,.05); }
/* Das Wort steht hinter der Zahl und tritt zurueck - die Zahl ist die
   Auskunft, das Wort nur ihre Einheit. */
.standwort {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .02em;
}
.standwert.muenzen strong { color: var(--accent-2); }
.standwert strong { color: var(--accent); }

@media (max-width: 620px) {
  .topbar[data-nav] { gap: 8px; padding: 8px 10px; }
  .topbar[data-nav] .brand-logo img { width: 56px; }
  .navpunkt { padding: 7px 9px; font-size: 13px; }
  .navpunkt.an::after { left: 9px; right: 9px; }
  .navpunkt.haupt { padding: 7px 12px; }
  .standwert { padding: 4px 6px; font-size: 13px; }
}
/* Ganz schmal: Das Wortzeichen tritt ab, die vier Orte sind wichtiger. */
@media (max-width: 430px) {
  .topbar[data-nav] .brand-logo { display: none; }
}
/* Hier wird es eng. Die Zeichen vor den Zahlen kosten Platz, den der letzte
   Menuepunkt braucht - ohne sie ist immer noch klar, was Gold und was Wertung
   ist, weil beide ihre Farbe behalten. */
@media (max-width: 560px) {
  /* Hier zaehlt jeder Pixel: Die Einheit faellt weg, die Farbe unterscheidet
     die beiden Zahlen weiterhin. */
  .standwort { display: none; }
  .standwert { padding: 4px 5px; font-size: 12.5px; gap: 0; }
  .stand { gap: 2px; }
  .navpunkt { padding: 7px 6px; font-size: 12.5px; }
  .navpunkt.haupt { padding: 7px 10px; }
  .navpunkt.an::after { left: 6px; right: 6px; }
  .hauptnav { gap: 1px; }
}

/* ---- Endscreen ----
 *
 * Eine Partie kostet eine Karte fuer immer. Das Ende darf nicht aussehen wie
 * eine Systemmeldung - es traegt das Gewicht der ganzen Partie.
 */

.overlay.ende { background: rgba(6,7,12,.9); }

/* Strahlenkranz hinter der Tafel - dieselbe Sprache wie Kartenrueckseite und
   legendaerer Fund. Nur beim Sieg; eine Niederlage feiert man nicht. */
.ende-strahlen {
  position: absolute; inset: -30%;
  pointer-events: none; opacity: 0;
  /* Schmale, blasse Strahlen. Breit und kraeftig ueberziehen sie den ganzen
     Bildschirm und wirken billig - sie sollen hinter der Tafel glimmen, nicht
     vor ihr liegen. */
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(240,180,41,.075) 0deg 1.6deg, transparent 1.6deg 13deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%,
    #000 6%, rgba(0,0,0,.45) 26%, transparent 46%);
          mask-image: radial-gradient(circle at 50% 50%,
    #000 6%, rgba(0,0,0,.45) 26%, transparent 46%);
}
.overlay.ende.sieg .ende-strahlen {
  opacity: 1;
  animation: endeKranz 14s linear infinite;
}
@keyframes endeKranz { to { transform: rotate(360deg); } }

.result-card.ende-karte {
  max-width: 460px;
  border-width: 2px;
  position: relative;
}
.ende-karte.an { animation: endeAuf .5s cubic-bezier(.18,.9,.28,1.25); }
@keyframes endeAuf {
  from { opacity: 0; transform: translateY(16px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
.overlay.ende.sieg .ende-karte {
  border-color: rgba(240,180,41,.5);
  box-shadow: 0 0 60px rgba(240,180,41,.22), var(--shadow);
}
.overlay.ende.niederlage .ende-karte {
  border-color: rgba(239,95,107,.42);
  box-shadow: 0 0 46px rgba(239,95,107,.14), var(--shadow);
}

.ende-schlag { margin-bottom: 18px; }
.ende-marke { font-size: 30px; display: block; line-height: 1; opacity: .9; }

/* Das Wort traegt den Bildschirm. Kursiv und schwer wie das Wortzeichen. */
/* Zwei Klassen und das Element: .result-card h2 { font-size: 24px } ist
   spezifischer als eine blosse Klasse und haette das Wort sonst klein
   gehalten - derselbe Stolperstein wie bei .result-card/.pack-result. */
.result-card h2.ende-wort {
  margin: 6px 0 4px;
  /* Das Wort ist der Bildschirm. Alles andere ordnet sich ihm unter. */
  font-size: clamp(44px, 13vw, 92px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.035em;
  line-height: .92;
  text-transform: uppercase;
}
/* „NIEDERLAGE" ist zehn Zeichen lang und spraengte sonst die Tafel. */
.overlay.ende.niederlage h2.ende-wort { font-size: clamp(32px, 9vw, 66px); }
.overlay.ende.sieg h2.ende-wort {
  color: var(--accent);
  text-shadow: 0 0 34px rgba(240,180,41,.45);
  animation: wortSchlag .55s cubic-bezier(.2,.9,.3,1.5) .08s backwards;
}
.overlay.ende.niederlage h2.ende-wort {
  color: var(--lose);
  text-shadow: 0 0 26px rgba(239,95,107,.3);
  animation: wortFallen .5s cubic-bezier(.3,.7,.4,1) .08s backwards;
}
.overlay.ende.remis h2.ende-wort { color: var(--muted); font-size: clamp(26px, 7vw, 44px); }
@keyframes wortSchlag {
  0%   { opacity: 0; transform: scale(1.5); }
  60%  { opacity: 1; transform: scale(.96); }
  100% { transform: scale(1); }
}
@keyframes wortFallen {
  0%   { opacity: 0; transform: translateY(-14px) scale(1.06); }
  100% { opacity: 1; transform: none; }
}

.ende-unter { font-size: 13.5px; color: var(--muted); margin: 0; }

.ende-bilanz {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.ende-bilanz:empty { display: none; }
.ende-karte .loot { margin-top: 14px; }
.ende-karte .loot-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em;
}

/* Die Beute liegt verdeckt und schlaegt um - derselbe Griff wie beim Paket,
   nur groesser und mit mehr Anlauf. Das ist der Moment, um den es geht. */
.loot.buehne { margin-top: 16px; }
.beute-slot {
  position: relative;
  width: 100%; max-width: 210px;
  margin: 10px auto 0;
  perspective: 1100px;
}
.beute-slot .pack-karte {
  transition: transform .56s cubic-bezier(.3,.85,.35,1.05);
}
.beute-slot.auf .pack-karte { transform: rotateY(180deg); }
.beute-slot .pack-deckel { border-radius: 14px; }
.beute-slot.gelandet { animation: beuteStoss .6s ease-out; }
@keyframes beuteStoss {
  0%   { transform: none; }
  32%  { transform: translateY(-11px) scale(1.05); }
  100% { transform: none; }
}
.loot.buehne .pack-welle {
  position: absolute; top: 50%; left: 50%;
  width: 60px; height: 60px; margin: -30px 0 0 -30px;
  border-radius: 50%; border: 2px solid var(--farbe);
  opacity: 0; pointer-events: none;
}
.beute-slot.gelandet .pack-welle { animation: welle .9s ease-out; }
.loot.buehne.wertvoll .pack-inhalt {
  filter: drop-shadow(0 0 20px color-mix(in srgb, var(--farbe) 60%, transparent));
}
/* Solange sie verdeckt liegt, schlaegt die Beschriftung den Ton an. */
.loot.buehne .loot-label { font-size: 12px; }
.loot.buehne .loot-fanfare { margin-top: 10px; font-size: 14px; }
.loot-label.nachschub {
  margin-top: 12px; font-size: 11.5px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .beute-slot .pack-karte { transition: none; }
  .beute-slot.gelandet, .beute-slot.gelandet .pack-welle { animation: none; }
}

/* ---- Einsaetze ---- */

.result-card.einsatz-schau { max-width: 880px; position: relative; overflow: hidden; }

/* Der Balken laeuft ueber die volle Breite der Tafel ab - man sieht die
   verbleibende Zeit, ohne die Zahl lesen zu muessen. */
.einsatz-balken {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transform-origin: left center;
  pointer-events: none;
}
.einsatz-uhr {
  display: inline-grid; place-items: center;
  min-width: 1.5em; height: 1.5em; margin-left: 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.16);
  font-variant-numeric: tabular-nums;
}
.einsatz-uhr:empty { display: none; }
.einsatz-schau h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 14px 0 6px; text-align: left;
}
.einsatz-reihe {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.einsatz-platz { min-width: 0; }
@media (min-width: 780px) {
  /* Acht nebeneinander: So sieht man einen Einsatz auf einen Blick, statt ihn
     aus zwei Reihen zusammensetzen zu muessen. */
  .einsatz-reihe { grid-template-columns: repeat(8, 1fr); gap: 7px; }
}

/* ---- Tonschalter ---- */

.klang-schalter { margin-top: 10px; font-size: 12.5px; }
.chip.klang-schalter { display: block; margin: 12px auto 0; }
.klang-schalter.aus { opacity: .6; }

/* ---- Gutscheine ---- */

/* Dasselbe Feld wie in der Lobby - nur der Abstand ist eigen. Ein
   Gutscheincode ist doppelt so lang wie ein Spielcode, deshalb sperrt er
   etwas enger, damit er nicht aus dem Feld laeuft. */
.gutschein-form { margin: 10px 0 2px; }
.gutschein-form .code-input { font-size: 18px; letter-spacing: .16em; }

.gutschein-bau {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 14px;
}
.gutschein-bau .weit { grid-column: 1 / -1; }
.gutschein-bau button.weit { grid-column: 1 / -1; }

.code-zeile.gutschein {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 6px 10px;
  align-items: center;
}
.gutschein-inhalt {
  grid-column: 1 / -1;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---- Auswertung ---- */

.stat-titel {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 16px 0 4px;
}
.stat-zahlen {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 9px; margin: 8px 0 4px;
}
.stat-zahlen .kachel { background: var(--bg-soft); }
.stat-zahlen .kachel strong { font-size: 20px; }

.stat-liste { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.stat-zeile {
  display: grid;
  grid-template-columns: minmax(5em, 8em) 1fr 3.4em;
  align-items: center;
  gap: 4px 9px;
}
.stat-name {
  font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat-wert {
  font-size: 12px; font-weight: 800; text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Die Erläuterung sitzt unter dem Balken, nicht daneben - sonst bleibt für
   den Balken selbst nichts übrig. */
.stat-unten { grid-column: 2 / -1; margin-top: -2px; }
/* Karten färben ihren Balken in der Farbe ihrer Seltenheit. */
.stat-zeile[style*="--farbe"] .form-fuellung {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--farbe) 45%, #1b2133), var(--farbe));
}

.stat-spalten { display: grid; grid-template-columns: 1fr; gap: 16px; }
.stat-spalten h4 {
  font-size: 12.5px; margin: 0 0 2px; color: var(--text);
}

.uebung-schalter {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 2px; font-size: 12.5px; color: var(--muted);
  cursor: pointer;
}

/* ---- Karten-Editor ---- */

/* Zwei Spalten, sobald Platz ist: links die Liste, rechts Formular und Waage.
   Auf dem Telefon untereinander - der Editor ist Schreibtischarbeit, muss dort
   aber wenigstens benutzbar bleiben. */
.editor {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  gap: 0;
}
.editor-liste {
  display: flex; flex-direction: column; min-height: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(12,15,24,.4);
}
.editor-suche {
  display: flex; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.editor-suche input {
  flex: 1; min-width: 0;
  padding: 8px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font: inherit; font-size: 13.5px;
}
.karten-liste { overflow-y: auto; max-height: 34vh; padding: 6px; }

.karten-eintrag {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px;
  border: 1px solid transparent; background: none; color: var(--text);
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.karten-eintrag:hover { background: rgba(255,255,255,.04); }
.karten-eintrag.an {
  background: rgba(240,180,41,.1);
  border-color: rgba(240,180,41,.35);
}
.eintrag-punkt {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--farbe); box-shadow: 0 0 7px var(--farbe);
}
.eintrag-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.karten-eintrag.neu .eintrag-name { font-style: italic; }

.editor-blatt {
  overflow-y: auto; min-height: 0;
  padding: 14px;
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  align-content: start;
}
.editor-form { display: flex; flex-direction: column; gap: 11px; }
.editor-kopf { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.editor-kopf h2 { margin: 0; }
.editor-form h3, .waage h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 6px 0 0;
}
.feld-hinweis { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: block; }
.werte-raster { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-form input:disabled { opacity: .55; cursor: not-allowed; }

.editor-schau { display: flex; flex-direction: column; gap: 16px; }
.schau-karte { width: 100%; max-width: 210px; margin: 0 auto; }

.waage { padding: 13px 14px; border-radius: 12px;
         border: 1px solid var(--line); background: var(--panel); }
.waage-zeile {
  display: grid; grid-template-columns: 4.4em 1fr 2.8em;
  align-items: center; gap: 8px;
}
.waage-name { font-size: 11px; font-weight: 700; text-transform: uppercase;
              letter-spacing: .04em; color: var(--muted); }
.waage-quote { font-size: 12px; font-weight: 800; text-align: right;
               font-variant-numeric: tabular-nums; }
.waage-urteil {
  margin: 10px 0 0; font-size: 12.5px; line-height: 1.45;
  padding: 8px 10px; border-radius: 9px;
  border-left: 2px solid var(--line); background: var(--bg-soft);
}
.waage-urteil.passt   { border-left-color: var(--win); }
.waage-urteil.stark   { border-left-color: var(--lose); }
.waage-urteil.schwach { border-left-color: #3b9dd8; }

.editor-stand { font-size: 12px; color: var(--muted); }
.editor-stand.offen { color: var(--accent); font-weight: 700; }

.verwaltung-knopf {
  max-width: 940px; margin: 12px auto 0;
  display: flex; gap: 8px; justify-content: center;
}

/* ---- Verwaltung ---- */

.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 auto 12px;
  max-width: 940px;
}
[data-view="admin"] .scroller > .panel { max-width: 940px; }
.kachel {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.kachel strong {
  font-size: 24px; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kachel-titel { font-size: 12.5px; font-weight: 700; }
.kachel-unten { font-size: 11px; color: var(--muted); }

.zaehler {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,.06);
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  vertical-align: middle;
}

.lauf-liste { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.lauf {
  padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
}
/* Uebungspartien zaehlen nicht fuer die Wertung - das soll man sofort sehen. */
.lauf.uebung { border-left-color: var(--muted); opacity: .82; }
.lauf-kopf { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lauf-kopf code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800; letter-spacing: .1em; color: var(--accent);
}
.lauf-zeit { margin-left: auto; }
.lauf-spieler { display: flex; flex-direction: column; gap: 1px; margin-top: 5px; }
.spieler { font-size: 13px; }
.spieler.weg { opacity: .55; }

.marke {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; padding: 2px 6px; border-radius: 5px;
  background: rgba(255,255,255,.07); color: var(--muted);
}
.marke.gold { background: rgba(240,180,41,.16); color: var(--accent); }

.code-liste { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.code-zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.code-zeile code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; font-weight: 800; letter-spacing: .16em; color: var(--accent);
}
.code-zeile.weg { opacity: .5; }
.code-zeile.weg code { color: var(--muted); text-decoration: line-through; }
.btn.winzig { font-size: 11.5px; padding: 5px 9px; }

.kette { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.ketten-zeile {
  display: flex; align-items: baseline; gap: 7px; font-size: 13px;
  /* Jede Stufe rueckt ein - daraus liest man die Kette ohne Linien. */
  padding-left: calc(var(--tiefe) * 16px);
}
.ketten-strich { color: var(--muted); font-size: 11px; }

.nutzer-liste { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.nutzer { padding-bottom: 8px; border-bottom: 1px solid rgba(46,52,72,.6); }
.nutzer:last-child { border-bottom: 0; padding-bottom: 0; }
.nutzer-kopf { display: flex; align-items: baseline; gap: 7px; }
.nutzer-zeit { margin-left: auto; }

/* ---- Erklaerung auf der Anmeldeseite ---- */

.erklaerung {
  text-align: left;
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(12,15,24,.45);
  display: flex; flex-direction: column; gap: 8px;
}
.erklaerung p { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin: 0; }
.erklaerung strong { color: var(--text); }
/* Der Satz mit dem Diebstahl ist der Kern des Spiels - er darf auffallen. */
.erklaerung p:nth-child(2) strong { color: var(--accent); }

.code-eingabe {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}
/* Karten-IDs sind kleingeschrieben - sie stehen so in den Bilddateinamen. */
.id-eingabe {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .04em;
}

/* Mehrere Pakete nebeneinander. Auf dem Telefon untereinander - die Kacheln
   sollen lesbar bleiben, nicht moeglichst viele in eine Reihe passen. */
.pack-regal {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
  margin-bottom: 4px;
}
.paket {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 13px 13px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-soft);
}
.paket h3 { font-size: 15px; margin: 0; }
.paket.zu-teuer { opacity: .72; }

/* Der Knopf sitzt unten auf, egal wie lang die Beschreibung darueber ist -
   sonst tanzen die Kacheln auf verschiedenen Hoehen. */
.paket .btn {
  margin-top: auto; width: 100%;
  padding: 0 10px; font-size: 13.5px;
  white-space: nowrap;
}
.paket-marken {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  margin: 4px 0 8px;
}
.paket-fehlt {
  margin: 0 0 6px; font-size: 11.5px; font-weight: 700; color: var(--lose);
}

/* Titelbild eines Pakets - HOCHKANT (2:3).
 *
 * Ich hatte zuerst 3:2 quer vorgesehen, wie bei den Kartenbildern. Das war
 * falsch: Ein Paket sieht aus wie ein Paket, und die Vorlagen bringen ihr
 * Motiv senkrecht mit. Quer beschnitten faellt oben und unten das Beste weg.
 */
.paket-bild {
  width: 100%; height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 11px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
}
/* Ein Paket ohne Titelbild belegt dieselbe Flaeche wie eines mit - sonst
   klafft in der Reihe eine Luecke, sobald das erste Cover da ist. Der
   Kartenstapel steht darin mittig. */
.paket-platzhalter {
  width: 100%; aspect-ratio: 2 / 3;
  display: grid; place-items: center;
  margin-bottom: 10px;
  border-radius: 11px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.015);
}
.paket-platzhalter .pack-visual { margin: 0; }

.paket-gruppe, .paket-chance {
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.paket-gruppe { background: rgba(255,255,255,.07); color: var(--muted); }
.paket-chance {
  color: var(--farbe);
  background: color-mix(in srgb, var(--farbe) 14%, transparent);
}

.pack-visual {
  position: relative;
  height: 124px; width: 110px;
  margin: 2px auto 12px;
}
/* Der Stapel im Laden zeigt die echte Kartenrueckseite. Nur die Groesse wird
   hier fest gesetzt, statt sie wie im Match aus der Vorderseite abzuleiten. */
.pack-card {
  position: absolute; inset: 0;
  width: auto; height: auto; padding-bottom: 0;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(0,0,0,.5);
}
/* Die verdeckten Karten treten zurueck, damit der Blick oben landet. */
.pack-card.c2 { filter: brightness(.8); }
.pack-card.c3 { filter: brightness(.62); }
.pack-card.c1 { transform: rotate(-3deg); }
.pack-card.c2 { transform: rotate(6deg) translate(7px, -5px); }
.pack-card.c3 { transform: rotate(14deg) translate(14px, -9px); }

.earn { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 7px; }
.earn li { font-size: 13.5px; color: var(--muted); padding-left: 16px; position: relative; }
.earn li::before { content: "·"; position: absolute; left: 4px; color: var(--accent); font-weight: 800; }
.earn b { color: var(--accent-2); }

/* ---- Paketoeffnung ---- */

/* Zwei Klassen, damit die Angabe die spaeter stehende Grundregel
   .result-card { max-width: 380px } schlaegt. */
.result-card.pack-result { max-width: 620px; }
.pack-cards {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin: 16px 0 6px;
}
/* Die Karte liegt verdeckt und schlaegt um. Deckel und Karte blenden ihre
   Rueckseite aus - dadurch ist beim Drehen immer genau eine Seite sichtbar,
   ohne dass etwas gespiegelt erscheint. */
.pack-slot {
  position: relative;
  width: 130px;
  perspective: 900px;
}
.pack-karte {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .52s cubic-bezier(.3,.8,.35,1.05);
}
.pack-slot.auf .pack-karte { transform: rotateY(180deg); }
.pack-slot.sofort .pack-karte { transition: none; }

.pack-deckel {
  position: absolute; inset: 0;
  border-radius: 11px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid #2b3450;
  box-shadow: 0 5px 15px rgba(0,0,0,.5);
  background:
    radial-gradient(120% 90% at 50% 45%, #1d2540 0%, #10131f 62%, #0b0e16 100%),
    repeating-linear-gradient(45deg,  rgba(255,255,255,.028) 0 7px, transparent 7px 14px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.028) 0 7px, transparent 7px 14px);
}
.pack-inhalt {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
}

/* Ringwelle in der Farbe der Seltenheit, wenn die Karte landet. */
.pack-welle {
  position: absolute; top: 50%; left: 50%;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid var(--farbe);
  opacity: 0;
  pointer-events: none;
}
.pack-slot.gelandet .pack-welle { animation: welle .75s ease-out; }
@keyframes welle {
  from { opacity: .85; transform: scale(.3); }
  to   { opacity: 0;   transform: scale(4.6); }
}

.pack-stufe {
  display: block; margin-top: 6px; text-align: center;
  font-size: 10px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--farbe);
  opacity: 0; transition: opacity .3s .25s;
}
.pack-slot.auf .pack-stufe { opacity: .9; }

/* Wertvolle Karten heben sich kurz heraus, legendaere bekommen den Kranz. */
.pack-slot.gelandet { animation: stossen .5s ease-out; }
@keyframes stossen {
  0%   { transform: none; }
  35%  { transform: translateY(-9px) scale(1.06); }
  100% { transform: none; }
}
.pack-slot.wertvoll .pack-inhalt {
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--farbe) 65%, transparent));
}
.pack-slot.legendaer::before {
  content: "";
  position: absolute; inset: -34%;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(240,180,41,.2) 0deg 3deg, transparent 3deg 11deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 12%, transparent 66%);
          mask-image: radial-gradient(circle at 50% 50%, #000 12%, transparent 66%);
  opacity: 0; pointer-events: none;
}
.pack-slot.legendaer.gelandet::before { animation: kranz 1.5s ease-out; }
@keyframes kranz {
  0%   { opacity: 0; transform: rotate(0deg) scale(.7); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(38deg) scale(1.25); }
}

/* Ein kurzer Lichtschein ueber dem ganzen Bild - nur fuer Legendaeres. */
.blitz {
  position: absolute; inset: 0;
  pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(240,180,41,.4), transparent 62%);
}
.blitz.an { animation: aufblitzen .7s ease-out; }
@keyframes aufblitzen {
  0%  { opacity: 0; }
  14% { opacity: 1; }
  100%{ opacity: 0; }
}

.fanfare {
  margin: 12px 0 2px;
  font-size: 16px; font-weight: 800; letter-spacing: .02em;
  animation: fanfare .5s cubic-bezier(.2,.9,.3,1.3);
}
.fanfare.episch    { color: #a865e0; }
.fanfare.legendaer { color: var(--accent); text-shadow: 0 0 18px rgba(240,180,41,.5); }
@keyframes fanfare {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pack-karte, .pack-slot.gelandet, .pack-slot.legendaer.gelandet::before,
  .blitz.an, .fanfare, .pack-welle { animation: none !important; transition: none !important; }
}

/* ---- Karten-Einzelsicht ---- */

.result-card.card-detail { max-width: 300px; }
.detail-slot { display: flex; justify-content: center; margin-bottom: 14px; }
.detail-slot .card { width: 210px; }

/* In der Bilanzzeile steht der Muenzgewinn neben der Wertung, nicht darunter. */
.coin-gain {
  margin: 0; font-size: 14px; font-weight: 800; color: var(--accent-2);
  padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg-soft);
}

/* ------------------------------- Overlays ------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  overflow-y: auto;                 /* lange Inhalte muessen erreichbar bleiben */
  padding: 20px;
  background: rgba(8,10,16,.82);
  backdrop-filter: blur(6px);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.result-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
.result-card h2 { font-size: 24px; margin-bottom: 6px; }
.loot { margin-top: 18px; }
.loot .loot-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.loot .card { max-width: 190px; margin: 0 auto; animation: dealt .4s ease-out .15s backwards; }
.loot.gain .loot-label { color: var(--win); }
.loot.loss .loot-label { color: var(--lose); }

.toast {
  position: fixed; z-index: 60;
  left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 11px 18px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: pop .2s ease-out;
}
.toast.bad { border-color: var(--lose); color: var(--lose); }

/* ------------------------------ Ab Tablet ------------------------------- */

@media (min-width: 720px) {
  .halle-raster { grid-template-columns: 1fr 1fr; }

  .stat-spalten { grid-template-columns: 1fr 1fr; }
  .panel.shop { max-width: 720px; }
  .pack-regal { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  /* Ab hier steht der Inhalt neben dem Code statt darunter. */
  .code-zeile.gutschein { grid-template-columns: 9em 1fr auto auto; }
  .gutschein-inhalt { grid-column: 2; }

  /* Ab hier passt die Liste dauerhaft neben das Blatt. */
  .editor { grid-template-columns: 268px 1fr; grid-template-rows: 1fr; }
  .editor-liste { border-bottom: 0; border-right: 1px solid var(--line); }
  .karten-liste { max-height: none; flex: 1; }
  .editor-blatt { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 22px; }
  .schau-karte { margin: 0; }

  .halle-knoepfe .btn { flex: 0 0 auto; }

  /* Drei Spalten statt zwei: Das VS bekommt eine eigene Mitte, statt absolut
     ueber allem zu schweben. Dadurch steht es von selbst auf halber Hoehe der
     Karten und ruecht mit, wenn sie ihre Groesse aendern. */
  .arena {
    grid-template-rows: auto auto;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px 18px;
    align-content: center;
    padding: 18px;
  }
  .lane-opp { grid-column: 1; grid-row: 1; }
  .lane-you { grid-column: 3; grid-row: 1; }
  .verdict,
  .zugzeiger { grid-column: 1 / -1; grid-row: 2; }

  .vs {
    display: block;
    grid-column: 2; grid-row: 1;
    align-self: center;
    font-size: clamp(46px, 7vw, 104px);
    font-weight: 900;
    font-style: italic;
    letter-spacing: -.05em;
    line-height: 1;
    user-select: none;
    /* Hohl statt gefuellt: Gefuellt zoege es den Blick von den Karten weg,
       und um die geht es. */
    color: transparent;
    -webkit-text-stroke: 2px rgba(232,236,245,.22);
    text-shadow: 0 0 30px rgba(240,180,41,.09);
    transition: -webkit-text-stroke-color .35s, transform .35s, text-shadow .35s;
  }

  /* Im Moment des Aufdeckens tritt es kurz hervor. */
  .arena.aufgedeckt .vs {
    -webkit-text-stroke-color: rgba(240,180,41,.42);
    text-shadow: 0 0 40px rgba(240,180,41,.28);
    animation: vsSchlag .55s cubic-bezier(.2,.9,.3,1.4);
  }
  @keyframes vsSchlag {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.16); }
    100% { transform: scale(1); }
  }
  .lane { max-width: 300px; }
  .view-match .lane { max-width: 300px; }
  /* Groessere Zellen heissen hoeheres Werteraster - die Rueckseite muss
     mitwachsen, sonst steht sie neben der Vorderseite zu kurz. */
  .card-back { --werte-hoehe: 130px; }
  .wert { padding: 6px 10px 7px; }
  .wert .k { font-size: 10px; }
  .wert .v { font-size: 14px; }
  button.wert { min-height: 44px; }
  .pname { max-width: 16ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
