/* tisch.css · autisten.at, „Tisch zum Zuordnen“ (de/tisch/…, en/sorting-table/…). Agent für Falzbein, 04.12.2026 abends.
   Die Spielfläche für tisch.js; alles unter .ti gefasst. Farben aus den Tokens der Hülle (Tag, Nacht, Leise). Die Karten
   bleiben weiß wie laminierte Karten auf dem Tisch, bei Nacht etwas gedämpft. Kein Rot: ein falscher Platz zeigt nichts an,
   die Karte gleitet nur zurück. Ziele mindestens 44 px. Kein url(), kein @import, keine Adressen. Bewegung nur weich und
   kurz, im Leise-Modus und bei reduzierter Bewegung keine. */

.ti { max-width: 64rem; }
.ti [hidden] { display: none !important; }
.ti h1 { margin-block-end: .2em; }
.ti-aufgabe { font-size: 1.12rem; max-width: 30em; margin: 0 0 18px; }
.ti-spiel { margin: 0; }

/* Tafel oder Geschichte wählen */
.ti-wahl { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.ti-wahl-knopf {
  min-height: 48px; padding: 8px 18px; font: inherit; font-weight: 700; cursor: pointer;
  color: var(--tinte); background: var(--papier-hell); border: 2px solid var(--linie); border-radius: 12px;
}
.ti-wahl-knopf[aria-pressed="true"] { background: var(--mo-blau); color: var(--akzent-text); border-color: var(--mo-blau); }
.ti-wahl-knopf:hover { border-color: var(--mo-blau); }

/* der Tisch */
.ti-tisch {
  display: grid; gap: 22px; align-items: start;
  padding: 16px; border: 2px solid var(--linie); border-radius: 18px; background: var(--tisch);
}
.ti-ziele, .ti-ablage { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ti-ablage:empty { display: none; }

/* eine Karte wie im Druck: Streifen (Wortart), Bild, Wort */
.ti-karte, .ti-vorlage {
  display: grid; grid-template-rows: 9px minmax(0, 1fr) auto auto; justify-items: center;
  width: 100%; aspect-ratio: 5 / 6; padding: 0 0 6px; overflow: hidden;
  background: #FFFFFF; color: #26303B; border: 2px solid #C9D1DA; border-radius: 12px;
}
.ti-karte {
  font: inherit; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 6px 10px -6px var(--schatten); min-height: 44px;
}
.ti-streifen { justify-self: stretch; height: 9px; }
.ti-bild { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; padding: 6px 8px 2px; box-sizing: border-box; pointer-events: none; }
.ti-wort {
  max-width: 100%; padding: 0 5px; box-sizing: border-box; font-weight: 700; font-size: max(16px, .85rem); line-height: 1.15;
  text-align: center; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; transform-origin: 50% 50%;
}
.ti-wort.ti-bricht, .ti-unter.ti-bricht { overflow-wrap: anywhere; }
.ti-unter { max-width: 100%; font-size: 16px; line-height: 1.1; color: #4E5A67; transform-origin: 50% 50%; }
.ti-karte[aria-pressed="true"] {
  outline: 4px solid var(--mo-blau); outline-offset: 3px; transform: translateY(-4px);
  box-shadow: 0 14px 18px -10px var(--schatten);
}
.ti-karte:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }
.ti-karte[aria-pressed="true"]:focus-visible { outline-width: 4px; }
.ti-zieht { position: relative; z-index: 50; pointer-events: none; cursor: grabbing; box-shadow: 0 18px 26px -10px var(--schatten); transition: none !important; }
.ti-fliegt { position: relative; z-index: 40; }
.ti-am-ziehen, .ti-am-ziehen * { cursor: grabbing; }
@media (prefers-reduced-motion: no-preference) {
  html:not([data-leise="an"]) .ti-karte { transition: transform .15s ease, box-shadow .15s ease; }
  html:not([data-leise="an"]) .ti-neu { animation: ti-auf .26s ease-out; }
}
@keyframes ti-auf { from { opacity: .3; transform: translateY(-10px) scale(.96); } }

/* Plätze: ein Knopf (Tippen, Tastatur), darüber die Lage, in der die Karte einrastet */
.ti-feld { position: relative; min-width: 0; }
.ti-feld-knopf {
  display: block; width: 100%; min-height: 44px; padding: 6px; font: inherit; color: var(--tinte); cursor: pointer;
  background: var(--papier-hell); border: 3px dashed var(--rand); border-radius: 14px;
}
.ti-feld-knopf .ti-vorlage { border-color: transparent; box-shadow: none; }
.ti-feld-knopf:disabled { cursor: default; }
.ti-ueber .ti-feld-knopf, .ti-wahl-an .ti-feld:not(.ti-voll) .ti-feld-knopf:hover {
  border-style: solid; border-color: var(--mo-blau); background: var(--papier);
}
.ti-belegt .ti-feld-knopf { border-style: solid; border-color: var(--linie); }
.ti-lage { position: absolute; inset: 6px; pointer-events: none; }
.ti-lage > .ti-karte { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; cursor: default; }
.ti-karte.ti-liegt { box-shadow: 0 2px 4px -2px var(--schatten); }

/* nur das Wort (Gleich zu gleich, Tafel 2) */
.ti-feld-wort .ti-vorlage { grid-template-rows: 9px minmax(0, 1fr); align-items: center; }
.ti-nur-wort { font-size: max(18px, 1.05rem); }

/* Was kommt zuerst? Nummern, Pfeile, Bilder */
.ti-zuerst .ti-ziele, .ti-zuerst .ti-ablage { gap: 26px; }
.ti-feld-nr .ti-vorlage { grid-template-rows: 1fr; aspect-ratio: 1; align-items: center; background: transparent; }
.ti-nummer { font-size: 2.4rem; font-weight: 700; color: var(--tinte-leise); }
.ti-feld-nr::before {
  content: attr(data-nr); position: absolute; z-index: 2; inset-block-start: -12px; inset-inline-start: -10px;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--mo-blau); color: var(--akzent-text); font-weight: 700; font-size: 1rem;
}
.ti-feld-nr + .ti-feld-nr::after {
  content: "→"; position: absolute; inset-block-start: 50%; inset-inline-start: -21px; transform: translateY(-50%);
  font-size: 1.1rem; font-weight: 700; color: var(--tinte-leise);
}
.ti-karte-bild { grid-template-rows: minmax(0, 1fr); aspect-ratio: 1; padding: 0; border-radius: 12px; }
.ti-karte-bild .ti-bild { object-fit: cover; padding: 0; }

/* Sortieren: Körbe mit Kopfkarte und vier Fächern */
.ti-feld-korb {
  display: flex; flex-direction: column; gap: 8px; padding: 6px;
  background: var(--papier-hell); border: 3px dashed var(--rand); border-radius: 16px;
}
.ti-feld-korb .ti-feld-knopf { border: 0; padding: 0; background: transparent; }
.ti-feld-korb .ti-feld-knopf .ti-vorlage { border: 2px solid #C9D1DA; }
.ti-feld-korb.ti-ueber, .ti-wahl-an .ti-feld-korb:not(.ti-voll):hover { border-style: solid; border-color: var(--mo-blau); background: var(--papier); }
.ti-feld-korb .ti-lage { position: static; inset: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ti-fach { position: relative; aspect-ratio: 1; border: 2px dashed var(--linie); border-radius: 9px; }
.ti-fach > .ti-karte { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; grid-template-rows: 5px minmax(0, 1fr); padding: 0; border-width: 1px; border-radius: 8px; }
.ti-klein .ti-streifen { height: 5px; }
.ti-klein .ti-bild { padding: 3px; }
.ti-klein .ti-wort, .ti-klein .ti-unter { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* der Stapel (Sortieren, Lotto): oben liegt eine Karte offen */
.ti-sortieren .ti-ablage, .ti-lotto .ti-ablage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ti-stapel { position: relative; width: clamp(130px, 40vw, 190px); }
.ti-stapel-platz { position: relative; z-index: 1; }
.ti-stapel-platz > .ti-karte { display: grid; }
.ti-stapel::before, .ti-stapel::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; background: #FFFFFF; border: 2px solid #C9D1DA; display: none;
}
.ti-stapel::before { transform: translate(5px, 5px) rotate(1.5deg); }
.ti-stapel::after { transform: translate(10px, 9px) rotate(-1deg); }
.ti-stapel-dick::before, .ti-stapel-dick::after { display: block; }
.ti-stapel-leer { aspect-ratio: 5 / 6; border: 3px dashed var(--linie); border-radius: 14px; }
.ti-noch { margin: 6px 0 0; color: var(--tinte-leise); min-height: 1.4em; text-align: center; }

/* Stand, Hilfe, Lob */
.ti-stand { min-height: 1.5em; margin: 14px 0 0; color: var(--tinte-leise); }
.ti-hilfe { margin: 6px 0 0; color: var(--tinte-leise); font-size: .9rem; max-width: var(--mass); }
.ti-lob {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-block-start: 18px; padding: 16px 20px;
  background: var(--papier-hell); border: 2px solid var(--linie); border-radius: 18px;
}
.ti-lob-baer { width: 72px; height: 72px; flex: none; }
.ti-lob-text { margin: 0; font-size: 1.3rem; font-weight: 700; flex: 1 1 12em; }
.ti-lob-text:focus { outline: none; }
.ti-lob-knoepfe { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; align-items: center; }
.ti-lob-knoepfe .knopf-gross { min-height: 56px; padding: 8px 22px; font-size: 1.15rem; cursor: pointer; }

/* die Seite mit den vier Spielen: der Satz für Erwachsene */
.ti-erwachsene { margin: 36px 0 0; max-width: var(--mass); color: var(--tinte-leise); }

/* breite Fenster: Tafel und Karten nebeneinander */
@media (min-width: 760px) {
  .ti-gleich, .ti-lotto { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .ti-gleich .ti-ablage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ti-sortieren { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
  .ti-zuerst { padding: 22px 28px; }
  .ti-zuerst .ti-ziele, .ti-zuerst .ti-ablage { max-width: 40rem; }
}
/* hohe, breite Fenster (PC, Tablet): Lotto und Körbe nach der Fensterhöhe, damit der ganze Tisch auf einmal zu sehen ist */
@media (min-width: 760px) and (min-height: 560px) {
  .ti-lotto, .ti-sortieren { grid-template-columns: auto minmax(160px, 240px); justify-content: start; }
  .ti-lotto .ti-ziele { width: clamp(330px, calc((100vh - 300px) * .75), 620px); }
  .ti-sortieren .ti-ziele { width: clamp(420px, calc((100vh - 300px) * 1.25), 820px); }
  .ti-zuerst .ti-ziele, .ti-zuerst .ti-ablage { max-width: min(40rem, calc((100vh - 300px) * 1.55)); }
}
@media (min-width: 1100px) {
  .ti-gleich .ti-ablage { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ti-gleich { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
/* Handy quer: wenig Höhe, die Karten kleiner */
@media (max-height: 500px) and (orientation: landscape) {
  .ti-lotto .ti-ziele { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ti-sortieren .ti-ziele { width: min(100%, 21rem); }
  .ti-sortieren { grid-template-columns: auto minmax(130px, 1fr); justify-content: start; }
  .ti-stapel { width: clamp(110px, 18vw, 150px); }
  .ti-zuerst .ti-ziele, .ti-zuerst .ti-ablage { max-width: 26rem; }
}
@media (max-width: 420px) {
  .ti-tisch { padding: 10px; gap: 16px; }
  .ti-ziele, .ti-ablage { gap: 8px; }
  .ti-zuerst .ti-ziele, .ti-zuerst .ti-ablage { gap: 22px; }
  .ti-feld-knopf { padding: 3px; }
  .ti-lage { inset: 3px; }
  .ti-feld-korb { padding: 4px; gap: 6px; }
}

/* Nacht: die Karten etwas gedämpft */
@media (prefers-color-scheme: dark) {
  :root:not([data-modus="hell"]) .ti-karte, :root:not([data-modus="hell"]) .ti-vorlage, :root:not([data-modus="hell"]) .ti-stapel::before,
  :root:not([data-modus="hell"]) .ti-stapel::after { filter: brightness(.9); }
}
:root[data-modus="dunkel"] .ti-karte, :root[data-modus="dunkel"] .ti-vorlage,
:root[data-modus="dunkel"] .ti-stapel::before, :root[data-modus="dunkel"] .ti-stapel::after { filter: brightness(.9); }
.ti-feld-nr .ti-vorlage { filter: none !important; }

/* Leise: zwei Töne, keine Bewegung */
html[data-leise="an"] .ti-tisch { background: var(--papier-hell); }
html[data-leise="an"] .ti-karte, html[data-leise="an"] .ti-vorlage { box-shadow: none; border-color: #1F2730; }
html[data-leise="an"] .ti-bild { filter: saturate(.35); }
html[data-leise="an"] .ti-streifen { background: #1F2730 !important; }
html[data-leise="an"] .ti-karte[aria-pressed="true"] { transform: none; outline-color: var(--tinte); }
html[data-leise="an"] .ti-feld-knopf, html[data-leise="an"] .ti-feld-korb { border-color: var(--tinte); }
html[data-leise="an"] .ti-feld-korb .ti-feld-knopf { border: 0; }
html[data-leise="an"] .ti-wahl-knopf[aria-pressed="true"] { background: var(--tinte); color: var(--papier); border-color: var(--tinte); }
html[data-leise="an"] .ti-lob-baer { filter: grayscale(1) contrast(.9); opacity: .8; }
@media (prefers-reduced-motion: reduce) {
  .ti-karte[aria-pressed="true"] { transform: none; }
}
