/* Wortschatz-App – Panda-Design */
[hidden] { display: none !important; }
@font-face {
  font-family: "Playwrite DE Grund";
  src: url("assets/fonts/PlaywriteDEGrund.woff") format("woff");
  font-weight: 100 400;
  font-display: swap;
}
:root {
  --ink: #1f1f24;
  --ink-soft: #55555f;
  --cream: #fff8ec;
  --paper: #ffffff;
  --gold: #f7c441;
  --gold-dark: #d9a21b;
  --line: #eadfca;
  --shadow: 0 4px 0 rgba(31, 31, 36, .12), 0 8px 22px rgba(31, 31, 36, .08);

  /* Artikelfarben */
  --der: #1f6fd9;
  --die: #d7263d;
  --das: #23964a;
  --pl:  #ee8400;

  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Playwrite DE Grund", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(247, 196, 65, .14) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 80%, rgba(247, 196, 65, .12) 0 160px, transparent 161px),
    var(--cream);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 6px solid var(--gold);
  box-shadow: 0 6px 0 #d7263d; /* Pulli-Streifen */
  margin-bottom: 6px;
}
.topbar h1 { flex: 1; margin: 0; font-size: clamp(1.25rem, 3.2vw, 1.8rem); font-weight: 800; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-kopf { flex: none; display: block; line-height: 0; }
.topbar-kopf img { width: 52px; height: 44px; object-fit: contain; }
.back {
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--gold); display: grid; place-items: center; flex: none;
}
.back svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.back:active { transform: scale(.94); }

main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 18px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; }

/* ---------- Allgemeine Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px; border-radius: 999px; border: 3px solid var(--ink);
  background: var(--gold); font-weight: 800; font-size: 1.15rem;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.light { background: var(--paper); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ok { background: #2fa84f; color: #fff; }
.btn.no { background: #e0393e; color: #fff; }
.btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn.small { min-height: 46px; font-size: 1rem; padding: 0 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- Artikel ---------- */
.art { font-weight: 800; }
.art-der { color: var(--der); }
.art-die { color: var(--die); }
.art-das { color: var(--das); }
.art-pl  { color: var(--pl); }
.bar-der { --c: var(--der); } .bar-die { --c: var(--die); } .bar-das { --c: var(--das); } .bar-pl { --c: var(--pl); }

/* ---------- Startseite ---------- */
.hero { display: flex; align-items: center; gap: 18px; justify-content: center; margin: 8px 0 26px; flex-wrap: wrap; text-align: center; }
.hero img { width: clamp(130px, 22vw, 200px); filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); }
.bubble {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 26px; padding: 16px 22px;
  font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 800; position: relative; box-shadow: var(--shadow); max-width: 520px;
}
.unit-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.unit {
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; text-decoration: none; color: inherit;
}
.unit img { height: 120px; max-width: 100%; object-fit: contain; }
.unit:active { transform: scale(.98); }

/* ---------- Menü ---------- */
.modes { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 6px; }
.mode {
  border: 3px solid var(--ink); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow);
  padding: 22px 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  position: relative; overflow: hidden; min-height: 230px; justify-content: center;
}
.mode::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 14px; background: linear-gradient(var(--ink) 0 33%, var(--die) 33% 66%, var(--gold) 66%); }
.mode .ico { width: 92px; height: 92px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; border: 3px solid var(--ink); }
.mode .ico svg { width: 52px; height: 52px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mode b { font-size: 1.5rem; }
.mode span { color: var(--ink-soft); font-size: 1.02rem; font-weight: 600; }
.mode:active { transform: scale(.98); }

/* ---------- Wortkarte (Bild + Label) ---------- */
.label { font-size: clamp(1.15rem, 2.3vw, 1.55rem); font-weight: 700; line-height: 1.15; text-align: center; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.label .art { margin-right: .25em; }

/* ---------- Lernen ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.toolbar .group { display: flex; gap: 12px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px 0 10px; border-radius: 999px; border: 3px solid var(--ink); background: var(--paper); font-weight: 800; font-size: 1.1rem; }
.switch .knob { width: 52px; height: 30px; border-radius: 999px; background: #cfc6b4; position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch[aria-pressed="true"] .knob { background: var(--ink); }
.switch[aria-pressed="true"] .knob::after { left: 25px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(46%, 170px), 1fr)); }
.tile {
  position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 10px 0; display: flex; flex-direction: column; align-items: center; overflow: hidden;
  transition: transform .15s, opacity .25s;
}
.tile .pic { width: 100%; aspect-ratio: 1; position: relative; }
.tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile { container-type: inline-size; }
.tile .label { font-size: min(1.8rem, 12cqi); hyphens: manual; -webkit-hyphens: manual; padding: 8px 4px 12px; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--c, transparent); }
.hide-text .tile .label { display: none; }
.hide-text .tile { padding-bottom: 12px; }
.tile.speaking { animation: pop .45s ease; }
.tile.gone { transform: scale(.6); opacity: 0; }
.tile .hide {
  position: absolute; top: 8px; right: 8px; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--paper); display: grid; place-items: center; z-index: 2;
}
.tile .hide svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.tile .hide:active { background: var(--gold); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06) rotate(-1deg); } 100% { transform: scale(1); } }

/* ---------- Testen ---------- */
.test { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.progress { width: 100%; max-width: 720px; }
.progress .meta { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 8px; font-size: 1.1rem; gap: 10px; flex-wrap: wrap; }
.progress .meta .piles { display: flex; gap: 14px; }
.pile { display: inline-flex; align-items: center; gap: 6px; }
.pile i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; border: 2px solid var(--ink); font-style: normal; }
.pile.ok i { background: #2fa84f; }
.pile.no i { background: #e0393e; }
.pile i svg { stroke: #fff !important; }
.pile i svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.track { height: 18px; border-radius: 999px; border: 3px solid var(--ink); background: var(--paper); overflow: hidden; }
.track > div { height: 100%; background: var(--gold); transition: width .3s; }

.flash {
  width: 100%; max-width: 560px; flex: 1; min-height: 300px; max-height: 620px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 30px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; padding: 18px; position: relative; overflow: hidden;
}
.flash .pic { flex: 1; width: 100%; min-height: 0; position: relative; }
.flash .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.flash .answer { min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.flash .answer .label { font-size: clamp(2rem, 6vw, 2.8rem); }
.flash .answer .qm { font-size: 2.4rem; font-weight: 900; color: #cfc6b4; letter-spacing: .2em; }
.flash::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--c, transparent); }
.flash.enter { animation: slidein .3s ease; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.speak {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--ink); background: var(--gold); display: grid; place-items: center; flex: none;
}
.speak svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 560px; }
.actions .btn { flex: 1 1 200px; min-height: 66px; font-size: 1.25rem; }

/* ---------- Memory ---------- */
.setup { max-width: 640px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
.setup h2 { margin: 0 0 12px; font-size: 1.4rem; }
.choices { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.choice {
  min-width: 76px; min-height: 64px; padding: 0 18px; border-radius: 20px; border: 3px solid var(--ink); background: var(--paper);
  font-weight: 900; font-size: 1.35rem; box-shadow: 0 4px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.choice[aria-pressed="true"] { background: var(--gold); }
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.choice small { font-size: .85rem; font-weight: 700; }

.mem { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.scores { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.score { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px; border: 3px solid var(--ink); background: var(--paper); font-weight: 800; font-size: 1.1rem; opacity: .55; transition: all .2s; }
.score b { font-size: 1.35rem; }
.score.active { opacity: 1; background: var(--gold); transform: scale(1.06); }
.score.solo { opacity: 1; }
.board { flex: 1; min-height: 0; display: grid; place-content: center; gap: var(--gap, 10px); }
.mcard { width: var(--cw); height: var(--ch); perspective: 900px; border: 0; padding: 0; background: none; }
.mcard .inner { position: relative; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.mcard.open .inner, .mcard.done .inner { transform: rotateY(180deg); }
.mcard .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.mcard .back-face {
  background:
    linear-gradient(var(--ink) 0 0) bottom/100% 22% no-repeat,
    linear-gradient(var(--die) 0 0) bottom 22% left 0/100% 10% no-repeat,
    var(--gold);
}
.mcard .back-face img { width: 62%; max-height: 62%; object-fit: contain; margin-bottom: 18%; }
.mcard .front-face { background: var(--paper); transform: rotateY(180deg); padding: 8%; flex-direction: column; gap: 6px; }
.mcard .front-face img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.mcard .front-face .label { font-size: var(--fs, 1.2rem); hyphens: manual; overflow-wrap: normal; }
.mcard .front-face .label .art { display: block; margin: 0; }
.mcard .front-face::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: var(--c, transparent); }
.mcard .front-face .mini-speak { width: 26%; max-width: 30px; height: auto; aspect-ratio: 1; fill: none; stroke: var(--ink-soft); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mcard.done .front-face { border-color: var(--gold-dark); box-shadow: inset 0 0 0 4px var(--gold); }
.mcard.done { animation: pop .5s ease; }
.mcard.gone { visibility: hidden; opacity: 0; transition: opacity .35s, visibility 0s .35s; pointer-events: none; }
.mcard.shake .inner { animation: shake .35s ease; }
@keyframes shake { 0%,100% { margin-left: 0; } 25% { margin-left: -6px; } 75% { margin-left: 6px; } }

/* ---------- Overlay (Panda-Lob) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(31, 31, 36, .55); z-index: 50; display: grid; place-items: center; padding: 20px; }
.overlay[hidden] { display: none; }
.card-pop {
  background: var(--paper); border: 4px solid var(--ink); border-radius: 32px; padding: 26px 24px 24px; max-width: 460px; width: 100%;
  text-align: center; box-shadow: 0 10px 0 var(--ink); animation: rise .35s cubic-bezier(.2, 1.4, .4, 1);
}
.card-pop img { width: min(200px, 50vw); margin-top: -90px; filter: drop-shadow(0 8px 10px rgba(0,0,0,.2)); animation: bounce 1.4s ease-in-out infinite; }
.card-pop h2 { margin: 8px 0 6px; font-size: 1.9rem; }
.card-pop p { margin: 0 0 20px; font-size: 1.2rem; font-weight: 600; color: var(--ink-soft); }
.card-pop .btns { display: flex; flex-direction: column; gap: 12px; }
@keyframes rise { from { transform: translateY(40px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.confetti { position: fixed; top: -20px; width: 12px; height: 18px; z-index: 60; pointer-events: none; animation: fall linear forwards; border-radius: 3px; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.empty { text-align: center; margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.empty img { width: 180px; }
.empty p { font-size: 1.3rem; font-weight: 700; margin: 0; }

@media (max-width: 520px) {
  main { padding: 12px 10px calc(18px + var(--safe-b)); }
  .grid { gap: 10px; }
  .tile { border-radius: 18px; padding: 8px 6px 0; }
  .tile .hide { width: 40px; height: 40px; top: 5px; right: 5px; }
  .btn { font-size: 1.05rem; }
  .mode { min-height: 170px; flex-direction: row; text-align: left; justify-content: flex-start; padding: 26px 16px 18px; }
  .mode .ico { width: 72px; height: 72px; flex: none; }
  .mode .ico svg { width: 40px; height: 40px; }
  .mode .txt { display: flex; flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Artikelfarben ausgeschaltet */
.no-colors .art { color: inherit; }
.no-colors .tile::after, .no-colors .flash::after, .no-colors .mcard .front-face::after { background: transparent; }

/* ---------- Impressum/Datenschutz (nur Übersicht) ---------- */
.legal { text-align: center; margin: 28px 0 12px; font-size: .85rem; }
.legal a { color: var(--ink-soft); text-decoration: none; margin: 0 10px; }
.legal a:hover { text-decoration: underline; }

/* ---------- Vollbild (in Entdecken, Üben, Spielen) ---------- */
.fs-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; flex: none;
  background: var(--gold); display: grid; place-items: center;
}
.fs-btn svg, .fs-exit svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fs-btn:active, .fs-exit:active { transform: scale(.94); }
.fs-exit {
  position: fixed; z-index: 50; top: max(8px, env(safe-area-inset-top)); right: 12px;
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--gold); display: grid; place-items: center; opacity: .75;
  box-shadow: 0 3px 0 rgba(31, 31, 36, .25);
}
.fs-exit:hover { opacity: 1; }
body.vollbild .topbar { display: none; }
body.vollbild main { padding-top: calc(58px + env(safe-area-inset-top, 0px)); }
