/* Maulwurfsgänge - styles
 * Paper cut-out look: flat paper cards with a cream edge and soft
 * shadows, a pale sky, green paper hills, gardens of soil under a meadow.
 * No style attributes in the HTML (strict CSP): sizes and grid positions
 * that depend on the game are set from game.js through the CSSOM.
 */

@font-face {
  font-family: 'Baloo 2';
  src: url('assets/fonts/baloo2-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Baloo 2';
  src: url('assets/fonts/baloo2-latin-ext.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --himmel: #cfe9f3;
  --himmel-unten: #e6f4e4;
  --papier: #fff8ea;
  --papier-rand: #ead7b3;
  --tinte: #3a2416;
  --tinte-hell: #6e5847;
  --erde: #8a5631;
  --erde-dunkel: #5a3219;
  --wiese: #4f9c32;
  --wiese-dunkel: #2f6a1b;
  --wiese-hell: #8fd062;
  --nase: #f48fb3;
  --sonne: #ffd84d;
  --sonne-dunkel: #c99a0e;
  --fokus: #1c5fc4;
  --fehler: #c2413a;
  --schatten: rgba(58, 36, 22, 0.22);
  --radius: 22px;
  --font: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--himmel) 0%, var(--himmel-unten) 100%);
  color: var(--tinte);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hintergrund {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38vh;
  pointer-events: none;
}
.hintergrund-svg { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------------------------- views */

.ansicht {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(16px + var(--safe-top)) calc(14px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(14px + var(--safe-left));
}
/* Centre vertically when there is room, scroll from the top when not. */
.ansicht > .karte { margin: auto 0; }

.karte {
  width: 100%;
  max-width: 560px;
  background: var(--papier);
  border: 4px solid #fffdf6;
  border-radius: var(--radius);
  box-shadow: 0 0 0 2px var(--papier-rand), 6px 8px 0 var(--schatten), 0 18px 40px rgba(58, 36, 22, 0.12);
  padding: 22px 24px 18px;
  text-align: center;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--erde-dunkel);
  line-height: 1.1;
}

/* ---------------------------------------------------------------- title */

.karte-titel { padding-top: 6px; margin-top: 46px !important; }

.titel-bild {
  margin: -60px -14px 0;
}
.titel-svg { display: block; width: 100%; height: auto; }

.logo {
  margin: 4px 0 0;
  font-size: clamp(2rem, 8vw, 2.9rem);
  font-weight: 800;
  line-height: 1;
  color: var(--erde-dunkel);
  letter-spacing: 0.01em;
  text-shadow: 2px 2px 0 #fffdf6, 4px 5px 0 rgba(58, 36, 22, 0.16);
}
.unterzeile {
  margin: 6px 0 14px;
  color: var(--tinte-hell);
  font-size: 1.02rem;
}

.gruppe { margin: 0 0 12px; }
.gruppe-titel {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tinte-hell);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.knopf-reihe {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
}

/* ---------------------------------------------------------------- buttons */

.knopf {
  appearance: none;
  font: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
  min-height: 48px;
  padding: 10px 22px 8px;
  border-radius: 999px;
  border: 3px solid var(--erde-dunkel);
  background: var(--papier);
  color: var(--erde-dunkel);
  box-shadow: 0 4px 0 var(--erde-dunkel);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
}
.knopf:hover { background: #fff2d6; }
.knopf:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--erde-dunkel); }
.knopf:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
  box-shadow: 0 4px 0 var(--erde-dunkel);
}

.knopf-haupt {
  background: var(--wiese);
  border-color: var(--wiese-dunkel);
  color: #fff;
  box-shadow: 0 4px 0 var(--wiese-dunkel);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  min-width: 132px;
}
.knopf-haupt:hover { background: #5aab3b; }
.knopf-haupt:active { box-shadow: 0 1px 0 var(--wiese-dunkel); }
.knopf-haupt:disabled { box-shadow: 0 4px 0 var(--wiese-dunkel); }

.knopf-breit { display: block; width: min(100%, 290px); margin: 0 auto 14px; }

.knopf-leise {
  font-size: 1rem;
  min-height: 44px;
  padding: 8px 18px 6px;
}

.rund-knopf {
  appearance: none;
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--erde-dunkel);
  background: var(--papier);
  color: var(--erde-dunkel);
  box-shadow: 0 3px 0 var(--erde-dunkel);
  cursor: pointer;
  padding: 0;
}
.rund-knopf svg { width: 24px; height: 24px; }
.rund-knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--erde-dunkel); }

.link-knopf {
  appearance: none;
  font: inherit;
  font-weight: 700;
  color: var(--erde-dunkel);
  background: none;
  border: 0;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

:focus-visible {
  outline: 4px solid var(--fokus);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- switches */

.schalter-reihe {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 4px 0 8px;
}
.schalter {
  appearance: none;
  font: inherit;
  font-size: 1rem;
  color: var(--tinte);
  background: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  min-height: 44px;
  cursor: pointer;
}
.schalter-bahn {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #d6c6ab;
  border: 3px solid var(--erde-dunkel);
  position: relative;
  transition: background-color 0.15s ease;
  flex: none;
}
.schalter-knopf {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fffdf6;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.schalter[aria-checked='true'] .schalter-bahn { background: var(--wiese); }
.schalter[aria-checked='true'] .schalter-knopf { transform: translateX(20px); }

/* ---------------------------------------------------------------- hints */

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 0.35em;
  margin: 0 1px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  color: var(--erde-dunkel);
  background: #fffdf6;
  border: 2px solid var(--papier-rand);
  border-bottom-width: 4px;
  border-radius: 7px;
}
kbd.breit { min-width: 3em; }

.tasten-hinweise {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin: 6px 0 10px;
  font-size: 0.88rem;
  color: var(--tinte-hell);
}
/* Keyboard hints only where there is a mouse (desktop, board with mouse). */
@media (hover: none), (pointer: coarse) {
  .nur-tastatur { display: none; }
}

.speicher-hinweis {
  margin: 8px 0 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  background: #fff1cf;
  border: 2px dashed var(--papier-rand);
  border-radius: 14px;
  color: var(--tinte);
}

.titel-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--papier-rand);
  font-size: 0.92rem;
}
.titel-links a { color: var(--erde-dunkel); text-underline-offset: 3px; }
.rechtliches { display: inline-flex; gap: 14px; }
.zurueck-link { font-weight: 700; }
.zurueck-link::before { content: '‹ '; }

/* Wide but low screens (laptops, boards): smaller picture, so the whole
   title card fits without scrolling. */
@media (min-width: 700px) and (max-height: 860px) {
  .karte-titel { max-width: 600px; padding-bottom: 12px; }
  .titel-bild { width: 62%; margin: -46px auto 0; }
  .gruppe { margin-bottom: 8px; }
  .gruppe-titel { margin-bottom: 4px; }
  .unterzeile { margin-bottom: 10px; }
  .knopf-reihe { margin-bottom: 8px; }
  .tasten-hinweise { margin: 2px 0 6px; }
  .speicher-hinweis { margin: 4px 0 6px; padding: 6px 12px; }
  .titel-links { margin-top: 6px; padding-top: 6px; }
}

/* ---------------------------------------------------------------- help */

.anleitung {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  text-align: left;
}
.anleitung li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 2px dashed var(--papier-rand);
}
.anleitung li:last-child { border-bottom: 0; }
.anleitung-bild {
  flex: none;
  width: 76px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #b98555;
  box-shadow: inset 0 0 0 3px rgba(255, 244, 226, 0.35);
  overflow: hidden;
}
.anleitung-bild svg { width: 56px; height: 56px; display: block; }
.anleitung-bild[data-bild='gang'] svg { width: 70px; height: 24px; }
.anleitung-bild[data-bild='wahl'] .feld-probe {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 5px var(--sonne), 0 0 0 2px rgba(58, 36, 22, 0.35);
}

/* ---------------------------------------------------------------- top bar */

.ansicht-feld {
  justify-content: flex-start;
  padding-top: calc(10px + var(--safe-top));
}
.kopfleiste {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.kopf-titel {
  margin: 0;
  font-size: clamp(1.1rem, 4.8vw, 1.45rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- garden */
/*
 * One garden: picture (meadow strip + soil) with a 10 x 10 grid of fields
 * over the soil part. The picture is 1000 x 1130, the soil starts at 130.
 * --garten is the width; game.js sets it on the view that contains the
 * garden, from the free space on the screen.
 */

.garten {
  position: relative;
  width: var(--garten, 420px);
  aspect-ratio: 1000 / 1130;
  flex: none;
}
.garten-bild {
  position: absolute;
  inset: 0;
  border-radius: 14px 14px 18px 18px;
  overflow: hidden;
  box-shadow: 0 0 0 3px #fffdf6, 0 0 0 5px var(--papier-rand), 7px 9px 0 var(--schatten);
}
.garten-svg { display: block; width: 100%; height: 100%; }

.garten-raster {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88.4956%; /* 1000 / 1130 */
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

.feld {
  appearance: none;
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  z-index: 2;
  cursor: default;
  touch-action: manipulation;
}
.feld:focus-visible { outline: none; }
.feld > svg {
  position: absolute;
  left: 4%;
  top: 4%;
  width: 92%;
  height: 92%;
  pointer-events: none;
  overflow: visible;
}

/* Fields that are already known get a little darker. */
.feld[data-zustand='daneben']::before,
.feld[data-zustand='frei']::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(40, 18, 4, 0.24);
}
/* "Surely empty": a small pale dot. */
.feld[data-zustand='frei']::after {
  content: '';
  position: absolute;
  left: 41%;
  top: 41%;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 244, 226, 0.75);
}

/* A field you can poke: frame on hover (mouse) */
.garten[data-aktiv='1'] .feld[data-zustand='leer'] { cursor: pointer; }
@media (hover: hover) {
  .garten[data-aktiv='1'] .feld[data-zustand='leer']:hover::after {
    content: '';
    position: absolute;
    inset: 7%;
    border-radius: 18%;
    border: 3px solid rgba(255, 248, 232, 0.9);
  }
}

/* Chosen field: sunny frame that pulses. Second tap pokes. */
.garten .feld.gewaehlt::after {
  content: '';
  position: absolute;
  inset: 3%;
  width: auto;
  height: auto;
  background: none;
  border-radius: 20%;
  border: 5px solid var(--sonne);
  box-shadow: 0 0 0 2px rgba(58, 36, 22, 0.45), inset 0 0 0 2px rgba(58, 36, 22, 0.45);
  animation: pulsieren 1.1s ease-in-out infinite;
  z-index: 4;
}
.garten .feld.gewaehlt { z-index: 5; }
/* Keyboard focus on a field when it is not the chosen one (setup). */
.garten .feld:focus-visible:not(.gewaehlt)::after {
  content: '';
  position: absolute;
  inset: 3%;
  width: auto;
  height: auto;
  background: none;
  border-radius: 20%;
  border: 4px solid var(--fokus);
}

/* Tunnels and moles sit in the same grid, under / over the fields. */
.gang {
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.gang-svg { display: block; width: 100%; height: 100%; }
.maulwurf-platz {
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.maulwurf-platz .maulwurf-svg {
  position: absolute;
  left: -18%;
  bottom: 8%;
  width: 136%;
  height: auto;
  overflow: visible;
}

/* ---------------------------------------------------------------- pieces */

.huegel-svg, .wurm-svg, .maulwurf-svg { display: block; }

.neu.huegel-svg {
  transform-origin: 50% 85%;
  animation: ploppen 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.neu .wurm-koerper {
  transform-box: fill-box;
  transform-origin: 50% 80%;
  animation: winden 1s ease-in-out both;
}
.neu.maulwurf-svg {
  transform-origin: 50% 100%;
  animation: auftauchen 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
.neu .pfote-winkt,
.titel-maulwurf .pfote-winkt {
  transform-box: view-box;
  transform-origin: 70px 82px;
  animation: winken 0.42s ease-in-out 0.45s 6 alternate both;
}
.titel-maulwurf .pfote-winkt { animation-delay: 0.8s; }

@keyframes ploppen {
  0% { transform: scale(0.2, 0.1); opacity: 0; }
  60% { transform: scale(1.12, 1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes winden {
  0% { transform: translateY(12px) scale(0.5); opacity: 0; }
  25% { transform: skewX(12deg); opacity: 1; }
  50% { transform: skewX(-10deg) scaleX(0.94); }
  75% { transform: skewX(6deg); }
  100% { transform: none; }
}
@keyframes auftauchen {
  0% { transform: translateY(40%) scaleY(0.5); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes winken {
  from { transform: rotate(-10deg); }
  to { transform: rotate(14deg); }
}
@keyframes pulsieren {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.92); }
}

/* ---------------------------------------------------------------- level tag */

.stufe-schild {
  margin-left: auto;
  padding: 3px 14px 1px;
  border-radius: 999px;
  background: var(--papier);
  border: 2px solid var(--papier-rand);
  color: var(--tinte-hell);
  font-weight: 700;
  font-size: 0.95rem;
}
.stufe-schild:empty { display: none; }

/* ---------------------------------------------------------------- digging */

.aufstellen-flaeche {
  --feld: 42px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 28px;
  margin: auto 0;
  padding-bottom: 12px;
}
.aufstellen-flaeche[data-layout='hoch'] {
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 0;
}
.aufstellen-flaeche .garten-raster { touch-action: none; }
.aufstellen-flaeche .feld { cursor: pointer; }
.aufstellen-flaeche .feld[data-gang] { cursor: grab; }

.werkzeug {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aufstellen-flaeche[data-layout='hoch'] .werkzeug { width: var(--garten, 100%); max-width: 100%; }
.aufstellen-flaeche[data-layout='hoch'] .tasten-hinweise { display: none; }

.hinweis {
  margin: 0;
  padding: 10px 14px 8px;
  background: var(--papier);
  border: 2px solid var(--papier-rand);
  border-radius: 16px;
  box-shadow: 4px 5px 0 var(--schatten);
  font-size: 0.98rem;
}
.hinweis.fehler { border-color: var(--fehler); color: #8f2a24; }

.ablage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(150, 100, 58, 0.18);
  border: 2px dashed rgba(90, 50, 25, 0.35);
  min-height: calc(var(--feld) + 42px);
}
.ablage-gang {
  appearance: none;
  position: relative;
  width: calc(var(--feld) * var(--laenge, 3) + 18px);
  height: calc(var(--feld) + 18px);
  padding: 6px;
  margin: 0;
  border: 3px solid transparent;
  border-radius: 14px;
  background: rgba(255, 248, 234, 0.55);
  cursor: grab;
  touch-action: none;
  font: inherit;
}
.ablage-gang .gang-svg { width: 100%; height: 100%; display: block; }
.ablage-gang:hover { background: rgba(255, 248, 234, 0.9); }
.ablage-gang.aktiv {
  border-color: var(--sonne);
  background: #fff6d6;
  box-shadow: 0 0 0 2px rgba(58, 36, 22, 0.35);
}
.ablage-gang[data-gegraben='1'] { opacity: 0.32; cursor: pointer; }
.ablage-gang[data-gegraben='1']::after {
  content: '✓';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: var(--wiese-dunkel);
}
/* Small sign on the chosen piece when it will be dug top to bottom. */
.ablage-gang[data-richtung='v'].aktiv::before {
  content: '↕ senkrecht';
  position: absolute;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--erde-dunkel);
  background: var(--sonne);
  border-radius: 999px;
}

.werkzeug-knoepfe { margin: 0; }
.aufstellen-flaeche[data-layout='quer'] #bereit-knopf { flex: 1 1 100%; }
.aufstellen-flaeche[data-layout='hoch'] .werkzeug-knoepfe { flex-wrap: nowrap; gap: 8px; }
.aufstellen-flaeche[data-layout='hoch'] .werkzeug-knoepfe .knopf { padding-left: 14px; padding-right: 14px; min-width: 0; flex: 1 1 auto; }
.aufstellen-flaeche[data-layout='hoch'] .hinweis { min-height: 0; font-size: 0.92rem; padding: 7px 12px 5px; }
.aufstellen-flaeche[data-layout='hoch'] .werkzeug { gap: 10px; }

/* Tunnels while digging: chosen, ghost (where it would go), not allowed. */
.gang.gewaehlt .gang-svg,
.gang.geist .gang-svg {
  filter: drop-shadow(0 0 2px var(--sonne)) drop-shadow(0 0 3px var(--sonne));
}
.gang.geist { opacity: 0.85; z-index: 4; }
.gang.ungueltig .gang-koerper { fill: var(--fehler); }
.gang.ungueltig .gang-svg { filter: drop-shadow(0 0 3px #ffb3ad); }
.gang.wackeln { animation: wackeln 0.35s ease-in-out; }
.gang.verraten { opacity: 0.55; }

.schwebe {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.92;
  filter: drop-shadow(4px 6px 0 rgba(58, 36, 22, 0.25));
}
.schwebe .gang-svg { width: 100%; height: 100%; display: block; }

@keyframes wackeln {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

/* ---------------------------------------------------------------- playing */

.spiel-flaeche {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.status-zeile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.status {
  margin: 0;
  padding: 9px 18px 7px;
  min-height: 46px;
  max-width: 640px;
  background: var(--papier);
  border: 2px solid var(--papier-rand);
  border-radius: 18px;
  box-shadow: 4px 5px 0 var(--schatten);
  font-weight: 600;
  text-align: center;
}
.status[data-ton='gut'] { border-color: var(--wiese); }
.status[data-ton='warten'] { color: var(--tinte-hell); }

.reiter {
  display: none;
  gap: 6px;
  padding: 4px;
  background: rgba(150, 100, 58, 0.18);
  border-radius: 999px;
}
.spiel-flaeche[data-layout='einzeln'] .reiter { display: flex; }
.reiter-knopf {
  appearance: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  border: 0;
  border-radius: 999px;
  padding: 7px 18px 5px;
  min-height: 40px;
  background: transparent;
  color: var(--erde-dunkel);
  cursor: pointer;
  position: relative;
}
.reiter-knopf[aria-selected='true'] { background: var(--papier); box-shadow: 0 2px 0 var(--schatten); }
/* A dot shows whose garden is being poked right now. */
.reiter-knopf[data-dran='1']::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--nase);
}

.gaerten {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 32px;
  width: 100%;
  touch-action: pan-y;
}
.garten-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.spiel-flaeche[data-layout='einzeln'] .garten-block:not([data-sichtbar='1']) { display: none; }
.spiel-flaeche[data-layout='einzeln'] .garten-name { display: none; }

.garten-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--erde-dunkel);
  padding: 2px 14px 0;
  border-radius: 999px;
}
.garten-block[data-dran='1'] .garten-name { background: var(--sonne); }
.garten-block[data-dran='1'] .garten-bild {
  box-shadow: 0 0 0 3px #fffdf6, 0 0 0 7px var(--sonne), 7px 9px 0 var(--schatten);
}
.garten-block[data-dran='0'] .garten { opacity: 0.93; }

.noch-zu-finden {
  max-width: var(--garten, 420px);
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  font-size: 0.88rem;
  color: var(--tinte-hell);
}
.mini-gang {
  display: inline-block;
  height: 16px;
  width: calc(16px * var(--laenge, 3));
  position: relative;
}
.mini-gang .gang-svg { width: 100%; height: 100%; display: block; }
.mini-gang.gefunden { opacity: 0.35; }
.mini-gang.gefunden::after {
  content: '✓';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -55%);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--wiese-dunkel);
}

.garten[data-aktiv='1'] .feld[data-zustand='leer'] { cursor: pointer; }

/* Phones held sideways: everything compact. */
.ansicht-feld[data-flach='1'] { padding-top: calc(6px + var(--safe-top)); padding-bottom: 6px; }
.ansicht-feld[data-flach='1'] .kopfleiste { margin-bottom: 4px; }
.ansicht-feld[data-flach='1'] .rund-knopf { width: 40px; height: 40px; }
.ansicht-feld[data-flach='1'] .garten-name,
.ansicht-feld[data-flach='1'] .tasten-hinweise { display: none; }
.ansicht-feld[data-flach='1'] .status { min-height: 0; padding: 4px 14px 2px; font-size: 0.9rem; }
.ansicht-feld[data-flach='1'] .spiel-flaeche { gap: 6px; }
.ansicht-feld[data-flach='1'] .noch-zu-finden { margin: 0; font-size: 0.78rem; gap: 2px 5px; }
.ansicht-feld[data-flach='1'] .mini-gang { height: 11px; width: calc(11px * var(--laenge, 3)); }

/* ---------------------------------------------------------------- online */

.spiel-flaeche[data-modus='online'] .nur-solo,
.spiel-flaeche:not([data-modus='online']) .nur-online { display: none; }

.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.karte-warten, .karte-code { max-width: 460px; }
.warten-bild { width: 120px; margin: -70px auto 4px; }
.warten-bild svg { width: 100%; height: auto; display: block; overflow: visible; }
.warten-text { margin: 0 0 6px; }
.code-anzeige {
  margin: 4px auto 10px;
  font-size: clamp(2.6rem, 14vw, 3.6rem);
  font-weight: 800;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: var(--erde-dunkel);
  background: #fff1cf;
  border: 3px dashed var(--papier-rand);
  border-radius: 18px;
  display: inline-block;
  min-width: 6.5em;
  line-height: 1.3;
}
.warten-hinweis { margin: 0 0 14px; color: var(--tinte-hell); font-size: 0.95rem; }
.karte-warten .warten-bild .maulwurf-svg .pfote-winkt {
  transform-box: view-box;
  transform-origin: 70px 82px;
  animation: winken 0.6s ease-in-out infinite alternate;
}

.code-form {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}
.code-eingabe {
  width: 6.4em;
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 6px 2px 14px;
  border: 3px solid var(--erde-dunkel);
  border-radius: 14px;
  background: #fffdf6;
  color: var(--erde-dunkel);
}
.code-eingabe::placeholder { color: #d9c9ad; }
.code-fehler { min-height: 1.4em; margin: 0 0 12px; color: #8f2a24; font-weight: 600; }

.verbindung {
  margin-left: auto;
  padding: 3px 12px 1px 26px;
  border-radius: 999px;
  background: var(--papier);
  border: 2px solid var(--papier-rand);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tinte-hell);
  position: relative;
  white-space: nowrap;
}
.verbindung::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--fehler);
}
.verbindung[data-zustand='offen']::before { background: var(--wiese); }
.verbindung[data-zustand='verbinde']::before { background: var(--sonne-dunkel); animation: pulsieren 0.8s ease-in-out infinite; }
.verbindung:not([hidden]) + .stufe-schild { margin-left: 8px; }

.lobkarten {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 760px;
}
.lobkarte {
  appearance: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 5px 12px 3px;
  min-height: 34px;
  border-radius: 999px;
  border: 2px solid var(--papier-rand);
  background: #fff6e0;
  color: var(--erde-dunkel);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--papier-rand);
}
.lobkarte:hover { background: #fff0c7; }
.lobkarte:disabled { opacity: 0.45; cursor: default; }
.ansicht-feld[data-flach='1'] .lobkarte { font-size: 0.78rem; min-height: 28px; padding: 3px 9px 1px; }
@media (max-width: 480px) {
  .lobkarte { font-size: 0.8rem; padding: 4px 9px 2px; }
  .verbindung { font-size: 0; padding: 0; width: 22px; height: 22px; }
  .verbindung::before { left: 4px; }
}

/* ---------------------------------------------------------------- dialog */

.dialog-schicht {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(58, 36, 22, 0.35);
  overflow-y: auto;
}
.dialog-karte {
  max-width: 440px;
  animation: auftauchen 0.3s ease-out both;
}
.dialog-bild { width: 150px; margin: -76px auto 0; }
.dialog-bild:empty { display: none; }
.dialog-bild svg { width: 100%; height: auto; display: block; overflow: visible; }
.dialog-text { margin: 0 0 16px; }

/* ---------------------------------------------------------------- message */

.meldung {
  position: absolute;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 10px 18px 8px;
  background: var(--erde-dunkel);
  color: #fffdf6;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
  text-align: center;
}
.meldung.sichtbar { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: absolute;
  inset: auto 16px 40% 16px;
  text-align: center;
  font-size: 1.2rem;
}

/* ---------------------------------------------------------------- reduced motion */
/* data-ruhig on <html>: set from the switch, default from the system. */

html[data-ruhig='1'] *,
html[data-ruhig='1'] *::before,
html[data-ruhig='1'] *::after {
  animation: none !important;
  transition: none !important;
}
