body {
  background: #f1f5f8;
}

#app-container {
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
}

.trainer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 2.5vw, 16px);
  width: 100%;
  margin-bottom: 0.65rem;
  padding: clamp(12px, 3vw, 18px) clamp(14px, 4vw, 22px);
  border-radius: 16px;
  background: linear-gradient(110deg, #112e52, #174669);
  color: #fff;
  overflow-wrap: anywhere;
}

.trainer-header p {
  margin: 0 0 0.18rem;
  color: #d6e7f4;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
}

.trainer-header h1 {
  margin: 0;
  color: inherit;
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.15;
}

.trainer-header img {
  display: block;
  width: clamp(30px, 9vw, 48px);
  height: auto;
  filter: brightness(0) invert(1);
}

/* The original phone layout fixes the toolbar at very small font and button sizes. */
#topic-select {
  min-height: 44px;
  padding: 0.55rem 0.7rem !important;
  border-color: #bdcddc;
  font-size: 0.94rem !important;
  font-weight: 650;
  color: #142f4c;
  box-shadow: none;
}

.controls:not(.hidden) {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr)) !important;
  gap: 0.4rem !important;
  margin: 0.45rem 0 !important;
}

.controls.hidden {
  display: none !important;
}

.controls .control-btn {
  min-width: 0;
  min-height: 42px !important;
  padding: 0.45rem 0.55rem !important;
  font-size: 0.82rem !important;
  font-weight: 600;
  line-height: 1.25 !important;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none !important;
}

.progress-text {
  color: #435a70;
  font-size: 0.8rem !important;
  line-height: 1.35 !important;
  margin: 0 0 0.25rem !important;
  text-align: start;
}

.progress-container {
  margin-bottom: 0.65rem !important;
}

#app-container .card-buttons {
  background: #f4f7fa !important;
  border-color: #d8e2eb !important;
  box-shadow: none !important;
}

#app-container .card-buttons .main-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.2rem), 1fr)) !important;
  gap: 0.35rem !important;
}

#app-container .main-actions button {
  min-width: 0;
  padding: 0.4rem 0.2rem !important;
  border-color: #c6d5e2 !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: none !important;
  overflow-wrap: anywhere;
}

#app-container #flip-card {
  background: #173f6d !important;
  color: #fff !important;
  border-color: #173f6d !important;
}

#app-container #flip-card span {
  color: #fff !important;
}

#app-container .main-actions button span:not(.btn-icon) {
  line-height: 1.3 !important;
}

#prev-card > span:not(.btn-icon),
#flip-card > span:not(.btn-icon),
#next-card > span:not(.btn-icon) {
  font-size: 0.7rem !important;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

#app-container .card-buttons .app-footer {
  order: 3;
  font-weight: 500 !important;
  line-height: 1.45 !important;
}

/* In der Webfassung bleiben Kurs und Verbindungsstatus sichtbar. */
.trainer-course { display: flex; flex-wrap: wrap; gap: .2rem .8rem; margin-top: .3rem; color: #e4edf6; font-size: .82rem; }
.trainer-course span { min-width: 0; overflow-wrap: anywhere; }
