/* Scrollschlau Cockpit (angemeldet, "/").
   Kopfbereich in der Nacht: heute, Aktivität, Kennzahlen. Darunter Papier: Libraries,
   Rangliste, Coins und Konto. Bausteine und Farben kommen aus app.css. */

/* Meldung, wenn das Cockpit nicht geladen werden konnte. */
.load-error { max-width: 600px; margin: 0 auto; padding: clamp(56px, 14vh, 144px) var(--gutter) 72px; display: grid; gap: 16px; justify-items: start; }
.load-error .row { gap: 12px 24px; margin-top: 8px; }

/* ---- Kopfbereich ------------------------------------------------------------------------- */

.deck { background: linear-gradient(to bottom, var(--night) 35%, var(--night-2) 160%); border-bottom: 1px solid var(--line); }
.deck-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 32px; }

.deck-intro { display: grid; gap: 14px; align-content: start; justify-items: start; }
.deck-intro h1 { font-size: clamp(2.25rem, 2.6vw + 1.5rem, 3.75rem); font-stretch: 86%; line-height: 1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.deck-intro .lead { max-width: 30em; }
.deck-action { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px; margin-top: 10px; }
.deck-action p { flex: 1 1 14em; max-width: 22em; }

/* Aktivität: vier Wochen als Kalender. Jeder Tag füllt sich mit Textmarker, je mehr Antworten. */
.activity { display: grid; gap: 10px; align-content: start; }
.activity h2 { font-size: 1.125rem; font-weight: 700; }
.calendar { width: calc(100% + 12px); margin: -2px -6px; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.calendar th { padding: 0; font-size: .8125rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.calendar thead th { text-align: center; }
.calendar th.week { width: 46px; text-align: left; white-space: nowrap; }
.calendar abbr { text-decoration: none; }
.calendar td { padding: 0; }
/* Leere Tage bleiben als Raster sichtbar: Der Rand hebt sich mit mehr als 3:1 von der Nacht ab. */
.day { position: relative; height: 34px; border-radius: 9px; overflow: hidden; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--field-line); }
.day > i { position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 0%); background: var(--marker); }
.day.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.activity > p { max-width: 60ch; }

/* Kennzahlen: eine Leiste, keine Karten. */
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); }
.figures > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; padding: 18px 0 20px; min-width: 0; }
.figures > div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
.figures > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
.figures dt { color: var(--ink-2); font-size: .9375rem; }
.figures dd { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.figures dd b { font-family: var(--font-display); font-stretch: 86%; font-weight: 800; font-size: clamp(2rem, 1.4vw + 1.6rem, 2.75rem); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.figures dd span:not(.coin) { color: var(--ink-2); font-weight: 600; }
.figures > div:nth-child(3) { grid-column: 1 / -1; }

@media (min-width: 760px) {
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .figures > div, .figures > div:nth-child(even) { padding: 22px 28px 26px; border-left: 1px solid var(--line); }
  .figures > div:nth-child(n + 3) { border-top: 0; grid-column: auto; }
  .figures > div:first-child { padding-left: 0; border-left: 0; }
}
@media (min-width: 960px) {
  .deck-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(40px, 6vw, 88px); row-gap: 44px; padding-top: 52px; }
  .deck-intro { align-content: center; }
  .figures { grid-column: 1 / -1; }
  .day { height: 36px; }
}

/* ---- Papier ------------------------------------------------------------------------------ */

.cockpit-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 64px; }
.cockpit-body h2 { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.section-head { margin-bottom: 20px; }
.cockpit-body .footer { margin-top: 0; }

/* Libraries: eine breite Zeile je Library statt einer Karte. */
.lib-list { display: grid; gap: 16px; }
.lib { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 20px; padding-bottom: 22px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.lib > * { padding-inline: 20px; min-width: 0; }
.lib-cover { position: relative; padding: 0; height: 128px; background: linear-gradient(140deg, var(--night-2), var(--night)); display: grid; place-items: center; }
.lib-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.lib-cover span { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 3.75rem; line-height: 1; color: #b9b4e6; }

.lib-main { display: grid; gap: 14px; align-content: start; }
.lib-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.lib-head h3 { flex: 1 1 100%; font-size: 1.375rem; font-weight: 800; line-height: 1.1; }
.lib-progress { display: grid; gap: 8px; }
.lib-progress p { color: var(--ink-2); }
.lib-progress b { font-family: var(--font-display); font-stretch: 86%; font-weight: 800; font-size: 1.75rem; line-height: 1; letter-spacing: -.02em; color: var(--ink); margin-right: 2px; }
.lib-main > p { max-width: 58ch; }

.lib-open { justify-self: stretch; margin-top: 4px; }

/* Fortschritt je Prüfungsgebiet: Name und Zahl in einer Zeile, darunter der Balken in voller Breite. */
.lib-modules { list-style: none; margin: 0; display: grid; gap: 12px; align-content: center; }
.lib-modules li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; font-size: .875rem; }
.lib-module-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-module-count { color: var(--ink-2); text-align: right; white-space: nowrap; }
.lib-module-count b { color: var(--ink); font-weight: 700; }
.lib-modules .bar { grid-column: 1 / -1; height: 8px; }
.lib-modules .locked { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }

/* Weg zur Vollversion: nur bei Libraries in der Gratis-Stufe. Stand, Tempo, ein Knopf zum Angebot. */
.lib-unlock { display: grid; gap: 12px; align-content: center; }
.lib-unlock .button { justify-self: start; padding-inline: 18px; white-space: nowrap; }

@media (min-width: 700px) {
  .lib { grid-template-columns: 184px minmax(0, 1fr); padding-bottom: 26px; }
  .lib > * { grid-column: 2; padding-inline: 28px; }
  .lib > .lib-cover { grid-column: 1; grid-row: 1 / span 3; height: auto; padding: 0; margin-bottom: -26px; }
  .lib-cover img { object-position: 50% 50%; }
  .lib-main { padding-top: 26px; }
  .lib-open { justify-self: start; min-width: 168px; }
  .lib-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
  .lib > .lib-unlock { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 28px; margin-inline: 28px; padding: 20px 0 0; border-top: 1px solid var(--line); }
  .lib-unlock .way-title { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .lib { grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1.1fr) 288px; column-gap: 0; padding-bottom: 0; }
  .lib.unlocked { grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1.1fr); }
  .lib > * { grid-column: auto; padding: 28px 0 28px 32px; }
  .lib > .lib-cover { grid-column: auto; grid-row: auto; padding: 0; margin-bottom: 0; }
  .lib > .lib-modules { grid-template-columns: minmax(0, 1fr); padding-left: 40px; }
  .lib.unlocked > .lib-modules { padding-right: 36px; }
  .lib > .lib-unlock { grid-template-columns: minmax(0, 1fr); align-items: start; margin: 0 0 0 28px; padding: 28px 24px; border-top: 0; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--sheet-2) 45%, var(--sheet)); }
  .lib-unlock .bar { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); }
}

/* Rangliste neben Coins und Konto */
.cockpit-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.board-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 20px; }
.board-tools { flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }
.board-panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 12px 12px; }
.board-panel .board td:nth-child(2) { overflow-wrap: anywhere; }
.board-panel .board .chip { margin-left: 10px; }
.board-note { padding: 14px 12px 8px; font-size: .9375rem; }
#board-self { border-top: 1px solid var(--line); }
#board-empty { padding-block: 28px; }

.side { display: grid; gap: 40px; align-content: start; }
.side-block { display: grid; gap: 14px; align-content: start; justify-items: start; }
.side-block > * { min-width: 0; }
.side-block + .side-block { border-top: 1px solid var(--line); padding-top: 36px; }
.side-block details { width: 100%; }
.shop { margin: 0; width: 100%; }
.shop > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.shop > div:last-child { border-bottom: 1px solid var(--line); }
.shop dd { margin: 0; flex: none; }

/* Coin-Pakete gegen Geld: nur sichtbar, wenn der Katalog das Echtgeld-Angebot eingeschaltet meldet. */
.packs { display: grid; gap: 10px; width: 100%; margin-top: 12px; }
.packs h3 { font-size: 1.125rem; }
.pack-list { list-style: none; margin: 0; padding: 0; }
.pack-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.pack-list li:last-child { border-bottom: 1px solid var(--line); }
.pack-coins { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.pack-price { font-weight: 650; }

@media (min-width: 1000px) {
  .cockpit-split { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); column-gap: clamp(40px, 5vw, 72px); align-items: start; }
  .side { padding-top: 6px; }
}
@media (max-width: 560px) {
  .board-head .segmented { width: 100%; }
  .board-head .segmented button { flex: 1 1 auto; }
  .board-tools .input.auto { width: 100%; }
  .board-panel { padding-inline: 4px; }
  .board-panel .board td:first-child, .board-panel .board th:first-child { width: 52px; }
}
