/* lern-widgets: gemeinsame Bausteine (Vorlage lib/app/widgets). Masse wie in Flutter. */

.lw-band-scope { display: contents; }

/* ------------------------------------------------------------ BandButton */
.lw-btn {
  appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer; display: inline-flex; flex-direction: column;
  transition: transform 120ms ease-out; -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}
.lw-btn--expand { display: flex; width: 100%; }
.lw-btn:disabled { opacity: 0.45; cursor: default; }
.lw-btn:not(:disabled):active { transform: scale(0.975); }
.lw-btn:focus-visible { outline: 3px solid var(--b-primary); outline-offset: 3px; border-radius: var(--b-r); }
.lw-btn-body {
  box-sizing: border-box; height: var(--b-h); border-radius: var(--b-r);
  display: flex; align-items: center; justify-content: center; min-width: 0;
}
.lw-btn-content { display: flex; align-items: center; justify-content: center; min-width: 0; color: #fff; }
.lw-btn-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 17px; font-weight: var(--b-weight); line-height: 1.2;
}
.lw-btn-icon { margin-right: 8px; }
.lw-btn-icon-disc {
  width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--b-primary);
  display: inline-flex; align-items: center; justify-content: center; margin-right: 10px; flex: none;
}
.lw-btn--outline .lw-btn-content { color: var(--b-primary); }

/* Entdecker: Pille mit fester Unterkante */
.lw-btn--junior .lw-btn-body {
  background: var(--b-primary); padding: 0 24px; margin-bottom: 5px;
  box-shadow: 0 5px 0 0 var(--b-deep);
}
.lw-btn--junior:not(:disabled):active .lw-btn-body { margin-bottom: 0; box-shadow: none; transform: translateY(3px); }
.lw-btn--junior.lw-btn--outline .lw-btn-body { background: #fff; border: 2.5px solid var(--b-primary); box-shadow: none; }

/* Forscher: Verlauf */
.lw-btn--explorer .lw-btn-body { background: var(--b-gradient); padding: 0 12px; box-shadow: var(--b-glow); }
.lw-btn--explorer.lw-btn--outline .lw-btn-body { background: transparent; border: 1.5px solid var(--b-primary); box-shadow: none; }

/* Stratege: flacher Block, Pfeil-Chip */
.lw-btn--young .lw-btn-body { background: var(--b-primary); padding: 0 6px 0 18px; justify-content: space-between; }
.lw-btn--young .lw-btn-content { flex: 1; justify-content: flex-start; }
.lw-btn--young.lw-btn--outline .lw-btn-body { background: transparent; border: 1.5px solid var(--b-primary); }
.lw-btn-chip {
  width: calc(var(--b-h) - 12px); height: calc(var(--b-h) - 12px); border-radius: calc(var(--b-r) - 2px);
  background: rgba(255, 255, 255, 0.18); color: #fff; display: flex; align-items: center; justify-content: center; flex: none;
}
.lw-btn--young.lw-btn--outline .lw-btn-chip { background: var(--b-primary); }

/* Experte: Navy, Gold, Haarlinie */
.lw-btn--expert .lw-btn-body { background: var(--b-primary); border: 1px solid var(--b-secondary-60); padding: 0 20px; }
.lw-btn--expert .lw-btn-content { color: var(--b-secondary); }
.lw-btn--expert .lw-btn-label { font-size: 14px; letter-spacing: 1.6px; }
.lw-btn--expert.lw-btn--outline .lw-btn-body { background: transparent; border-color: var(--b-secondary); }
.lw-btn--expert.lw-btn--outline .lw-btn-content { color: var(--b-primary); }

/* ------------------------------------------------------------ IconButton */
.lw-icon-btn {
  appearance: none; border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center; transition: background 120ms;
  -webkit-tap-highlight-color: transparent;
}
.lw-icon-btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.lw-icon-btn:active { background: color-mix(in srgb, currentColor 12%, transparent); }
.lw-icon-btn:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }

/* ------------------------------------------------------------ Dialog */
.lw-dialog-root { position: fixed; inset: 0; z-index: 1000; font-family: var(--lern-font, inherit); }
.lw-dialog-barrier { position: absolute; inset: 0; }
.lw-dialog-scroll {
  position: absolute; inset: 0; overflow-y: auto; display: flex; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); box-sizing: border-box;
}
.lw-dialog-card {
  position: relative; width: 100%; max-width: 420px; margin: auto; background: var(--lern-surface, #fff);
  overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box;
}
.lw-dialog-root--anim .lw-dialog-barrier { animation: lw-fade 260ms cubic-bezier(0.215, 0.61, 0.355, 1) both; }
.lw-dialog-root--anim .lw-dialog-card {
  animation: lw-fade 260ms cubic-bezier(0.215, 0.61, 0.355, 1) both, lw-pop 260ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes lw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lw-pop { from { transform: scale(0.9); } to { transform: scale(1); } }
.lw-dialog-head { position: relative; height: 112px; flex: none; }
.lw-dialog-medal {
  position: absolute; left: 50%; bottom: 0; width: 60px; height: 60px; margin-left: -30px; box-sizing: border-box;
  background: var(--lern-surface, #fff); display: flex; align-items: center; justify-content: center;
}
.lw-dialog-body { padding: 14px 22px 22px; display: flex; flex-direction: column; }
.lw-dialog-title { margin: 0; text-align: center; color: var(--lern-ink); line-height: 1.25; text-transform: none; }
.lw-dialog-message { margin: 8px 0 0; text-align: center; font-size: 15px; line-height: 1.4; color: var(--lern-muted); }
.lw-dialog-content { margin-top: 16px; }
.lw-dialog-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------ Textfeld */
.lw-field { display: flex; flex-direction: column; }
.lw-field-box { position: relative; }
.lw-field-input {
  box-sizing: border-box; width: 100%; font: inherit; font-size: var(--f-size); font-weight: 700; color: var(--f-ink);
  background: var(--f-fill); border: 1.5px solid var(--f-border); border-radius: var(--f-radius);
  padding: 18px 18px; outline: none; caret-color: var(--f-primary);
}
.lw-field-input:focus { border: 2.5px solid var(--f-primary); padding: 17px 17px; }
.lw-field-input::placeholder { color: transparent; }
.lw-field-input:focus::placeholder { color: #6b6b80; font-weight: 400; }
.lw-field-label {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); padding: 0 4px;
  font-size: 16px; font-weight: 600; color: var(--f-muted); pointer-events: none;
  transition: top 150ms, font-size 150ms, color 150ms; line-height: 1;
}
.lw-field-input:focus + .lw-field-label, .lw-field-label--up {
  top: 0; font-size: 12px; background: linear-gradient(to bottom, transparent calc(50% - 1px), var(--f-fill) calc(50% - 1px));
}
.lw-field-input:focus + .lw-field-label { color: var(--f-primary); font-weight: 800; }
.lw-field-counter { align-self: flex-end; font-size: 12px; color: #6b6b80; padding: 4px 16px 0; }

/* ------------------------------------------------------------ Seite */
.lw-page { position: relative; min-height: 100%; height: 100%; box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; }
.lw-band-bg { z-index: 0; }
.lw-page-inner {
  position: relative; z-index: 1; width: 100%; max-width: 960px; margin: 0 auto; flex: 1; min-height: 0;
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); box-sizing: border-box;
}
.lw-page-head { display: flex; align-items: center; padding: 8px 20px 4px 8px; }
.lw-page-title { flex: 1; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.lw-page-rule { height: 1px; margin: 0 20px; }
.lw-page-body { flex: 1; min-height: 0; overflow-y: auto; box-sizing: border-box; }

/* ------------------------------------------------------------ Karten */
.lw-card { position: relative; box-sizing: border-box; }
.lw-card--bar { display: flex; overflow: hidden; }
.lw-card-bar { width: 6px; flex: none; align-self: stretch; }
.lw-card--bar > .lw-card-content { flex: 1; min-width: 0; }
.lw-card--tap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lw-card--tap:hover { filter: brightness(0.985); }
.lw-card--tap:focus-visible { outline: 3px solid var(--lern-primary); outline-offset: 2px; }

.lw-section-header { display: flex; align-items: center; }
.lw-section-text { flex: 1; min-width: 0; }
.lw-section-title { font-size: 16px; font-weight: 800; line-height: 1.5; }
.lw-section-sub { margin-top: 2px; font-size: 13px; color: #6b6b80; }

.lw-gradient-icon { display: flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box; }

.lw-stat .lw-card-content { display: flex; flex-direction: column; justify-content: center; }
.lw-stat-value { margin-top: 10px; font-size: 20px; font-weight: 900; line-height: 1.2; }
.lw-stat-label { margin-top: 2px; font-size: 12px; font-weight: 600; color: #6b6b80; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lw-avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  color: #fff; font-weight: 800; line-height: 1; font-family: var(--lern-font, inherit);
}

/* ------------------------------------------------------------ Rahmen, Footer, Hinweise */
.lw-frame { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.lw-frame-content { position: relative; flex: 1; min-height: 0; }
.lw-footer {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 10px; row-gap: 2px;
  padding: 7px 16px calc(7px + env(safe-area-inset-bottom)); font-size: 11.5px; line-height: 1.2; font-weight: 600;
  font-family: var(--lern-font, inherit);
}
.lw-footer-link { color: inherit; text-decoration: none; cursor: pointer; }
.lw-footer-company { font-weight: 900; text-decoration: underline; text-decoration-color: var(--lw-footer-under); }
.lw-footer-link { display: inline-flex; align-items: center; gap: 5px; }
.lw-footer-logo { vertical-align: middle; }
.lw-footer-parents { font-weight: 800; text-decoration: underline; text-decoration-color: var(--lw-footer-under); text-underline-offset: 2px; }
.lw-footer-dot { width: 3px; height: 3px; display: inline-block; }
.lw-footer-made { display: inline-flex; align-items: center; white-space: pre; }
.lw-footer-heart-box { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.lw-footer-heart {
  display: inline-block; font-size: 13px; font-weight: 900; line-height: 1; cursor: default;
  font-family: "LernSymbole", var(--lern-font, sans-serif); user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.lw-snack-host {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 900; pointer-events: none;
  display: flex; justify-content: center; padding: 0 15px 10px;
}
.lw-snack {
  pointer-events: auto; display: flex; align-items: center; width: 100%; max-width: 560px; box-sizing: border-box;
  padding: 14px 16px; color: #fff; font-weight: 600; font-size: 14px; line-height: 1.4;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22); animation: lw-fade 250ms ease-out both;
}
.lw-snack-text { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ XP-Karte */
.lw-xp { padding: 20px; border-radius: 24px; color: #fff; }
.lw-xp-row { display: flex; align-items: center; }
.lw-xp-badge {
  width: 54px; height: 54px; border-radius: 16px; background: rgba(255, 255, 255, 0.18);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 24px; flex: none;
}
.lw-xp-text { flex: 1; min-width: 0; margin-left: 14px; }
.lw-xp-eyebrow { color: rgba(255, 255, 255, 0.7); font-weight: 600; font-size: 14px; }
.lw-xp-level { font-weight: 800; font-size: 20px; }
.lw-xp-total { font-weight: 800; font-size: 16px; }
.lw-xp-bar { margin-top: 16px; height: 12px; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.22); }
.lw-xp-fill { height: 100%; }
.lw-xp-hint { margin-top: 8px; color: rgba(255, 255, 255, 0.7); font-size: 13px; }

/* ------------------------------------------------------------ Weltbanner */
.lw-banner { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; }
.lw-banner-row { position: relative; display: flex; align-items: flex-end; gap: 12px; box-sizing: border-box; }
.lw-banner-main { flex: 3 1 0; min-width: 0; display: flex; align-items: flex-end; }
.lw-banner-trailing { flex: 0 1 auto; display: flex; justify-content: flex-end; align-items: flex-end; min-width: 0; }
.lw-plate { padding: 10px 14px 12px; border-radius: 14px; display: flex; flex-direction: column; max-width: 100%; box-sizing: border-box; }
.lw-plate-eyebrow { font-size: 10.5px; letter-spacing: 1.3px; font-weight: 800; margin-bottom: 2px; }
.lw-plate-title {
  line-height: 1.1; font-weight: 900; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lw-plate-sub { margin-top: 3px; font-size: 12.5px; line-height: 1.35; }
.lw-journey { display: flex; gap: 4px; }
.lw-journey-world { flex: 1; display: flex; }
.lw-journey-seg { flex: 1; margin: 0 0.5px; }
.lw-jtitle { display: flex; align-items: flex-end; gap: 12px; }
.lw-jtitle-text { flex: 1; min-width: 0; }
.lw-jtitle-title { line-height: 1.2; }
.lw-jtitle-sub { margin-top: 2px; font-size: 13.5px; }
.lw-jtitle-value { display: flex; flex-direction: column; align-items: flex-end; }
.lw-jtitle-num { font-size: 30px; line-height: 1; font-weight: 900; }
.lw-jtitle-label { font-size: 12px; font-weight: 700; }

/* ------------------------------------------------------------ Figur, Effekte */
.lw-figure { position: relative; flex: none; -webkit-tap-highlight-color: transparent; }
.lw-figure[role="button"] { cursor: pointer; }
.lw-figure:focus-visible { outline: 3px solid var(--lern-primary); outline-offset: 4px; border-radius: 50%; }
.lw-confetti { position: relative; }
.lw-holo { position: relative; box-sizing: border-box; }
.lw-logo { position: relative; flex: none; }
.lw-press { will-change: transform; }

.lw-shake--on { animation-name: lw-shake; animation-timing-function: linear; animation-fill-mode: both; }
@keyframes lw-shake {
  0% { transform: translateX(0); }
  8.33% { transform: translateX(6.42px); }
  16.67% { transform: translateX(0); }
  25% { transform: translateX(-5.25px); }
  33.33% { transform: translateX(0); }
  41.67% { transform: translateX(4.08px); }
  50% { transform: translateX(0); }
  58.33% { transform: translateX(-2.92px); }
  66.67% { transform: translateX(0); }
  75% { transform: translateX(1.75px); }
  83.33% { transform: translateX(0); }
  91.67% { transform: translateX(-0.58px); }
  100% { transform: translateX(0); }
}
.lw-stagger--on {
  animation-name: lw-stagger; animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); animation-fill-mode: both;
}
@keyframes lw-stagger {
  from { opacity: 0; transform: translate(var(--lw-sx), var(--lw-sy)) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lw-shake--on, .lw-stagger--on, .lw-dialog-root--anim .lw-dialog-card, .lw-dialog-root--anim .lw-dialog-barrier { animation: none; }
}

/* Firmenlogos (brand.rs) */
.lw-brand { flex: none; }
a.lw-brand { cursor: pointer; transition: transform var(--motion-quick, 160ms) ease; }
a.lw-brand:hover { transform: translateY(-1px); }
a.lw-brand:focus-visible { outline: 3px solid var(--lern-primary, #FF6B4A); outline-offset: 3px; }
.lw-brand-strip { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lw-brand-strip-caption { font: 600 13px/1.2 "Fredoka", sans-serif; opacity: .85; }
.lw-brand-strip-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.lw-field--invalid .lw-field-input, .lw-field--invalid .lw-field-input:focus { border-color: #D7263D; }
.lw-field--invalid .lw-field-label { color: #D7263D; }
