/*
 * Mein Lufox: Übersicht, Handy-Leiste und die Golem-Bühne.
 * Mobile zuerst (390 px), ab 700 px mehr Spalten. Tippflächen >= 44 px, Aktionen unten in Karten.
 * Bewegung: nur transform/opacity, 250-500 ms, aus bei prefers-reduced-motion oder html.lf-reduce-motion.
 */
.lfh { --lfh-gap: 14px; --lfh-r: 16px; display: grid; gap: 26px; padding-bottom: 12px; }
.lfh h1, .lfh h2 { margin: 0; }
.lfh-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lfh-bubble { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); flex: none; }
.dark .lfh-bubble { color: #b8a8ff; }

/* Begrüßung */
.lfh-hero { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 20px; border-radius: 22px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, .22), transparent 55%), radial-gradient(90% 120% at 100% 100%, rgba(14, 165, 196, .16), transparent 60%), var(--bg-elevated);
  border: 1px solid var(--line); position: relative; overflow: hidden; }
.lfh-hero:only-child, .lfh-hero:not(:has(.lfh-avatar)) { grid-template-columns: 1fr; }
.lfh-avatar { width: 64px; height: 64px; border-radius: 16px; image-rendering: pixelated; background: var(--bg-elevated-2); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.lfh-hero h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: var(--titel-spationierung); line-height: 1.1; }
.lfh-hero p { margin: 6px 0 0; color: var(--text-muted); max-width: 46ch; }
.lfh-wallet { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 14px; background: var(--bg-elevated-2);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.lfh-wallet .lfh-icon { width: 28px; height: 28px; color: var(--warn); }
.lfh-wallet strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.lfh-wallet small { color: var(--text-muted); }

/* Abschnitte */
.lfh-block { display: grid; gap: 12px; }
.lfh-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lfh-head a { font-size: .92rem; white-space: nowrap; }
.lfh h2.lfh-title { font-size: clamp(1.2rem, 4.5vw, 1.45rem); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.lfh-card { display: block; padding: 16px; border-radius: var(--lfh-r); background: var(--bg-elevated); border: 1px solid var(--line); color: var(--text); text-decoration: none; }

/* Als Nächstes */
.lfh-next { display: grid; gap: 10px; }
.lfh-next-card { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: start; transition: transform .25s ease, border-color .25s ease; }
.lfh-next-body { display: grid; gap: 4px; min-width: 0; }
.lfh-next-body small { color: var(--text-muted); line-height: 1.4; }
.lfh-chip { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: .92rem; }
.lfh-chip .lfh-icon { width: 18px; height: 18px; transition: transform .25s ease; }
.lfh-next-card:hover, .lfh-next-card:focus-visible { border-color: var(--accent); }
.lfh-next-card:hover .lfh-chip .lfh-icon { transform: translateX(3px); }
.lfh-bar { display: block; height: 8px; margin-top: 4px; border-radius: 99px; background: var(--bg-elevated-2); overflow: hidden; }
.lfh-bar i { display: block; height: 100%; width: var(--wert); border-radius: inherit; background: var(--iris); transform-origin: left; }
.lfh-bar-text { font-variant-numeric: tabular-nums; }

/* Zahlen */
.lfh-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lfh-tile { display: grid; gap: 4px; padding: 14px; border-radius: var(--lfh-r); background: var(--bg-elevated); border: 1px solid var(--line); }
.lfh-tile .lfh-bubble { width: 36px; height: 36px; border-radius: 11px; margin-bottom: 4px; }
.lfh-tile .lfh-icon { width: 19px; height: 19px; }
.lfh-tile strong { font-size: 1.45rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lfh-tile strong small { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.lfh-tile > span:last-child { color: var(--text-muted); font-size: .9rem; }
.lfh-hint { margin: 0; color: var(--text-muted); font-size: .92rem; }

/* Helfer: seitlich wischen */
.lfh-golems { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 44%); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.lfh-golem { scroll-snap-align: start; display: grid; justify-items: center; gap: 4px; padding: 14px 10px; border-radius: var(--lfh-r); background: var(--bg-elevated); border: 1px solid var(--line); color: var(--text); text-decoration: none; text-align: center; transition: transform .25s ease, border-color .25s ease; }
.lfh-golem strong { font-size: .98rem; }
.lfh-golem-stage { position: relative; display: grid; place-items: center; width: 100%; height: 104px; border-radius: 12px; background: radial-gradient(60% 55% at 50% 60%, var(--accent-soft), transparent 70%); }
.lfh-golem-stage::after { content: ""; position: absolute; bottom: 10px; width: 46px; height: 8px; border-radius: 50%; background: rgba(0, 0, 0, .28); filter: blur(2px); }
.lfh-golem img { position: relative; z-index: 1; width: 84px; height: 84px; object-fit: contain; image-rendering: pixelated; }
.lfh-state { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); }
.lfh-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.lfh-golem.is-an .lfh-state i { background: var(--ok); box-shadow: 0 0 0 3px rgba(102, 231, 119, .18); }
.lfh-golem:hover, .lfh-golem:focus-visible { border-color: var(--accent); }
.lfh-empty { margin: 0; padding: 16px; border-radius: var(--lfh-r); border: 1px dashed var(--line-strong); color: var(--text-muted); }

/* Bereiche */
.lfh-areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lfh-area { display: grid; gap: 6px; align-content: start; min-height: 112px; padding: 14px; border-radius: var(--lfh-r); background: var(--bg-elevated); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: transform .25s ease, border-color .25s ease; }
.lfh-area strong { display: flex; align-items: center; gap: 6px; }
.lfh-area small { color: var(--text-muted); line-height: 1.35; }
.lfh-area:hover, .lfh-area:focus-visible { border-color: var(--accent); }
.lfh-badge { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--fehler); color: #fff; font-size: .75rem; display: inline-grid; place-items: center; }

/* Mehr */
.lfh-more { border-radius: var(--lfh-r); border: 1px solid var(--line); background: var(--bg-elevated); }
.lfh-more summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; color: var(--text-muted); }
.lfh-more summary::-webkit-details-marker { display: none; }
.lfh-more summary::after { content: "›"; margin-left: auto; font-size: 1.4rem; transition: transform .25s ease; }
.lfh-more[open] summary::after { transform: rotate(90deg); }
.lfh-more-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 0 16px 14px; }
.lfh-more-links a { display: flex; align-items: center; min-height: 44px; }

/* Konto verbinden */
.lfh-link h2 { font-size: 1.2rem; }
.lfh-steps { margin: 12px 0; padding-left: 1.3em; color: var(--text-muted); display: grid; gap: 4px; }
.lfh-btn { min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--iris); color: #fff; font-weight: 600; cursor: pointer; }
.lfh-code code { font-size: 1.05rem; }
.lfh-link-more { display: inline-block; margin-top: 12px; }

@media (min-width: 700px) {
  .lfh { gap: 32px; }
  .lfh-hero { grid-template-columns: auto 1fr auto; padding: 26px 28px; }
  .lfh-hero:not(:has(.lfh-avatar)) { grid-template-columns: 1fr auto; }
  .lfh-avatar { width: 84px; height: 84px; }
  .lfh-wallet { grid-column: auto; min-width: 210px; }
  .lfh-next { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .lfh-next-card { grid-template-rows: auto 1fr auto; }
  .lfh-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lfh-golems { grid-auto-columns: 180px; }
  .lfh-areas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lfh-more-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) { .lfh-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- Handy-Leiste (unten, Daumenbereich) ---------- */
.lfh-dock { display: none; }
@media (max-width: 760px) {
  .lfh-dock { position: fixed; z-index: 900; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px; border-radius: 20px; background: color-mix(in srgb, var(--bg-elevated) 88%, transparent); border: 1px solid var(--line-strong);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 12px 36px rgba(0, 0, 0, .35); }
  .lfh-dock a { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding-top: 6px; border-radius: 14px; color: var(--text-muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
  .lfh-dock a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  .dark .lfh-dock a[aria-current="page"] { color: #c7b9ff; }
  body.lfh-has-dock { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* ---------- Bewegung ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.lfh-js:not(.lf-reduce-motion) .lfh-reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1); }
  html.lfh-js:not(.lf-reduce-motion) .lfh-reveal.is-sichtbar { opacity: 1; transform: none; }
  html.lfh-js:not(.lf-reduce-motion) .lfh-reveal.is-sichtbar .lfh-bar i { animation: lfh-fuellen 1.1s cubic-bezier(.2, .7, .2, 1) both .15s; }
  html:not(.lf-reduce-motion) .lfh-golem img { animation: lfh-wippen 2.8s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.45s); }
  html:not(.lf-reduce-motion) .lfh-golem.is-an .lfh-golem-stage::before { content: ""; position: absolute; width: 5px; height: 5px; top: 30%; left: 30%; border-radius: 50%; background: #ffd66b; box-shadow: 34px 10px 0 -1px #c7b9ff, 18px -12px 0 -1px #7ee0f2; animation: lfh-funkeln 2.4s ease-in-out infinite; }
  html:not(.lf-reduce-motion) .lfh-golem:hover, html:not(.lf-reduce-motion) .lfh-area:hover, html:not(.lf-reduce-motion) .lfh-next-card:hover { transform: translateY(-3px); }
  html:not(.lf-reduce-motion) .lfh-golem:active, html:not(.lf-reduce-motion) .lfh-area:active, html:not(.lf-reduce-motion) .lfh-next-card:active { transform: scale(.98); }
}
@keyframes lfh-fuellen { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lfh-wippen { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes lfh-funkeln { 0%, 100% { opacity: 0; transform: translateY(6px) scale(.6); } 40% { opacity: 1; } 70% { opacity: .8; transform: translateY(-10px) scale(1); } }

/* ---------- Golem-Bühne (Seite eines Helfers) ---------- */
.lfg-hero { --farbe: #7c5cff; display: grid; gap: 0; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-elevated); margin-bottom: 18px; }
.lfg-stage { position: relative; min-height: 270px; display: grid; place-items: end center; padding: 58px 16px 34px; overflow: hidden;
  background: radial-gradient(70% 60% at 50% 70%, color-mix(in srgb, var(--farbe) 38%, transparent), transparent 70%), linear-gradient(180deg, color-mix(in srgb, var(--farbe) 22%, #0c0b1a) 0%, #0c0b16 100%); }
:root:not(.dark) .lfg-stage { background: radial-gradient(70% 60% at 50% 70%, color-mix(in srgb, var(--farbe) 30%, transparent), transparent 70%), linear-gradient(180deg, color-mix(in srgb, var(--farbe) 18%, #eef3ff) 0%, #f7f8ff 100%); }
.lfg-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(180deg, #5fae3a 0 8px, #4a8a2c 8px 10px, #7a5433 10px 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .12); }
.lfg-ground::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(0, 0, 0, .12) 14px 16px); }
.lfg-golem { position: relative; z-index: 2; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; -webkit-tap-highlight-color: transparent; }
.lfg-golem img { width: clamp(140px, 42vw, 190px); height: auto; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); transform-origin: 50% 100%; }
.lfg-golem::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 44%; height: 12px; margin-left: -22%; border-radius: 50%; background: rgba(0, 0, 0, .32); filter: blur(2px); transform-origin: center; }
.lfg-golem:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 6px; border-radius: 12px; }
.lfg-bubble { position: absolute; z-index: 3; top: 14px; left: 50%; transform: translateX(-50%); max-width: min(88%, 340px); margin: 0; padding: 10px 14px; border-radius: 14px;
  background: var(--bg-elevated); color: var(--text); border: 1px solid var(--line-strong); font-size: .92rem; line-height: 1.35; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.lfg-bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; background: inherit; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); transform: rotate(45deg); }
.lfg-sky { position: absolute; inset: 0; pointer-events: none; }
.lfg-sky i { position: absolute; bottom: 34px; width: 7px; height: 7px; border-radius: 2px; background: var(--teil, #ffd66b); opacity: 0; }
.lfg-sky i:nth-child(1) { left: 22%; } .lfg-sky i:nth-child(2) { left: 34%; width: 5px; height: 5px; } .lfg-sky i:nth-child(3) { left: 46%; }
.lfg-sky i:nth-child(4) { left: 58%; width: 5px; height: 5px; } .lfg-sky i:nth-child(5) { left: 68%; } .lfg-sky i:nth-child(6) { left: 78%; width: 6px; height: 6px; }
.lfg-ernte { --teil: #e9c54a; } .lfg-stein { --teil: #9aa0a8; } .lfg-blatt { --teil: #5fae3a; } .lfg-funken { --teil: #ff9a3c; } .lfg-dampf { --teil: rgba(255, 255, 255, .7); }
.lfg-sand { --teil: #e6d29a; } .lfg-glitzer { --teil: #c7b9ff; } .lfg-kiste { --teil: #b07a45; } .lfg-zahnrad { --teil: #c0c6cf; } .lfg-ziegel { --teil: #b5563c; }
.lfg-dampf .lfg-sky i { border-radius: 50%; width: 10px; height: 10px; }
.lfg-info { display: grid; gap: 10px; padding: 18px; }
.lfg-info h2 { margin: 0; font-size: clamp(1.5rem, 6vw, 2rem); letter-spacing: -0.02em; }
.lfg-info p { margin: 0; color: var(--text-muted); }
.lfg-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.lfg-fact { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--bg-elevated-2); border: 1px solid var(--line); font-size: .9rem; }
.lfg-fact i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.lfg-fact.is-an i { background: var(--ok); box-shadow: 0 0 0 3px rgba(102, 231, 119, .18); }
.lfg-progress { display: grid; gap: 6px; }
.lfg-progress strong { font-size: 1.3rem; } .lfg-progress small { color: var(--text-muted); }
@media (min-width: 820px) { .lfg-hero { grid-template-columns: minmax(300px, 44%) 1fr; } .lfg-stage { min-height: 320px; } .lfg-info { align-content: center; padding: 28px; } }

@media (prefers-reduced-motion: no-preference) {
  html:not(.lf-reduce-motion) .lfg-golem img { animation: lfg-atmen 3.2s ease-in-out infinite; }
  html:not(.lf-reduce-motion) .lfg-golem::after { animation: lfg-schatten 3.2s ease-in-out infinite; }
  html:not(.lf-reduce-motion) .lfg-stage:not(.is-an) .lfg-golem img { animation-duration: 5.5s; }
  html:not(.lf-reduce-motion) .lfg-stage.is-an .lfg-sky i { animation: lfg-teilchen 3.6s ease-out infinite; }
  html:not(.lf-reduce-motion) .lfg-sky i:nth-child(2) { animation-delay: -.6s; } html:not(.lf-reduce-motion) .lfg-sky i:nth-child(3) { animation-delay: -1.2s; }
  html:not(.lf-reduce-motion) .lfg-sky i:nth-child(4) { animation-delay: -1.8s; } html:not(.lf-reduce-motion) .lfg-sky i:nth-child(5) { animation-delay: -2.4s; } html:not(.lf-reduce-motion) .lfg-sky i:nth-child(6) { animation-delay: -3s; }
  html:not(.lf-reduce-motion) .lfg-golem.is-hopp img { animation: lfg-hopp .55s cubic-bezier(.3, .7, .3, 1.3); }
  html:not(.lf-reduce-motion) .lfg-bubble.is-neu { animation: lfg-blase .35s ease-out; }
}
@keyframes lfg-atmen { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-5px) scale(1.01, .99); } }
@keyframes lfg-schatten { 0%, 100% { transform: scaleX(1); opacity: .32; } 50% { transform: scaleX(.86); opacity: .22; } }
@keyframes lfg-teilchen { 0% { opacity: 0; transform: translateY(0) rotate(0); } 15% { opacity: .9; } 100% { opacity: 0; transform: translateY(-150px) rotate(160deg); } }
@keyframes lfg-hopp { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.08, .9); } 55% { transform: translateY(-26px) scale(.96, 1.05); } 80% { transform: translateY(0) scale(1.05, .95); } 100% { transform: none; } }
@keyframes lfg-blase { from { opacity: 0; transform: translate(-50%, 6px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* Lesbarkeit: im Dunkeln ist --accent ein helles Violett -> dunkle Schrift auf Knöpfen (Kontrast > 4.5:1). */
.dark .lfh-chip { color: #140d33; }
.lfh-hero p { font-size: .95rem; line-height: 1.45; }
@media (max-width: 699px) { .lfh-hero { padding: 16px; } .lfh-avatar { width: 56px; height: 56px; } .lfh-hero p { display: none; } }
.lfh .lfh-block > h2.lfh-title, .lfh .lfh-head > h2.lfh-title { margin: 0; }
