/* Trichter - Spielkarten, Design G (Owner 2026-11-19, Vorlage: docs/karten-varianten.html Runde 3).
   Wird NACH style.css geladen. Jeder Selektor beginnt mit body:not(#_), damit die Karte in allen Themen gleich aussieht (schlägt die alten .tcard-Regeln in style.css und theme-*.css).
   Aufbau: Bild randlos oben, darauf Kategorie-Etikett (Neon-Schild) und Seltenheit (Perle, Diamant, Krone).
   Darunter Name (bis 2 Zeilen, oben bündig), Regel (bis 3 Zeilen), unten die Wann-Wen-Leiste.
   Rahmen, Schein und Farbverlauf ins Bild wachsen mit der Seltenheit.
   Größe: alles in em aus font-size = --w / 10. HTML: public/js/cardview.js.
   Neon-Farben: Kopie aus dem Neon-Thema in style.css. */

body:not(#_) .tcard {
  /* --w (Kartenbreite) kommt aus dem Umfeld: style.css setzt den Standard, Reihen und Hand ihre eigene Breite */
  --rc: #c9b8ff; --lc: #ff3d9a; --bw: 0.07em; --glow: 0.25em; --glow-a: 30%; --fade-a: 30%; --fade-h: 40%;
  position: relative; display: block; box-sizing: border-box; width: var(--w); margin: 0; padding: 0;
  font: 400 calc(var(--w) / 10)/1.2 var(--display, var(--body)); color: #fff; text-align: left; text-decoration: none;
  border: 0; border-radius: 0; background: none; box-shadow: none;
  filter: drop-shadow(0 0 var(--glow) color-mix(in srgb, var(--rc) var(--glow-a), transparent));
  -webkit-tap-highlight-color: transparent;
}
/* Seltenheit: Farbe, Rahmenstärke, Schein */
body:not(#_) .tcard.rn1 { --rc: #c9b8ff; --bw: 0.07em; --glow: 0.15em; --glow-a: 25%; --fade-a: 22%; --fade-h: 35%; }
body:not(#_) .tcard.rn2 { --rc: #2ef2ff; --bw: 0.14em; --glow: 0.5em; --glow-a: 60%; --fade-a: 50%; --fade-h: 45%; }
body:not(#_) .tcard.rn3 { --rc: #f5e04a; --bw: 0.24em; --glow: 0.9em; --glow-a: 90%; --fade-a: 70%; --fade-h: 58%; }
/* Kategorie-Farbe des Etiketts */
body:not(#_) .tcard.t-angriff { --lc: #ff3d9a; } body:not(#_) .tcard.t-abwehr { --lc: #64aaff; } body:not(#_) .tcard.t-ereignis { --lc: #f5e04a; }
body:not(#_) .tcard.t-zustand { --lc: #5fd6a2; } body:not(#_) .tcard.t-joker { --lc: #c9b8ff; } body:not(#_) .tcard.t-boost { --lc: #ff9c4a; }

body:not(#_) .tcard .tc-in {
  position: relative; display: flex; flex-direction: column; box-sizing: border-box; height: 100%; min-height: 15em; overflow: hidden;
  border: var(--bw) solid var(--rc); border-radius: 0; background: #0d0722;
  clip-path: polygon(0.54em 0, 100% 0, 100% calc(100% - 0.54em), calc(100% - 0.54em) 100%, 0 100%, 0 0.54em);
  box-shadow: inset 0 0 calc(var(--glow) * 1.2) color-mix(in srgb, var(--rc) calc(var(--glow-a) * 0.6), transparent);
}
body:not(#_) .tcard .tc-in::before, body:not(#_) .tcard .tc-in::after { content: none; }

/* Bild randlos, Seltenheitsfarbe zieht von unten ins Bild */
body:not(#_) .tcard .tc-art {
  position: relative; display: block; flex: 0 0 auto; margin: 0; padding: 0; aspect-ratio: 3 / 2; overflow: hidden;
  border-radius: 0; background: #14213d; box-shadow: none;
}
body:not(#_) .tcard .tc-art svg { display: block; width: 100%; height: 100%; filter: none; }
body:not(#_) .tcard .tc-art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, color-mix(in srgb, var(--rc) var(--fade-a), transparent), transparent var(--fade-h));
}
body:not(#_) .tcard .tc-art::after {
  content: ""; position: absolute; inset: auto 0 0; height: 18%; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, #0d0722); box-shadow: none; border-radius: 0;
}

/* Kategorie-Etikett: Neon-Schild mit Zeichen, oben links auf dem Bild */
body:not(#_) .tcard .tc-tag {
  position: absolute; z-index: 2; left: 0.36em; top: 0.36em; display: flex; align-items: center; gap: 0.22em;
  padding: 0.18em 0.45em 0.18em 0.27em; color: var(--lc); background: rgba(5, 2, 15, 0.82); border: 0.07em solid var(--lc);
  clip-path: polygon(0.27em 0, 100% 0, 100% calc(100% - 0.27em), calc(100% - 0.27em) 100%, 0 100%, 0 0.27em);
  box-shadow: inset 0 0 0.45em color-mix(in srgb, var(--lc) 35%, transparent); text-shadow: 0 0 0.27em var(--lc);
}
body:not(#_) .tcard .tc-tag svg { width: 0.63em; height: 0.63em; flex: none; filter: drop-shadow(0 0 0.13em var(--lc)); }
body:not(#_) .tcard .tc-tag b { font: 700 0.49em/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }

/* Seltenheit oben rechts, alle gleich groß */
body:not(#_) .tcard .tc-rb {
  position: absolute; z-index: 2; right: 0.36em; top: 0.27em; display: grid; place-items: center; width: 1.52em; height: 1.52em;
  color: var(--rc); background: #05020f; border: 0.07em solid var(--rc); border-radius: 50%;
  box-shadow: 0 0 0.45em color-mix(in srgb, var(--rc) 60%, transparent);
}
body:not(#_) .tcard .tc-rb svg { width: 0.98em; height: 0.98em; filter: drop-shadow(0 0 0.13em var(--rc)); }
body:not(#_) .tcard.rn3 .tc-rb { animation: tc-rb 1.8s ease-in-out infinite; }
@keyframes tc-rb { 50% { box-shadow: 0 0 1em var(--rc); transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { body:not(#_) .tcard.rn3 .tc-rb { animation: none; } }

/* Name: oben bündig, höchstens 2 Zeilen */
body:not(#_) .tcard .tc-name {
  display: block; margin: 0; padding: 0.15em 0.45em 0; min-height: 0; background: none; box-shadow: none; clip-path: none;
  font: 700 0.8em/1.1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: #fff; text-shadow: none; text-align: left;
}
body:not(#_) .tcard .tc-name > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; hyphens: auto; }

/* Regel: kleiner, höchstens 3 Zeilen */
body:not(#_) .tcard .tc-text {
  display: block; margin: 0.2em 0 0; padding: 0 0.45em; background: none; box-shadow: none; border-radius: 0; color: #fff;
  font: 600 0.6em/1.3 var(--display); text-align: left;
}
body:not(#_) .tcard .tc-text > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; hyphens: auto; }

/* Wann-Wen-Leiste: nur Text, Wann in Cyan, Wen in Magenta */
body:not(#_) .tcard .tc-split { display: grid; grid-template-columns: 1fr 1fr; margin-top: auto; border-top: 0.045em solid rgba(201, 184, 255, 0.25); }
body:not(#_) .tcard .tc-half { display: grid; justify-items: center; gap: 0.1em; padding: 0.3em 0.18em 0.36em; text-align: center; }
body:not(#_) .tcard .tc-half + .tc-half { border-left: 0.045em solid rgba(201, 184, 255, 0.25); }
body:not(#_) .tcard .tc-half small { font: 700 0.45em/1 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
body:not(#_) .tcard .tc-half b { font: 700 0.67em/1.15 var(--display); }
body:not(#_) .tcard .wann b { color: #2ef2ff; } body:not(#_) .tcard .wer b { color: #ff3d9a; }

/* alte Teile (falls irgendwo noch erzeugt) ausblenden */
body:not(#_) .tcard .tc-seal, body:not(#_) .tcard .tc-rar, body:not(#_) .tcard .tc-line, body:not(#_) .tcard .tc-when, body:not(#_) .tcard .tc-rname { display: none !important; }

/* Klein (Auswahl, Mini): Bild, Etikett-Zeichen, Seltenheit, Name */
body:not(#_) .tcard.mini .tc-in { min-height: 0; }
body:not(#_) .tcard.mini .tc-text, body:not(#_) .tcard.mini .tc-split { display: none; }
body:not(#_) .tcard.mini .tc-name { padding: 0.3em 0.45em 0.45em; font-size: max(10px, 0.95em); }
body:not(#_) .tcard.mini .tc-tag b { display: none; }
body:not(#_) .tcard.mini .tc-tag { padding: 0.25em; }
body:not(#_) .tcard.mini .tc-tag svg { width: 1em; height: 1em; }
body:not(#_) .tcard.mini .tc-rb { width: 1.9em; height: 1.9em; }
body:not(#_) .tcard.mini .tc-rb svg { width: 1.25em; height: 1.25em; }

/* Hand */
body:not(#_) .hand .tcard .tc-in { min-height: 0; }
body:not(#_) .hand .tcard .tc-split { display: none; }
body:not(#_) .hand .tcard .tc-name { min-height: 0; padding: 0.3em 0.45em 0.2em; }
body:not(#_) .hand .tcard .tc-text { font-size: max(10px, 0.6em); padding: 0 0.45em 0.5em; }

body:not(#_) .tcard.big { --w: min(250px, 66vw); margin: 0 auto; }
body:not(#_) .tcard.big .tc-in, body:not(#_) .tcard.show .tc-in { min-height: 15em; }

body:not(#_) button.tcard { cursor: pointer; touch-action: manipulation; }
body:not(#_) button.tcard:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
body:not(#_) .pick-row button.tcard { transition: transform 200ms var(--spring); }
body:not(#_) .pick-row button.tcard[aria-pressed="true"] { transform: translateY(-8px); outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Größen (Owner 2026-11-20: überall lesbar, echtes Design) ----------
   Regeltext = 0.6em = 6 % der Kartenbreite: ab 215 px Breite sind das 13 px. Reihen mit vollen Karten
   (Auswahl, Startkarten) nutzen deshalb mindestens diese Breite und lassen sich seitlich wischen, wenn es eng wird. */
body:not(#_) .card-row { display: flex; justify-content: safe center; align-items: flex-start; gap: 14px; padding: 16px 12px 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; perspective: 900px; }
body:not(#_) .card-row .card-it { display: grid; justify-items: center; gap: 8px; flex: none; scroll-snap-align: center; }
body:not(#_) .card-row .tcard { --w: clamp(215px, 17vw, 250px); }
@media (max-width: 520px) { body:not(#_) .card-row .tcard { --w: min(68vw, 240px); } body:not(#_) .card-row { justify-content: flex-start; } }
@media (orientation: landscape) and (max-height: 520px) { body:not(#_) .card-row .tcard { --w: clamp(150px, 38vh, 215px); } body:not(#_) .card-row { padding-top: 8px; } }
.zoom-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid rgba(201, 184, 255, 0.5); background: rgba(10, 6, 24, 0.8); color: var(--text, #fff); font: 600 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.zoom-btn:hover, .zoom-btn:focus-visible { border-color: #2ef2ff; color: #2ef2ff; }
.zoom-dialog { width: auto; max-width: 96vw; padding: 56px 18px 18px; }
body:not(#_) .zoom-dialog .tcard.big { --w: min(340px, 84vw, 52vh); }
body:not(#_) .tcard.big { --w: min(300px, 78vw); }
/* Hand: kompakte Karte (Bild, Zeichen, Seltenheit, Name). Der volle Text steht in der Großansicht beim Antippen. */
body:not(#_) .hand .tcard .tc-text { display: none; }
body:not(#_) .hand .tcard .tc-tag b { display: none; }
body:not(#_) .hand .tcard .tc-tag { padding: 0.25em; }
body:not(#_) .hand .tcard .tc-tag svg { width: 1em; height: 1em; }
body:not(#_) .hand .tcard .tc-rb { width: 1.9em; height: 1.9em; }
body:not(#_) .hand .tcard .tc-rb svg { width: 1.25em; height: 1.25em; }
body:not(#_) .hand .tcard .tc-name { font-size: max(11px, 0.95em); padding-bottom: 0.45em; }
/* fliegende Karte: Breite kommt vom Flug (--w am Träger), Schatten statt abgeschnittenem Kasten */
body:not(#_) .flycard .tcard { width: var(--w); }
/* Großansicht ohne Fenster: nur die Karte auf abgedunkeltem Grund (Owner 2026-11-20) */
.zoom-dialog, .zoom-dialog[open] { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden; place-items: center; cursor: zoom-out; animation: none; }
.zoom-dialog::backdrop { background: rgba(3, 2, 10, 0.86); }
.zoom-dialog #zoomClose { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
body:not(#_) .zoom-dialog .tcard.big { --w: min(380px, 86vw, 56vh); margin: 0; animation: zoomIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.86); } }
@media (prefers-reduced-motion: reduce) { body:not(#_) .zoom-dialog .tcard.big { animation: none; } }

/* Karten-Blatt (Antippen in der Hand): die große Karte passt IMMER ohne Scrollen (Owner 2026-11-20).
   Kartenhöhe = 1,5 x Breite, also richtet sich die Breite auch nach der freien Höhe. */
body:not(#_) #sheet .tcard.big { --w: min(300px, 78vw, calc((100dvh - 190px) / 1.5)); }
@media (orientation: landscape) and (max-height: 520px) {
  /* Querformat am Handy: Karte links, Hinweis und Knöpfe rechts daneben */
  #sheet:has(> .tcard.big) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-content: center; align-items: center; max-height: 100dvh; overflow: hidden; padding-top: 10px; padding-bottom: calc(10px + var(--safe-b, 0px)); }
  #sheet:has(> .tcard.big) > .tcard.big { grid-column: 1; grid-row: 1 / span 8; margin: 0; --w: calc((100dvh - 44px) / 1.5); }
  #sheet:has(> .tcard.big) > :not(.tcard) { grid-column: 2; }
}
/* Hand: Karten sind immer ganz zu sehen, nichts ragt unten aus dem Bild */
body:not(#_) .handzone { height: auto; min-height: 0; padding-bottom: calc(8px + var(--safe-b, 0px)); overflow: visible; }
body:not(#_) .hand { align-items: flex-end; padding-top: 26px; }
body:not(#_) .hand li { --drop: 0px; }
@media (orientation: landscape) and (max-height: 520px) { body:not(#_) .hand li { transform: none; margin-left: -30px; } body:not(#_) .hand li:hover, body:not(#_) .hand li:has(:focus-visible) { transform: translateY(-8px); } body:not(#_) .hand .tcard { --w: 96px; } }

/* ---------- Nachbesserung 2026-11-20 ---------- */
/* Großansicht passt immer in die Höhe (auch Handy quer) */
body:not(#_) .zoom-dialog .tcard.big { --w: min(380px, 86vw, calc((100dvh - 24px) / 1.5)); }
/* Karten sind selbst antippbar: Startkarte = groß ansehen, gewählte Karte in der Auswahl nochmal = groß */
body:not(#_) .deal-mine button.tcard { cursor: zoom-in; }
body:not(#_) .card-row button.tcard { transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 200ms; }
body:not(#_) .card-row button.tcard:hover { transform: translateY(-6px); }
body:not(#_) .pick-row button.tcard[aria-pressed="true"] { transform: translateY(-8px) scale(1.06); outline: 3px solid #fff; outline-offset: 3px; cursor: zoom-in; z-index: 2; }
body:not(#_) .pick-row:has([aria-pressed="true"]) button.tcard:not([aria-pressed="true"]) { filter: brightness(0.6) saturate(0.7); }
/* Handy quer: volle Karten so groß, wie die Höhe erlaubt; Antippen zeigt sie groß */
@media (orientation: landscape) and (max-height: 520px) {
  body:not(#_) .card-row .tcard { --w: min(215px, calc((100dvh - 150px) / 1.5)); }
  body:not(#_) .card-row { padding: 6px 8px 4px; gap: 10px; }
  body:not(#_) #sheet:has(> .tcard.big) > .tcard.big { --w: calc((100dvh - 44px) / 1.5); }
}
/* Hand: unten genug Luft (gedrehte Karten ragten 1 px aus dem Bild), Anheben beim Zeigen und per Tastatur */
body:not(#_) .handzone { padding-bottom: calc(16px + var(--safe-b, 0px)); }
@media (hover: hover) {
  body:not(#_) .hand li:hover, body:not(#_) .hand li:has(:focus-visible) { transform: translateY(-26px) scale(1.14) rotate(0deg); z-index: 5; }
  body:not(#_) .hand li:hover .tcard, body:not(#_) .hand li:has(:focus-visible) .tcard { filter: drop-shadow(0 0 0.9em color-mix(in srgb, var(--rc) 90%, transparent)) brightness(1.12); }
}
@media (orientation: landscape) and (max-height: 520px) { body:not(#_) .intro.deal .card-row .tcard { --w: calc((100dvh - 172px) / 1.5); } /* 2026-11-26: Platz für Abstände zu Titel und Knopf */ body:not(#_) .action .card-row .tcard { --w: calc((100dvh - 190px) / 1.5); } }
@media (orientation: landscape) and (max-height: 520px) { #sheet:has(> .tcard.big) { padding-right: 68px; } }
/* Handy quer: das Blatt ist ein ganzes Fenster in der Bildmitte, mit Rand rundum, nichts ragt unten heraus (Owner 2026-11-20) */
@media (orientation: landscape) and (max-height: 520px) {
  body:not(#_) .sheet-wrap { align-items: center; padding: 8px; box-sizing: border-box; }
  body:not(#_) #sheet { box-sizing: border-box; max-height: calc(100dvh - 16px); border-bottom-width: 3px; border-bottom-style: solid; }
  body:not(#_) #sheet:has(> .tcard.big) { max-height: calc(100dvh - 16px); padding-top: 10px; padding-bottom: 10px; }
  body:not(#_) #sheet:has(> .tcard.big) > .tcard.big { --w: calc((100dvh - 64px) / 1.5); }
}
@media (orientation: landscape) and (max-height: 520px) { body:not(#_) #sheet:has(> .tcard.big) { padding-right: 72px; } body:not(#_) #sheet:has(> .tcard.big) > :not(.tcard) { text-align: left; } }
/* Hochformat: das Schließen-Kreuz steht in einer eigenen Zeile über der Karte und verdeckt deren Ecke nicht */
@media not ((orientation: landscape) and (max-height: 520px)) {
  body:not(#_) #sheet:has(> .tcard.big) { position: relative; padding-top: 60px; }
  body:not(#_) #sheet:has(> .tcard.big) > .sheet-x { position: absolute; top: 8px; right: 8px; margin: 0; }
  body:not(#_) #sheet .tcard.big { --w: min(300px, 78vw, calc((100dvh - 250px) / 1.5)); }
}

/* ---------- 2026-11-21 (Owner): Kartenname bricht nur zwischen Wörtern und wird nie abgeschnitten ---------- */
body:not(#_) .tcard .tc-name > span { display: block; -webkit-line-clamp: none; overflow: visible; overflow-wrap: normal; word-break: normal; hyphens: manual; text-wrap: balance; }
body:not(#_) .tcard .tc-name.nm-1 { font-size: 0.7em; letter-spacing: 0.01em; }
body:not(#_) .tcard .tc-name.nm-2 { font-size: 0.6em; letter-spacing: 0; }
body:not(#_) .tcard .tc-name.nm-3 { font-size: 0.52em; letter-spacing: 0; }
body:not(#_) .tcard.mini .tc-name.nm-1, body:not(#_) .hand .tcard .tc-name.nm-1 { font-size: max(9.5px, 0.82em); letter-spacing: 0.01em; }
body:not(#_) .tcard.mini .tc-name.nm-2, body:not(#_) .hand .tcard .tc-name.nm-2 { font-size: max(9px, 0.72em); letter-spacing: 0; }
body:not(#_) .tcard.mini .tc-name.nm-3, body:not(#_) .hand .tcard .tc-name.nm-3 { font-size: max(8px, 0.62em); letter-spacing: 0; }

/* ---------- 2026-11-21 (Owner): Hochformat - Fenster mit großen Karten füllen nicht mehr den ganzen Bildschirm ---------- */
/* große Einzelkarte (Startkarten, Kartenansicht): Breite richtet sich auch nach der Bildschirmhöhe */
body:not(#_) .tcard.big { --w: min(250px, 66vw, 30dvh); }
@media (max-width: 720px) and (orientation: portrait) {
  /* Kartenwahl: Karte kleiner, die Nachbarn schauen links und rechts hervor */
  body:not(#_) .pick-row { padding-inline: calc(50% - min(23vw, 12dvh)); gap: 10px; }
  body:not(#_) .pick-row .tcard { --w: min(46vw, 24dvh); }
}
@media (max-width: 520px) and (orientation: portrait) {
  /* Kartenreihen (Startkarten, Kartenfeld): Karte richtet sich nach Breite UND Höhe, die Nachbarn schauen hervor */
  body:not(#_) .card-row .tcard { --w: min(52vw, 26dvh, 240px); }
  body:not(#_) .card-row { padding-inline: calc(50% - min(26vw, 13dvh, 120px)); gap: 10px; }
}
