/* Tiere von Talamon — Look aus dem Vegamonie-Design (Mockup "Tiere von Talamon App Design"),
   Karten sind die echten Scans aus Karten_v0.7. */

@font-face {
  font-family: 'Roca';
  src: url('assets/fonts/Roca-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --cream: #f5f2ea;
  --paper: #eeeae0;
  --ink: #17140f;
  --ink-soft: #55514a;
  --line: #e4e0d5;
  --green-deep: #2f4a39;
  --green-table: #3f6e56;
  --green-mid: #5c8f70;
  --mint: #cdf3da;
  --teal: #004744;
  --sky: #9fd3e8;
  --pink: #d6127e;
  --pink-soft: #f383b8;
  --amber: #f2b705;
  --cyan: #0b6e85;
  --brown: #713d28;
  --card-radius: 4.5%;
  --shadow-card: 0 2px 10px rgba(23, 20, 15, 0.35);
  /* Einheitliche Kartenbreite für Hand, Hofmarkt und Gehege — nur Garten/
     Kompost/Wächter (Kartenrücken-Stapel) bleiben bewusst kleiner. */
  --card-w: clamp(96px, 8vw, 144px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* Während eines Karten-Drags (siehe makeDraggable/makeMarketDraggable in
   app.js): verhindert, dass schnelle Mausbewegungen versehentlich Text auf
   der Seite markieren. */
body.dragging-noselect, body.dragging-noselect * { user-select: none; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Nunito Sans', sans-serif;
  overflow: hidden;
}
button {
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  transition: filter 150ms, transform 120ms;
}
button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.97); }
h1, h2, h3, .roca { font-family: 'Roca', 'Nunito Sans', serif; font-weight: 700; }
.mono { font-family: 'JetBrains Mono', monospace; }

#app { height: 100vh; display: flex; flex-direction: column; }
.screen { position: absolute; inset: 0; overflow: hidden; }

@keyframes decor-float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }
@keyframes pop-in { from { transform: scale(0.85); opacity: 0;} to { transform: scale(1); opacity: 1;} }
@keyframes fade-in-up { from { transform: translateY(10px); opacity: 0;} to { transform: translateY(0); opacity: 1;} }
@keyframes wobble { 0%,100% { transform: rotate(-1.5deg);} 50% { transform: rotate(1.5deg);} }

/* ---------- Buttons ---------- */
.btn { border: none; border-radius: 999px; font-weight: 800; padding: 12px 22px; font-size: 15px; }
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 6px 0 -2px rgba(23,20,15,0.35); }
.btn-ghost   { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.btn-paper   { background: #fff; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-link    { background: none; color: var(--mint); text-decoration: underline; text-underline-offset: 4px; padding: 8px; font-size: 14px; font-weight: 800; border: none; }
/* Mint ist für dunkle Hintergründe (Menü, Tisch) gedacht — auf dem hellen
   .setup-Creme praktisch unlesbar (helles Mint auf Creme = kaum Kontrast). */
.setup .btn-link { color: var(--pink); }
.btn-amber   { background: var(--amber); color: var(--ink); }
.btn-teal    { background: var(--cyan); color: #fff; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none !important; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* ---------- Menü ---------- */
.menu {
  background: var(--green-deep);
  display: flex; align-items: center; justify-content: center;
}
.menu .decor { position: absolute; pointer-events: none; }
.menu-account-bar {
  position: absolute; top: 22px; right: 24px;
  display: flex; align-items: center; gap: 10px; z-index: 2;
}
.account-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px; padding: 5px 14px 5px 5px; cursor: pointer;
  color: #fff; font-weight: 800; font-size: 13.5px;
}
.account-chip img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.menu-center { position: relative; display: flex; flex-direction: column; align-items: center; animation: fade-in-up 350ms ease-out; }
/* Etwas mehr Luft als die reine Kartenhöhe bräuchte — die äußeren Karten sind
   rotiert UND nach unten versetzt, ihre Bounding-Box reicht sichtbar über die
   nominelle Bildhöhe hinaus (sonst überlappt das der Kicker-Text darunter). */
.menu-fan { display: flex; justify-content: center; margin-bottom: 34px; height: 168px; }
.menu-fan img {
  width: 104px; border-radius: var(--card-radius); box-shadow: var(--shadow-card);
  border: 3px solid rgba(255,255,255,0.75); margin: 0 -12px;
}
.menu-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--mint); }
.menu h1 { font-size: 56px; line-height: 1.05; letter-spacing: -0.02em; color: #fff; margin: 10px 0 6px; text-align: center; }
.menu p { margin: 0 0 30px; font-size: 17px; color: rgba(255,255,255,0.82); max-width: 460px; text-align: center; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 320px; }
/* Lautstärke-Regler im Einstellungen-Popup (heller .modal-Hintergrund). */
.audio-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.audio-row .btn { flex: none; width: 118px; }
.audio-row .btn.muted { opacity: 0.55; }
.audio-row input[type="range"] { flex: 1; accent-color: var(--pink); cursor: pointer; }

/* ---------- Setup ---------- */
.setup { background: var(--cream); overflow: auto; }
.setup-wrap { max-width: 920px; margin: 0 auto; padding: 36px 32px; }
.back-link { border: none; background: none; color: var(--green-table); font-weight: 800; font-size: 13px; padding: 0; margin-bottom: 14px; }
.setup h2 { font-size: 34px; margin: 0 0 4px; }
.setup-sub { margin: 0 0 26px; font-size: 15px; color: var(--ink-soft); }
.setup-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.card-panel { background: #fff; border-radius: 12px; box-shadow: 0 8px 24px -12px rgba(23,20,15,0.28); padding: 26px; display: flex; flex-direction: column; gap: 22px; }
.side-panel { background: var(--green-deep); border-radius: 16px; padding: 24px; color: #fff; display: flex; flex-direction: column; gap: 14px; }
.label-caps { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: var(--ink-soft); margin-bottom: 8px; }
.side-panel .label-caps { color: var(--mint); }
.player-row { display: flex; align-items: center; gap: 10px; }
.player-badge { width: 34px; height: 34px; border-radius: 50%; background: var(--green-deep); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.player-row input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-family: inherit; font-size: 14.5px; background: var(--cream); color: var(--ink); }
.player-row input:focus { outline: 2px solid var(--green-mid); }
.row-x { border: none; background: none; color: var(--ink-soft); font-size: 16px; font-weight: 800; padding: 4px 6px; }
.add-player { border: 1px dashed var(--green-mid); border-radius: 10px; background: none; color: var(--green-table); font-weight: 800; font-size: 13.5px; padding: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.toggle { border: none; border-radius: 999px; width: 52px; height: 30px; position: relative; flex: none; background: var(--line); }
.toggle.on { background: var(--green-mid); }
.toggle span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left 150ms; }
.toggle.on span { left: 25px; }
.info-chip { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }

.fresh-tag { font-size: 10px; font-weight: 800; color: #17140f; background: var(--amber); border-radius: 999px; padding: 1px 8px; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.setup-bonus-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; transition: opacity 150ms; }
.setup-bonus-gallery.dimmed { opacity: 0.35; }
.setup-bonus-item { position: relative; width: 52px; cursor: pointer; }
.setup-bonus-item img { width: 100%; border-radius: 6px; box-shadow: var(--shadow-card); display: block; }
.setup-bonus-item.gadget img { aspect-ratio: 1; object-fit: cover; }
.setup-bonus-count {
  position: absolute; top: -5px; right: -5px; background: var(--amber); color: var(--ink);
  font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

/* ---------- Spieltisch ---------- */
.table {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(0,0,0,0) 40%, rgba(10,25,15,0.45) 100%),
    url('assets/table-bg.jpg') center / cover no-repeat,
    var(--green-table);
  display: flex; flex-direction: column;
}
.table-main { flex: 1; display: grid; grid-template-columns: 1fr 236px; gap: 8px; padding: 8px 16px 0; min-height: 0; }

/* Ereignis-Slots am unteren Rand des Geheges: 3 aushaltbare Plätze (füllen
   sich mit der echten, lesbaren Querkarte) + 1 gestrichelter Gefahren-Slot,
   der nie gefüllt wird (das 4. Ereignis beendet die Rettung sofort). */
.event-slots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.event-slot {
  width: clamp(100px, 8.5vw, 180px); aspect-ratio: 800 / 587; border-radius: 8px; flex: none;
  overflow: hidden; position: relative;
}
.event-slot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; box-shadow: var(--shadow-card); border-radius: 8px; }
.event-slot.empty { border: 2px dashed rgba(255,255,255,0.35); }
.event-slot.danger { border-color: rgba(255,144,206,0.6); background: rgba(255,144,206,0.08); }
.event-slot .slot-warn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; font-size: 9.5px; font-weight: 800; color: rgba(255,255,255,0.85); line-height: 1.3; }
/* table-left trägt zwei content-sized Panels (Gehege, Hofmarkt+Ereignisse).
   Reicht die Fensterhöhe nicht, scrollt die ganze Spalte als Einheit — so
   wird nie ein einzelnes Panel intern weggeclippt (Gehege bräuchte sonst
   immer Vorrang, aber das Nachbar-Panel würde dann unsichtbar verdrängt). */
.table-left { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }

/* Gehege ist elastisch (flex:1) und schnappt sich die Höhe, die Hofmarkt/
   Ereignisse (beide flex:none, an ihren Inhalt gebunden) übrig lassen.
   overflow-y:auto fängt lange Kartenkaskaden ab, ohne dass ein Panel ein
   anderes von der Höhe verdrängt. */
.pens-panel {
  background: linear-gradient(180deg, rgba(24,44,30,0.35), rgba(24,44,30,0.22));
  border: 1px solid rgba(255,255,255,0.28); border-top-color: rgba(255,255,255,0.45);
  border-radius: 16px; padding: 6px 10px 8px; flex: 1; min-height: 0; display: flex; flex-direction: column;
  box-shadow: inset 0 2px 14px rgba(10,25,15,0.45), 0 4px 18px -8px rgba(10,25,15,0.6);
  position: relative; overflow-y: auto;
}
.pens-panel::after {
  content: ''; position: absolute; right: 10px; top: 6px; width: 44px; height: 44px;
  background: url('assets/decor/bee.svg') center / contain no-repeat; opacity: 0.5; pointer-events: none;
  animation: decor-float 5s ease-in-out infinite;
}
.panel-caps { font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; color: var(--mint); margin-bottom: 6px; flex: none; }
/* Auf großen Fenstern sollen die 4 Gehege nah beieinander bleiben statt sich
   über die ganze Breite zu verteilen — max-width + zentrieren hält den Block
   kompakt und lesbar; auf schmalen Fenstern schrumpft er einfach mit. */
.pens { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; flex: none; align-items: start; max-width: 640px; width: 100%; margin: 0 auto; }
.pen { display: flex; flex-direction: column; align-items: center; min-width: 0; border-radius: 12px; padding: 6px 4px; transition: background 150ms, box-shadow 150ms; }
.pen.droppable { background: rgba(255,255,255,0.14); box-shadow: 0 0 0 2px var(--mint) inset; }
.pen.drop-hot { background: rgba(205,243,218,0.30); box-shadow: 0 0 0 3px var(--mint) inset; }
.pen.blocked-drop { opacity: 0.55; }
.pen-cardwrap { position: relative; width: var(--card-w); max-width: 100%; }
.pen-stackline { position: absolute; inset: 0; border-radius: var(--card-radius); background: #fff; box-shadow: var(--shadow-card); }
.pen-card { position: relative; width: 100%; border-radius: var(--card-radius); display: block; box-shadow: var(--shadow-card); }
.pen-empty {
  width: min(100%, 148px); aspect-ratio: 0.714; border: 2px dashed rgba(255,255,255,0.35); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: rgba(255,255,255,0.65); font-size: 11.5px; padding: 10px;
}
.pen-stackcount {
  position: absolute; top: -7px; right: -7px; background: var(--ink); color: #fff;
  font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 3px 8px; box-shadow: var(--shadow-card);
}
.pen-meta { width: var(--card-w); max-width: 100%; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.pen-geduld { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: #fff; }
.geduld-bar { flex: 1; height: 7px; border-radius: 4px; background: rgba(0,0,0,0.35); overflow: hidden; }
.geduld-fill { height: 100%; border-radius: 4px; background: var(--mint); transition: width 200ms, background 200ms; }
.geduld-fill.warn { background: var(--amber); }
.geduld-fill.hot { background: var(--pink-soft); }
.need-dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.need-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.85); }
.need-dot.open { opacity: 0.38; }
.need-dot.tofu-filled { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
/* Angelegte Karten als Kaskade unter dem Tier: überdeckte Karten zeigen nur
   ihren Titelstreifen (Sanduhr + Name), die zuletzt angelegte liegt komplett
   sichtbar zuunterst — wie am echten Tisch übereinandergeschoben. */
.animal-holder { position: relative; z-index: 2; }
.pen-meta-slot { margin-top: 5px; }
.attached-cascade { position: relative; z-index: 1; margin-top: 5px; }
.cascade-card { position: relative; cursor: pointer; border-radius: 7px; box-shadow: 0 -3px 8px rgba(10,25,15,0.35); transition: transform 130ms; }
.cascade-card img { width: 100%; display: block; border-radius: 7px; }
.cascade-card:hover { transform: translateY(-2px); }
.cascade-card.selectable { outline: 2px solid var(--amber); outline-offset: -2px; }

/* Mitspieler-Hand im Inspector */
.ins-hand { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; background: rgba(255,255,255,0.96); border-radius: 10px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.ins-hand img { width: calc(33.33% - 4px); border-radius: 6px; box-shadow: var(--shadow-card); }

.market-panel {
  background: linear-gradient(180deg, rgba(24,44,30,0.35), rgba(24,44,30,0.22));
  border: 1px solid rgba(255,255,255,0.28); border-top-color: rgba(255,255,255,0.45);
  border-radius: 16px; padding: 6px 10px 8px; flex: none;
  display: flex; gap: 14px; align-items: flex-start;
  box-shadow: inset 0 2px 14px rgba(10,25,15,0.45), 0 4px 18px -8px rgba(10,25,15,0.6);
}
.market-panel-main { flex: 1; min-width: 0; }
/* Bezahlzone: Handkarten hierher ziehen (oder anklicken) sammelt sie sichtbar
   mit laufender Summe — die Marktkarte zieht man danach zur Hand oder zum Tier. */
.payzone {
  flex: none; width: 132px; min-height: 92px; border-radius: 12px; padding: 8px 9px;
  background: rgba(0,0,0,0.18); border: 2px dashed rgba(255,255,255,0.3); transition: background 150ms, box-shadow 150ms;
}
.payzone.droppable { border-color: var(--mint); background: rgba(205,243,218,0.12); }
.payzone.drop-hot { background: rgba(205,243,218,0.28); box-shadow: 0 0 0 2px var(--mint) inset; }
.payzone-label { font-size: 10px; font-weight: 800; color: var(--mint); letter-spacing: 0.06em; margin-bottom: 5px; }
.payzone-cards { display: flex; flex-wrap: wrap; gap: 4px; min-height: 40px; }
.payzone-thumb { width: 34px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.4); cursor: pointer; }
.payzone-empty { font-size: 10px; color: rgba(255,255,255,0.55); line-height: 1.4; align-self: center; }
.payzone-total { margin-top: 6px; font-size: 13px; font-weight: 800; color: #fff; text-align: right; }
/* Warenkorb: bei Überzahlung dürfen mehrere Marktkarten gesammelt und in
   einem Kauf (1 Aktion) zusammen genommen werden, statt dass der Rest verfällt. */
.buy-cart { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.buy-cart-summary { font-size: 10.5px; color: #fff; line-height: 1.4; background: rgba(255,255,255,0.12); border-radius: 8px; padding: 5px 7px; }
/* Handbereich als Kauf-Ziel beim Ziehen einer Marktkarte */
.hand-area.droppable { box-shadow: 0 0 0 2px var(--mint) inset; border-radius: 12px; }
.hand-area.drop-hot { background: rgba(205,243,218,0.16); }
.guard-pile { filter: drop-shadow(0 0 6px rgba(242,183,5,0.55)); }
.market-cards { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.market-card { width: var(--card-w); border-radius: var(--card-radius); box-shadow: var(--shadow-card); cursor: pointer; transition: transform 130ms; display: block; }
.market-card:hover { transform: translateY(-4px); }
.market-card.too-expensive { opacity: 0.45; cursor: not-allowed; }
.market-card.in-cart { outline: 3px solid var(--mint); outline-offset: 2px; }
.market-closed { width: 160px; align-self: stretch; border: 2px dashed rgba(255,255,255,0.4); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; text-align: center; padding: 10px; min-height: 90px; }
/* Garten/Kompost/Wächter + Spielerzeile: eigene Ecke unten links IM Gehege
   ("aufs Brett gepackt") statt eigener Zeile darunter — spart eine ganze
   Panel-Reihe. Die Stapel bleiben bewusst kleiner als die Spielkarten. */
.piles { display: flex; gap: 8px; }
.pile { text-align: center; position: relative; }
.pile-back { width: clamp(52px, 4.4vw, 78px); border-radius: var(--card-radius); box-shadow: var(--shadow-card); display: block; }
.pile-blank { width: clamp(52px, 4.4vw, 78px); aspect-ratio: 0.714; border: 2px dashed rgba(255,255,255,0.35); border-radius: 8px; }
.pile-count { position: absolute; top: -7px; right: -7px; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 3px 7px; }
.pile-label { font-size: 9.5px; color: rgba(255,255,255,0.75); margin-top: 4px; font-weight: 800; letter-spacing: 0.04em; }
.pile.droptarget.drop-hot .pile-back, .pile.droptarget.drop-hot .pile-blank { outline: 3px solid var(--mint); }
.pile[data-compost].droppable .pile-back, .pile[data-compost].droppable .pile-blank { box-shadow: 0 0 0 2px var(--amber) inset, var(--shadow-card); }
.pile[data-compost].drop-hot .pile-back, .pile[data-compost].drop-hot .pile-blank { outline: 3px solid var(--amber); }

/* Hofmarkt und Ereignisse stehen 50:50 nebeneinander */
.market-events-row { display: flex; gap: 10px; flex: none; align-items: stretch; }
.market-events-row .market-panel { flex: 1 1 0%; min-width: 0; margin: 0; }
.events-panel {
  flex: 1 1 0%; min-width: 0;
  background: linear-gradient(180deg, rgba(24,44,30,0.35), rgba(24,44,30,0.22));
  border: 1px solid rgba(255,255,255,0.28); border-top-color: rgba(255,255,255,0.45);
  border-radius: 16px; padding: 6px 10px 8px;
  box-shadow: inset 0 2px 14px rgba(10,25,15,0.45), 0 4px 18px -8px rgba(10,25,15,0.6);
}

.table-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.lebenshof {
  background: linear-gradient(180deg, #d9f7e4, var(--mint));
  border: 1px solid rgba(47,74,57,0.25); border-top-color: rgba(255,255,255,0.9);
  border-radius: 16px; padding: 12px 14px; flex: 1; min-height: 0;
  box-shadow: 0 6px 18px -8px rgba(10,25,15,0.55);
  position: relative; display: flex; flex-direction: column;
}
.lebenshof .saved-grid { flex: 1; min-height: 0; overflow-y: auto; margin-top: 9px; }
.lebenshof .retreat-btn { margin-top: 8px; }
.lebenshof::after {
  content: ''; position: absolute; right: 6px; bottom: 4px; width: 56px; height: 56px;
  background: url('assets/decor/flowers.svg') center / contain no-repeat; opacity: 0.35; pointer-events: none;
}
.lebenshof h3 { font-size: 17px; margin: 0; color: var(--ink); }
.lebenshof .saved-sub { font-size: 11.5px; font-weight: 800; color: var(--green-table); margin: 2px 0 8px; }
.saved-grid { display: flex; flex-direction: column; gap: 10px; }
.fam-group { animation: pop-in 300ms cubic-bezier(0.34,1.56,0.64,1); }
.fam-label { font-size: 10px; font-weight: 800; color: var(--green-table); letter-spacing: 0.03em; margin-bottom: 4px; }
.fam-label b { color: var(--pink); }
/* Kleine Kärtchen, die sich pro Familie nebeneinander sammeln — leichte
   Überlappung wie eine Hand von Karten, damit man das Sammeln direkt sieht. */
.fam-row { display: flex; flex-wrap: wrap; }
.fam-card {
  /* Die Tier-Rückseite (imgBack) ist ein Querformat-Bild — Kärtchen entsprechend breiter als hoch. */
  position: relative; width: clamp(52px, 4.6vw, 78px); aspect-ratio: 800 / 587;
  border-radius: 5px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-card);
  margin-right: -14px; transition: box-shadow 140ms; flex: none;
}
.fam-card:last-child { margin-right: 0; }
.fam-card img { width: 100%; height: 100%; display: block; object-fit: contain; }
.fam-card:hover { z-index: 5; box-shadow: 0 0 0 2px var(--mint), var(--shadow-card); }
.lebenshof .hint { font-size: 11.5px; color: var(--green-table); line-height: 1.45; }
.retreat-btn { width: 100%; margin-top: 9px; position: relative; z-index: 1; }
.log-panel { background: rgba(0,0,0,0.25); border-radius: 12px; padding: 6px 10px; font-size: 11px; color: rgba(255,255,255,0.85); flex: none; line-height: 1.5; }
.log-toggle { display: block; width: 100%; text-align: left; border: none; background: none; color: rgba(255,255,255,0.85); font-size: 11px; font-weight: 800; padding: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-body { max-height: 150px; overflow-y: auto; margin-top: 4px; }
.log-body div + div { margin-top: 2px; }
.saved-sub-inline { font-size: 12px; font-weight: 800; color: var(--green-table); margin-left: 6px; }
.pts-badge {
  position: absolute; top: 1px; right: 1px; background: rgba(255,255,255,0.92); color: var(--ink);
  font-size: 6.5px; font-weight: 800; border-radius: 999px; padding: 0 3px; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); line-height: 1.5;
}

/* ---------- Unser Lebenshof (Fortschritt) ---------- */
.hof {
  background:
    linear-gradient(180deg, rgba(24,44,30,0.35), rgba(24,44,30,0.55)),
    url('assets/table-bg.jpg') center / cover no-repeat,
    var(--green-mid);
  overflow: auto;
}
.hof-wrap { max-width: 980px; margin: 0 auto; padding: 32px; }
.hof h2 { font-size: 36px; color: #fff; margin: 0 0 6px; }
.hof-sub { color: rgba(255,255,255,0.85); font-size: 14px; margin: 0 0 20px; }
.hof-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.hof-tile { position: relative; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-card); animation: pop-in 300ms ease-out backwards; }
.hof-tile img { width: 100%; display: block; }
.hof-tile.missing img { filter: grayscale(1) brightness(0.45); }
.hof-count { position: absolute; top: 4px; right: 5px; background: var(--amber); color: var(--ink); font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.hof-deck { background: rgba(255,255,255,0.92); border-radius: 12px; padding: 12px 16px; margin-top: 18px; font-size: 13.5px; color: var(--ink); line-height: 1.5; }

/* ---------- Handbereich ---------- */
.hand-dock {
  background: url('assets/wood.jpg') center / cover, var(--cream);
  border-radius: 16px 16px 0 0; margin: 8px 16px 0; padding: 6px 16px 8px;
  display: flex; flex-direction: column; gap: 4px; flex: none;
  border: 1px solid rgba(122,80,34,0.45); border-bottom: none;
  box-shadow: 0 -6px 22px -10px rgba(10,25,15,0.65), inset 0 1px 0 rgba(255,255,255,0.5);
}
/* Oberste Zeile der Holzfläche: Spielerzeile links, Werkzeugleiste rechts
   (Rückgängig/Auto-Zug/Regeln/Menü — vorher ein eigener dunkler Balken über
   dem Tisch, der dem Gehege Höhe wegnahm). */
.hand-dock-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hand-toolbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hand-toolbar .btn { background: rgba(70,50,20,0.08); color: var(--ink-soft); border-color: rgba(70,50,20,0.22); }
.hand-toolbar .btn:hover { background: rgba(70,50,20,0.16); }
.hand-toolbar .btn.auto-on { background: var(--pink); border-color: var(--pink); color: #fff; }
.hand-toolbar .btn:disabled { opacity: 0.4; }
/* Spielerzeile sitzt oben links auf der Holzfläche, kompakt — getrennt von
   den Stapeln, die unten links (in .hand-corner) bleiben. */
.player-line { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.hand-dock .player-chip { background: rgba(255,255,255,0.85); }
.hand-dock .player-chip.active { background: var(--green-deep); }
.player-chip { display: flex; align-items: center; gap: 7px; border-radius: 999px; padding: 4px 12px; background: #fff; color: var(--ink-soft); border: 1px solid var(--line); }
.player-chip.active { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.player-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.player-chip.active .dot { background: var(--mint); }
.player-chip .nm { font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.player-chip .cnt { font-size: 10.5px; font-weight: 800; opacity: 0.7; flex: none; }
.hand-row { display: flex; align-items: center; gap: 14px; }
/* Ecke links neben den Handkarten — vorher leere Holzfläche, jetzt Garten/
   Kompost/Wächter. Bündig mit der Kartenunterkante. */
.hand-corner { flex: none; align-self: flex-end; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hand-area { flex: 1; display: flex; justify-content: center; align-items: flex-end; min-height: clamp(148px, 12.5vw, 208px); position: relative; }
.hand-card {
  width: var(--card-w); border-radius: var(--card-radius); box-shadow: var(--shadow-card);
  margin: 0 -9px; position: relative; transition: transform 140ms, box-shadow 140ms;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none;
  transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
}
.hand-card:hover { transform: translateY(-14px) scale(1.05); z-index: 5; }
.hand-card.pay-marked { outline: 3px solid var(--amber); transform: translateY(-10px); }
.hand-card.dragging { opacity: 0.35; }
/* Spielerwechsel: Hand wird sichtbar neu "ausgeteilt", damit klar ist, wer
   jetzt dran ist — Rotation/Fächer bleibt dabei über die CSS-Variablen erhalten. */
@keyframes hand-deal {
  from { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--ty, 0px) + 46px)) scale(0.86); opacity: 0; }
  to   { transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px)) scale(1); opacity: 1; }
}
.hand-dock.turn-flash .hand-card { animation: hand-deal 420ms cubic-bezier(0.34,1.56,0.64,1) backwards; }
.hand-dock.turn-flash .player-chip.active { animation: wobble 420ms ease-in-out; }
.hand-empty { font-size: 13px; color: var(--ink-soft); align-self: center; }
.pay-badge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: var(--amber); color: var(--ink); border-radius: 999px; font-size: 10px; font-weight: 800; padding: 2px 8px; pointer-events: none; }
.hand-actions { display: flex; flex-direction: column; gap: 7px; flex: none; width: 200px; }
.hand-hint { font-size: 10px; color: var(--ink-soft); text-align: center; line-height: 1.4; }

/* Drag-Geist */
#drag-ghost { position: fixed; width: 96px; pointer-events: none; z-index: 200; border-radius: var(--card-radius); box-shadow: 0 12px 32px rgba(0,0,0,0.45); transform: translate(-50%, -55%) rotate(4deg); }
/* Rettungs-Flug: Kopie der Tierkarte gleitet vom Gehege zu "Gerettete Tiere". */
.flight-ghost {
  position: fixed; z-index: 400; pointer-events: none; border-radius: var(--card-radius);
  box-shadow: 0 16px 34px -10px rgba(10,25,15,0.6); opacity: 1;
  transition: left 620ms cubic-bezier(0.22,1,0.36,1), top 620ms cubic-bezier(0.22,1,0.36,1),
              width 620ms cubic-bezier(0.22,1,0.36,1), height 620ms cubic-bezier(0.22,1,0.36,1),
              opacity 620ms ease 300ms;
}

/* ---------- Inspector ---------- */
#inspector {
  position: fixed; z-index: 150; width: 320px; pointer-events: none;
  animation: pop-in 140ms ease-out;
}
#inspector .ins-card { width: auto; max-width: 100%; max-height: 58vh; border-radius: 4.5%; box-shadow: 0 18px 48px rgba(0,0,0,0.5); display: block; margin: 0 auto; }
#inspector .ins-info { background: #fff; border-radius: 10px; margin-top: 8px; padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
#inspector .ins-info b { font-weight: 800; }
#inspector .ins-title { font-weight: 800; font-size: 14px; }
#inspector .ins-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
#inspector .tag { font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: var(--cream); border: 1px solid var(--line); }

/* ---------- Overlays ---------- */
.overlay { position: absolute; inset: 0; background: rgba(23,20,15,0.55); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #fff; border-radius: 14px; box-shadow: 0 24px 60px -24px rgba(23,20,15,0.5); padding: 26px; width: 460px; max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); overflow: auto; animation: pop-in 280ms cubic-bezier(0.34,1.56,0.64,1); }
.modal.dark { background: var(--teal); color: #fff; }
.modal-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--pink); }
.modal.dark .modal-kicker { color: var(--sky); }
.modal h3 { font-size: 25px; margin: 8px 0 10px; }
.modal p { margin: 0 0 16px; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.modal.dark p { color: rgba(255,255,255,0.88); }
.modal .stack { display: flex; flex-direction: column; gap: 10px; }
.modal .row { display: flex; gap: 10px; }
.modal .event-img { width: 200px; border-radius: 8px; display: block; margin: 0 auto 14px; box-shadow: var(--shadow-card); }
.modal .remove-box { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
/* Auslöser (Wächter/Panik) vor dem eigentlichen Ereignis — kurz "hereinwackeln",
   damit klar wird, WIE es zu diesem Ereignis kam. */
@keyframes cause-reveal {
  0% { transform: scale(0.8) rotate(-4deg); opacity: 0; }
  60% { transform: scale(1.06) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.event-cause {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 12px; padding: 8px 14px;
  font-size: 12.5px; font-weight: 700; margin: 2px 0 12px;
  animation: cause-reveal 420ms cubic-bezier(0.34,1.56,0.64,1);
}
.event-cause.panic { border-color: rgba(242,183,5,0.6); }
.event-cause-body { display: flex; align-items: center; gap: 8px; }
.event-cause-icon { font-size: 16px; flex: none; }
.event-cause-imgwrap { position: relative; flex: none; }
.event-cause-img { width: 46px; aspect-ratio: 0.714; object-fit: cover; border-radius: 5px; box-shadow: var(--shadow-card); display: block; }
.event-cause-badge {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--amber); color: var(--ink); font-size: 8.5px; font-weight: 800;
  border-radius: 999px; padding: 1px 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.modal .choice-cards { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.modal .choice-cards img { width: 84px; border-radius: 5px; box-shadow: var(--shadow-card); cursor: pointer; border: 3px solid transparent; }
.modal .choice-cards img.sel { border-color: var(--pink); }
.modal .choice-cards img.dim { opacity: 0.4; }
.modal label.chk { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink-soft); }

/* ---------- Sieg / Niederlage ---------- */
.finale { display: flex; align-items: center; justify-content: center; }
.finale.win { background: var(--green-mid); }
.finale.lose { background: var(--ink); }
.finale-center { text-align: center; animation: fade-in-up 350ms ease-out; max-width: 620px; padding: 24px; position: relative; }
.finale-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--mint); }
.finale.lose .finale-kicker { color: var(--pink-soft); }
.finale h2 { font-size: 44px; color: #fff; margin: 10px 0 8px; line-height: 1.1; }
.finale p { font-size: 16px; color: rgba(255,255,255,0.85); margin: 0 0 26px; }
.finale .saved-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 22px; }
.finale .saved-row img { width: 64px; border-radius: 4px; box-shadow: var(--shadow-card); animation: pop-in 400ms cubic-bezier(0.34,1.56,0.64,1) backwards; }
.finale .btn-row { display: flex; gap: 12px; justify-content: center; }

/* ---------- Regeln ---------- */
.rules { background: var(--cream); overflow: auto; }
.rules-wrap { max-width: 980px; margin: 0 auto; padding: 32px; }
.rules h2 { font-size: 34px; margin: 0 0 6px; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.rules-cardbox { background: #fff; border-radius: 12px; box-shadow: 0 8px 24px -12px rgba(23,20,15,0.28); padding: 22px; font-size: 13.5px; line-height: 1.55; }
.rules-cardbox h3 { font-size: 19px; margin: 0 0 10px; }
.rules-cardbox.dark { background: var(--teal); color: #fff; }
.rules-cardbox.mint { background: var(--mint); }
.rules-cardbox .kv { margin-bottom: 9px; }

.modal .event-img.landscape { width: 320px; }
.finale .saved-row.lost img { filter: grayscale(1) brightness(0.7); }

/* ---------- Auswertung & Shop ---------- */
.finale-center.wide { max-width: 760px; width: 100%; max-height: 100vh; overflow: auto; padding: 28px 24px; }
.score-panel {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3); border-radius: 14px;
  padding: 14px 18px; margin: 0 auto 18px; max-width: 520px; text-align: left;
}
.score-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; color: rgba(255,255,255,0.9); padding: 4px 0; }
.score-row.total { border-top: 1px solid rgba(255,255,255,0.35); margin-top: 6px; padding-top: 9px; font-size: 16px; color: #fff; }
.shop { background: var(--cream); border-radius: 16px; padding: 16px 18px; margin: 0 auto 22px; max-width: 640px; box-shadow: 0 12px 32px -14px rgba(10,25,15,0.6); }
.shop-title { font-weight: 800; font-size: 15px; color: var(--ink); margin-bottom: 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.shop-item img { width: 100%; border-radius: 6px; box-shadow: var(--shadow-card); cursor: pointer; }
.shop-name { font-size: 12px; font-weight: 800; color: var(--ink); }
.shop-owned { opacity: 0.6; font-weight: 700; }
.shop-grid.gadgets { grid-template-columns: repeat(6, 1fr); }
.shop-item.owned img { outline: 3px solid var(--green-mid); }
.shop-have { font-size: 11px; font-weight: 800; color: var(--green-table); }

/* Ausrüstung am Tisch */
.gadget-panel { background: rgba(0,0,0,0.22); border-radius: 12px; padding: 8px 12px 10px; flex: none; }
.gadget-strip { display: flex; gap: 7px; flex-wrap: wrap; }
.gadget-icon { width: 42px; height: 42px; object-fit: cover; border-radius: 9px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); border: 2px solid rgba(255,255,255,0.35); }
.gadget-icon.used { filter: grayscale(1) brightness(0.6); }
.finale .saved-row { max-height: 130px; overflow: auto; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); z-index: 220; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--mint); color: var(--ink); border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 800; box-shadow: 0 8px 24px -12px rgba(23,20,15,0.4); animation: pop-in 300ms cubic-bezier(0.34,1.56,0.64,1); max-width: 70vw; text-align: center; }
.toast.error { background: #fff; color: var(--pink); border: 2px solid var(--pink); }
.toast.event { background: var(--amber); }
.toast.turn { background: var(--green-deep); color: #fff; font-size: 16px; padding: 13px 28px; box-shadow: 0 10px 30px -8px rgba(10,25,15,0.6), 0 0 0 3px var(--mint); }
.auto-on { background: var(--pink) !important; border-color: var(--pink) !important; color: #fff !important; }
