/* Layout der Mushaf-Fortschritt-Seite. Farben, Schriften und Bausteine kommen
   aus uebungen.css (Design-Kit „German Method“); hier nur die Anordnung. */

body {
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 340px;
  grid-template-areas: "lessons stage settings";
  min-height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 18px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  background: color-mix(in srgb, var(--card) 55%, transparent);
  backdrop-filter: blur(8px);
}
.lessons-panel { grid-area: lessons; border-right: 1px solid var(--line); overflow: hidden; }
.lessons-panel .side-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px 12px; }
.settings-panel { grid-area: settings; border-left: 1px solid var(--line); }
.stage { grid-area: stage; display: flex; flex-direction: column; gap: 12px; padding: 20px 28px 28px; min-width: 0; }

.side-brand { margin: 0; padding: 6px 8px; margin: -6px -8px; text-decoration: none; width: auto; }
.side-logo { font-family: var(--ar); }

/* Lektionen */
.lesson-picker { display: flex; flex-direction: column; gap: 4px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input[type="range"] { flex: 1; accent-color: var(--primary); }
.side-list { gap: 4px; }
.side-lesson { width: 100%; font-family: inherit; color: inherit; }
.side-lesson .num-badge {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--chip); color: var(--muted); font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.side-lesson.current .num-badge { background: var(--primary); color: var(--card); }
.side-lesson.done .num-badge { background: var(--lav); color: var(--primary); }
.side-lesson-sub .ar-inline { font-size: 1.45em; line-height: 1.3; }
.side-lesson-sub { white-space: normal; overflow: visible; }
.side-lesson-sub .item + .item { margin-inline-start: 8px; }

/* Bühne */
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stage-title h1 { margin: 0; font-size: 26px; font-weight: 500; color: var(--primary-2); line-height: 1.15; }
.stage-title p { margin: 2px 0 0; font-size: 14px; }
.stage-title .ar-inline { font-size: 1.35em; }
.stage-nav { display: flex; gap: 8px; }
.btn.compact { width: auto; padding: 9px 14px; font-size: 13px; letter-spacing: .2px; border-radius: 12px; }
.btn.compact svg { font-size: 18px; }

.known-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; }
.known-text { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.known-text .label { color: var(--primary-2); }
.known-pct { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.known-bar .progress-bar { flex: none; height: 8px; background: var(--track); }

.page-wrap { flex: 1; display: flex; justify-content: center; align-items: flex-start; min-height: 0; }
.mushaf-page {
  position: relative;
  width: min(100%, calc((100vh - 190px) / 1.414));
  min-width: 300px;
  aspect-ratio: 1000 / 1414;
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .08), 0 18px 40px rgba(38, 36, 123, .16);
}
.mushaf-page svg { display: block; width: 100%; height: 100%; font-size: inherit; fill: none; }
.mushaf-page svg path[data-lesson] { transition: fill .18s ease; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }

/* Einstellungen */
.block { display: flex; flex-direction: column; gap: 12px; }
.block .side-head { margin: 0; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.fields[hidden] { display: none; }
.legend { display: grid; grid-template-columns: 26px 1fr; gap: 8px 10px; align-items: center; font-size: 14px; }
.swatch { width: 26px; height: 18px; border-radius: 6px; border: 1px solid var(--line); }
.dl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dl-row .btn { width: 100%; justify-content: center; }
.status { min-height: 1.2em; color: var(--primary-2); font-weight: 600; }
.status.error { color: var(--bad); }
code { font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 6px; }
.btn[aria-busy="true"] { opacity: .6; cursor: progress; }

/* Mittlere Breite: Lektionen unter die Einstellungen */
@media (max-width: 1279px) {
  .app { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "stage settings" "stage lessons"; grid-template-rows: auto 1fr; }
  .panel { height: auto; position: static; }
  .settings-panel { border-bottom: 1px solid var(--line); }
  .lessons-panel { border-right: 0; border-left: 1px solid var(--line); }
  .lessons-panel .side-list { max-height: 60vh; overflow-y: auto; }
  .stage { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

/* Handy: alles untereinander */
@media (max-width: 860px) {
  .app { display: flex; flex-direction: column; }
  .stage { order: 1; position: static; height: auto; padding: 16px; }
  .lessons-panel { order: 2; }
  .lessons-panel .side-list { max-height: 50vh; }
  .settings-panel { order: 3; }
  .panel { padding: 16px; border: 0; }
  .mushaf-page { width: 100%; min-width: 0; }
  .stage-top { flex-direction: column; align-items: flex-start; }
}
