/* Hausaufgaben-Erklärer – Logik in web/src/hausaufgaben/ */
.ha-main { max-width: 820px; }
#ha { margin-bottom: var(--sp-7); display: flex; flex-direction: column; gap: var(--sp-4); }
.ha-center { text-align: center; }
.ha-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tg-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: var(--r-m); opacity: 0; pointer-events: none; transition: .2s; z-index: 1100; max-width: calc(100% - 32px); text-align: center; }
.tg-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Start */
.ha-hero { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--r-l); background: radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--c1, #8b5cf6) 16%, transparent), transparent 60%), var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 40px -32px var(--c2, #4f46e5); }
.ha-cam-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
@media (max-width: 520px) { .ha-cam-row { grid-template-columns: 1fr 1fr; } }
.ha-cam { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 130px; padding: 14px 10px; border-radius: 18px; border: 0; cursor: pointer; font: inherit; color: #fff; text-align: center;
  background: linear-gradient(140deg, var(--c1, #8b5cf6), var(--c2, #4f46e5)); box-shadow: 0 16px 30px -16px var(--c2, #4f46e5); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s; }
.ha-cam:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 22px 36px -16px var(--c2, #4f46e5); }
.ha-cam:active { transform: scale(.97); }
.ha-cam b { font-size: 1.05rem; }
.ha-cam small { opacity: .85; font-size: var(--fs-xs, .8rem); }
.ha-cam-ico { font-size: 2.4rem; line-height: 1; animation: haBob 3s ease-in-out infinite; }
.ha-cam--alt { background: var(--surface); color: var(--text); border: 2px dashed color-mix(in srgb, var(--c2, #4f46e5) 40%, var(--border)); box-shadow: none; }
.ha-cam--alt .ha-cam-ico { animation-delay: -1.5s; }
@keyframes haBob { 50% { transform: translateY(-5px) rotate(-6deg); } }
.ha-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.ha-thumb { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--bg-soft, #f1f5f9); box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .35); animation: haPop .35s cubic-bezier(.34, 1.56, .64, 1); }
.ha-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ha-thumb-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .7); color: #fff; cursor: pointer; font-size: .75rem; }
.ha-thumb-add { display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: var(--muted); border: 2px dashed var(--border); background: transparent; cursor: pointer; }
@keyframes haPop { from { transform: scale(.6); opacity: 0; } }
.ha-text { resize: vertical; min-height: 64px; }
.ha-label { font-weight: 700; font-size: var(--fs-s); }
.ha-label small { font-weight: 400; color: var(--muted); }
.ha-grade-box { display: flex; flex-direction: column; gap: 8px; }
.ha-grades { display: flex; flex-wrap: wrap; gap: 6px; }
.ha-grade { min-width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 700 var(--fs-s)/1 var(--font); cursor: pointer; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s; }
.ha-grade:hover { transform: translateY(-2px); }
.ha-grade[aria-pressed="true"] { background: linear-gradient(135deg, var(--c1, #8b5cf6), var(--c2, #4f46e5)); color: #fff; border-color: transparent; transform: scale(1.08); }
@media (max-width: 520px) { .ha-grades { display: grid; grid-template-columns: repeat(7, 1fr); } .ha-grade { min-width: 0; } }
.ha-promise { margin: 0; font-size: var(--fs-s); color: var(--muted); background: color-mix(in srgb, var(--c1, #8b5cf6) 8%, transparent); padding: 10px 12px; border-radius: 12px; }
.ha-streak, .ha-stars-total { font-weight: 700; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, #f97316 14%, transparent); }
.ha-stars-total { background: color-mix(in srgb, #eab308 16%, transparent); }
.ha-hist h2 { font-size: 1.05rem; margin: 0 0 10px; }
.ha-hist h2 small { font-weight: 400; color: var(--muted); font-size: var(--fs-xs, .8rem); }
.ha-hist-list { display: flex; flex-direction: column; gap: 6px; }
.ha-hist-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform .2s, border-color .15s; }
.ha-hist-item:hover { transform: translateX(3px); border-color: var(--c2, #4f46e5); }
.ha-hist-item > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ha-hist-item small { color: var(--muted); font-size: var(--fs-xs, .8rem); }
.ha-hist-emoji { font-size: 1.6rem; }
.ha-hist-x { padding: 6px 8px; color: var(--muted); border-radius: 8px; }
.ha-hist-x:hover { background: color-mix(in srgb, #ef4444 14%, transparent); color: #dc2626; }

/* Warten */
.ha-wait { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.ha-wait-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c2, #4f46e5) 15%, transparent); overflow: hidden; }
.ha-wait-bar span { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c1, #8b5cf6), var(--c2, #4f46e5)); transform-origin: left; animation: haLoad 40s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes haLoad { from { transform: scaleX(.03); } to { transform: scaleX(.96); } }

/* Lösung */
.ha-back { align-self: flex-start; }
.ha-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ha-head > div:nth-child(2) { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.ha-head b { font-size: 1.3rem; line-height: 1.2; }
.ha-head small { color: var(--muted); }
.ha-head-emoji { font-size: 2.6rem; line-height: 1; animation: haPop .5s cubic-bezier(.34, 1.56, .64, 1); }
.ha-mode button { min-height: 38px; font-size: var(--fs-s); }
.ha-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ha-tab { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 700 var(--fs-s)/1 var(--font); cursor: pointer; }
.ha-tab[aria-selected="true"] { background: var(--text); color: var(--surface); }
.ha-part { display: flex; flex-direction: column; gap: 14px; }
.ha-task { padding: 12px 14px; border-radius: 12px; background: repeating-linear-gradient(transparent 0 27px, color-mix(in srgb, #60a5fa 22%, transparent) 27px 28px), #fffef7; color: #1e293b; font-size: 1.05rem; line-height: 28px; border-left: 4px solid #f87171; }
.ha-task-l { display: block; font: 700 var(--fs-xs, .78rem)/1.6 var(--font); text-transform: uppercase; letter-spacing: .06em; color: #b91c1c; }
.ha-idea { margin: 0; }

/* Lernpfad */
.ha-path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ha-step { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.ha-step::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 3px; border-radius: 3px; background: var(--border); }
.ha-step:last-child::before { display: none; }
.ha-step.is-done::before { background: linear-gradient(var(--c1, #8b5cf6), var(--c2, #4f46e5)); }
.ha-step-dot { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--surface); border: 3px solid var(--border); color: var(--muted); z-index: 1; }
.ha-step.is-done .ha-step-dot { background: linear-gradient(135deg, var(--c1, #8b5cf6), var(--c2, #4f46e5)); border-color: transparent; color: #fff; animation: haPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ha-step.is-now .ha-step-dot { border-color: var(--c2, #4f46e5); color: var(--c2, #4f46e5); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c2, #4f46e5) 15%, transparent); animation: haPulse 1.8s ease-in-out infinite; }
@keyframes haPulse { 50% { box-shadow: 0 0 0 11px color-mix(in srgb, var(--c2, #4f46e5) 6%, transparent); } }
.ha-step.is-locked { opacity: .45; }
.ha-step.is-locked .ha-step-title::after { content: " 🔒"; font-size: .85em; }
.ha-step-body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; min-width: 0; }
.ha-step.is-done .ha-step-body { animation: haIn .4s cubic-bezier(.2, .9, .3, 1); }
@keyframes haIn { from { opacity: 0; transform: translateY(8px); } }
.ha-step-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ha-hint { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, #facc15 18%, transparent); animation: haIn .3s; }
.ha-explain { line-height: 1.6; overflow-wrap: anywhere; }
.ha-quiz { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c1, #8b5cf6) 8%, transparent); display: flex; flex-direction: column; gap: 8px; }
.ha-quiz-q { margin: 0; font-weight: 600; }
.ha-quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ha-opt { min-height: 40px; padding: 6px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: 600 var(--fs-s)/1.3 var(--font); cursor: pointer; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), border-color .15s; }
.ha-opt:not(:disabled):hover { transform: translateY(-2px); border-color: var(--c2, #4f46e5); }
.ha-opt.is-right { border-color: #22c55e; background: color-mix(in srgb, #22c55e 14%, var(--surface)); animation: haPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ha-opt.is-wrong { border-color: #ef4444; background: color-mix(in srgb, #ef4444 10%, var(--surface)); animation: haShake .4s; }
.ha-opt.is-off { opacity: .5; }
.ha-opt:disabled { cursor: default; }
.ha-quiz-fb { margin: 0; font-size: var(--fs-s); }
@keyframes haShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.ha-shake { animation: haShake .4s; border-color: #ef4444 !important; }

/* Ergebnis */
.ha-answer { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; border: 2px dashed color-mix(in srgb, var(--c2, #4f46e5) 45%, var(--border)); }
.ha-answer.is-open { border-style: solid; border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, var(--surface)); animation: haPop .45s cubic-bezier(.34, 1.56, .64, 1); }
.ha-answer-l { font-weight: 800; font-size: var(--fs-s); text-transform: uppercase; letter-spacing: .05em; }
.ha-answer-v { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.ha-proof { margin: 0; color: var(--muted); font-size: var(--fs-s); }
.ha-try { display: flex; gap: 8px; }
.ha-try .h-input { flex: 1; min-width: 0; }
.ha-try-fb { margin: 0; color: #b45309; font-size: var(--fs-s); }
.ha-try-fb:empty { display: none; }

.ha-concept { background: linear-gradient(135deg, color-mix(in srgb, #38bdf8 12%, var(--surface)), var(--surface)); }
.ha-concept h3, .ha-mistakes h3, .ha-parents h3, .ha-practice h3, .ha-ask h3 { margin: 0 0 8px; font-size: 1.05rem; }
.ha-concept p { margin: 0 0 6px; }
.ha-example { font-family: ui-monospace, Consolas, monospace; background: var(--surface); padding: 6px 10px; border-radius: 8px; display: inline-block; }
.ha-example > span:first-child { font-family: var(--font); color: var(--muted); }
.ha-mistakes ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ha-parents { background: linear-gradient(135deg, color-mix(in srgb, #f472b6 12%, var(--surface)), var(--surface)); }
.ha-parents-mini summary { cursor: pointer; font-weight: 700; }
.ha-practice ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.ha-practice h3 small { font-weight: 400; color: var(--muted); font-size: var(--fs-s); }
.ha-prac { display: flex; flex-direction: column; gap: 8px; }
.ha-prac-q { font-weight: 600; }
.ha-prac-ok { margin: 0; color: #15803d; font-weight: 700; animation: haPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ha-demo-cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: linear-gradient(135deg, color-mix(in srgb, var(--c1, #8b5cf6) 14%, var(--surface)), var(--surface)); }

/* Fragen */
.ha-ask { display: flex; flex-direction: column; gap: 10px; }
.ha-chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px; }
.ha-msg { max-width: 88%; padding: 9px 13px; border-radius: 16px; line-height: 1.5; animation: haIn .3s; overflow-wrap: anywhere; }
.ha-msg--user { align-self: flex-end; background: linear-gradient(135deg, var(--c1, #8b5cf6), var(--c2, #4f46e5)); color: #fff; border-bottom-right-radius: 4px; }
.ha-msg--assistant { align-self: flex-start; background: color-mix(in srgb, var(--text) 6%, var(--surface)); border-bottom-left-radius: 4px; }
.ha-dots { display: inline-flex; gap: 4px; }
.ha-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: haDot 1s infinite; }
.ha-dots i:nth-child(2) { animation-delay: .15s; } .ha-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes haDot { 50% { transform: translateY(-5px); opacity: .5; } }
.ha-ask-row { display: flex; gap: 8px; align-items: flex-end; }
.ha-ask-row .h-input { flex: 1; min-width: 0; }
.ha-check summary { cursor: pointer; font-weight: 700; }
.ha-check[open] { display: flex; flex-direction: column; gap: 10px; }
.ha-verdict { padding: 12px 14px; border-radius: 12px; animation: haPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ha-verdict p { margin: 6px 0 0; }
.ha-verdict.is-richtig { background: color-mix(in srgb, #22c55e 14%, var(--surface)); }
.ha-verdict.is-fast { background: color-mix(in srgb, #f59e0b 14%, var(--surface)); }
.ha-verdict.is-falsch { background: color-mix(in srgb, #ef4444 10%, var(--surface)); }

@media (prefers-reduced-motion: reduce) { .ha-cam-ico, .ha-step.is-now .ha-step-dot { animation: none; } }
.ha-go { white-space: normal; line-height: 1.25; height: auto; min-height: 56px; padding-block: 10px; font-size: 1.1rem; }
.ha-grade-sel { max-width: 220px; }
