:root{
  --dust:#D2CABF;
  --ash:#6B5945;
  --camel:#BC9E81;
  --warm:#EEECE4;
  --ink:#1A1A1A;

  --radius:18px;
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --shadow2: 0 6px 18px rgba(0,0,0,.10);

  --maxw:1100px;
  --tap:44px;

  --headerH: 148px;
  --tabsH: 56px;
}

/* Base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ash);
  background:
    linear-gradient(rgba(238,236,228,.55), rgba(238,236,228,.55)),
    url("fernlichtsicht_20260108_p_3805640354150510642_2_3805640339327833000.jpg");
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

a{color:inherit}
button,input,select,textarea{font:inherit}

.app{min-height:100%; display:flex; flex-direction:column}
.wrap{max-width:var(--maxw); margin:0 auto; padding:0 16px}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:50;
  background:rgba(210,202,191,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(107,89,69,.15);
  transform: translateY(var(--topbarOffset, 0px));
  transition: transform .25s ease;
}
.topbar.is-hidden{ --topbarOffset: -200px; }

.topbar .brand{display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:14px 16px 10px}
.brand__title{font-weight:800; letter-spacing:.01em; font-size:18px; color:var(--ink)}
.brand__subtitle{font-size:13px; opacity:.85}

.topbar__row{display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between; padding:0 16px 12px}

.yearSwitch{display:flex; gap:8px; flex-wrap:wrap}
.yearBtn{
  height:40px; padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(107,89,69,.22);
  background: rgba(238,236,228,.75);
  color:var(--ink);
  font-weight:700;
}
.yearBtn.is-active{
  background:var(--camel);
  border-color: rgba(107,89,69,.25);
}

.stats{display:flex; gap:10px; flex-wrap:wrap}
.stat{
  background: rgba(238,236,228,.70);
  border:1px solid rgba(107,89,69,.14);
  border-radius:14px;
  padding:8px 12px;
  min-width:92px;
  box-shadow: var(--shadow2);
}
.stat__num{font-weight:900; font-size:18px; color:var(--ink)}
.stat__label{font-size:12px; opacity:.75}

.topbar__actions{display:flex; gap:10px; padding:0 16px 14px}
.btn, .btn:visited{
  height:var(--tap);
  display:inline-flex; align-items:center; justify-content:center;
  padding:0 14px;
  border-radius:14px;
  border:1px solid rgba(107,89,69,.22);
  background: rgba(238,236,228,.80);
  color:var(--ink);
  font-weight:800;
  cursor:pointer;
  box-shadow: var(--shadow2);
}
.btn--primary{
  background: var(--camel);
  border-color: rgba(107,89,69,.25);
}
.btn--ghost{
  background: rgba(238,236,228,.55);
}
.btn:active{transform: translateY(1px)}

.filebtn input{display:none}

/* Tabs */
.tabs{
  position:sticky; top: var(--topbarH, 0px);
  z-index:49;
  background: rgba(238,236,228,.86);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(107,89,69,.14);
  display:flex;
  gap:8px;
  padding:10px 10px;
  overflow-x:auto;
  transform: translateY(var(--tabsOffset, 0px));
  transition: transform .25s ease;
}
.tabs.is-hidden{ --tabsOffset: -90px; }

.tab{
  height:42px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(107,89,69,.18);
  background: rgba(210,202,191,.35);
  color:var(--ink);
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.tab.is-active{
  background: rgba(188,158,129,.90);
}

.main{flex:1; max-width:var(--maxw); margin:0 auto; width:100%; padding:18px 16px 92px}
.panel{display:none}
.panel.is-active{display:block}

.panel__header{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:16px 0 10px}
.h1{margin:0; font-size:28px; color:var(--ink); letter-spacing:-.02em}
.h2{margin:0; font-size:18px; color:var(--ink)}
.p{margin:0 0 12px}
.ul{margin:0; padding-left:18px}
.muted{opacity:.78}
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 12px;
  border-radius:999px;
  background: rgba(210,202,191,.50);
  border:1px solid rgba(107,89,69,.14);
  color:var(--ink);
  font-weight:800;
}

/* Cards / forms */
.card{
  background: rgba(238,236,228,.80);
  border:1px solid rgba(107,89,69,.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

.grid{display:grid; grid-template-columns:1fr; gap:12px}
.grid--3{grid-template-columns:1fr}
@media (min-width: 840px){
  .grid{grid-template-columns:1fr 1fr}
  .grid--3{grid-template-columns:1fr 1fr 1fr}
}

.field label{display:block; font-size:12px; letter-spacing:.08em; text-transform:uppercase; font-weight:900; color:rgba(26,26,26,.78); margin-bottom:6px}
.field input, .field select, .field textarea{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(107,89,69,.18);
  background: rgba(255,255,255,.72);
  padding:12px 12px;
  outline:none;
  color:var(--ink);
}
.field textarea{resize:vertical}
.help{font-size:12px; opacity:.75; margin-top:6px}

.divider{height:1px; background: rgba(107,89,69,.12); margin:14px 0}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.row--end{justify-content:flex-end}

.kv{display:grid; grid-template-columns: 1fr; gap:10px}
@media (min-width:840px){ .kv{grid-template-columns: 200px 1fr} }

/* Entries used for glossar and list */
.entry{
  border-radius:16px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(255,255,255,.60);
  padding:14px;
  box-shadow: var(--shadow2);
  margin-bottom:10px;
}
.entry__title{font-weight:900; font-size:16px; color:var(--ink)}
.entry__meta{font-size:12px; opacity:.78; margin-top:4px}
.entry__body{margin-top:10px}

.entries{display:flex; flex-direction:column; gap:10px}

/* Calendar */
.calWeekdays{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; font-weight:900; font-size:12px; opacity:.72}
.calendarGrid{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-top:10px}
.calDay{
  min-height:44px;
  border-radius:12px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(255,255,255,.55);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  font-weight:800;
}
.calDay.is-marked{background: rgba(188,158,129,.65)}

/* Checks */
.checks{display:flex; flex-wrap:wrap; gap:10px}
.check{display:flex; gap:8px; align-items:center; padding:8px 10px; border-radius:999px; background: rgba(210,202,191,.35); border:1px solid rgba(107,89,69,.12)}
.check input{width:18px; height:18px}

/* Wissen */
.wissenWrap{display:grid; grid-template-columns: 1fr; gap:12px}
@media (min-width: 920px){ .wissenWrap{grid-template-columns: 280px 1fr} }
.wissenNav{
  border-radius:16px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(255,255,255,.55);
  padding:12px;
  position:sticky; top:140px;
  height: fit-content;
}
.wissenNav__title{font-weight:900; margin-bottom:8px; color:var(--ink)}
.wissenNav__items{display:flex; flex-direction:column; gap:6px}
.wissenNav__items button{
  text-align:left;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(238,236,228,.75);
  cursor:pointer;
  font-weight:800;
}
.wissenNav__items button.is-active{background: rgba(188,158,129,.75)}
.wissenContent{color:var(--ink)}
.wissenContent h2{margin:0 0 10px}
.wissenContent h3{margin:18px 0 10px}

/* Glossar TOC */
.glossarToc{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:12px;
  padding-bottom:8px;
}
.glossarToc a{
  display:inline-flex;
  min-width:34px;
  height:34px;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  text-decoration:none;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(210,202,191,.35);
  font-weight:900;
  color:var(--ink);
}
.glossarToc a:hover{background: rgba(188,158,129,.55)}

/* Quiz / Exam */
.quizTop,.examTop{display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap}
.qText,.examQ__text{font-size:18px; font-weight:900; color:var(--ink); line-height:1.25}
.choices,.examChoices{display:grid; grid-template-columns:1fr; gap:10px; margin-top:12px}
.choice{
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(107,89,69,.16);
  background: rgba(255,255,255,.65);
  cursor:pointer;
  font-weight:800;
  text-align:left;
}
.choice:hover{background: rgba(210,202,191,.55)}
.choice.is-selected{outline: 2px solid rgba(188,158,129,.95)}
.choice.is-correct{background: rgba(188,158,129,.65)}
.choice.is-wrong{background: rgba(107,89,69,.22)}
.feedback{
  border-radius:16px;
  padding:12px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(255,255,255,.60);
}
.examCard{
  border-radius:18px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(255,255,255,.60);
  padding:14px;
  box-shadow: var(--shadow2);
}
.examCard__title{font-weight:900; color:var(--ink)}
.examCard__meta{margin-top:6px; font-size:12px; opacity:.78}
.resultBox{
  border-radius:18px;
  border:1px solid rgba(107,89,69,.14);
  background: rgba(188,158,129,.50);
  padding:14px;
  box-shadow: var(--shadow2);
}
.resultBox__title{font-weight:900; font-size:18px; color:var(--ink)}
.resultBox__meta{margin-top:6px; font-size:12px; opacity:.85}

/* Footer */
.footer{
  background: rgba(107,89,69,.86);
  color: rgba(238,236,228,.96);
  padding:12px 16px;
  border-top:1px solid rgba(238,236,228,.10);
}

.footer__wrap{max-width:var(--maxw); margin:0 auto}
.footer__note{font-weight:900}
.footer__sub{margin-top:6px; font-size:12px; opacity:.9}
.footer__sub a{color: rgba(238,236,228,.96); text-decoration:none}
.dot{opacity:.65; padding:0 6px}

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 82px;
  transform: translateX(-50%);
  background: rgba(26,26,26,.86);
  color: rgba(238,236,228,.96);
  padding:10px 14px;
  border-radius: 999px;
  font-weight:900;
  box-shadow: var(--shadow);
  opacity:0;
  pointer-events:none;
  transition: opacity .25s ease;
  z-index:99;
}
.toast.is-on{opacity:1}

/* Mobile: bottom tabs, header hides on scroll */
@media (max-width: 820px){
  body{background-attachment:scroll}
  .main{padding-bottom: 132px}
  .tabs{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    border-top:1px solid rgba(107,89,69,.16);
    border-bottom:none;
    padding:10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .wissenNav{position:relative; top:auto}
}
/* ===== MINI STRIP (Variante C) ===== */
.miniStrip{
  position: sticky;
  top: 0;
  z-index: 60;

  display: none; /* wird per JS aktiviert */
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 12px;
  margin-bottom: 10px;

  background: rgba(210,202,191,.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(107,89,69,.18);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0,0,0,.14);
}

.miniStrip.is-on{
  display: flex;
}

.miniStrip__left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}

.miniStrip__title{
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}

.miniStrip__year{
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(188,158,129,.95);
  color: #2f241b;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}

.miniStrip__right{
  display:flex;
  gap:8px;
  align-items:center;
}

.miniStrip__btn{
  border:none;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(238,236,228,.92);
  color: var(--ash);
  font-weight: 900;
  cursor: pointer;
  border: 1px solid rgba(107,89,69,.14);
  box-shadow: 0 8px 18px rgba(0,0,0,.10);
}

.miniStrip__btn--primary{
  background: rgba(107,89,69,.92);
  color: var(--white);
}

/* Header-Hide bleibt wie gehabt */
.topbar.is-hidden{
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}



/* Kill debug HUD if it exists from older deploys */
#debugHUD{display:none !important; pointer-events:none !important;}



/* Glossar Sidebar Layout */
.glossarLayout{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 980px){
  .glossarLayout{ grid-template-columns: 1fr; }
  .glossarSide{ order: 0; }
  .glossarMain{ order: 1; }
}
.glossarSide{
  position: sticky;
  top: calc(var(--headerH) + var(--tabsH) + 18px);
  max-height: calc(100vh - (var(--headerH) + var(--tabsH) + 34px));
  overflow:auto;
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow2);
  border: 1px solid rgba(0,0,0,.08);
}
.glossarSideTop{ padding: 14px 14px 10px; border-bottom: 1px solid rgba(0,0,0,.08); }
.glossarSideTitle{ font-weight: 800; letter-spacing: .02em; }
.glossarSideHint{ opacity:.75; font-size: .92rem; margin-top: 4px; }
.glossarSideList{ padding: 10px; }
.glossarAGroup{ margin: 10px 0 14px; }
.glossarALetter{ font-weight: 800; opacity:.8; margin: 10px 6px 6px; }
.glossarItemBtn{
  width: 100%;
  text-align:left;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.55);
  border-radius: 12px;
  padding: 10px 10px;
  margin: 6px 0;
  min-height: 40px;
  cursor: pointer;
}
.glossarItemBtn:hover{ transform: translateY(-1px); }
.glossarItemBtn.is-active{ background: rgba(181,122,126,.18); border-color: rgba(181,122,126,.35); }
.glossarMain{
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow2);
  border: 1px solid rgba(0,0,0,.08);
  min-height: 420px;
}
.glossarDetail{ padding: 16px; }
.glossarEmpty{ opacity:.7; padding: 10px 2px; }
.glossarTerm{ font-size: 1.3rem; font-weight: 900; margin: 0 0 8px; }
.glossarMeta{ opacity:.72; margin: 0 0 10px; }
.glossarDef{ line-height: 1.55; white-space: pre-wrap; }

.glossarSearchWrap{
  display:flex;
  gap:10px;
  padding: 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.glossarSearchWrap .input{ flex:1; min-height: 42px; border-radius: 12px; border:1px solid rgba(0,0,0,.10); padding: 10px 12px; background: rgba(255,255,255,.62); }
.glossarBlock{ margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,.08); }
.glossarBlockTitle{ font-weight: 800; margin-bottom: 6px; opacity: .85; }



/* Contrast boost for readability */
.glossarSide, .glossarMain{
  background: rgba(255,255,255,.86) !important;
  border: 1px solid rgba(0,0,0,.10) !important;
}
.glossarDetail{ color: var(--ink); }
.glossarDef{ color: rgba(26,26,26,.92); }
.glossarMeta{ color: rgba(26,26,26,.70); }
.glossarItemBtn{
  background: rgba(255,255,255,.90) !important;
}
.glossarItemBtn.is-active{
  background: rgba(188,158,129,.28) !important;
}



/* A–Z Schnellleiste */
.glossarAZ{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding: 10px 14px 12px;
}
.azBtn{
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.85);
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 34px;
  cursor:pointer;
  font-weight: 700;
  font-size: .9rem;
}
.azBtn:hover{ transform: translateY(-1px); }

.glossarDetailActions{
  position: sticky;
  bottom: 0;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding: 10px 14px 14px;
  background: rgba(255,255,255,.86);
  border-top: 1px solid rgba(0,0,0,.08);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}


/* --- Compact header on scroll (adds body.is-compact) --- */
body.is-compact .brand{padding:8px 16px 6px}
body.is-compact .brand__subtitle{display:none}
body.is-compact .topbar__row{padding:0 16px 8px}
body.is-compact .yearBtn{height:34px; padding:0 10px; font-size:13px}
body.is-compact .stat{padding:6px 10px; min-width:78px}
body.is-compact .tab{height:36px; padding:0 10px; font-size:14px}
body.is-compact .tabs{padding:8px 10px}
body.is-compact .topbar__actions{padding:0 16px 10px}
body.is-compact .btn{height:36px}

/* smooth compact transitions */
.brand, .topbar__row, .topbar__actions{transition: padding .18s ease}
.brand__subtitle{transition: opacity .18s ease}
.yearBtn, .tab, .stat{transition: all .18s ease}


/* Header shrink on scroll (minimal) */
.topbar.is-scrolled .brand{padding:8px 16px 6px;}
.topbar.is-scrolled .topbar__row{padding:0 16px 8px;}
.topbar.is-scrolled .topbar__actions{padding:0 16px 10px;}
