/* ---- page wrapper (matches the app's .page-content, incl. its breathing room) ---- */
.page { max-width: 72rem; margin: 0 auto; padding: 2rem 1.5rem; }
.page > .page-title { margin: 0 0 0.4rem; }
.page > .page-subtitle { margin: 0 0 1.75rem; }
.page-head-row + * { margin-top: 0; }

/* ---- KI generating animation (course/exam create) ---- */
.gen-loader { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2rem 1rem; text-align: center; }
.gen-orbit { width: 3.5rem; height: 3.5rem; position: relative; }
.gen-orbit::before, .gen-orbit::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--primary); animation: gen-spin 0.9s linear infinite; }
.gen-orbit::after { inset: 0.55rem; border-top-color: var(--schulivo-accent-lilac, #b98cea); animation-duration: 1.4s; animation-direction: reverse; }
.gen-title { font-weight: 700; }
.gen-sub { color: var(--muted-fg); font-size: 0.85rem; }

/* inline spinner for buttons in a loading state (uiux §9: KI-Aktionen zeigen Spinner) */
.btn-spin {
    width: 1.05em; height: 1.05em; flex-shrink: 0;
    border: 2px solid currentColor; border-top-color: transparent;
    border-radius: 999px; animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spin { animation-duration: 2.4s; } }
.gen-dots::after { content: ""; animation: gen-dots 1.4s steps(4, end) infinite; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
@keyframes gen-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@media (prefers-reduced-motion: reduce) { .gen-orbit::before, .gen-orbit::after, .gen-dots::after { animation: none; } }

/* subtle entrance for cards/panels */
.fade-in { animation: fade-in 0.35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- course history ---- */
.history-panel { margin-top: 1.5rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0; border-top: 1px solid var(--border); font-size: 0.88rem; }
.history-item:first-child { border-top: none; }
.history-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex-shrink: 0; background: var(--primary); }
.history-dot.done { background: #0ea053; }
.history-dot.quiz { background: var(--schulivo-accent-lilac, #b98cea); }
.history-dot.reset { background: var(--muted-fg); }
.history-body { flex: 1; min-width: 0; }
.history-course { font-weight: 600; }
.history-meta { color: var(--muted-fg); font-size: 0.78rem; }
.history-when { color: var(--muted-fg); font-size: 0.78rem; white-space: nowrap; }

/* ---- Tagebuch: calendar ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cal-month { font-weight: 700; font-size: 1.15rem; text-transform: capitalize; }
.cal-head-right { display: flex; align-items: center; gap: 0.5rem; }
.cal-navbtn { width: 2rem; height: 2rem; border: 1px solid var(--border); background: var(--card); border-radius: 0.5rem; cursor: pointer; font-size: 1.1rem; color: var(--fg); line-height: 1; }
.cal-navbtn:hover { border-color: var(--primary); color: var(--primary); }
.cal-today { padding: 0.35rem 0.8rem; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; margin-bottom: 0.4rem; }
.cal-weekday { text-align: center; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--muted-fg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; }
.cal-cell { position: relative; aspect-ratio: 1 / 1; border: none; border-radius: 10px; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.22rem; padding: 0.3rem; transition: background 0.12s ease; }
.cal-cell:hover { background: var(--muted); }
.cal-cell.other { opacity: 0.35; }
.cal-num { font-weight: 500; font-size: 0.9rem; }
.cal-dots { display: flex; gap: 0.2rem; height: 0.4rem; }
.cal-dot { width: 0.38rem; height: 0.38rem; border-radius: 50%; background: var(--primary); }
.cal-dot.appt { background: var(--schulivo-warning, #efa831); }
.cal-legend { display: flex; gap: 1.2rem; margin-top: 0.9rem; font-size: 0.78rem; color: var(--muted-fg); }
.cal-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* flyout: right drawer on desktop, bottom sheet on mobile */
.diary-flyout-backdrop { position: fixed; inset: 0; background: rgba(12,18,26,0.35); z-index: 60; animation: fade-in 0.2s ease; }
.diary-flyout { position: fixed; z-index: 61; background: var(--card); display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(12,18,26,0.18); top: 0; right: 0; height: 100vh; width: min(30rem, 94vw); animation: flyout-in-right 0.25s ease; }
.diary-flyout-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.diary-flyout-title { font-weight: 700; text-transform: capitalize; }
.diary-flyout-head-actions { display: flex; align-items: center; gap: 0.5rem; }
.diary-add-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: none; border-radius: 50%; background: var(--primary); color: var(--primary-fg); cursor: pointer; }
.diary-add-btn svg { width: 1.15rem; height: 1.15rem; }
.diary-flyout-close { background: none; border: none; cursor: pointer; color: var(--muted-fg); font-size: 0.95rem; }
.diary-flyout-close svg { width: 1.2rem; height: 1.2rem; }
.diary-flyout-body { flex: 1; overflow-y: auto; padding: 1.2rem; }
.diary-flyout-subject { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--primary); margin: 1rem 0 0.4rem; }
.diary-flyout-entry { border: 1px solid var(--border); border-radius: 0.7rem; padding: 0.9rem; margin-bottom: 0.8rem; }
.diary-flyout-entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.diary-flyout-entry-title { font-weight: 700; }
/* media kept small so the summary is the focus */
.diary-entry-media { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.diary-mini-media { width: 3rem; height: 3rem; object-fit: cover; border-radius: 0.4rem; border: 1px solid var(--border); }
.diary-mini-file { width: 3rem; height: 3rem; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 0.4rem; text-decoration: none; font-size: 1.2rem; }
.diary-topics { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; }
.diary-topic { font-size: 0.72rem; background: var(--muted); color: var(--muted-fg); border-radius: 999px; padding: 0.2rem 0.6rem; }

/* appointments inside the flyout */
.diary-appt-block { margin-bottom: 0.5rem; }
.appt-row { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.4rem 0; border-top: 1px solid var(--border); }
.appt-row:first-of-type { border-top: none; }
.appt-time { font-weight: 700; font-size: 0.78rem; color: var(--primary); white-space: nowrap; }
.appt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appt-title { font-weight: 600; font-size: 0.88rem; }
.appt-meta { color: var(--muted-fg); font-size: 0.78rem; }
.appt-del { background: none; border: none; color: var(--muted-fg); cursor: pointer; font-size: 0.85rem; padding: 0.1rem 0.3rem; }
.appt-del:hover { color: #c0392b; }
.appt-add { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.appt-add-row { display: flex; gap: 0.4rem; }

/* flyout tabs */
.diary-tabs { display: flex; gap: 0.25rem; padding: 0 1.2rem; border-bottom: 1px solid var(--border); }
.diary-tab { border: none; background: none; padding: 0.7rem 0.4rem; margin-bottom: -1px; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--muted-fg); cursor: pointer; border-bottom: 2px solid transparent; }
.diary-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* upload modal dialog — centered, animates without shifting off-center */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12,18,26,0.4); z-index: 70; animation: fade-in 0.15s ease; }
.modal-dialog {
    position: fixed; z-index: 71; top: 50%; left: 50%;
    width: min(30rem, calc(100vw - 2.5rem));
    max-height: calc(100vh - 3rem); overflow-y: auto;
    background: var(--card); border-radius: 1rem; box-shadow: 0 24px 60px rgba(12,18,26,0.28);
    padding: 1.2rem; animation: modal-pop 0.16s ease;
    transform: translate(-50%, -50%);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-title { font-weight: 700; }

/* confirm dialog (irreversible actions) — reuses .modal-* */
.confirm-dialog { width: min(26rem, calc(100vw - 2.5rem)); }
.confirm-text { font-size: 0.9rem; line-height: 1.5; color: var(--muted-fg); margin: 0; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }

/* global error dialog (GlobalErrorBoundary) — reuses .modal-* / .confirm-* */
.error-dialog { width: min(28rem, calc(100vw - 2.5rem)); }
.error-dialog-title { display: flex; align-items: center; gap: 0.5rem; }
.error-dialog-icon { width: 1.15rem; height: 1.15rem; color: var(--schulivo-accent-coral); flex: none; }
.error-dialog-detail {
    margin: 0.85rem 0 0; padding: 0.7rem 0.8rem; max-height: 9rem; overflow: auto;
    background: var(--muted); border: 1px solid var(--border); border-radius: 0.6rem;
    font-size: 0.78rem; line-height: 1.45; color: var(--muted-fg); white-space: pre-wrap; word-break: break-word;
}
.error-dialog-detail-btn { margin-right: auto; }

/* ---- Lernreise (learning journeys) ---- */
.jr-list { display: grid; gap: 0.9rem; }
.jr-card { display: block; padding: 1.1rem 1.2rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); text-decoration: none; color: inherit; transition: border-color .12s ease, transform .12s ease; }
.jr-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.jr-card-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .35rem; }
.jr-card-title { font-weight: 700; font-size: 1.02rem; }
.jr-card-meta { font-size: .8rem; color: var(--muted-fg); }

.jr-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .18rem .5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted-fg); background: var(--muted); white-space: nowrap; }
.jr-badge.is-active { color: var(--primary); border-color: var(--primary); background: transparent; }
.jr-badge.is-done { color: var(--card); background: var(--primary); border-color: var(--primary); }
.jr-badge.is-failed { color: var(--schulivo-accent-coral); border-color: var(--schulivo-accent-coral); background: transparent; }

.jr-progress { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; margin-top: .55rem; }
.jr-progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }



.jr-task { padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--card); margin-bottom: .8rem; }
.jr-task-prompt { font-weight: 600; margin: 0 0 .6rem; }
.jr-options { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.jr-option { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: .6rem; cursor: pointer; font-size: .92rem; }
.jr-option.is-correct { border-color: var(--primary); }
.jr-option.is-wrong { border-color: var(--schulivo-accent-coral); }
.jr-reveal { margin-top: .7rem; font-size: .88rem; color: var(--muted-fg); }
.jr-reveal b { color: var(--primary); }

.jr-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.jr-daynav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1.2rem; }

/* section heading with breathing room to the content below (Dein Plan / Tage / …) */
.jr-h2 { margin: 1.6rem 0 .85rem; }
/* flat intake question — avoids the "card inside a card" look inside a .panel */
.jr-field { margin: 0 0 1.3rem; }
.jr-field:last-child { margin-bottom: 0; }
.jr-q-prompt { font-weight: 600; margin: 0 0 .55rem; }

/* add-choice cards */
.choice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.7rem; }
.choice-card { display: flex; flex-direction: column; gap: 0.3rem; text-align: left; padding: 1rem; border: 1px solid var(--border); border-radius: 0.8rem; background: var(--card); cursor: pointer; transition: border-color 0.12s ease, transform 0.12s ease; }
.choice-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.choice-emoji { font-size: 1.5rem; }
.choice-title { font-weight: 700; }
.choice-sub { font-size: 0.78rem; color: var(--muted-fg); line-height: 1.4; }
@keyframes modal-pop { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* ---- flashcards ---- */
.card-stats { display: flex; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.card-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1.2rem; display: flex; flex-direction: column; min-width: 8rem; }
.card-stat-num { font-size: 1.4rem; font-weight: 700; }
.card-stat-cap { font-size: 0.78rem; color: var(--muted-fg); }

/* set grid – tiles that look like little card stacks */
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.set-card { position: relative; display: block; }
.set-card-stack { position: absolute; inset: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); transform: rotate(2.5deg) translate(4px, 4px); transition: transform 0.18s ease; }
.set-card-body { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; transition: transform 0.18s ease, border-color 0.18s ease; }
.set-card:hover .set-card-body { border-color: var(--primary); transform: translateY(-3px); }
.set-card:hover .set-card-stack { transform: rotate(4deg) translate(6px, 6px); }
.set-card-name { font-weight: 700; }
.set-card-meta { color: var(--muted-fg); font-size: 0.8rem; }
.set-card-due { align-self: flex-start; font-size: 0.72rem; font-weight: 700; background: #fef3d6; color: #b9770a; border-radius: 999px; padding: 0.2rem 0.6rem; margin-top: 0.3rem; }
.set-card-ok { align-self: flex-start; font-size: 0.72rem; font-weight: 700; color: #0ea053; margin-top: 0.3rem; }
.choice-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .choice-grid-3 { grid-template-columns: 1fr; } }

/* card list + inline edit */
.cardlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cardlist-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0; border-top: 1px solid var(--border); font-size: 0.88rem; }
.cardlist-item:first-child { border-top: none; }
.cardlist-texts { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cardlist-front { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardlist-back { color: var(--muted-fg); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardlist-due { font-size: 0.75rem; color: var(--muted-fg); white-space: nowrap; }
.cardlist-edit { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.4rem 0; }

/* review + 3D flip */
.review-wrap { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; }
.review-top { display: flex; align-items: center; justify-content: space-between; }
.review-progress { color: var(--muted-fg); font-size: 0.85rem; }
.review-subject { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary); }
.review-front { font-size: 1.3rem; font-weight: 700; margin: 0; }
.review-back-content { width: 100%; text-align: left; overflow-y: auto; }
.review-actions { display: flex; gap: 0.6rem; justify-content: center; min-height: 3rem; }
.review-show { padding: 0.7rem 2rem; }
.grade-btn { border: none; border-radius: 999px; padding: 0.7rem 1.5rem; font-weight: 700; font-size: 0.92rem; cursor: pointer; color: var(--primary-fg); transition: transform 0.12s ease, filter 0.12s ease; }
.grade-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.grade-again { background: var(--schulivo-accent-coral); }
.grade-good { background: var(--primary); }
.grade-easy { background: var(--schulivo-success); }
.review-done { text-align: center; padding: 3rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.review-done-emoji { font-size: 3rem; }

.flip-scene { perspective: 1400px; animation: card-enter 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.flip-card {
    position: relative; height: min(24rem, 62vh); cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.35, 0.0, 0.15, 1);
}
.flip-card.flipped { transform: rotateY(180deg); }
.flip-face {
    position: absolute; inset: 0;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    background: var(--card); border: 1px solid var(--border); border-radius: 1.1rem;
    box-shadow: 0 14px 38px rgba(12,18,26,0.12);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.9rem; padding: 1.8rem 1.5rem; text-align: center; overflow: hidden;
}
.flip-back { transform: rotateY(180deg); }
.flip-back .review-back-content { flex: 1; }
.flip-hint { position: absolute; bottom: 0.9rem; left: 0; right: 0; font-size: 0.75rem; color: var(--muted-fg); }
@keyframes card-enter { from { opacity: 0; transform: translateX(26px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .flip-card { transition: none; } .flip-scene { animation: none; } }

/* ---- dashboard ---- */
.due-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; border-left: 4px solid var(--primary); }
.due-banner-title { font-weight: 700; margin: 0; }
.due-banner-sub { color: var(--muted-fg); font-size: 0.85rem; margin: 0.15rem 0 0; }
.dash-week-label { margin-bottom: 0.6rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.1rem; align-items: start; margin-top: 1.25rem; }
.dash-links { display: flex; flex-direction: column; gap: 0.35rem; }
.dash-link { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 0.6rem; font-weight: 600; font-size: 0.9rem; }
.dash-link:hover { background: var(--muted); }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---- row combo menu (⋯) ---- */
.rowmenu { position: relative; display: inline-flex; }
.rowmenu-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px solid var(--border); background: var(--card); border-radius: 0.5rem; cursor: pointer; color: var(--muted-fg); }
.rowmenu-btn:hover { border-color: var(--primary); color: var(--primary); }
.rowmenu-btn svg { width: 1.2rem; height: 1.2rem; }
.rowmenu-backdrop { position: fixed; inset: 0; z-index: 40; }
.rowmenu-list { position: absolute; top: calc(100% + 0.3rem); right: 0; z-index: 41; min-width: 11rem; background: var(--card); border: 1px solid var(--border); border-radius: 0.7rem; box-shadow: 0 12px 32px rgba(12,18,26,0.2); padding: 0.3rem; display: flex; flex-direction: column; animation: fade-in 0.12s ease; }
.rowmenu-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left; background: none; border: none; padding: 0.5rem 0.6rem; border-radius: 0.45rem; font: inherit; font-size: 0.88rem; color: var(--fg); cursor: pointer; text-decoration: none; }
.rowmenu-item:hover { background: var(--muted); }
.rowmenu-item svg { width: 1rem; height: 1rem; flex: none; }
.rowmenu-item.danger { color: #c0392b; }

/* set card corner menu */
.set-card > .rowmenu { position: absolute; top: 0.55rem; right: 0.55rem; z-index: 2; }
.set-card-body { display: flex; flex-direction: column; gap: 0.3rem; }

/* course flag + card foot */
.course-cover { position: relative; }
.course-flag { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; background: rgba(255,255,255,0.9); }
.course-flag.pub { color: #0ea053; }
.course-flag.priv { color: var(--muted-fg); }
.course-body-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.2rem; }

/* ---- guided tour ---- */
.tour-overlay { position: fixed; inset: 0; z-index: 90; }
.tour-dim { position: fixed; background: rgba(12,18,26,0.62); }
.tour-ring { position: fixed; border-radius: 0.7rem; box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px rgba(28,101,200,0.35); pointer-events: none; transition: all 0.25s ease; }
.tour-tooltip {
    position: fixed; left: 50%; transform: translateX(-50%);
    width: min(22rem, calc(100vw - 2rem));
    background: var(--card); border-radius: 1rem; box-shadow: 0 20px 55px rgba(12,18,26,0.35);
    padding: 1.1rem 1.2rem; z-index: 91; animation: fade-in 0.2s ease;
}
.tour-tooltip.tour-center { top: 50%; transform: translate(-50%, -50%); }
.tour-tooltip.tour-above { transform: translateX(-50%) translateY(-100%); }
.tour-emoji { font-size: 1.7rem; line-height: 1; }
.tour-title { font-weight: 700; font-size: 1.05rem; margin: 0.4rem 0 0.25rem; }
.tour-text { color: var(--muted-fg); font-size: 0.88rem; line-height: 1.5; margin: 0; }
.tour-text b { color: var(--fg); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.tour-progress { font-size: 0.78rem; color: var(--muted-fg); font-weight: 600; }
.tour-btns { display: flex; gap: 0.45rem; align-items: center; }
.tour-skip { background: none; border: none; color: var(--muted-fg); font-size: 0.8rem; cursor: pointer; }
.tour-skip:hover { color: var(--fg); }
.shell-tour-btn { display: flex; align-items: center; gap: 0.5rem; width: 100%; background: none; border: none; padding: 0.5rem 0.7rem; border-radius: 0.6rem; color: var(--muted-fg); font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.shell-tour-btn:hover { background: var(--muted); color: var(--fg); }
.shell-tour-btn svg { width: 1.05rem; height: 1.05rem; }

/* grade-button hints */
.grade-hint { display: flex; gap: 0.6rem; justify-content: center; margin-top: 0.4rem; }
.grade-hint span { flex: 1; max-width: 8rem; text-align: center; font-size: 0.72rem; color: var(--muted-fg); }

/* PWA install banner */
.install-banner {
    position: fixed; z-index: 80; left: 50%; bottom: 1rem; transform: translateX(-50%);
    width: min(34rem, calc(100vw - 2rem));
    display: flex; align-items: center; gap: 0.8rem;
    background: var(--card); border: 1px solid var(--border); border-radius: 1rem;
    box-shadow: 0 14px 40px rgba(12,18,26,0.22); padding: 0.8rem 1rem;
    animation: install-in 0.3s ease;
}
.install-banner-icon { width: 2.6rem; height: 2.6rem; border-radius: 0.6rem; border: 1px solid var(--border); flex-shrink: 0; }
.install-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.install-banner-title { font-weight: 700; font-size: 0.92rem; }
.install-banner-sub { font-size: 0.8rem; color: var(--muted-fg); line-height: 1.4; }
.install-banner-btn { flex-shrink: 0; }
.install-banner-close { background: none; border: none; color: var(--muted-fg); cursor: pointer; font-size: 0.9rem; padding: 0.2rem 0.35rem; flex-shrink: 0; }
@keyframes install-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 520px) { .choice-grid { grid-template-columns: 1fr; } }

@keyframes flyout-in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes flyout-in-bottom { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 860px) {
    .diary-flyout { top: auto; bottom: 0; right: 0; left: 0; width: auto; height: 82vh; border-radius: 1rem 1rem 0 0; animation: flyout-in-bottom 0.25s ease; }
    .cal-grid { gap: 0.25rem; }
    .cal-cell { border-radius: 0.5rem; }
}

/* ---- home cards ---- */
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.home-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; transition: border-color 0.12s ease, transform 0.12s ease; }
.home-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.home-card-emoji { font-size: 1.6rem; }
.home-card-title { font-weight: 700; font-size: 1.05rem; }
.home-card-text { color: var(--muted-fg); font-size: 0.85rem; line-height: 1.5; }

/* ---- shared UI ---- */
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.back-link { display: inline-flex; align-items: center; min-height: 2.25rem; color: var(--muted-fg); font-size: 0.88rem; font-weight: 500; margin-bottom: 0.4rem; text-decoration: none; }
.back-link:hover { color: var(--primary); }
.row-gap { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.section-title { font-weight: 700; margin: 0 0 0.6rem; }
.hint, .field-hint { color: var(--muted-fg); font-weight: 400; font-size: 0.8rem; }
.empty { color: var(--muted-fg); text-align: center; }
.quota-line { color: var(--muted-fg); font-size: 0.85rem; margin: -0.5rem 0 1rem; }
.full { width: 100%; margin-top: 0.6rem; }
.btn-danger-pill { border: 1px solid #f3c0c0; color: #c0392b; background: var(--card); border-radius: 999px; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.form-stack { display: flex; flex-direction: column; gap: 0.9rem; }
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem; }
.form-label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.85rem; }
.form-actions { display: flex; gap: 0.6rem; }
.form-error { color: #c0392b; font-size: 0.88rem; }
.upsell { display: flex; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 1.3rem; text-align: center; color: var(--muted-fg); cursor: pointer; font-size: 0.85rem; position: relative; }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-pick { cursor: default; }
.pick-row { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.5rem; width: 100%; }
.pick-btn { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--fg); font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.pick-btn:hover { border-color: var(--primary); }
.pick-btn svg { width: 1.05rem; height: 1.05rem; }
.pick-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tutor-toggle { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--muted); cursor: pointer; }
.tutor-toggle-title { font-weight: 700; display: block; }

.list { display: flex; flex-direction: column; gap: 0.6rem; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; }
.list-row:hover { border-color: var(--primary); }
.list-title { font-weight: 600; margin: 0; }
.list-sub { color: var(--muted-fg); font-size: 0.82rem; margin: 0.15rem 0 0; }
.status-badge { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.status-ready { background: #e5f6ec; color: #0ea053; }
.status-generating, .status-queued { background: #fef3d6; color: #b9770a; }
.status-failed { background: #fde5e3; color: #c0392b; }

.qcard { margin-bottom: 0.7rem; }
.qcard-head { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted-fg); margin-bottom: 0.4rem; }
.qtype { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.qtext { font-weight: 600; margin: 0 0 0.6rem; }
.qoptions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.qoptions li { padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.9rem; }
.qoptions li.correct { border-color: var(--schulivo-success); background: color-mix(in oklab, var(--schulivo-success) 15%, var(--card)); }
.qoptions li.selected { outline: 2px solid var(--primary); }
.qoptions-take { display: flex; flex-direction: column; gap: 0.4rem; }

/* fill-in / ordering / matching take widgets */
.q-hint { font-size: 0.82rem; color: var(--muted-fg); margin: 0 0 0.5rem; }
.order-list { display: flex; flex-direction: column; gap: 0.4rem; }
.order-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--card); }
.order-pos { flex-shrink: 0; width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--muted); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; }
.order-text { flex: 1; min-width: 0; font-size: 0.9rem; }
.order-btns { display: inline-flex; gap: 0.25rem; flex-shrink: 0; }
.match-list { display: flex; flex-direction: column; gap: 0.5rem; }
.match-row { display: flex; align-items: center; gap: 0.6rem; }
.match-left { flex: 1; min-width: 0; font-size: 0.9rem; }
.match-arrow { color: var(--muted-fg); flex-shrink: 0; }
.match-select { flex: 1; min-width: 0; }

/* blank (sidebar-free) layout for public pages like the shared quiz link */
.blank-shell { min-height: 100vh; background: var(--bg); color: var(--fg); font-family: var(--schulivo-font); }
.blank-main { max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* Info tooltip ("?" → Erklärung, woher ein Wert/Status kommt) */
.info-tip { position: relative; display: inline-flex; vertical-align: middle; }
.info-tip-btn { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--muted); color: var(--muted-fg); font-size: 0.72rem; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; }
.info-tip-btn:hover { border-color: var(--primary); color: var(--primary); }
.info-tip-backdrop { position: fixed; inset: 0; z-index: 60; }
.info-tip-pop { position: absolute; top: calc(100% + 0.35rem); z-index: 61; width: max-content; max-width: 18rem; background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 0.6rem; box-shadow: 0 12px 32px rgba(12,18,26,0.2); padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; animation: fade-in 0.12s ease; white-space: normal; }
.info-tip-pop-left { left: 0; }
.info-tip-pop-right { right: 0; }
.info-tip-title { font-weight: 700; font-size: 0.8rem; }
.info-tip-text { font-size: 0.8rem; line-height: 1.45; color: var(--muted-fg); }

/* Quick-Quiz manage tabs */
.quiz-tabs { margin: 0.25rem 0 1.25rem; flex-wrap: wrap; }

/* Quick-Quiz question editor */
.qedit-list { display: flex; flex-direction: column; gap: 1rem; }
.qedit-card { display: flex; flex-direction: column; gap: 0.85rem; }
.qedit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.qedit-points { display: inline-flex; flex-direction: column; gap: 0.25rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-fg); }
.qedit-points input { width: 4.5rem; height: 2.5rem; box-sizing: border-box; border-radius: 0.5rem; border: 1px solid var(--border); background: var(--muted); padding: 0 0.6rem; font-size: 0.95rem; font-weight: 600; color: var(--fg); text-align: center; }
.qedit-opts { display: flex; flex-direction: column; gap: 0.5rem; }
.qedit-opt { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem 0.35rem 0.4rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--card); transition: border-color 0.12s ease, background 0.12s ease; }
.qedit-opt.correct { border-color: var(--schulivo-success); background: color-mix(in oklab, var(--schulivo-success) 12%, var(--card)); }
.qedit-opt-letter { flex-shrink: 0; width: 1.7rem; height: 1.7rem; border-radius: 999px; background: var(--muted); color: var(--muted-fg); font-weight: 700; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; }
.qedit-opt.correct .qedit-opt-letter { background: var(--schulivo-success); color: var(--schulivo-primary-foreground); }
.qedit-opt .qedit-opt-input { flex: 1; min-width: 0; border: none; background: transparent; height: 2.2rem; padding: 0 0.3rem; font-size: 0.9rem; color: var(--fg); font-family: inherit; outline: none; }
.qedit-opt-toggle { flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--muted-fg); cursor: pointer; padding: 0.3rem 0.6rem; border-radius: 999px; border: 1px solid var(--border); user-select: none; }
.qedit-opt-toggle.on { color: var(--schulivo-success); border-color: var(--schulivo-success); background: color-mix(in oklab, var(--schulivo-success) 10%, var(--card)); }
.qedit-opt-toggle input { accent-color: var(--schulivo-success); margin: 0; }
.qedit-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.qedit-note { font-size: 0.8rem; color: var(--muted-fg); background: var(--muted); border-radius: 0.5rem; padding: 0.5rem 0.7rem; }

/* Quick-Quiz list (mobile-friendly, stacking cards) */
.quiz-list { display: flex; flex-direction: column; gap: 0.8rem; }
.quiz-card { border: 1px solid var(--border); border-radius: 0.8rem; background: var(--card); padding: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.quiz-card-head { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.quiz-card-title { display: flex; flex-direction: column; min-width: 0; }
.quiz-share { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.quiz-share .text-input { flex: 1 1 12rem; min-width: 0; }
.quiz-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* exam take: topbar + right-sliding solutions flyout */
.exam-take-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.exam-flyout-backdrop { position: fixed; inset: 0; background: rgba(12,18,26,0.35); z-index: 80; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.exam-flyout-backdrop.open { opacity: 1; pointer-events: auto; }
.exam-flyout { position: fixed; top: 0; right: 0; height: 100vh; width: min(30rem, 92vw); background: var(--card); border-left: 1px solid var(--border); box-shadow: -12px 0 40px rgba(12,18,26,0.22); z-index: 81; transform: translateX(100%); transition: transform 0.25s ease; display: flex; flex-direction: column; }
.exam-flyout.open { transform: translateX(0); }
.exam-flyout-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.exam-flyout-body { padding: 1rem 1.2rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.sol-item { border-bottom: 1px solid var(--border); padding-bottom: 0.8rem; }
.sol-item:last-child { border-bottom: none; }
.sol-q { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.4rem; }
.sol-expected { font-size: 0.85rem; margin: 0.3rem 0 0; }
@media (prefers-reduced-motion: reduce) { .exam-flyout { transition: none; } }
.opt-take { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; cursor: pointer; }
.qsolution { font-size: 0.82rem; color: var(--muted-fg); margin: 0.5rem 0 0; }
.qfeedback { font-size: 0.85rem; color: var(--fg); background: color-mix(in oklab, var(--schulivo-primary) 9%, var(--card)); padding: 0.4rem 0.6rem; border-radius: 0.4rem; margin: 0.4rem 0 0; }
.qfree { font-size: 0.85rem; margin: 0.4rem 0 0; }
.res-correct { border-left: 3px solid #0ea053; }
.res-wrong { border-left: 3px solid #c0392b; }
.score-panel { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.score-big { font-size: 1.8rem; font-weight: 700; }
.score-pct { color: var(--muted-fg); }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.course-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.course-card:hover { border-color: var(--primary); }
.course-cover { display: flex; align-items: flex-end; background: var(--c, #3b82f6); color: var(--primary-fg); padding: 1.1rem 0.9rem; min-height: 4.5rem; font-size: 0.78rem; }
.course-body { padding: 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; }
.course-title { font-weight: 700; margin: 0; }
.course-meta { color: var(--muted-fg); font-size: 0.8rem; margin: 0; }
.progress { height: 6px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }

.runner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start; }
.runner-side { display: flex; flex-direction: column; gap: 1.2rem; }
.course-hero { background: var(--c, #3b82f6); color: var(--primary-fg); border-radius: var(--radius); padding: 1.4rem; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.course-hero-title { font-size: 1.3rem; font-weight: 700; }
.summary-box { background: var(--muted); border-radius: 0.6rem; padding: 0.7rem 0.9rem; font-size: 0.9rem; margin-bottom: 0.9rem; }
.video { position: relative; padding-top: 56.25%; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0.6rem; }
.quiz-q { margin-bottom: 1rem; }
.quiz-qtext { font-weight: 600; }
.quiz-opt { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; margin-bottom: 0.35rem; cursor: pointer; }
.quiz-opt.correct { border-color: #0ea053; background: #e5f6ec; }
.quiz-opt.wrong { border-color: #c0392b; background: #fde5e3; }
.quiz-score { font-weight: 700; }
.runner-nav { display: flex; justify-content: space-between; gap: 0.6rem; margin-top: 1rem; }
.side-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 0.5rem; }
.side-module { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-fg); margin: 0.7rem 0 0.3rem; }
.side-lesson { display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left; background: none; border: none; padding: 0.4rem 0.5rem; border-radius: 0.5rem; cursor: pointer; font-size: 0.85rem; color: var(--fg); }
.side-lesson:hover { background: var(--muted); }
.side-lesson.active { background: var(--muted); font-weight: 600; }
.side-check { width: 0.9rem; height: 0.9rem; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.side-check.done { background: #0ea053; border-color: #0ea053; }
.module-block { margin-bottom: 0.8rem; }
.module-title { font-weight: 700; margin: 0 0 0.3rem; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.lesson-list li { font-size: 0.85rem; display: flex; gap: 0.5rem; align-items: center; }
.ltype { font-size: 0.7rem; font-weight: 700; color: var(--primary); }
.ldur { color: var(--muted-fg); margin-left: auto; font-size: 0.75rem; }

.lesson-md { line-height: 1.6; font-size: 0.92rem; }
.lesson-md h2 { font-size: 1.1rem; border-bottom: 1px solid var(--muted); padding-bottom: 0.2rem; }
.lesson-md h3 { font-size: 1rem; }
.lesson-md blockquote { background: rgba(28,101,200,0.06); border-left: 3px solid var(--primary); border-radius: 0 0.4rem 0.4rem 0; margin: 0.7rem 0; padding: 0.5rem 0.8rem; }
.lesson-md table { border-collapse: collapse; width: 100%; font-size: 0.85rem; display: block; overflow-x: auto; }
.lesson-md th, .lesson-md td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; }
.lesson-md thead th { background: var(--muted); }


.license-current { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; justify-content: space-between; margin-bottom: 1rem; }
.license-label { font-size: 0.75rem; text-transform: uppercase; color: var(--muted-fg); }
.license-plan { font-size: 1.4rem; font-weight: 700; margin: 0.1rem 0 0; }
.license-usage { display: flex; gap: 1.4rem; }
.usage-item { display: flex; flex-direction: column; }
.usage-num { font-size: 1.2rem; font-weight: 700; }
.usage-cap { font-size: 0.75rem; color: var(--muted-fg); }
.license-note { color: var(--muted-fg); font-size: 0.85rem; margin-bottom: 1rem; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.plan-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.plan-card.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card-head { display: flex; flex-direction: column; gap: 0.2rem; }
.plan-name { font-weight: 700; font-size: 1.1rem; }
.plan-price { font-size: 1.5rem; font-weight: 700; }
.plan-per { font-size: 0.8rem; font-weight: 400; color: var(--muted-fg); margin-left: 0.3rem; }
.plan-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; }
.plan-feats li::before { content: "\2713 "; color: #0ea053; font-weight: 700; }
.plan-badge { font-size: 0.8rem; font-weight: 700; color: var(--primary); }
.plan-badge.muted { color: var(--muted-fg); }
/* Billing page: even vertical rhythm between the stacked blocks (was cramped — the .panel blocks
   have no own margin, so the code panel sat flush against the plan cards). */
.billing-stack > * + * { margin-top: 1.25rem; }
.billing-stack .license-current { margin-bottom: 0; }
/* Licence-code row: align the "Einlösen" button with the input's bottom edge, not centred against
   the taller label+input stack. */
.code-panel .row-gap { align-items: flex-end; row-gap: 0.75rem; }
.code-panel .row-gap .form-label { flex: 1 1 16rem; }
.code-panel .row-gap .text-input { width: 100%; max-width: none; }

/* minmax(0,1fr), not 1fr: a plain 1fr column can't shrink below the widest unbreakable lesson content
   (long code line, mermaid diagram, URL) and pushed the whole player past the right screen edge. */
@media (max-width: 820px) { .runner { grid-template-columns: minmax(0, 1fr); } }
.runner-main { min-width: 0; }
.runner .lesson-md, .course-hero-title { overflow-wrap: break-word; }


/* =========================================================================
   skolio Personal — 1:1 design system (mobile-first)
   Matches ai-prompt-school.lovable.app/private
   ========================================================================= */

:root {
    --schulivo-background: oklch(0.995 0.003 255);
    --schulivo-foreground: oklch(0.17 0.02 260);
    --schulivo-card: oklch(1 0 0);
    --schulivo-primary: oklch(0.52 0.17 258);
    --schulivo-primary-foreground: oklch(0.99 0 0);
    --schulivo-muted: oklch(0.968 0.006 255);
    --schulivo-muted-foreground: oklch(0.52 0.02 258);
    --schulivo-border: oklch(0.92 0.006 255);
    --radius: 14px;
}

/* Category / activity tag colours (oklch bases → tinted pills) */
:root {
    --c-lernen: oklch(0.55 0.13 162);
    --c-hausuebung: oklch(0.54 0.15 255);
    --c-test: oklch(0.63 0.16 55);
    --c-abgabe: oklch(0.52 0.20 300);
    --c-schularbeit: oklch(0.58 0.20 22);
    --c-termin: oklch(0.52 0.03 260);
    --c-flashcards: oklch(0.55 0.12 165);
    --c-exam: oklch(0.52 0.17 258);
    --c-course: oklch(0.49 0.22 295);
    --c-diary: oklch(0.55 0.11 220);
    --c-note: oklch(0.52 0.03 260);
}

/* ---- shared page header (eyebrow + title + subtitle + optional action) ---- */
.px-head { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.px-head-main { min-width: 0; }
/* eyebrow = homepage pill badge ("✦ Für Schüler:innen …") with a Lucide sparkles icon via CSS mask,
   so no page markup has to change. */
.px-eyebrow {
    display: inline-flex; align-items: center; gap: 0.375rem; width: fit-content;
    padding: 0.25rem 0.75rem; border-radius: 9999px;
    background: var(--schulivo-secondary); color: var(--schulivo-secondary-foreground);
    font-size: 0.75rem; font-weight: 500; line-height: 1.4; margin-bottom: 0.7rem;
}
.px-eyebrow::before {
    content: ""; flex: none; width: 0.75rem; height: 0.75rem; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z'/%3E%3Cpath d='M20 2v4'/%3E%3Cpath d='M22 4h-4'/%3E%3Ccircle cx='4' cy='20' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z'/%3E%3Cpath d='M20 2v4'/%3E%3Cpath d='M22 4h-4'/%3E%3Ccircle cx='4' cy='20' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* homepage headline style: Inter 600, tight tracking (-1.5px @ 60px ≈ -0.025em) */
.px-title { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 0.5rem; line-height: 1.12; text-wrap: balance; }
.px-sub { color: var(--muted-fg); margin: 0; max-width: 46rem; line-height: 1.55; font-size: 1.02rem; }
.px-head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
/* On mobile the header "Neu" button is left-aligned, so a right-anchored dropdown would run off the
   left edge. Anchor the menu to the button's left edge instead so it opens into the screen. */
@media (max-width: 767px) {
    .px-head-actions .rowmenu-list { left: 0; right: auto; }
}
@media (min-width: 768px) {
    .px-title { font-size: 2.4rem; }
    .px-head { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
    .px-head-actions { flex-shrink: 0; }
}

/* pill buttons: ensure icon+label alignment */
.btn-primary-pill, .btn-ghost-pill { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.75rem; }
.btn-primary-pill svg, .btn-ghost-pill svg { width: 1.05em; height: 1.05em; }
.btn-block { width: 100%; box-sizing: border-box; }

/* =========================================================================
   Dashboard (Übersicht)
   ========================================================================= */
.dash-hero { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.dash-eyebrow { font-size: 0.85rem; color: var(--muted-fg); font-weight: 500; }
.dash-greeting { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin: 0.15rem 0 0.4rem; line-height: 1.15; }
.dash-sub { color: var(--muted-fg); margin: 0; max-width: 42rem; line-height: 1.5; }
.dash-hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
@media (min-width: 768px) {
    .dash-greeting { font-size: 2rem; }
    .dash-hero { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
    .dash-hero-actions { flex-shrink: 0; }
}

.dash-stats { display: grid; grid-template-columns: 1fr; gap: 0.8rem; margin-bottom: 1.1rem; }
@media (min-width: 560px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .dash-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; } }

.dash-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem 1.1rem; display: flex; align-items: flex-start; gap: 0.85rem; }
.dash-stat-icon { width: 2.6rem; height: 2.6rem; border-radius: 0.7rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in oklab, var(--primary) 12%, var(--card)); color: var(--primary); }
.dash-stat-icon svg { width: 1.3rem; height: 1.3rem; }
.dash-stat-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.dash-stat-label { font-size: 0.82rem; color: var(--muted-fg); }
.dash-stat-num { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.dash-stat-sub { font-size: 0.76rem; color: var(--muted-fg); }

.dash-columns { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
.dash-columns > * { min-width: 0; }
@media (min-width: 1024px) { .dash-columns { grid-template-columns: minmax(0, 1fr) 360px; gap: 1.1rem; } }

.dash-card-title { font-weight: 700; font-size: 1.1rem; margin: 0; }
.dash-card-sub { color: var(--muted-fg); font-size: 0.85rem; margin: 0.15rem 0 0; }
.dash-week-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dash-week-pct { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; font-weight: 700; color: var(--primary); background: color-mix(in oklab, var(--primary) 10%, var(--card)); padding: 0.25rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.dash-progress { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; margin: 0.9rem 0 0; }
.dash-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.4s ease; }
.dash-due { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; padding: 0.65rem 0.8rem; border-radius: 0.7rem; background: color-mix(in oklab, var(--primary) 9%, var(--card)); color: var(--primary); font-weight: 600; font-size: 0.88rem; }
.dash-section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-fg); margin: 1.3rem 0 0.7rem; }

.activity-list { display: flex; flex-direction: column; gap: 0.55rem; }
.activity-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--card); }
.activity-dc { width: 2.1rem; height: 2.1rem; border-radius: 999px; background: var(--muted); color: var(--muted-fg); display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0; }
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.activity-title { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-sub { font-size: 0.8rem; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-check { color: var(--c-lernen); display: flex; flex-shrink: 0; }
.activity-check svg { width: 1.15rem; height: 1.15rem; }

/* generic tinted tag pill (activities + categories) */
.tag { font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.6rem; border-radius: 8px; white-space: nowrap; flex-shrink: 0; }
.tag-flashcards { color: var(--c-flashcards); background: color-mix(in oklab, var(--c-flashcards) 13%, var(--card)); }
.tag-exam { color: var(--c-exam); background: color-mix(in oklab, var(--c-exam) 13%, var(--card)); }
.tag-course { color: var(--c-course); background: color-mix(in oklab, var(--c-course) 13%, var(--card)); }
.tag-diary { color: var(--c-diary); background: color-mix(in oklab, var(--c-diary) 13%, var(--card)); }
.tag-note { color: var(--c-note); background: color-mix(in oklab, var(--c-note) 13%, var(--card)); }
.tag-lernen { color: var(--c-lernen); background: color-mix(in oklab, var(--c-lernen) 13%, var(--card)); }
.tag-hausuebung { color: var(--c-hausuebung); background: color-mix(in oklab, var(--c-hausuebung) 13%, var(--card)); }
.tag-test { color: var(--c-test); background: color-mix(in oklab, var(--c-test) 13%, var(--card)); }
.tag-abgabe { color: var(--c-abgabe); background: color-mix(in oklab, var(--c-abgabe) 13%, var(--card)); }
.tag-schularbeit { color: var(--c-schularbeit); background: color-mix(in oklab, var(--c-schularbeit) 13%, var(--card)); }
.tag-termin { color: var(--c-termin); background: color-mix(in oklab, var(--c-termin) 13%, var(--card)); }

/* upcoming appointments */
.appt-days { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.9rem; }
.appt-day { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--card); }
.appt-daybox { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 0.7rem; background: var(--muted); flex-shrink: 0; }
.appt-dow { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--muted-fg); }
.appt-dm { font-size: 0.8rem; font-weight: 700; }
.appt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appt-title { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-meta { font-size: 0.8rem; color: var(--muted-fg); display: inline-flex; align-items: center; gap: 0.25rem; }
.appt-meta svg { width: 0.9em; height: 0.9em; }

/* =========================================================================
   Exams — create + recent (mirrors /private/exams)
   ========================================================================= */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 1024px) { .exam-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.1rem; } }

.gen-card-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.15rem; margin: 0 0 1rem; }
.gen-card-title svg { width: 1.25rem; height: 1.25rem; color: var(--primary); }

.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; }
@media (min-width: 640px) { .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.recent-title { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.9rem; }
.recent-list { display: flex; flex-direction: column; gap: 0.6rem; }
.results-rounds { display: flex; flex-direction: column; gap: 1rem; }

/* course accent carries into the lesson content — header and in-text highlights share the subject color */
.runner .lesson-md h1,
.runner .lesson-md h2,
.runner .lesson-md h3,
.runner .lesson-md h4 { color: var(--c, var(--primary)); }
.runner .lesson-md a { color: var(--c, var(--primary)); }
.runner .lesson-md strong { color: var(--c, inherit); }

/* image lightbox (Instagram-style viewer) */
.diary-mini-media-btn { padding: 0; border: none; background: none; cursor: pointer; display: inline-flex; }
.lightbox { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.lightbox:focus { outline: none; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 18, 0.92); }
.lightbox-figure { position: relative; z-index: 2; margin: 0; display: flex; flex-direction: column; align-items: center; gap: .6rem; max-width: 92vw; max-height: 90vh; }
.lightbox-img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: .5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox-cap { color: #fff; font-size: .8rem; opacity: .85; text-align: center; }
.lightbox-btn { position: absolute; top: 1rem; z-index: 3; width: 2.6rem; height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: none; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; text-decoration: none; }
.lightbox-btn:hover { background: rgba(255, 255, 255, .26); }
.lightbox-btn svg { width: 1.2rem; height: 1.2rem; }
.lightbox-close { left: 1rem; }
.lightbox-download { right: 1rem; }
.lightbox-nav { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; border-radius: 999px; border: none; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer; }
.lightbox-nav:hover { background: rgba(255, 255, 255, .26); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
@media (max-width: 640px) {
    .lightbox-nav { width: 2.4rem; height: 2.4rem; font-size: 1.5rem; }
    .lightbox-prev { left: .4rem; }
    .lightbox-next { right: .4rem; }
}

/* ---- Focused student dashboard (E1 redesign) ---- */
.dash2 { display: flex; flex-direction: column; gap: 1rem; max-width: 40rem; margin: 0 auto; }
.dash2-hello { display: block; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; color: var(--fg); margin-bottom: .2rem; }
@media (min-width: 768px) { .dash2-hello { font-size: 2.1rem; } }

/* 1) Primary "Weitermachen" — biggest, unmissable */
.dash2-continue { display: flex; flex-direction: column; gap: .2rem; justify-content: center; min-height: 8.5rem; padding: 1.5rem 1.4rem; border-radius: 1.2rem; text-decoration: none; color: var(--primary-fg); background: var(--c, var(--primary)); box-shadow: 0 12px 30px color-mix(in oklab, var(--c, var(--primary)) 30%, transparent); transition: transform .12s ease; }
.dash2-continue:hover { transform: translateY(-2px); }
.dash2-continue-eyebrow { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.dash2-continue-title { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.dash2-continue-pos { font-size: .92rem; opacity: .92; }
.dash2-continue-cta { display: inline-flex; align-items: center; gap: .4rem; margin-top: .8rem; font-weight: 700; font-size: .95rem; }
.dash2-continue-cta svg { width: 1.1rem; height: 1.1rem; }
.dash2-continue-empty { background: var(--muted); color: var(--fg); box-shadow: none; border: 1px solid var(--border); }

/* 2) Exam strip */
.dash2-exam { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border: 1px solid var(--border); border-left: 4px solid var(--schulivo-accent-coral); border-radius: .9rem; background: var(--card); }
.dash2-exam-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.dash2-exam-title { font-weight: 700; font-size: .95rem; }
.dash2-exam-sub { font-size: .82rem; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash2-exam .btn-primary-pill { flex: none; }
.dash2-prep-error { color: var(--schulivo-accent-coral); }

/* 3) Subject grid with subtle progress ring */
.dash2-subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 480px) { .dash2-subjects { grid-template-columns: repeat(3, 1fr); } }
.dash2-subject { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .6rem; border: 1px solid var(--border); border-radius: .9rem; background: var(--card); text-decoration: none; color: var(--fg); transition: border-color .12s ease, transform .12s ease; }
.dash2-subject:hover { border-color: var(--c); transform: translateY(-2px); }
.dash2-subject-name { max-width: 100%; font-size: .85rem; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash2-ring { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--muted) 0); }
.dash2-ring-in { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; background: var(--card); font-size: .9rem; font-weight: 800; color: var(--c); }

/* 4) Wiederholen — small, always visible */
.dash2-review { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--card); text-decoration: none; color: var(--fg); }
.dash2-review:hover { border-color: var(--primary); }
.dash2-review svg { width: 1.1rem; height: 1.1rem; color: var(--muted-fg); flex: none; }
.dash2-review-text { font-weight: 600; font-size: .9rem; }
.dash2-review-cta { margin-left: auto; font-size: .85rem; font-weight: 700; color: var(--primary); }
.dash2-review-empty { margin: 0; padding: .3rem 0; font-size: .85rem; color: var(--muted-fg); }

/* 5) Footer metric */
.dash2-foot { margin: .4rem 0 0; text-align: center; font-size: .8rem; color: var(--muted-fg); }

/* First-run branch (no full onboarding flow yet — just the switch) */
.dash2-firstrun { display: flex; flex-direction: column; align-items: center; gap: .6rem; max-width: 30rem; margin: 3rem auto 0; text-align: center; }
.dash2-firstrun-title { margin: 0; font-size: 1.9rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance; }
@media (min-width: 768px) { .dash2-firstrun-title { font-size: 2.4rem; } }
.dash2-firstrun-text { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--muted-fg); }
.dash2-firstrun-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .8rem; }

/* Loading skeleton */
.dash2-skeleton { display: flex; flex-direction: column; gap: 1rem; max-width: 40rem; margin: 0 auto; }
.dash2-sk-hero { height: 8.5rem; border-radius: 1.2rem; }
.dash2-sk-line { height: 1.2rem; width: 70%; }
.dash2-sk-tile { height: 6rem; border-radius: .9rem; }

/* ---- Snackbar / transient feedback (ISnackbarService + <SnackbarHost/>) ---- */
.snackbar-stack { position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: .5rem; width: min(26rem, calc(100vw - 1.5rem)); pointer-events: none; }
.snackbar { pointer-events: auto; display: flex; align-items: center; gap: .6rem; padding: .7rem .75rem .7rem .9rem; border-radius: .75rem; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: 0 12px 30px rgba(12, 18, 26, .22); font-size: .9rem; color: var(--fg); animation: snackbar-in .18s ease; }
.snackbar-icon { flex: none; display: inline-flex; }
.snackbar-icon svg { width: 1.15rem; height: 1.15rem; }
.snackbar-text { flex: 1; line-height: 1.35; }
.snackbar-close { flex: none; border: none; background: none; color: var(--muted-fg); cursor: pointer; font-size: 1rem; line-height: 1; padding: .15rem .25rem; border-radius: .3rem; }
.snackbar-close:hover { color: var(--fg); }
.snackbar-info { border-left-color: var(--primary); }
.snackbar-info .snackbar-icon { color: var(--primary); }
.snackbar-success { border-left-color: var(--schulivo-success, var(--schulivo-accent-mint)); }
.snackbar-success .snackbar-icon { color: var(--schulivo-success, var(--schulivo-accent-mint)); }
.snackbar-warning { border-left-color: var(--schulivo-warning, var(--schulivo-accent-yellow)); }
.snackbar-warning .snackbar-icon { color: var(--schulivo-warning, var(--schulivo-accent-yellow)); }
.snackbar-error { border-left-color: var(--schulivo-accent-coral); }
.snackbar-error .snackbar-icon { color: var(--schulivo-accent-coral); }
@keyframes snackbar-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .snackbar { animation: none; } }
@media (max-width: 640px) { .snackbar-stack { bottom: .8rem; } }
.recent-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem; text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
.recent-item:hover { border-color: color-mix(in oklab, var(--primary) 40%, var(--border)); background: color-mix(in oklab, var(--primary) 4%, var(--card)); }
.recent-link { display: flex; align-items: center; gap: 0.7rem; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.recent-ic { width: 2.2rem; height: 2.2rem; border-radius: 0.6rem; background: color-mix(in oklab, var(--primary) 12%, var(--card)); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recent-ic svg { width: 1.1rem; height: 1.1rem; }
.recent-body { min-width: 0; display: flex; flex-direction: column; }
.recent-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: 0.78rem; color: var(--muted-fg); }
.recent-note { font-size: 0.8rem; color: var(--muted-fg); margin: 1rem 0 0; line-height: 1.45; }

/* =========================================================================
   Course cards (Catalog + Feed + generic)
   ========================================================================= */
.crs-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 620px) { .crs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .crs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.crs-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
a.crs-card:hover { border-color: color-mix(in oklab, var(--primary) 35%, var(--border)); box-shadow: 0 6px 20px -12px rgba(20,30,60,0.35); }
.crs-cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--c, #4f46e5), color-mix(in oklab, var(--c, #4f46e5) 62%, black)); display: flex; align-items: center; justify-content: center; }
.crs-cover-play { color: rgba(255,255,255,0.85); }
.crs-cover-play svg { width: 3rem; height: 3rem; }
.crs-flag { position: absolute; top: 0.7rem; left: 0.7rem; display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 600; padding: 0.28rem 0.65rem; border-radius: 999px; background: rgba(255,255,255,0.92); color: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.crs-flag svg { width: 0.85em; height: 0.85em; }
.crs-flag.pub { background: var(--c-lernen); color: var(--primary-fg); }
.crs-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.crs-metatop { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.crs-eyebrow { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-fg); }
.crs-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; margin: 0; }
.crs-desc { font-size: 0.85rem; color: var(--muted-fg); line-height: 1.45; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crs-author { font-size: 0.8rem; color: var(--muted-fg); margin: 0; }
.crs-foot { display: flex; align-items: center; gap: 1rem; margin-top: auto; padding-top: 0.35rem; font-size: 0.82rem; color: var(--muted-fg); }
.crs-foot span { display: inline-flex; align-items: center; gap: 0.3rem; }
.crs-foot svg { width: 0.95em; height: 0.95em; }
.crs-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crs-chip { font-size: 0.72rem; font-weight: 500; padding: 0.18rem 0.55rem; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }
.crs-toggle { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.4rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.7rem; background: color-mix(in oklab, var(--muted) 60%, var(--card)); }
.crs-toggle-ic { display: flex; color: var(--muted-fg); }
.crs-toggle-ic svg { width: 1rem; height: 1rem; }
.crs-toggle-label { flex: 1; font-size: 0.82rem; font-weight: 500; }

/* toolbar: search + filter pills */
.tbar { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1.3rem; }
.tbar-search { position: relative; display: flex; align-items: center; }
.tbar-search svg { position: absolute; left: 0.9rem; width: 1.05rem; height: 1.05rem; color: var(--muted-fg); pointer-events: none; }
.tbar-search input { width: 100%; padding: 0.7rem 1rem 0.7rem 2.5rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font: inherit; font-size: 0.9rem; }
.tbar-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent); }
.tbar-filters { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.2rem; -webkit-overflow-scrolling: touch; }
.tbar-pill { flex-shrink: 0; padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--fg); cursor: pointer; transition: all 0.15s; }
.tbar-pill:hover { border-color: color-mix(in oklab, var(--primary) 40%, var(--border)); }
.tbar-pill.active { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
@media (min-width: 768px) {
    .tbar { flex-direction: row; align-items: flex-start; }
    .tbar-search { flex: 1 1 18rem; min-width: 15rem; }
    .tbar-filters { overflow-x: visible; flex-wrap: wrap; justify-content: flex-end; }
}

/* create / empty tile (dashed) */
.crs-create { border: 1.5px dashed var(--border); border-radius: var(--radius); background: color-mix(in oklab, var(--muted) 45%, var(--card)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: 2rem 1rem; min-height: 200px; text-align: center; text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
.crs-create:hover { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 6%, var(--card)); }
.crs-create-ic { color: var(--primary); }
.crs-create-ic svg { width: 1.8rem; height: 1.8rem; }
.crs-create-title { font-weight: 600; }
.crs-create-sub { font-size: 0.82rem; color: var(--muted-fg); }

/* =========================================================================
   Flashcards — decks (mirrors /private/flashcards)
   ========================================================================= */
.deck-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 560px) { .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.deck-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.deck-head { background: linear-gradient(135deg, var(--c, #4f46e5), color-mix(in oklab, var(--c, #4f46e5) 62%, black)); color: var(--primary-fg); padding: 1rem 1.1rem 1.1rem; position: relative; min-height: 96px; display: flex; flex-direction: column; justify-content: flex-end; }
.deck-head-ic { position: absolute; top: 0.8rem; right: 0.9rem; opacity: 0.85; }
.deck-head-ic svg { width: 1.4rem; height: 1.4rem; }
.deck-subject { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.deck-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; margin: 0.15rem 0 0; }
.deck-body { padding: 0.9rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.deck-count-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.deck-count { font-size: 0.85rem; color: var(--muted-fg); }
.deck-ai { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; font-weight: 600; color: var(--primary); background: color-mix(in oklab, var(--primary) 12%, var(--card)); padding: 0.15rem 0.5rem; border-radius: 999px; }
.deck-ai svg { width: 0.85em; height: 0.85em; }
.deck-prog-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; color: var(--muted-fg); }
.deck-prog-row b { color: var(--fg); font-weight: 700; }
.deck-prog { height: 7px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.deck-prog span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.deck-body .btn-primary-pill { margin-top: 0.35rem; }
.deck-menu { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 3; }
.deck-menu .rowmenu-btn { color: var(--primary-fg); }

/* =========================================================================
   Tagebuch (mirrors /private/tagebuch)
   ========================================================================= */
.diary-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
@media (min-width: 1024px) { .diary-layout { grid-template-columns: 380px minmax(0, 1fr); gap: 1.1rem; } }
.diary-left { display: flex; flex-direction: column; gap: 1rem; }

.selday-eyebrow { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-fg); }
.selday-title { font-size: 1.3rem; font-weight: 700; margin: 0.1rem 0 1rem; }
.selday-empty { border: 1.5px dashed var(--border); border-radius: 0.8rem; padding: 1.6rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; background: color-mix(in oklab, var(--muted) 40%, var(--card)); margin-bottom: 1.1rem; }
.selday-empty-ic { color: var(--muted-fg); }
.selday-empty-ic svg { width: 1.7rem; height: 1.7rem; }
.selday-empty-title { font-weight: 600; }
.selday-empty-sub { font-size: 0.82rem; color: var(--muted-fg); max-width: 24rem; }
.selday-field-label { display: block; font-weight: 600; font-size: 0.9rem; margin: 1rem 0 0.4rem; }

.termcard-title { display: flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 1rem; margin: 0 0 0.8rem; }
.termcard-title svg { width: 1.05rem; height: 1.05rem; color: var(--primary); }
.term-list { display: flex; flex-direction: column; gap: 0.5rem; }
.term-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 0.7rem; }
.term-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.term-row-title { font-weight: 600; font-size: 0.88rem; }
.term-row-meta { font-size: 0.78rem; color: var(--muted-fg); }

/* calendar tweaks for skolio look (works with existing .cal-*) */
/* today/selected calendar styling lives in the .sel / .today:not(.sel) rules below */

.recent-entries-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.entry-row { display: flex; gap: 0.8rem; padding: 0.8rem 0; border-top: 1px solid var(--border); }
.entry-row:first-child { border-top: none; }
.entry-datebox { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 0.6rem; background: var(--muted); flex-shrink: 0; }
.entry-mon { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; color: var(--muted-fg); }
.entry-day { font-size: 0.95rem; font-weight: 700; }
.entry-body { min-width: 0; flex: 1; }
.entry-title { font-weight: 600; font-size: 0.92rem; }
.entry-text { font-size: 0.83rem; color: var(--muted-fg); line-height: 1.45; margin: 0.1rem 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dash2-appts-more { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.9rem; font-weight: 600; font-size: 0.88rem; color: var(--primary); text-decoration: none; }
.dash2-appts-more:hover { text-decoration: underline; }
.dash2-appts-more svg { width: 1rem; height: 1rem; }

/* segmented control (add-type choice, category picker) */
.seg { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.seg-btn { flex: 1; min-width: fit-content; padding: 0.5rem 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font: inherit; font-size: 0.83rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.seg-btn.active { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }

.dropzone-hint { font-size: 0.78rem; color: var(--muted-fg); }
.exam-layout .dropzone { min-height: 150px; padding: 2rem 1rem; }

/* toggle switch */
.switch { position: relative; width: 2.6rem; height: 1.5rem; border-radius: 999px; border: none; background: color-mix(in oklab, var(--muted-fg) 35%, var(--card)); cursor: pointer; padding: 0; flex-shrink: 0; transition: background 0.2s; }
.switch.on { background: var(--primary); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; border-radius: 999px; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s; }
.switch.on .switch-knob { transform: translateX(1.1rem); }

.diary-right { display: flex; flex-direction: column; gap: 1rem; }
.cal .cal-cell.sel { background: var(--primary); }
.cal .cal-cell.sel .cal-num { color: var(--primary-fg); }
.cal .cal-cell.sel .cal-dot { background: rgba(255, 255, 255, 0.9); }
.cal .cal-cell.today:not(.sel) { background: color-mix(in oklab, var(--primary) 12%, var(--card)); }
.cal .cal-cell.today:not(.sel) .cal-num { color: var(--primary); font-weight: 700; }

/* lesson figures (skizze SVG + mermaid) */
.skizze { margin: 1.25rem 0; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 0.9rem; background: linear-gradient(180deg, var(--card), var(--card)); box-shadow: 0 1px 2px rgba(20,30,60,0.04); overflow-x: auto; }
.skizze svg { display: block; max-width: 100%; max-height: 340px; height: auto; margin: 0 auto; }
.skizze figcaption { margin-top: 0.6rem; font-size: 0.82rem; color: var(--muted-fg); text-align: center; }
.skizze-err { color: var(--muted-fg); font-size: 0.85rem; text-align: center; }
.lesson-md pre.mermaid { margin: 1.1rem 0; padding: 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--card); text-align: center; overflow-x: auto; }
.lesson-md pre.mermaid svg { max-width: 100%; height: auto; }

/* exam question with an embedded figure */
.qtext-fig { display: flex; gap: 0.4rem; align-items: baseline; }
.qtext-fig .qnum { font-weight: 600; flex-shrink: 0; }
.qbody { flex: 1; min-width: 0; }
.qbody.lesson-md > :first-child { margin-top: 0; }

/* disable user zoom (app-like); iOS auto-zooms inputs with font-size < 16px */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
input, select, textarea, .text-input, .select-input, .tbar-search input { font-size: 16px; }

/* =========================================================================
   Ideen & Wünsche (community feature board)
   ========================================================================= */
.idea-list { display: flex; flex-direction: column; gap: 0.8rem; }
.idea-card { display: flex; gap: 0.9rem; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.idea-vote { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.05rem; flex-shrink: 0; width: 2.5rem; padding: 0.35rem 0; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--card); color: var(--muted-fg); cursor: pointer; font: inherit; transition: all 0.15s; }
.idea-vote:hover { border-color: color-mix(in oklab, var(--primary) 45%, var(--border)); color: var(--primary); }
.idea-vote svg { width: 0.95rem; height: 0.95rem; }
.idea-vote-num { font-size: 0.9rem; font-weight: 700; color: var(--fg); }
.idea-vote.voted { background: color-mix(in oklab, var(--primary) 10%, var(--card)); border-color: var(--primary); color: var(--primary); }
.idea-vote.voted .idea-vote-num { color: var(--primary); }
.idea-vote.big { width: 2.8rem; padding: 0.45rem 0; }
.idea-main { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.35rem; }
.idea-main-head { display: flex; align-items: center; gap: 0.6rem; }
.idea-comments { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--muted-fg); }
.idea-comments svg { width: 0.95rem; height: 0.95rem; }
.idea-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.idea-desc { font-size: 0.88rem; color: var(--muted-fg); line-height: 1.45; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea-meta { font-size: 0.78rem; color: var(--muted-fg); margin: 0; }

/* status badges */
.fstatus { font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.fs-new { color: var(--c-termin); background: color-mix(in oklab, var(--c-termin) 13%, var(--card)); }
.fs-accepted { color: var(--c-exam); background: color-mix(in oklab, var(--c-exam) 13%, var(--card)); }
.fs-progress { color: var(--c-test); background: color-mix(in oklab, var(--c-test) 14%, var(--card)); }
.fs-done { color: var(--c-lernen); background: color-mix(in oklab, var(--c-lernen) 14%, var(--card)); }
.fs-declined { color: var(--c-schularbeit); background: color-mix(in oklab, var(--c-schularbeit) 13%, var(--card)); }

/* detail */
.idea-detail { display: flex; gap: 1rem; margin-bottom: 1.1rem; }
.idea-detail-main { flex: 1; min-width: 0; }
.idea-detail-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.4rem 0 0.3rem; }
.idea-detail-desc { font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; margin: 0.6rem 0 0; }
.idea-delete { margin-top: 0.9rem; background: none; border: none; color: var(--c-schularbeit); font: inherit; font-size: 0.82rem; cursor: pointer; padding: 0; }

.admin-panel { border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); }
.admin-panel-title { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.7rem; }

.comment-form { margin: 0.9rem 0 1.4rem; }
.comment-form textarea { width: 100%; display: block; }
.comment-list { display: flex; flex-direction: column; gap: 1rem; }
.comment { display: flex; gap: 0.65rem; align-items: flex-start; }
.comment-avatar { width: 2.2rem; height: 2.2rem; border-radius: 999px; background: var(--muted); color: var(--muted-fg); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; flex-shrink: 0; }
.comment-avatar.team { background: var(--primary); color: var(--primary-fg); }
.comment-bubble { flex: 1; min-width: 0; background: var(--muted); border: 1px solid transparent; border-radius: 2px 12px 12px 12px; padding: 0.6rem 0.85rem; }
.comment.team .comment-bubble { background: color-mix(in oklab, var(--primary) 7%, var(--card)); border-color: color-mix(in oklab, var(--primary) 25%, var(--border)); }
.comment-head { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.2rem; }
.comment-author { font-weight: 600; font-size: 0.88rem; }
.comment-team-badge { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary-fg); background: var(--primary); padding: 0.08rem 0.4rem; border-radius: 999px; }
.comment-when { font-size: 0.74rem; color: var(--muted-fg); }
.comment-del { margin-left: auto; background: none; border: none; color: var(--muted-fg); cursor: pointer; font-size: 0.85rem; line-height: 1; }
.comment-body { font-size: 0.9rem; line-height: 1.5; margin: 0; white-space: pre-wrap; word-break: break-word; }

/* course generation (queue) states */
.crs-cover-pending { display: flex; align-items: center; justify-content: center; }
.crs-cover-warn { color: rgba(255,255,255,0.95); }
.crs-cover-warn svg { width: 2.4rem; height: 2.4rem; }
.crs-spinner { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 3px solid rgba(255,255,255,0.4); border-top-color: var(--primary-fg); animation: crs-spin 0.8s linear infinite; }
@keyframes crs-spin { to { transform: rotate(360deg); } }
.crs-desc-error { color: var(--c-schularbeit); }
@media (prefers-reduced-motion: reduce) { .crs-spinner { animation-duration: 2s; } }

/* AI hand-drawn course cover illustration (sits over the coloured cover) */
.crs-cover-art { position: absolute; inset: 0; display: block; pointer-events: none; }
.crs-cover-art svg, .crs-cover-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.crs-cover.has-art { background: linear-gradient(135deg, color-mix(in oklab, var(--c, #4f46e5) 55%, var(--card)), color-mix(in oklab, var(--c, #4f46e5) 80%, var(--card))); }
.crs-cover .crs-flag, .crs-cover .crs-cover-play { z-index: 2; }

/* flashcard deck "Wie fit?" indicator colours */
.deck-prog span.fit-0 { background: #f43f5e; }
.deck-prog span.fit-1 { background: #f59e0b; }
.deck-prog span.fit-2 { background: #6366f1; }
.deck-prog span.fit-3 { background: #10b981; }
.deck-prog-row b.fit-0 { color: #f43f5e; }
.deck-prog-row b.fit-1 { color: #d97706; }
.deck-prog-row b.fit-2 { color: #6366f1; }
.deck-prog-row b.fit-3 { color: #10b981; }

/* exam list pending/failed states */
.recent-item-pending { opacity: 0.95; }
.recent-spin { width: 1.5rem; height: 1.5rem; flex-shrink: 0; border-radius: 50%; border: 2.5px solid color-mix(in oklab, var(--primary) 25%, var(--card)); border-top-color: var(--primary); animation: crs-spin 0.8s linear infinite; }
.recent-ic-err { background: color-mix(in oklab, var(--c-schularbeit) 12%, var(--card)); color: var(--c-schularbeit); }
.linklike { background: none; border: none; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .recent-spin { animation-duration: 2s; } }

/* lesson icon-tiles (skizze typ:"icons") — concepts without numbers */
.skizze:has(.sk-tiles) { border: none; background: none; padding: 0; box-shadow: none; }
.sk-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; }
.sk-tile { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 0.8rem; background: var(--card); }
.sk-tile-ic { width: 2.4rem; height: 2.4rem; border-radius: 0.65rem; display: flex; align-items: center; justify-content: center; }
.sk-tile-ic svg { width: 1.35rem; height: 1.35rem; }
.sk-tile-title { font-weight: 700; font-size: 0.95rem; }
.sk-tile-text { font-size: 0.83rem; color: var(--muted-fg); line-height: 1.4; }

/* dashboard: learning streak + review action cards */
.dash-streak { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.7rem; font-size: 0.85rem; font-weight: 600; color: #b45309; background: color-mix(in oklab, #f59e0b 15%, var(--card)); padding: 0.3rem 0.7rem; border-radius: 999px; }
.dash-actions { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .dash-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-action { display: flex; gap: 0.9rem; padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.dash-action-ic { width: 2.8rem; height: 2.8rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-action-ic svg { width: 1.5rem; height: 1.5rem; }
.act-review { background: color-mix(in oklab, var(--primary) 12%, var(--card)); color: var(--primary); }
.act-week { background: color-mix(in oklab, var(--c-lernen) 14%, var(--card)); color: var(--c-lernen); }
.dash-action-body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.dash-action-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.dash-action-sub { font-size: 0.85rem; color: var(--muted-fg); margin: 0 0 0.35rem; }
.dash-action .btn-primary-pill, .dash-action .btn-ghost-pill { align-self: flex-start; }

/* =========================================================================
   Wochenübersicht: mastery topics, learning plan, weekly tasks
   ========================================================================= */
.dash-explainer { font-size: 0.85rem; color: var(--muted-fg); background: var(--muted); border-radius: 0.7rem; padding: 0.7rem 0.9rem; margin: 0 0 1.4rem; line-height: 1.45; }

.mastery-cols { display: grid; grid-template-columns: 1fr; gap: 1.4rem; margin-bottom: 1.4rem; }
@media (min-width: 900px) { .mastery-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; } }
.mastery-cols .dash-card-sub { margin-bottom: 0.8rem; }
.topic-list { display: flex; flex-direction: column; gap: 0.7rem; }
.topic-card { background: var(--card); border: 1px solid var(--border); border-radius: 0.8rem; padding: 0.9rem 1rem; }
.topic-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem; }
.topic-headtext { min-width: 0; }
.topic-title { font-weight: 700; font-size: 0.98rem; margin: 0; }
.topic-subject { font-size: 0.8rem; color: var(--muted-fg); margin: 0.05rem 0 0; }
.topic-pct { font-size: 1.3rem; font-weight: 700; flex-shrink: 0; line-height: 1; }
.topic-pct.m-good { color: #10b981; }
.topic-pct.m-mid { color: #d97706; }
.topic-pct.m-low { color: #f43f5e; }
.topic-note { font-size: 0.83rem; color: var(--muted-fg); margin: 0.55rem 0 0; line-height: 1.4; }
.topic-exam { display: inline-block; margin-top: 0.6rem; font-size: 0.72rem; font-weight: 600; color: var(--c-schularbeit); background: color-mix(in oklab, var(--c-schularbeit) 12%, var(--card)); padding: 0.16rem 0.55rem; border-radius: 999px; }

.plan-empty { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; margin-top: 0.9rem; }
.plan-empty-text { font-size: 0.88rem; color: var(--muted-fg); margin: 0; line-height: 1.5; }
.plan-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.9rem; }
.plan-item { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--card); }
.plan-item-ic { flex-shrink: 0; }
.plan-item-text { font-size: 0.9rem; line-height: 1.4; }

.task-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.9rem; }
.task-item { display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--card); font: inherit; cursor: pointer; transition: background 0.12s; }
.task-item:hover { background: color-mix(in oklab, var(--muted) 60%, var(--card)); }
.task-check { width: 1.4rem; height: 1.4rem; border-radius: 0.4rem; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary-fg); }
.task-item.done .task-check { background: var(--primary); border-color: var(--primary); }
.task-check svg { width: 0.9rem; height: 0.9rem; }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-title { font-weight: 600; font-size: 0.9rem; }
.task-meta { font-size: 0.78rem; color: var(--muted-fg); }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted-fg); }

/* clickable "Lernstoff für heute" items */
.plan-item { align-items: center; }
.plan-item-link { text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
.plan-item-link:hover { border-color: color-mix(in oklab, var(--primary) 40%, var(--border)); background: color-mix(in oklab, var(--primary) 5%, var(--card)); }
.plan-item-arrow { width: 1.05rem; height: 1.05rem; margin-left: auto; color: var(--muted-fg); flex-shrink: 0; }

/* KI-Lernplan as numbered steps */
.plan-steps { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.9rem; }
.plan-step { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.85rem; border: 1px solid color-mix(in oklab, var(--primary) 18%, var(--border)); border-radius: 0.7rem; background: var(--card); text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
.plan-step:hover { border-color: color-mix(in oklab, var(--primary) 45%, var(--border)); background: color-mix(in oklab, var(--primary) 5%, var(--card)); }
.plan-step-num { flex-shrink: 0; width: 1.7rem; height: 1.7rem; border-radius: 999px; background: var(--primary); color: var(--primary-fg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; }
.plan-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.plan-step-title { font-weight: 600; font-size: 0.92rem; line-height: 1.35; }
.plan-step-why { font-size: 0.8rem; color: var(--muted-fg); line-height: 1.4; }
.plan-step-min { flex-shrink: 0; font-size: 0.75rem; font-weight: 600; color: var(--primary); background: color-mix(in oklab, var(--primary) 12%, var(--card)); border-radius: 999px; padding: 0.2rem 0.6rem; white-space: nowrap; }
.plan-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; flex-wrap: wrap; }
.plan-actions .btn-ghost-pill { padding: 0 0.95rem; }

/* section F quick-links */
.home-quicklinks { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }

/* =========================================================================
   Home (reduced Wochenübersicht) + flashcards rework
   ========================================================================= */
.page.dash > section { margin-bottom: 1.1rem; }
.home-hero { margin-bottom: 1.4rem; }
.home-hero .dash-greeting { margin: 0 0 0.4rem; }
.home-hero-sub { color: var(--muted-fg); font-size: 0.9rem; line-height: 1.5; margin: 0 0 1rem; max-width: 46rem; }
.home-hero-btn { width: 100%; justify-content: center; }
@media (min-width: 560px) { .home-hero-btn { width: auto; } }

.plan-panel { background: color-mix(in oklab, var(--primary) 7%, var(--card)); border-color: color-mix(in oklab, var(--primary) 22%, var(--border)); }
.plan-title { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 1rem; }
.plan-title svg { width: 1.1rem; height: 1.1rem; color: var(--primary); }
.plan-panel-text { color: var(--muted-fg); font-size: 0.82rem; line-height: 1.45; margin: 0.4rem 0 0.85rem; max-width: 46ch; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.2rem; }
.sec-count { font-size: 0.85rem; color: var(--muted-fg); white-space: nowrap; }

.appt2-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.9rem; }
.appt2-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: 0.7rem; }
.appt2-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appt2-title { font-weight: 600; font-size: 0.92rem; }
.appt2-meta { font-size: 0.8rem; color: var(--muted-fg); }

.topic-bar { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; margin: 0.6rem 0 0; }
.topic-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* deck footer: Lernen + delete */
.deck-foot { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.35rem; }
.deck-foot .btn-primary-pill { flex: 1; }
.deck-del { width: 2.5rem; height: 2.5rem; flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted-fg); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.deck-del:hover { border-color: var(--c-schularbeit); color: var(--c-schularbeit); }
.deck-del svg { width: 1.1rem; height: 1.1rem; }

/* learn modal */
.learn-dialog { max-width: 480px; }
.learn-progress { height: 6px; background: var(--muted); border-radius: 999px; overflow: hidden; margin: 0 0 1.2rem; }
.learn-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.25s ease; }
.learn-card { border: 1.5px dashed var(--border); border-radius: 0.9rem; background: color-mix(in oklab, var(--muted) 50%, var(--card)); min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem; padding: 1.6rem 1.2rem; text-align: center; cursor: pointer; }
.learn-side { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-fg); }
.learn-text { font-size: 1.3rem; font-weight: 600; line-height: 1.35; }
.learn-count { text-align: center; font-size: 0.8rem; color: var(--muted-fg); margin: 0.9rem 0; }
.learn-grades { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem; }
.learn-grades .btn-ghost-pill, .learn-grades .btn-primary-pill { width: 100%; }
.learn-finish { text-align: center; padding: 1.5rem 0.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.learn-finish-ic { font-size: 2.5rem; }
.learn-finish-title { font-weight: 600; margin: 0; }

/* create modal tabs */
.ctabs { display: flex; gap: 0.3rem; background: var(--muted); border-radius: 999px; padding: 0.25rem; margin-bottom: 1.1rem; }
.ctab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.5rem; border: none; border-radius: 999px; background: transparent; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--muted-fg); cursor: pointer; }
.ctab svg { width: 1rem; height: 1rem; }
.ctab.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(20,30,60,0.08); }
.mcard-list { display: flex; flex-direction: column; gap: 0.4rem; }
.mcard { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 0.6rem; }
.mcard-text { flex: 1; min-width: 0; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================================================
   Homepage look (schulivo.at) — decorative wallpaper, handwritten doodles, yellow marker,
   scribble sparkles. All colours from tokens; decoration never sits on top of content and
   respects prefers-reduced-motion. Components: AppBackdrop.razor, Marker.razor.
   ===================================================================================== */

/* wallpaper behind the content (inside .shell-body / .blank-shell, z-index:-1 in their stacking context) */
.app-backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.app-backdrop-blobs {
    position: absolute; inset: 0; opacity: .8;
    background:
        radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, var(--schulivo-primary) 22%, transparent), transparent 65%),
        radial-gradient(40% 40% at 90% 30%, color-mix(in oklab, var(--schulivo-accent-coral) 18%, transparent), transparent 70%),
        radial-gradient(40% 40% at 10% 60%, color-mix(in oklab, var(--schulivo-accent-mint) 18%, transparent), transparent 70%);
}
.app-backdrop-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(color-mix(in oklab, var(--schulivo-primary) 5%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in oklab, var(--schulivo-primary) 5%, transparent) 1px, transparent 1px);
    background-size: 60px 60px;
}
.app-backdrop-doodles { position: absolute; inset: 0; }
.doodle {
    position: absolute; white-space: nowrap; user-select: none;
    font-family: var(--schulivo-doodle-font); font-size: 1.125rem; line-height: 1.5;
    color: var(--schulivo-primary); opacity: var(--o, .14); transform: rotate(var(--r, 0deg));
}
@media (max-width: 767px) { .doodle { display: none; } }

/* public pages (BlankLayout) get the same wallpaper */
.blank-shell { position: relative; isolation: isolate; }

/* ---- Marker (yellow hand-drawn highlight behind a word) ----
   No isolation on purpose: the stroke multiplies with the real page behind it, so any letters it
   overlaps (neighbouring words) stay dark instead of being painted over. */
.mk { position: relative; display: inline-block; white-space: nowrap; }
.mk-text { position: relative; z-index: 1; }
.mk-svg {
    position: absolute; left: 50%; top: 54%; z-index: 0; pointer-events: none; overflow: visible;
    width: calc(100% + 0.45em); height: 150%; transform: translate(-50%, -50%);
    mix-blend-mode: multiply;
}
.mk-svg g { stroke: var(--schulivo-accent-yellow); }
.mk-stroke { stroke-dasharray: 900; stroke-dashoffset: 900; animation: mk-draw .9s cubic-bezier(.7, 0, .3, 1) .25s forwards; }
.mk-stroke-2 { animation-duration: .7s; animation-delay: .55s; }
.mk-stroke-3 { animation-duration: .6s; animation-delay: .8s; }
@keyframes mk-draw { to { stroke-dashoffset: 0; } }

/* scribble sparkle just above the marked word's top-right corner (stays clear of neighbouring
   words and of the line above in multi-line titles) */
.mk-spark { position: absolute; z-index: 1; width: .34em; height: .34em; right: -.36em; top: -.14em; pointer-events: none; overflow: visible; }
.mk-spark g { stroke: var(--schulivo-accent-yellow); stroke-width: 2.6; }

/* dashboard first run: hand-drawn arrow pointing at the primary action (desktop) */
.dash2-firstrun-actions { position: relative; }
.dash2-firstrun-arrow {
    position: absolute; width: 5.5rem; height: 3.6rem; right: -6.2rem; top: -2.4rem;
    transform: scaleX(-1); pointer-events: none; display: none;
}
.dash2-firstrun-arrow g { stroke: var(--schulivo-primary); }
@media (min-width: 768px) { .dash2-firstrun-arrow { display: block; } }

/* dark mode: calmer colour fields; marker as a softer band so light text keeps its contrast */
:root[data-theme="dark"] .app-backdrop-blobs { opacity: .45; }
:root[data-theme="dark"] .doodle { opacity: calc(var(--o, .14) * .8); }
:root[data-theme="dark"] .mk-svg { mix-blend-mode: normal; opacity: .5; }

@media (prefers-reduced-motion: reduce) {
    .mk-stroke { animation: none; stroke-dashoffset: 0; }
}

/* ---- Empty state in homepage look (EmptyState.razor) ---- */
.es {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; gap: .55rem; text-align: center;
    padding: 3rem 1.5rem 2.6rem;
    border: 2px dashed var(--border); box-shadow: none;
    background: color-mix(in oklab, var(--card) 90%, transparent);
}
.es-compact { padding: 1.4rem .5rem; gap: .4rem; border: 0; background: none; }
.es-ic {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 3.1rem; height: 3.1rem; border-radius: 9999px; margin-bottom: .25rem;
    background: color-mix(in oklab, var(--schulivo-primary) 10%, transparent); color: var(--schulivo-primary);
}
.es-ic > svg:not(.es-spark) { width: 1.4rem; height: 1.4rem; }
.es-compact .es-ic { width: 2.5rem; height: 2.5rem; }
.es-compact .es-ic > svg:not(.es-spark) { width: 1.15rem; height: 1.15rem; }
.es-spark { position: absolute; width: .85rem; height: .85rem; right: -.35rem; top: -.3rem; overflow: visible; }
.es-spark g { stroke: var(--schulivo-accent-yellow); }
.es-title { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.015em; color: var(--fg); text-wrap: balance; }
.es-compact .es-title { font-size: .98rem; }
.es-text { margin: 0; max-width: 28rem; font-size: .9rem; line-height: 1.55; color: var(--muted-fg); text-wrap: pretty; }
.es-actions { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .7rem; }
.es-arrow {
    position: absolute; width: 4.6rem; height: 3rem; right: -5.2rem; top: -1.9rem;
    transform: scaleX(-1); pointer-events: none; display: none;
}
.es-arrow g { stroke: var(--schulivo-primary); }
.es-doodle {
    position: absolute; pointer-events: none; user-select: none; white-space: nowrap;
    font-family: var(--schulivo-doodle-font); font-size: 1.05rem; color: var(--schulivo-primary); opacity: .17;
}
.es-doodle-a { top: 1rem; left: 1.3rem; transform: rotate(-10deg); }
.es-doodle-b { bottom: .9rem; right: 1.3rem; transform: rotate(8deg); }
@media (min-width: 768px) { .es-arrow { display: block; } }
@media (max-width: 640px) { .es-doodle { display: none; } }

/* =====================================================================================
   KI-Tutor (homepage look): pill FAB with sparkle avatar, handwritten "Frag mich" hint,
   chat card with grid-paper body, suggestion chips, round send button.
   ===================================================================================== */
.tutor-widget { position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: .75rem; }

.tutor-fab {
    position: relative; display: inline-flex; align-items: center; gap: .55rem;
    height: 3.1rem; padding: 0 1.3rem 0 .45rem; border: 0; border-radius: 9999px;
    background: var(--schulivo-primary); color: var(--schulivo-primary-foreground);
    font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 12px 26px -8px color-mix(in oklab, var(--schulivo-primary) 55%, transparent),
                0 4px 10px -4px color-mix(in oklab, var(--schulivo-primary) 35%, transparent);
    transition: transform .2s ease, box-shadow .2s ease, width .2s ease, padding .2s ease;
}
.tutor-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -10px color-mix(in oklab, var(--schulivo-primary) 60%, transparent), 0 6px 14px -6px color-mix(in oklab, var(--schulivo-primary) 40%, transparent); }
.tutor-fab:active { transform: scale(.97); }
.tutor-fab:focus-visible { outline: 2px solid var(--schulivo-primary); outline-offset: 3px; }
.tutor-fab-ic { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 9999px; background: var(--schulivo-card); color: var(--schulivo-primary); }
.tutor-fab-ic svg { width: 1.1rem; height: 1.1rem; }
.tutor-fab-spark { position: absolute; width: 1.05rem; height: 1.05rem; right: -.3rem; top: -.45rem; overflow: visible; pointer-events: none; }
.tutor-fab-spark g { stroke: var(--schulivo-accent-yellow); }
.tutor-widget.open .tutor-fab { width: 3.1rem; padding: 0; justify-content: center; }
.tutor-x { width: 1.3rem; height: 1.3rem; }

/* handwritten nudge with the homepage arrow, desktop only, until the tutor was opened once */
.tutor-hint {
    position: relative; display: none; margin: 0 3.4rem .1rem 0; white-space: nowrap; pointer-events: none;
    font-family: var(--schulivo-doodle-font); font-size: 1.05rem; color: var(--schulivo-primary);
    transform: rotate(-4deg);
}
.tutor-hint svg { position: absolute; width: 3.2rem; height: 2.3rem; right: -3.2rem; top: .55rem; transform: rotate(18deg); overflow: visible; }
.tutor-hint g { stroke: var(--schulivo-primary); }
@media (min-width: 768px) { .tutor-hint { display: block; } }

.tutor-chat {
    width: min(24rem, calc(100vw - 2rem)); height: min(34rem, calc(100vh - 7.5rem));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--schulivo-card); border: 1px solid var(--schulivo-border); border-radius: 1.25rem;
    box-shadow: 0 24px 60px -12px rgba(12, 18, 26, .28), 0 8px 20px -8px rgba(12, 18, 26, .18);
    transform-origin: bottom right; animation: tutor-in .22s ease-out;
}
@keyframes tutor-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.tutor-head {
    display: flex; align-items: center; gap: .65rem; padding: .75rem .7rem .75rem .9rem;
    border-bottom: 1px solid var(--schulivo-border);
    background: color-mix(in oklab, var(--schulivo-primary) 6%, var(--schulivo-card));
}
.tutor-avatar {
    position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 2.3rem; height: 2.3rem; border-radius: 9999px;
    background: var(--schulivo-primary); color: var(--schulivo-primary-foreground);
}
.tutor-avatar > svg:first-child { width: 1.1rem; height: 1.1rem; }
.tutor-avatar-sm { width: 1.75rem; height: 1.75rem; }
.tutor-avatar-sm > svg:first-child { width: .88rem; height: .88rem; }
.tutor-avatar-lg { width: 3.2rem; height: 3.2rem; margin-bottom: .2rem; }
.tutor-avatar-lg > svg:first-child { width: 1.5rem; height: 1.5rem; }
.tutor-avatar-spark { position: absolute; width: .95rem; height: .95rem; right: -.4rem; top: -.35rem; overflow: visible; }
.tutor-avatar-spark g { stroke: var(--schulivo-accent-yellow); }
.tutor-head-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.tutor-head-title { font-size: .95rem; font-weight: 600; letter-spacing: -.01em; }
.tutor-head-sub { font-size: .75rem; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tutor-close { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 0; border-radius: 9999px; background: none; color: var(--muted-fg); cursor: pointer; }
.tutor-close:hover { background: var(--schulivo-muted); color: var(--fg); }
.tutor-close svg { width: 1.05rem; height: 1.05rem; }

/* chat area on faint grid paper */
.tutor-body {
    flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem;
    background-color: var(--schulivo-background);
    background-image:
        linear-gradient(color-mix(in oklab, var(--schulivo-primary) 4%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in oklab, var(--schulivo-primary) 4%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
}
.tutor-row { display: flex; align-items: flex-end; gap: .5rem; max-width: 92%; }
.tutor-msg { padding: .6rem .85rem; border-radius: 1rem; font-size: .875rem; line-height: 1.55; overflow-wrap: break-word; min-width: 0; }
.tutor-msg-user {
    align-self: flex-end; max-width: 85%; white-space: pre-wrap; border-bottom-right-radius: .3rem;
    background: var(--schulivo-primary); color: var(--schulivo-primary-foreground);
    box-shadow: 0 4px 10px -6px color-mix(in oklab, var(--schulivo-primary) 60%, transparent);
}
.tutor-msg-assistant { background: var(--schulivo-card); border: 1px solid var(--schulivo-border); border-bottom-left-radius: .3rem; color: var(--fg); }
.tutor-msg .lesson-md { margin: 0; font-size: .875rem; }
.tutor-msg .lesson-md > :first-child { margin-top: 0; }
.tutor-msg .lesson-md > :last-child { margin-bottom: 0; }

.tutor-welcome { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: auto 0; padding: .4rem .2rem; text-align: center; }
.tutor-welcome-title { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.tutor-welcome-sub { margin: 0; max-width: 18rem; font-size: .82rem; line-height: 1.5; color: var(--muted-fg); }
.tutor-chips { display: flex; flex-direction: column; gap: .45rem; width: 100%; margin-top: .7rem; }
.tutor-chip {
    display: flex; align-items: center; gap: .5rem; text-align: left; cursor: pointer;
    padding: .6rem .85rem; border: 1.5px solid var(--schulivo-border); border-radius: .9rem;
    background: var(--schulivo-card); color: var(--fg); font: inherit; font-size: .84rem; font-weight: 500;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease;
}
.tutor-chip::before { content: "\2726"; color: var(--schulivo-primary); font-size: .8rem; }
.tutor-chip:hover:not(:disabled) {
    border-color: color-mix(in oklab, var(--schulivo-primary) 40%, var(--schulivo-border));
    background: color-mix(in oklab, var(--schulivo-primary) 5%, var(--schulivo-card)); color: var(--schulivo-primary);
    transform: translateY(-1px);
}
.tutor-chip:disabled { opacity: .55; cursor: default; }

/* typing indicator: dots fade (a loading indicator, no bounce) */
.tutor-typing { display: inline-flex; gap: .3rem; padding: .25rem 0; }
.tutor-typing span { width: .42rem; height: .42rem; border-radius: 50%; background: var(--muted-fg); opacity: .25; animation: tutor-dot 1.2s infinite ease-in-out; }
.tutor-typing span:nth-child(2) { animation-delay: .15s; }
.tutor-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tutor-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.tutor-input { display: flex; align-items: flex-end; gap: .5rem; padding: .7rem; border-top: 1px solid var(--schulivo-border); background: var(--schulivo-card); }
.tutor-input textarea {
    flex: 1; resize: none; min-height: 2.6rem; max-height: 6rem;
    padding: .62rem 1rem; border: 1.5px solid var(--schulivo-border); border-radius: 1.3rem;
    background: var(--schulivo-background); color: var(--fg); font: inherit; font-size: .875rem; line-height: 1.35;
}
.tutor-input textarea { box-sizing: border-box; height: 2.6rem; } /* no global border-box reset (preflight off) */
/* grow with the text while typing (Chromium/Edge); elsewhere it stays one line and scrolls */
@supports (field-sizing: content) { .tutor-input textarea { height: auto; field-sizing: content; } }
.tutor-input textarea:focus { outline: none; border-color: var(--schulivo-primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--schulivo-primary) 15%, transparent); }
.tutor-send {
    display: inline-flex; flex: none; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem;
    border: 0; border-radius: 9999px; cursor: pointer;
    background: var(--schulivo-primary); color: var(--schulivo-primary-foreground);
    box-shadow: 0 4px 10px -4px color-mix(in oklab, var(--schulivo-primary) 55%, transparent);
    transition: transform .15s ease, opacity .15s ease;
}
.tutor-send:hover:not(:disabled) { transform: translateY(-1px); }
.tutor-send:disabled { opacity: .4; cursor: default; box-shadow: none; }
.tutor-send svg { width: 1.05rem; height: 1.05rem; }

@media (max-width: 640px) {
    /* bottom-right corner on phones (respecting the home-indicator safe area) … */
    .tutor-widget { right: calc(1rem + env(safe-area-inset-right)); bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .tutor-chat { width: calc(100vw - 2rem); height: min(32rem, calc(100vh - 6.5rem)); height: min(32rem, calc(100dvh - 6.5rem)); }
    /* … and only lifted while the PWA install banner (fixed at the bottom) is showing */
    body:has(.install-banner) .tutor-widget { bottom: calc(6.2rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
    .tutor-chat { animation: none; }
    .tutor-typing span { animation: none; opacity: .6; }
    .tutor-fab, .tutor-chip, .tutor-send { transition: none; }
    .tutor-fab:hover, .tutor-chip:hover:not(:disabled), .tutor-send:hover:not(:disabled) { transform: none; }
}

/* ===== Book loader (BookLoader.razor) — the Schulivo logo book opens, glyphs fly in,
   it closes and reopens. One 3.6s timeline shared by every part so they stay in sync. ===== */
.bl { --bl-ink: #1b2a4a; --bl-t: 3.6s; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 2rem 1rem; text-align: center; }
.bl-stage { position: relative; font-size: 16px; padding: 2.4em 4.6em 0.6em; }
.bl-book { position: relative; width: 7.4em; height: 4.9em; perspective: 34em; transform-origin: 50% 100%; animation: bl-book var(--bl-t) ease-in-out infinite; }
.bl-half { position: absolute; top: 0; width: 50%; height: 100%; }
.bl-right { left: 50%; }
.bl-left { left: 0; transform-origin: 100% 50%; transform-style: preserve-3d; animation: bl-flip var(--bl-t) cubic-bezier(.55,.05,.35,1) infinite; }
.bl-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bl-back { transform: rotateY(180deg); }
.bl-half svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bl .bl-cover { fill: var(--schulivo-primary); stroke: var(--bl-ink); stroke-width: 3.2; stroke-linejoin: round; }
.bl .bl-page { fill: #fff; stroke: var(--bl-ink); stroke-width: 3.2; stroke-linejoin: round; }
.bl .bl-ink { fill: none; stroke: #c3cede; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 34; stroke-dashoffset: 34; animation: var(--bl-line) var(--bl-t) linear infinite; }
.bl .bl-ink-done { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
.bl .bl-l1 { --bl-line: bl-l1; } .bl .bl-l2 { --bl-line: bl-l2; } .bl .bl-l3 { --bl-line: bl-l3; } .bl .bl-l4 { --bl-line: bl-l4; }
/* the logo's pencil writes the right page line by line while the book is open */
.bl-pencil { position: absolute; left: 0; top: 0; z-index: 1; width: 2.5em; height: 0.62em; margin-top: -0.31em; opacity: 0; transform-origin: 0 50%; pointer-events: none; animation: bl-pencil var(--bl-t) ease-in-out infinite; }
.bl-pencil svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bl .bl-pc-wood { fill: #f6dcb4; stroke: var(--bl-ink); stroke-width: 1.3; stroke-linejoin: round; }
.bl .bl-pc-lead { fill: var(--bl-ink); }
.bl .bl-pc-body { fill: var(--schulivo-accent-yellow); stroke: var(--bl-ink); stroke-width: 1.3; }
.bl .bl-pc-band { fill: #c9d1dc; stroke: var(--bl-ink); stroke-width: 1.3; }
.bl .bl-pc-eraser { fill: #f59bb4; stroke: var(--bl-ink); stroke-width: 1.3; stroke-linejoin: round; }
.bl .bl-label { fill: #fff; stroke: var(--bl-ink); stroke-width: 2.2; }
.bl .bl-spine { stroke: var(--bl-ink); stroke-width: 2.4; stroke-linecap: round; opacity: .35; }
.bl-shadow { position: absolute; left: 50%; bottom: 0; width: 7.4em; height: 0.7em; margin-left: -3.7em; border-radius: 50%; background: radial-gradient(closest-side, rgba(12,18,26,.22), transparent); animation: bl-shadow var(--bl-t) ease-in-out infinite; }

.bl-fly { position: absolute; left: 50%; top: 42%; z-index: 2; opacity: 0; font-family: var(--schulivo-doodle-font, "Caveat", cursive); font-weight: 700; font-size: 1.7em; line-height: 1; color: var(--fc, var(--schulivo-primary)); white-space: nowrap; pointer-events: none;
    animation: bl-fly var(--bl-t) cubic-bezier(.3,.6,.4,1) infinite; animation-delay: var(--fd, 0s); }
.bl-f0 { --fx: -3.68em; --fy: -2.08em; --fr: -18deg; --fc: var(--schulivo-primary); --fd: 0s; }
.bl-f1 { --fx: 3.52em;  --fy: -2.32em; --fr: 16deg;  --fc: #e0a400; --fd: .1s; }
.bl-f2 { --fx: -4.32em; --fy: 0.32em;  --fr: 12deg;  --fc: var(--schulivo-accent-coral); --fd: .2s; }
.bl-f3 { --fx: 4.16em;  --fy: 0.16em;  --fr: -14deg; --fc: var(--schulivo-accent-lilac); --fd: .3s; }
.bl-f4 { --fx: -1.44em; --fy: -3.12em; --fr: 20deg;  --fc: #2fb886; --fd: .4s; }
.bl-f5 { --fx: 1.6em;  --fy: -3.28em; --fr: -10deg; --fc: var(--schulivo-primary); --fd: .5s; }
.bl-doc { font-size: 1.35em; }
.bl-doc svg { display: block; width: 1em; height: 1.25em; }
.bl-doc path:first-child { fill: #fff; stroke: var(--bl-ink); stroke-width: 1.6; stroke-linejoin: round; }
.bl-doc path:last-child { fill: none; stroke: var(--fc); stroke-width: 1.5; stroke-linecap: round; }
/* upload: documents come from above, one after another */
.bl-upload .bl-f0 { --fx: -3.4em; --fy: -3.4em; }
.bl-upload .bl-f1 { --fx: 3.2em;  --fy: -3.6em; --fd: .15s; }
.bl-upload .bl-f2 { --fx: -0.6em; --fy: -4.4em; --fd: .3s; }
.bl-upload .bl-f3 { --fx: 1.4em;  --fy: -4.2em; --fd: .45s; }

.bl-title { font-weight: 700; }
.bl-sub { color: var(--muted-fg); font-size: 0.85rem; line-height: 1.5; max-width: 30rem; }
.bl-compact { padding: 3rem 1rem; gap: 0.55rem; }
.bl-compact .bl-stage { font-size: 11px; }
.bl-compact .bl-title { font-weight: 500; font-size: 0.85rem; color: var(--muted-fg); }

@keyframes bl-flip {
    0% { transform: rotateY(180deg); }
    13%, 72% { transform: rotateY(0deg); }
    87%, 100% { transform: rotateY(180deg); }
}
/* closed, the book is only the right half wide — slide it to the middle */
@keyframes bl-book {
    0% { transform: translateX(-25%); }
    13%, 72% { transform: translateX(0); }
    87% { transform: translateX(-25%) scale(1, 1); }
    91% { transform: translateX(-25%) scale(1.05, .95); }
    95%, 100% { transform: translateX(-25%) scale(1, 1); }
}
@keyframes bl-shadow {
    0%, 87%, 100% { transform: scaleX(.55); opacity: .8; }
    13%, 72% { transform: scaleX(1); opacity: 1; }
}
@keyframes bl-l1 { 0%, 25% { stroke-dashoffset: 34; } 33%, 86% { stroke-dashoffset: 0; } 87%, 100% { stroke-dashoffset: 34; } }
@keyframes bl-l2 { 0%, 34% { stroke-dashoffset: 34; } 42%, 86% { stroke-dashoffset: 0; } 87%, 100% { stroke-dashoffset: 34; } }
@keyframes bl-l3 { 0%, 43% { stroke-dashoffset: 34; } 51%, 86% { stroke-dashoffset: 0; } 87%, 100% { stroke-dashoffset: 34; } }
@keyframes bl-l4 { 0%, 52% { stroke-dashoffset: 34; } 58%, 86% { stroke-dashoffset: 0; } 87%, 100% { stroke-dashoffset: 34; } }
/* pencil tip positions follow the right-page lines (book-local em: x 4.39→6.24, y 1.28/1.81/2.33/2.86) */
@keyframes bl-pencil {
    0%, 20% { opacity: 0; transform: translate(5.6em, 0.2em) rotate(-55deg); }
    25% { opacity: 1; transform: translate(4.39em, 1.28em) rotate(-55deg); }
    33% { transform: translate(6.24em, 1.28em) rotate(-55deg); }
    34% { transform: translate(4.39em, 1.81em) rotate(-55deg); }
    42% { transform: translate(6.01em, 1.81em) rotate(-55deg); }
    43% { transform: translate(4.39em, 2.33em) rotate(-55deg); }
    51% { transform: translate(6.24em, 2.33em) rotate(-55deg); }
    52% { transform: translate(4.39em, 2.86em) rotate(-55deg); }
    58% { opacity: 1; transform: translate(5.67em, 2.86em) rotate(-55deg); }
    66%, 100% { opacity: 0; transform: translate(6.6em, 1.6em) rotate(-40deg); }
}
@keyframes bl-fly {
    0%, 22% { opacity: 0; transform: translate(-50%, -50%) translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(.9); }
    28% { opacity: 1; transform: translate(-50%, -50%) translate(calc(var(--fx) * .85), calc(var(--fy) * .85)) rotate(var(--fr)) scale(1); }
    46% { opacity: 1; transform: translate(-50%, -50%) translate(calc(var(--fx) * .12), calc(var(--fy) * .12)) rotate(0deg) scale(.75); }
    52%, 100% { opacity: 0; transform: translate(-50%, -50%) translate(0, .5em) rotate(0deg) scale(.2); }
}
@media (prefers-reduced-motion: reduce) {
    .bl-book, .bl-left, .bl-shadow, .bl .bl-ink { animation: none; }
    .bl .bl-ink { stroke-dashoffset: 0; }
    .bl-fly, .bl-pencil { display: none; }
}

/* ===== Forms & dialogs (homepage look) — overrides the older field/dialog rules above and in
   app.css: white fields with a soft focus ring, rounded dropzone with icon bubble, own select
   (SelectBox.razor), dialogs with blur backdrop and round close button. ===== */
.text-input, .select-input, .sx-trigger {
    height: 2.85rem; box-sizing: border-box; border-radius: 0.85rem; border: 1.5px solid var(--border);
    background: var(--card); color: var(--fg); padding: 0 0.95rem; font-family: inherit;
    box-shadow: 0 1px 2px rgba(12,18,26,0.04); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.text-input::placeholder { color: color-mix(in oklab, var(--muted-fg) 80%, transparent); }
.text-input:hover, .select-input:hover, .sx-trigger:hover:not(:disabled) { border-color: color-mix(in oklab, var(--primary) 35%, var(--border)); }
.text-input:focus, .select-input:focus, .sx-trigger:focus-visible, .sx.is-open .sx-trigger {
    outline: none; background: var(--card); border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 16%, transparent);
}
textarea.text-input, .text-input.textarea { height: auto; min-height: 4.6rem; padding: 0.7rem 0.95rem; line-height: 1.55; resize: vertical; }
.form-label { gap: 0.42rem; font-size: 0.84rem; color: var(--fg); }
.form-label .hint { font-weight: 500; }
.form-stack { gap: 1.05rem; }
.form-error { display: flex; gap: .5rem; align-items: flex-start; margin: 0; padding: .65rem .85rem; border-radius: .8rem; background: color-mix(in oklab, var(--schulivo-accent-coral) 12%, var(--card)); color: #b4372f; font-size: .86rem; }
:root[data-theme="dark"] .form-error { color: #ffb4ae; }
.tutor-toggle { border-radius: 0.9rem; background: color-mix(in oklab, var(--muted) 70%, var(--card)); transition: border-color .15s ease; }
.tutor-toggle:hover { border-color: color-mix(in oklab, var(--primary) 35%, var(--border)); }
.tutor-toggle input[type="checkbox"], .form-stack input[type="checkbox"] { accent-color: var(--primary); width: 1.1rem; height: 1.1rem; flex-shrink: 0; margin-top: .1rem; }

/* form card heading ("KI-Prüfung generieren") — icon in a soft bubble */
.gen-card-title { gap: .65rem; font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; margin-bottom: 1.15rem; }
.gen-card-title svg { box-sizing: border-box; width: 2.2rem; height: 2.2rem; padding: .5rem; border-radius: .75rem; background: color-mix(in oklab, var(--primary) 11%, var(--card)); flex-shrink: 0; }

/* own select */
.sx { position: relative; min-width: 0; font-weight: 500; }
.sx-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-right: .75rem; font-size: 16px; text-align: left; cursor: pointer; }
.sx-trigger:disabled { opacity: .55; cursor: not-allowed; }
.sx-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-trigger.is-empty .sx-value { color: var(--muted-fg); }
.sx-chev { width: 1.1rem; height: 1.1rem; flex-shrink: 0; color: var(--muted-fg); transition: transform .2s ease, color .2s ease; }
.sx.is-open .sx-chev { transform: rotate(180deg); color: var(--primary); }
.sx-scrim { position: fixed; inset: 0; z-index: 85; }
.sx-list {
    position: absolute; z-index: 86; left: 0; right: 0; top: calc(100% + .4rem); min-width: 11rem;
    max-height: 17rem; overflow-y: auto; margin: 0; padding: .35rem; list-style: none;
    background: var(--card); border: 1px solid var(--border); border-radius: 1rem;
    box-shadow: 0 22px 44px -14px rgba(12,18,26,.32), 0 2px 6px rgba(12,18,26,.06);
    transform-origin: 50% 0; animation: sx-pop .14s ease;
}
.sx-opt { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .62rem .75rem; border-radius: .65rem; font-size: .92rem; font-weight: 500; color: var(--fg); cursor: pointer; }
.sx-opt.is-active { background: color-mix(in oklab, var(--primary) 9%, var(--card)); }
.sx-opt.is-sel { color: var(--primary); font-weight: 600; }
.sx-check { width: 1rem; height: 1rem; flex-shrink: 0; }

@keyframes sx-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* dropzone */
.dropzone {
    gap: .45rem; padding: 1.5rem 1rem 1.25rem; border: 2px dashed color-mix(in oklab, var(--primary) 30%, var(--border));
    border-radius: 1.15rem; background: color-mix(in oklab, var(--primary) 3.5%, var(--card)); transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover { border-color: color-mix(in oklab, var(--primary) 55%, var(--border)); background: color-mix(in oklab, var(--primary) 6%, var(--card)); }
.dz-icon { position: relative; display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: .2rem; border-radius: 50%; background: color-mix(in oklab, var(--primary) 13%, var(--card)); color: var(--primary); }
.dz-icon svg { width: 1.35rem; height: 1.35rem; }
.dz-icon::after {
    content: ""; position: absolute; top: -.2rem; right: -.45rem; width: .95rem; height: .95rem; background: var(--schulivo-accent-yellow);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.5l2.2 7.3 7.3 2.2-7.3 2.2L12 20.5l-2.2-7.3L2.5 11l7.3-2.2z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.5l2.2 7.3 7.3 2.2-7.3 2.2L12 20.5l-2.2-7.3L2.5 11l7.3-2.2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dz-title { font-weight: 600; font-size: .92rem; color: var(--fg); }
.dropzone.is-filled { border-style: solid; border-color: color-mix(in oklab, var(--schulivo-accent-mint) 65%, var(--border)); background: color-mix(in oklab, var(--schulivo-accent-mint) 7%, var(--card)); }
.dropzone.is-filled .dz-icon { background: color-mix(in oklab, var(--schulivo-accent-mint) 22%, var(--card)); color: #1f9d72; }
.dropzone.is-filled .dz-icon::after { display: none; }
.pick-btn { padding: .55rem 1.05rem; border-width: 1.5px; box-shadow: 0 1px 2px rgba(12,18,26,.05); transition: border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
.pick-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: 0 6px 14px -8px color-mix(in oklab, var(--primary) 60%, transparent); }
.pick-btn:focus-within { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 16%, transparent); }

/* dialogs */
.modal-backdrop, .diary-flyout-backdrop { background: rgba(12,18,26,.42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-dialog { border: 1px solid var(--border); border-radius: 1.4rem; padding: 1.4rem 1.5rem 1.5rem; box-shadow: 0 34px 80px -24px rgba(12,18,26,.5), 0 4px 12px rgba(12,18,26,.06); }
.modal-head { gap: .75rem; margin-bottom: 1.15rem; }
.modal-title { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; }
.diary-flyout-close {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.25rem; height: 2.25rem; border-radius: 50%;
    font-size: .9rem; line-height: 1; transition: background-color .15s ease, color .15s ease;
}
.diary-flyout-close:hover { background: var(--muted); color: var(--fg); }
.diary-flyout { border-left: 1px solid var(--border); border-radius: 1.4rem 0 0 1.4rem; }
.diary-flyout-head { padding: 1.05rem 1.25rem; }
.diary-flyout-title { font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
@media (max-width: 640px) {
    .diary-flyout { border-left: none; border-top: 1px solid var(--border); border-radius: 1.4rem 1.4rem 0 0; }
}
.confirm-head { justify-content: flex-start; }
.confirm-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex-shrink: 0; border-radius: .9rem; background: color-mix(in oklab, var(--schulivo-accent-coral) 16%, var(--card)); color: #d64a41; }
.confirm-icon svg { width: 1.3rem; height: 1.3rem; }
.confirm-text { margin-left: 3.35rem; }
.confirm-actions .btn-danger-pill { min-height: 44px; border: none; background: #e5484d; color: #fff; padding: .6rem 1.2rem; transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.confirm-actions .btn-danger-pill:hover { background: #d63c41; transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(229,72,77,.8); }
@media (max-width: 480px) { .confirm-text { margin-left: 0; } }
.form-stack[hidden] { display: none; }
/* reconnect overlay (App.razor) shows the book instead of the ring */
.reconnect-book { width: auto; height: auto; border: none; border-radius: 0; animation: none; margin-bottom: .4rem; }
.reconnect-book .bl { padding: 0; }

/* ===== Seasons (SeasonCalendar / AppBackdrop) — decoration only, switched on and off by date.
   Each season = ".season-{key}" on .app-backdrop + its decor layer + optional logo accent/badge.
   Everything sits behind the content and ignores the pointer. ===== */
.season-decor { position: absolute; inset: 0; pointer-events: none; }
.shell-logo { position: relative; }
.season-logo-accent { position: absolute; pointer-events: none; overflow: visible; }
.season-badge { display: none; align-items: center; gap: .4rem; padding: .3rem .75rem .3rem .45rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.season-badge svg { width: 1.15rem; height: 1.15rem; }
@media (min-width: 640px) { .season-badge { display: inline-flex; } }

/* --- Halloween --- */
.app-backdrop.season-halloween { --hw-orange: #f07a1a; --hw-purple: #7c4dcc; --hw-ink: #2a1846; }
:root[data-theme="dark"] .app-backdrop.season-halloween { --hw-orange: #ff9a3c; --hw-purple: #b18cff; --hw-ink: #d9c8ff; }
.season-halloween .app-backdrop-blobs {
    background:
        radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, var(--hw-orange) 20%, transparent), transparent 65%),
        radial-gradient(42% 42% at 92% 32%, color-mix(in oklab, var(--hw-purple) 20%, transparent), transparent 70%),
        radial-gradient(40% 40% at 8% 62%, color-mix(in oklab, var(--hw-purple) 13%, transparent), transparent 70%);
}
.season-halloween .doodle { color: var(--hw-orange); }
.season-halloween .hw-text { color: var(--hw-purple); font-size: 1.5rem; }

.hw-web { position: absolute; top: 3.5rem; right: 0; width: 15rem; height: 15rem; opacity: .32; }
.hw-web path { fill: none; stroke: var(--hw-ink); stroke-width: 1.1; stroke-linecap: round; }
.hw-spider { position: absolute; top: 3.5rem; right: 6.2rem; width: 2.1rem; transform-origin: 50% 0; animation: hw-dangle 5s ease-in-out infinite; }
.hw-thread { display: block; width: 1px; height: 9.5rem; margin: 0 auto -.35rem; background: color-mix(in oklab, var(--hw-ink) 45%, transparent); }
.hw-spider svg { display: block; width: 100%; height: auto; }
.hw-spider .hw-legs { fill: none; stroke: var(--hw-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hw-spider .hw-body { fill: var(--hw-ink); }
.hw-spider .hw-eye { fill: var(--hw-orange); }

.hw-bat { position: absolute; left: 45%; width: 2.6rem; height: 1.3rem; opacity: 0; fill: var(--hw-ink); animation: hw-fly 22s linear infinite; }
.hw-bat path { transform-origin: 50% 60%; animation: hw-flap .32s ease-in-out infinite alternate; }
.hw-bat-1 { top: 7rem; }
.hw-bat-2 { top: 6.4rem; width: 1.9rem; height: .95rem; animation-delay: 7s; animation-duration: 26s; }
.hw-bat-3 { top: 4.8rem; width: 2.2rem; height: 1.1rem; animation-delay: 15s; animation-duration: 20s; }

.hw-doodle { position: absolute; width: 3.4rem; height: 3.4rem; opacity: .3; transform: rotate(var(--r, 0deg)); }
.hw-doodle path { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hw-pumpkin path, .hw-candy path { stroke: var(--hw-orange); }
.hw-ghost path, .hw-moon path { stroke: var(--hw-purple); }
.hw-candy { width: 3.8rem; height: 2rem; }
@media (max-width: 767px) {
    .hw-doodle, .hw-bat { display: none; }
    .hw-web { width: 9rem; height: 9rem; }
    .hw-spider { right: 3.4rem; width: 1.6rem; }
    .hw-thread { height: 2.4rem; }
}

/* page accents: orange marker, witch hat on the logo, greeting pill */
body:has(.season-halloween) .mk-svg g, body:has(.season-halloween) .mk-spark g { stroke: #fb923c; }
.hw-hat { width: 1.45rem; height: 1.3rem; left: -.55rem; top: -.75rem; transform: rotate(-20deg); }
.hw-hat path { stroke: #1b1030; stroke-width: 1.6; stroke-linejoin: round; }
.hw-hat-cone, .hw-hat-brim { fill: #4b2a7a; }
.hw-hat-band { fill: #f59e0b; }
:root[data-theme="dark"] .hw-hat path { stroke: #c9b0ff; }
:root[data-theme="dark"] .hw-hat-cone, :root[data-theme="dark"] .hw-hat-brim { fill: #6a3fb0; }
.hw-badge { background: color-mix(in oklab, #f07a1a 14%, var(--card)); color: #b4530b; border: 1px solid color-mix(in oklab, #f07a1a 30%, var(--border)); }
:root[data-theme="dark"] .hw-badge { color: #ffb070; }
.hw-badge .hw-pk-body { fill: #f59e0b; stroke: #9a4a07; stroke-width: 2.4; }
.hw-badge .hw-pk-line { fill: none; stroke: #9a4a07; stroke-width: 2.4; stroke-linecap: round; }

@keyframes hw-dangle { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(1.2rem) rotate(3deg); } }
@keyframes hw-flap { from { transform: scaleY(1); } to { transform: scaleY(.55); } }
/* bats stay in the right half (cobweb side) so they never cross page titles for long */
@keyframes hw-fly {
    0% { opacity: 0; transform: translate(-2rem, 0); }
    4% { opacity: .55; }
    25% { transform: translate(14vw, -1rem); }
    48% { opacity: .55; transform: translate(30vw, .8rem); }
    55%, 100% { opacity: 0; transform: translate(36vw, -.4rem); }
}
@media (prefers-reduced-motion: reduce) {
    .hw-spider, .hw-bat path { animation: none; }
    .hw-bat { display: none; }
}

/* --- Christmas (01.12. – 06.01.) --- */
.app-backdrop.season-christmas { --xm-red: #d6363b; --xm-green: #1f8a4c; --xm-gold: #e0a400; --xm-ice: #8fb8e6; --xm-ink: #2b3a4f; }
:root[data-theme="dark"] .app-backdrop.season-christmas { --xm-red: #ff6b6b; --xm-green: #4fd08a; --xm-gold: #ffcf4a; --xm-ice: #e8f2ff; --xm-ink: #c9d6e8; }
.season-christmas .app-backdrop-blobs {
    background:
        radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, var(--xm-red) 15%, transparent), transparent 65%),
        radial-gradient(42% 42% at 92% 32%, color-mix(in oklab, var(--xm-ice) 26%, transparent), transparent 70%),
        radial-gradient(40% 40% at 8% 62%, color-mix(in oklab, var(--xm-green) 16%, transparent), transparent 70%);
}
.season-christmas .doodle { color: var(--xm-green); }
.season-christmas .xm-text { color: var(--xm-red); font-size: 1.5rem; }

.xm-garland { position: absolute; top: 3.5rem; left: 0; right: 0; height: 2.5rem; }
.xm-wire { position: absolute; inset: 0; width: 100%; height: 100%; }
.xm-wire path { fill: none; stroke: color-mix(in oklab, var(--xm-ink) 55%, transparent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.xm-bulb { position: absolute; top: 1.04rem; width: .55rem; height: .8rem; margin-left: -.275rem; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; background: var(--c); box-shadow: 0 0 .7rem .1rem color-mix(in oklab, var(--c) 70%, transparent); animation: xm-twinkle 2.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.xm-bulb::before { content: ""; position: absolute; left: 50%; top: -.22rem; width: .32rem; height: .26rem; margin-left: -.16rem; border-radius: .08rem; background: var(--xm-ink); opacity: .7; }
.xm-bulb-0 { --c: var(--xm-red); } .xm-bulb-1 { --c: var(--xm-gold); } .xm-bulb-2 { --c: var(--xm-green); } .xm-bulb-3 { --c: #3b82f6; }

.xm-snow { position: absolute; inset: 0; overflow: hidden; }
.xm-flake { position: absolute; top: -1rem; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; box-shadow: 0 0 3px 1px color-mix(in oklab, var(--xm-ice) 85%, transparent); opacity: .9; animation: xm-fall var(--dur) linear infinite; animation-delay: var(--delay); }
:root[data-theme="dark"] .xm-flake { background: var(--xm-ice); box-shadow: 0 0 4px rgba(232,242,255,.5); opacity: .55; }

.xm-doodle { position: absolute; width: 3.4rem; height: 3.4rem; opacity: .32; transform: rotate(var(--r, 0deg)); }
.xm-doodle path { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.xm-tree path { stroke: var(--xm-green); }
.xm-star path { stroke: var(--xm-gold); }
.xm-gift path, .xm-cane path { stroke: var(--xm-red); }
.xm-bauble path { stroke: #3b82f6; }
@media (max-width: 767px) {
    .xm-doodle { display: none; }
    .xm-flake:nth-child(2n) { display: none; }
    .xm-bulb:nth-of-type(2n) { display: none; }
}

body:has(.season-christmas) .mk-svg g { stroke: #f87171; }
body:has(.season-christmas) .mk-spark g { stroke: var(--schulivo-accent-yellow); }
.xm-hat { width: 1.55rem; height: 1.4rem; left: -.5rem; top: -.85rem; transform: rotate(-18deg); }
.xm-hat-cap { fill: #d6363b; stroke: #7a1518; stroke-width: 1.5; stroke-linejoin: round; }
.xm-hat-fur { fill: #fff; stroke: #c9d1dc; stroke-width: 1.3; }
.xm-badge { background: color-mix(in oklab, #d6363b 11%, var(--card)); color: #b02a2f; border: 1px solid color-mix(in oklab, #d6363b 28%, var(--border)); }
:root[data-theme="dark"] .xm-badge { color: #ff9a9a; }
.xm-badge .xm-bd-tree { fill: #1f8a4c; stroke: #145c33; stroke-width: 2.4; stroke-linejoin: round; }
.xm-badge .xm-bd-trunk { fill: #8a5a2b; }

@keyframes xm-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes xm-fall {
    from { transform: translate(0, 0); }
    50% { transform: translate(var(--drift), 55vh); }
    to { transform: translate(0, 110vh); }
}
@media (prefers-reduced-motion: reduce) {
    .xm-bulb { animation: none; }
    .xm-flake { animation: none; display: none; }
}

/* --- Silvester / New Year (28.12. – 01.01., wins over Christmas) --- */
.app-backdrop.season-newyear { --ny-gold: #d99a00; --ny-pink: #db2777; --ny-cyan: #0891b2; --ny-ink: #1e2a4a; }
:root[data-theme="dark"] .app-backdrop.season-newyear { --ny-gold: #ffd166; --ny-pink: #ff6fb5; --ny-cyan: #5ee0f5; --ny-ink: #dbe4ff; }
.season-newyear .app-backdrop-blobs {
    background:
        radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, #3b4fd8 20%, transparent), transparent 65%),
        radial-gradient(42% 42% at 92% 30%, color-mix(in oklab, var(--ny-pink) 15%, transparent), transparent 70%),
        radial-gradient(40% 40% at 8% 62%, color-mix(in oklab, var(--ny-gold) 18%, transparent), transparent 70%);
}
.season-newyear .doodle { color: var(--ny-gold); }
.season-newyear .ny-text { color: var(--ny-pink); font-size: 1.5rem; }

.ny-burst { position: absolute; width: var(--sz); height: var(--sz); opacity: 0; transform: scale(.2); animation: ny-burst 3.3s ease-out infinite; animation-delay: var(--d, 0s); }
.ny-burst path { fill: none; stroke: var(--fc); stroke-linecap: round; }
.ny-rays { stroke-width: 2.6; }
.ny-dots { stroke-width: 4.5; }

.ny-confetti { position: absolute; inset: 0; overflow: hidden; }
.ny-bit { position: absolute; top: -1rem; width: 6px; height: 10px; border-radius: 1.5px; opacity: .75; animation: ny-fall var(--dur) linear infinite; animation-delay: var(--delay); }
.ny-bit-0 { background: var(--ny-gold); } .ny-bit-1 { background: var(--ny-pink); }
.ny-bit-2 { background: var(--ny-cyan); } .ny-bit-3 { background: #7c5cff; width: 5px; height: 5px; border-radius: 50%; }

.ny-doodle { position: absolute; width: 3.4rem; height: 3.4rem; opacity: .32; transform: rotate(var(--r, 0deg)); }
.ny-doodle path { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ny-glasses path, .ny-spark path { stroke: var(--ny-gold); }
.ny-clock path { stroke: var(--ny-ink); }
.ny-spark-sm { width: 2.2rem; height: 2.2rem; }
.ny-spark-sm path { stroke: var(--ny-pink); }
@media (max-width: 767px) {
    .ny-doodle, .ny-burst:nth-of-type(n+2) { display: none; }
    .ny-burst { right: 4% !important; top: 4rem !important; --sz: 4.5rem !important; }
    .ny-bit:nth-child(2n) { display: none; }
}

body:has(.season-newyear) .mk-svg g { stroke: #f5c542; }
body:has(.season-newyear) .mk-spark g { stroke: #db2777; }
.ny-hat { width: 1.4rem; height: 1.4rem; left: -.45rem; top: -.85rem; transform: rotate(-18deg); }
.ny-hat-cone { fill: #3b4fd8; stroke: #1b2470; stroke-width: 1.5; stroke-linejoin: round; }
.ny-hat-stripe { fill: #ffd166; }
.ny-hat-rim { fill: none; stroke: #ffd166; stroke-width: 2.2; stroke-linecap: round; }
.ny-hat-pom { fill: #ff6fb5; stroke: #a3155a; stroke-width: 1.2; }
.ny-badge { background: color-mix(in oklab, #d99a00 14%, var(--card)); color: #8a5d00; border: 1px solid color-mix(in oklab, #d99a00 32%, var(--border)); }
:root[data-theme="dark"] .ny-badge { color: #ffd166; }
.ny-badge .ny-bd-star { fill: #f5c542; stroke: #a87400; stroke-width: 2.4; stroke-linejoin: round; }

@keyframes ny-burst {
    0% { opacity: 0; transform: scale(.2); }
    12% { opacity: .85; }
    45% { opacity: .55; transform: scale(1); }
    60%, 100% { opacity: 0; transform: scale(1.08); }
}
@keyframes ny-fall {
    from { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(var(--drift), 55vh) rotate(calc(var(--spin) / 2)); }
    to { transform: translate(0, 110vh) rotate(var(--spin)); }
}
@media (prefers-reduced-motion: reduce) {
    .ny-burst { animation: none; opacity: .5; transform: none; }
    .ny-bit { animation: none; display: none; }
}

/* ===== Lernreise path (JourneyOverview + JourneyPath.razor) — Candy-Crush-style road from day 1 at
   the bottom up to the goal. The page fills the viewport: head + progress card stay fixed, only the
   road box scrolls (vertically). ===== */
.jp-page { display: flex; flex-direction: column; box-sizing: border-box; height: calc(100vh - 3.5rem); height: calc(100dvh - 3.5rem); padding-bottom: 0; }
.jp-top { flex-shrink: 0; }
.jp-top .px-head { margin-bottom: 1rem; }
.jp-scroll {
    position: relative; flex: 1; min-height: 16rem; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    margin: 0 -1.5rem; padding: 0 1.5rem;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.6rem, #000 calc(100% - 1.6rem), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 1.6rem, #000 calc(100% - 1.6rem), transparent 100%);
}

.jp-hero { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.jp-hero-ring { position: relative; width: 4.4rem; height: 4.4rem; flex-shrink: 0; }
.jp-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.jp-ring circle { fill: none; stroke-width: 3.6; stroke-linecap: round; }
.jp-ring-bg { stroke: color-mix(in oklab, var(--primary) 12%, var(--card)); }
.jp-ring-fg { stroke: var(--primary); }
.jp-ring-t { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: .92rem; }
.jp-hero-txt { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 12rem; }
.jp-hero-k { font-size: .74rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }
.jp-hero-t { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.jp-hero-s { font-size: .84rem; color: var(--muted-fg); }
.jp-hero-actions { display: flex; align-items: center; gap: .5rem; }
.jp-hero-actions .btn-primary-pill svg { width: 1rem; height: 1rem; }
.jp-more { position: relative; margin-left: auto; }
.jp-more-btn { width: 2.75rem; height: 2.75rem; padding: 0; justify-content: center; }
.jp-more-btn svg { width: 1.15rem; height: 1.15rem; }
.jp-menu {
    position: absolute; z-index: 86; right: 0; top: calc(100% + .4rem); min-width: 16.5rem; white-space: nowrap; padding: .35rem; display: flex; flex-direction: column;
    background: var(--card); border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 22px 44px -14px rgba(12,18,26,.32), 0 2px 6px rgba(12,18,26,.06);
    max-width: calc(100vw - 2rem); animation: sx-pop .14s ease; transform-origin: 100% 0;
}
.jp-menu-item { text-align: left; padding: .62rem .75rem; border: none; border-radius: .65rem; background: none; color: var(--fg); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; }
.jp-menu-item:hover, .jp-menu-item:focus-visible { background: color-mix(in oklab, var(--primary) 9%, var(--card)); outline: none; }
.jp-menu-item.is-danger { color: #d64a41; }
.jp-menu-item.is-danger:hover { background: color-mix(in oklab, var(--schulivo-accent-coral) 12%, var(--card)); }

.jp-map { position: relative; width: 100%; max-width: 40rem; margin: 0 auto; }
.jp-road { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.jp-road path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.jp-road-base { stroke: color-mix(in oklab, var(--primary) 12%, var(--card)); stroke-width: 26; }
.jp-road-done { stroke: color-mix(in oklab, var(--primary) 70%, #8ab4ff); stroke-width: 26; }
.jp-road-dash { stroke: var(--card); stroke-width: 3.5; stroke-dasharray: 1 13; }
.jp-zone { position: absolute; left: -18%; right: -18%; border-radius: 3rem; background: radial-gradient(60% 50% at 50% 50%, color-mix(in oklab, var(--sc) 9%, transparent), transparent 72%); pointer-events: none; }

.jp-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--fg); z-index: 1; }
.jp-dot { position: relative; display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; font-weight: 800; font-size: 1.15rem; transition: transform .15s ease; }
.jp-dot svg { width: 1.45rem; height: 1.45rem; }
a.jp-node:hover .jp-dot { transform: translateY(-2px) scale(1.05); }
a.jp-node:focus-visible { outline: none; }
a.jp-node:focus-visible .jp-dot { outline: 3px solid var(--primary); outline-offset: 4px; }

.is-done .jp-dot { background: linear-gradient(180deg, #4f8df5, #1c65c8); color: #fff; box-shadow: 0 5px 0 #154a94, 0 10px 18px -8px rgba(28,101,200,.6); border: 3px solid #fff; }
.jp-check { position: absolute; right: -.35rem; bottom: -.2rem; display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%; background: #22c55e; color: #fff; border: 2.5px solid var(--card); }
.jp-check svg { width: .8rem; height: .8rem; }
.is-missed .jp-dot { background: linear-gradient(180deg, #ffb37a, #f2711c); color: #fff; box-shadow: 0 5px 0 #b4530b, 0 10px 18px -8px rgba(242,113,28,.6); border: 3px solid #fff; }
.is-today .jp-dot { width: 4.8rem; height: 4.8rem; background: linear-gradient(180deg, #ffe07a, #f4b70b); color: #7a4b00; box-shadow: 0 6px 0 #b98300, 0 0 0 8px color-mix(in oklab, #f4cd4b 30%, transparent), 0 14px 26px -10px rgba(214,150,0,.7); border: 3px solid #fff; animation: jp-pulse 2.4s ease-in-out infinite; }
.is-today .jp-dot svg { width: 1.9rem; height: 1.9rem; margin-left: .2rem; }
.jp-here { position: absolute; bottom: calc(100% + .55rem); white-space: nowrap; padding: .3rem .7rem; border-radius: 999px; background: var(--fg); color: var(--card); font-size: .74rem; font-weight: 700; box-shadow: 0 6px 14px -6px rgba(12,18,26,.5); }
.jp-here::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--fg); }
.is-locked .jp-dot { width: 3.3rem; height: 3.3rem; background: color-mix(in oklab, var(--muted) 80%, var(--card)); color: color-mix(in oklab, var(--muted-fg) 85%, transparent); border: 2.5px dashed color-mix(in oklab, var(--muted-fg) 35%, var(--border)); box-shadow: 0 4px 0 color-mix(in oklab, var(--muted-fg) 18%, var(--border)); }
.is-locked .jp-dot svg { width: 1.3rem; height: 1.3rem; }
:root[data-theme="dark"] .is-done .jp-dot, :root[data-theme="dark"] .is-missed .jp-dot, :root[data-theme="dark"] .is-today .jp-dot, :root[data-theme="dark"] .jp-goal-dot { border-color: var(--card); }

.jp-label { position: absolute; top: 50%; transform: translateY(-50%); width: 11.5rem; display: flex; flex-direction: column; gap: .1rem; }
.jp-label-right { left: calc(100% + .8rem); text-align: left; }
.jp-label-left { right: calc(100% + .8rem); text-align: right; }
.jp-lt { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.jp-lt-muted { color: var(--muted-fg); }
.jp-ls { font-size: .76rem; color: var(--muted-fg); }
.jp-ls-warn { color: #d9620c; font-weight: 600; }
.is-today .jp-lt { font-size: 1rem; }

.jp-stage { position: absolute; left: 50%; transform: translate(-50%, -50%); z-index: 2; display: inline-flex; align-items: center; gap: .55rem; max-width: 92%; padding: .38rem .9rem .38rem .38rem; border-radius: 999px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 6px 16px -10px rgba(12,18,26,.4); white-space: nowrap; }
.jp-stage-k { flex-shrink: 0; padding: .18rem .6rem; border-radius: 999px; background: var(--sc); color: #fff; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.jp-stage-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .84rem; font-weight: 600; }

.jp-goal { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; z-index: 1; }
.jp-goal-dot { display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 1.4rem; background: linear-gradient(180deg, #fff3c4, #f4cd4b); color: #8a5d00; border: 3px solid #fff; box-shadow: 0 6px 0 #c99a12, 0 14px 26px -10px rgba(214,150,0,.6); transform: rotate(-4deg); }
.jp-goal-dot svg { width: 2.3rem; height: 2.3rem; }
.jp-goal-t { font-weight: 700; font-size: .95rem; margin-top: .35rem; }
.jp-goal-s { font-size: .78rem; color: var(--muted-fg); }
.jp-goal.is-reached .jp-goal-dot { animation: jp-pulse-gold 2.4s ease-in-out infinite; }

@media (max-width: 640px) {
    .jp-page { padding-top: 1.25rem; }
    .jp-page .px-sub { display: none; }
    .jp-top .px-head { margin-bottom: .75rem; }

    .jp-hero { gap: .8rem; }
    .jp-hero-actions { width: 100%; }
    .jp-hero-actions .btn-primary-pill { flex: 1; justify-content: center; }
    .jp-label { width: 7.4rem; }
    .jp-label-right { left: calc(100% + .55rem); }
    .jp-label-left { right: calc(100% + .55rem); }
    .jp-lt { font-size: .8rem; }
    .jp-ls { font-size: .7rem; }
    .jp-dot { width: 3.1rem; height: 3.1rem; }
    .is-today .jp-dot { width: 4.1rem; height: 4.1rem; }
    .is-locked .jp-dot { width: 2.9rem; height: 2.9rem; }
    .jp-road-base, .jp-road-done { stroke-width: 22; }
    .jp-stage-n { font-size: .76rem; }
}
/* very short screens: let the whole page scroll instead of squeezing the road */
@media (max-height: 560px) {
    .jp-page { height: auto; }
    .jp-scroll { flex: none; height: 26rem; }
}
@keyframes jp-pulse { 0%, 100% { box-shadow: 0 6px 0 #b98300, 0 0 0 8px color-mix(in oklab, #f4cd4b 30%, transparent), 0 14px 26px -10px rgba(214,150,0,.7); } 50% { box-shadow: 0 6px 0 #b98300, 0 0 0 14px color-mix(in oklab, #f4cd4b 12%, transparent), 0 14px 26px -10px rgba(214,150,0,.7); } }
@keyframes jp-pulse-gold { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(-4deg) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .is-today .jp-dot, .jp-goal.is-reached .jp-goal-dot { animation: none; } }
.jp-page > .back-link { align-self: flex-start; flex-shrink: 0; }

/* ===== Achievements / "Meine Erfolge" (E10) — personal only: level, own week, badges. ===== */
:root { --coin-bronze: #cd7f3a; --coin-silver: #aab4c2; --coin-gold: #f0b90b; --coin-season: #f2771c; }

.me-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
@media (max-width: 900px) { .me-grid { grid-template-columns: minmax(0, 1fr); } }

.me-profile { display: flex; align-items: center; gap: 1.2rem; }
.me-avatar { position: relative; width: 6rem; height: 6rem; flex-shrink: 0; }
.me-avatar svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.me-avatar circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.me-avatar .bg { stroke: color-mix(in oklab, var(--primary) 12%, var(--card)); }
.me-avatar .fg { stroke: url(#me-lvl-grad); }
.me-avatar-in { position: absolute; inset: .7rem; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, #4f8df5, #1c65c8); color: #fff; font-weight: 700; font-size: 1.5rem; }
.me-lvl { position: absolute; left: 50%; bottom: -.35rem; transform: translateX(-50%); padding: .12rem .55rem; border-radius: 999px; background: var(--schulivo-accent-yellow); color: #5c4300; font-size: .7rem; font-weight: 800; border: 2px solid var(--card); white-space: nowrap; }
.me-who { display: flex; flex-direction: column; gap: .25rem; min-width: 0; flex: 1; }
.me-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; }
.me-title { font-size: .85rem; color: var(--muted-fg); }
.me-title b { color: var(--primary); font-weight: 600; }
.me-bar { height: .7rem; border-radius: 999px; background: color-mix(in oklab, var(--primary) 10%, var(--card)); overflow: hidden; margin-top: .45rem; }
.me-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f8df5, #1c65c8); position: relative; }
.me-bar > span::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.35), transparent 60%); }
.me-bar-l { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted-fg); margin-top: .3rem; }

.me-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.me-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 999px; background: color-mix(in oklab, var(--muted) 70%, var(--card)); border: 1px solid var(--border); font-size: .8rem; font-weight: 500; }
.me-chip svg { width: .95rem; height: .95rem; color: var(--primary); }

.me-week-h { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.me-week-t { font-weight: 600; }
.me-week-s { font-size: .78rem; color: var(--muted-fg); }
.me-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; margin: .9rem 0 .7rem; }
.me-day { display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .7rem; color: var(--muted-fg); font-weight: 600; }
.me-day i { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; border: 2px dashed color-mix(in oklab, var(--muted-fg) 30%, var(--border)); font-style: normal; }
.me-day.is-on i { border: none; background: linear-gradient(180deg, #4f8df5, #1c65c8); color: #fff; box-shadow: 0 3px 0 #154a94; }
.me-day.is-on i svg { width: 1rem; height: 1rem; }
.me-day.is-today i { border-style: solid; border-color: var(--primary); }
.me-week-note { font-size: .8rem; color: var(--muted-fg); margin: 0; }

.me-sec { display: flex; align-items: baseline; gap: .6rem; margin: 1.6rem 0 .8rem; }
.me-sec h2 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
.me-sec span { font-size: .8rem; color: var(--muted-fg); }

.me-new { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 640px) { .me-new { grid-template-columns: minmax(0, 1fr); } }
.me-new-card { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; border-radius: 1rem; background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(12,18,26,.04); }
.me-new-card .medal { width: 3.6rem; height: 3.9rem; }
.me-new-t { font-weight: 600; font-size: .92rem; }
.me-new-s { font-size: .76rem; color: var(--muted-fg); }

.me-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.me-tabs .tbar-pill { cursor: default; }

.me-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .8rem; }
.me-badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 1rem .7rem .9rem; border-radius: 1.1rem; background: var(--card); border: 1px solid var(--border); }
.me-badge .medal { width: 4.2rem; height: 4.6rem; margin-bottom: .2rem; }
.me-badge-t { font-weight: 600; font-size: .86rem; line-height: 1.25; }
.me-badge-s { font-size: .72rem; color: var(--muted-fg); line-height: 1.35; }
.me-badge-p { width: 100%; margin-top: .25rem; }
.me-badge-p .me-bar { height: .4rem; margin-top: 0; }
.me-badge-p small { display: block; font-size: .68rem; color: var(--muted-fg); margin-top: .25rem; }
.me-badge.is-locked { background: color-mix(in oklab, var(--muted) 45%, var(--card)); }
.me-badge.is-locked .me-badge-t { color: var(--muted-fg); }

/* medal: ribbon + round coin, tier colours */
.medal { display: block; overflow: visible; }
.medal .rib-l { fill: #4f8df5; } .medal .rib-r { fill: #1c65c8; }
.medal .coin { stroke-width: 2.5; }
.medal .ic { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.t-bronze .coin { fill: var(--coin-bronze); stroke: #9a5a22; } .t-bronze .rim { stroke: #f2c08f; }
.t-silver .coin { fill: var(--coin-silver); stroke: #7d8a99; } .t-silver .rim { stroke: #f4f7fb; }
.t-gold .coin { fill: var(--coin-gold); stroke: #b98300; } .t-gold .rim { stroke: #fff2b8; }
.t-season .coin { fill: var(--coin-season); stroke: #9a4a07; } .t-season .rim { stroke: #ffd2a6; }
.medal .rim { fill: none; stroke-width: 1.6; stroke-dasharray: 2 3.2; opacity: .9; }
.t-locked .rib-l, .t-locked .rib-r { fill: color-mix(in oklab, var(--muted-fg) 30%, var(--card)); }
.t-locked .coin { fill: color-mix(in oklab, var(--muted) 85%, var(--card)); stroke: color-mix(in oklab, var(--muted-fg) 40%, var(--border)); stroke-dasharray: 4 3; }
.t-locked .rim { display: none; }
.t-locked .ic { stroke: color-mix(in oklab, var(--muted-fg) 80%, transparent); }

/* unlock dialog */
.me-unlock { text-align: center; width: min(24rem, calc(100vw - 2.5rem)); padding: 2rem 1.6rem 1.6rem; overflow: hidden; }
.me-unlock .medal { width: 6.5rem; height: 7rem; margin: .4rem auto .9rem; filter: drop-shadow(0 12px 18px rgba(214,150,0,.35)); }
.me-unlock-k { display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: color-mix(in oklab, var(--schulivo-accent-yellow) 30%, var(--card)); color: #7a5600; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.me-unlock-t { font-size: 1.35rem; font-weight: 600; margin: .7rem 0 .3rem; letter-spacing: -.01em; }
.me-unlock-s { font-size: .9rem; color: var(--muted-fg); margin: 0 0 .5rem; }
.me-unlock-xp { font-weight: 700; color: var(--primary); margin: 0 0 1.2rem; }
.me-conf { position: absolute; inset: 0; pointer-events: none; }
.me-conf i { position: absolute; width: 7px; height: 11px; border-radius: 1.5px; opacity: .85; }


.medal .shine { fill: #fff; opacity: .22; }
.t-locked .shine { display: none; }
.me-badge-when { font-size: .7rem; color: var(--primary); font-weight: 600; margin-top: .15rem; }
.me-tabs .tbar-pill { cursor: pointer; }
.me-unlock-actions { justify-content: center; margin-top: 0; }
.me-conf i { animation: me-conf-in .9s cubic-bezier(.2,.7,.3,1) both; animation-delay: var(--d, 0s); transform: rotate(var(--r, 0deg)); }
@keyframes me-conf-in { from { opacity: 0; transform: translateY(-1.5rem) rotate(0deg); } to { opacity: .85; transform: translateY(0) rotate(var(--r, 0deg)); } }
.me-unlock .medal { animation: me-pop .5s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes me-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .me-conf i, .me-unlock .medal { animation: none; } }

/* sidebar user card → link to /me with a thin level ring around the initials */
a.shell-user-card { text-decoration: none; color: inherit; transition: background-color .15s ease; }
a.shell-user-card:hover { background-color: color-mix(in srgb, var(--schulivo-primary) 8%, transparent); }
.sb-lvl { position: relative; }
.sb-lvl svg { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); pointer-events: none; }
.sb-lvl circle { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.sb-lvl-bg { stroke: color-mix(in oklab, var(--primary) 14%, transparent); }
.sb-lvl-fg { stroke: var(--primary); }
.shell-user-email.sb-lvl-t { color: var(--primary); font-weight: 600; }
.me-unlock > *:not(.me-conf) { position: relative; z-index: 1; }
