:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #d9e0ea;
  --border-strong: #b8c4d4;
  --accent: #155eef;
  --accent-hover: #004eeb;
  --accent-soft: #eef4ff;
  --accent-alt: #6938ef;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --shadow: 0 10px 30px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, .96);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(16, 24, 40, .05);
  backdrop-filter: blur(12px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-link:hover strong { color: var(--accent); }

.brand-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-link strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.25;
}

.brand-link small {
  display: block;
  margin-top: .18rem;
  color: var(--muted);
  font-size: .88rem;
}

.header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
}

.header-nav,
.header-status {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .52rem .75rem;
  font-size: .86rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: filter .15s ease, transform .15s ease, opacity .15s ease;
}

.header-nav-button.secondary { background: #475467; }
.header-nav-button:hover:not(:disabled) {
  filter: brightness(.96);
  transform: translateY(-1px);
}

#status,
#contextBadge {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .32rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.wrap { flex-wrap: wrap; }

.eyebrow {
  margin: 0 0 .25rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3 { color: var(--text); }
h2 { margin-top: 0; }

.training-progress {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .04);
}

.training-progress li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.training-progress li:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -12%;
  width: 24%;
  height: 2px;
  background: var(--border);
}

.training-progress li span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: #eef1f6;
  color: #475467;
}

.training-progress li.done,
.training-progress li.active { color: var(--text); }

.training-progress li.done span {
  background: var(--success-soft);
  color: var(--success);
}

.training-progress li.active span {
  background: var(--accent);
  color: white;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .9rem;
  margin-top: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #9fb3ce;
  box-shadow: 0 12px 25px rgba(16, 24, 40, .08);
}

.card h3 { margin: 0; }
.card p { margin: .15rem 0; color: var(--muted); }
.card .button-row { margin-top: auto; padding-top: .6rem; }

.card-meta,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.tags { margin-top: .35rem; }

.tag,
.badge,
.status-pill {
  border-radius: 999px;
  padding: .22rem .55rem;
  font-size: .78rem;
  font-weight: 700;
}

.tag,
.badge {
  background: #eef2ff;
  color: #3730a3;
}

.badge.own { background: var(--success-soft); color: var(--success); }
.badge.shared { background: #fff7ed; color: #9a3412; }
.badge.draft { background: #f2f4f7; color: #475467; }

.status-pill {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid #fedf89;
}

.status-pill.ready {
  background: var(--success-soft);
  color: var(--success);
  border-color: #abefc6;
}

.row-between {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.button-row {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  align-items: center;
}

button {
  border: 0;
  border-radius: 10px;
  padding: .68rem .95rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: filter .15s ease, transform .15s ease, opacity .15s ease;
}

button:hover:not(:disabled) {
  filter: brightness(.96);
  transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(21, 94, 239, .22);
  outline-offset: 2px;
}

button:disabled { opacity: .45; cursor: not-allowed; }
button.danger { background: var(--danger); }
button.secondary { background: #475467; }
button.accent-alt { background: var(--accent-alt); }
button.small { padding: .5rem .7rem; font-size: .86rem; }
button.icon-button { font-size: 1.45rem; line-height: 1; padding: .35rem .65rem; }

.editor-heading { margin-bottom: 1rem; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin: 0 0 1rem;
}

legend {
  padding: 0 .45rem;
  font-weight: 750;
}

.form-grid {
  display: grid;
  gap: .9rem;
}

.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .35rem;
  color: #344054;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .67rem .75rem;
  background: white;
  color: var(--text);
  font: inherit;
}

textarea { resize: vertical; }
select[multiple] { min-height: 6.3rem; }
input:focus,
textarea:focus,
select:focus { border-color: var(--accent); }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  color: #344054;
  font-weight: 650;
}

.check-row input {
  width: auto;
  margin-top: .2rem;
}

.editor-footer,
.soundcheck-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.code-preview,
.lab pre {
  white-space: pre-wrap;
  background: var(--panel-soft);
  color: #344054;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
}

.code-preview { margin-top: 1rem; max-height: 520px; }

.scenario-summary {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 1rem 0;
  padding: .9rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
}

.scenario-summary span { color: #344054; }

.soundcheck-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.soundcheck-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

.soundcheck-card h3 { margin: 0 0 .8rem; font-size: 1rem; }
.soundcheck-card .field + .field { margin-top: .75rem; }

.hint,
.check-status {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.check-status.ok { color: var(--success); font-weight: 700; }
.check-status.error { color: var(--danger); font-weight: 700; }

.level-meter {
  width: 100%;
  height: 16px;
  margin: .85rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #e9eef5;
}

.level-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12b76a 0%, #fdb022 72%, #f04438 100%);
  transition: width .08s linear;
}

.soundcheck-checklist {
  display: grid;
  gap: .75rem;
  margin: 1rem 0;
}

.soundcheck-audio {
  width: 100%;
  margin-top: .8rem;
}

.soundcheck-footer {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
}

.soundcheck-footer p { margin: .25rem 0 0; }

.controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-weight: 650;
}

.transcript {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  padding: 1rem;
}

.msg {
  margin-bottom: .85rem;
  padding: .75rem;
  border-radius: 12px;
  max-width: 82%;
}

.msg .who {
  font-weight: 750;
  margin-bottom: .25rem;
  font-size: .86rem;
}

.msg.learner { margin-left: auto; background: #dbeafe; }
.msg.ai { background: #eef1f6; }

.turnForm {
  margin-top: .85rem;
  display: flex;
  gap: .5rem;
  align-items: stretch;
}

.turnForm input,
.turnForm textarea { flex: 1; }

.feedback-content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  white-space: normal;
}

.feedback-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--accent-soft);
}

.feedback-goal {
  display: grid;
  place-items: center;
  min-width: 5.3rem;
  min-height: 5.3rem;
  padding: .65rem;
  border-radius: 14px;
  background: white;
  border: 1px solid #b2ccff;
  text-align: center;
  font-weight: 800;
  color: var(--accent);
}

.feedback-hero h3,
.feedback-section h3 { margin: 0 0 .45rem; }
.feedback-hero p { margin: 0; line-height: 1.55; }

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.feedback-section {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
}

.feedback-section.success { border-left: 4px solid var(--success); }
.feedback-section.attention { border-left: 4px solid #f79009; }
.feedback-section.improve { border-left: 4px solid var(--accent); }

.feedback-section ul {
  margin: .45rem 0 0;
  padding-left: 1.2rem;
}

.feedback-section li + li { margin-top: .42rem; }

.score-list { display: grid; gap: .7rem; }
.score-row { display: grid; grid-template-columns: minmax(130px, .6fr) 1fr auto; gap: .75rem; align-items: center; }
.score-bar { height: 10px; overflow: hidden; border-radius: 999px; background: #e9eef5; }
.score-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.score-comment { grid-column: 2 / 4; color: var(--muted); font-size: .88rem; }

.lab-grid {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

#labOutput { min-height: 80px; }

dialog {
  border: 0;
  padding: 0;
  border-radius: 18px;
  width: min(900px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  box-shadow: 0 24px 70px rgba(16, 24, 40, .28);
}

dialog::backdrop { background: rgba(17, 24, 39, .45); }
.dialog-shell { padding: 1.2rem; background: white; }

.authoring-chat {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  min-height: 320px;
  max-height: 52vh;
  overflow: auto;
  padding: 1rem;
  margin-top: .8rem;
}

.authoring-message {
  max-width: 86%;
  padding: .75rem .85rem;
  border-radius: 13px;
  margin-bottom: .75rem;
  white-space: pre-wrap;
}

.authoring-message.assistant { background: #ede9fe; }
.authoring-message.user { background: #dbeafe; margin-left: auto; }
.authoring-message .who { font-size: .78rem; font-weight: 750; margin-bottom: .25rem; }
.dialog-actions { margin-top: .8rem; }

a.header-nav-button:visited { color: white; }

@media (max-width: 980px) {
  .soundcheck-grid { grid-template-columns: 1fr; }
}

a.header-nav-button:visited { color: white; }

@media (max-width: 760px) {
  .headset-callout { grid-template-columns: 1fr; }
  .headset-callout-icon { width: 3.5rem; height: 3.5rem; }
  .app-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 1rem;
  }

  .header-side { align-items: stretch; }
  .header-nav,
  .header-status { justify-content: flex-start; }
  .header-nav button,
  .header-nav a { flex: 1; }

  .brand-link small { white-space: normal; }
  main { padding: .8rem; }
  .panel { padding: 1rem; border-radius: 14px; }
  .form-grid.two,
  .feedback-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .row-between { flex-direction: column; }
  .button-row { width: 100%; }
  .button-row button { flex: 1; }
  .turnForm { flex-direction: column; }

  .training-progress {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: .7rem .35rem;
  }

  .training-progress li {
    flex-direction: column;
    gap: .25rem;
    font-size: .68rem;
    text-align: center;
  }

  .training-progress li:not(:last-child)::after { display: none; }
  .feedback-hero { grid-template-columns: 1fr; }
  .feedback-goal { min-height: auto; }
  .score-row { grid-template-columns: 1fr auto; }
  .score-bar { grid-column: 1 / 3; }
  .score-comment { grid-column: 1 / 3; }
}

/* Mikrofonhilfe im Soundcheck */
.soundcheck-title-row {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.soundcheck-title-row h2 { margin-bottom: 0; }

.help-icon-button {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #a9c4ff;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
}

.help-icon-button:hover,
.help-icon-button:focus-visible {
  border-color: var(--accent);
  background: #dbe8ff;
  color: var(--accent-hover);
  transform: none;
}

.help-dialog { width: min(820px, calc(100vw - 2rem)); }
.microphone-help-shell { max-height: calc(100vh - 2rem); overflow: auto; }
.help-dialog-heading { align-items: flex-start; gap: 1rem; }
.help-dialog-heading h2 { margin-bottom: .35rem; }
.help-dialog-heading p:last-child { margin: 0; }

.detected-environment {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0;
  padding: .85rem 1rem;
  border: 1px solid #b2ccff;
  border-radius: 13px;
  background: var(--accent-soft);
}

.detected-environment > span {
  color: var(--accent);
  font-size: 1.1rem;
}

.detected-environment div {
  display: flex;
  flex-direction: column;
  gap: .12rem;
}

.detected-environment strong { font-size: .86rem; }
.detected-environment div span { color: #344054; font-size: .9rem; }

.microphone-help-steps {
  display: grid;
  gap: 1rem;
}

.quick-help {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

.quick-help h3 { margin: 0 0 .55rem; font-size: 1rem; }
.quick-help ol { margin: 0; padding-left: 1.25rem; }
.quick-help li + li { margin-top: .35rem; }

.help-accordion {
  display: grid;
  gap: .55rem;
}

.help-accordion details {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.help-accordion details[open] {
  border-color: #a9c4ff;
  box-shadow: 0 5px 16px rgba(21, 94, 239, .08);
}

.help-accordion summary {
  cursor: pointer;
  padding: .8rem 2.7rem .8rem .9rem;
  color: #344054;
  font-weight: 750;
  list-style: none;
  position: relative;
}

.help-accordion summary::-webkit-details-marker { display: none; }
.help-accordion summary::after {
  content: "+";
  position: absolute;
  right: .95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}
.help-accordion details[open] summary::after { content: "−"; }
.help-accordion summary:hover { background: var(--panel-soft); }

.help-detail-content {
  padding: 0 .95rem .9rem;
  color: #475467;
  line-height: 1.5;
}

.help-detail-content ol,
.help-detail-content ul {
  margin: .15rem 0 0;
  padding-left: 1.25rem;
}

.help-detail-content li + li { margin-top: .35rem; }
.help-detail-content .hint { margin-bottom: 0; }
.help-dialog-actions { display: flex; justify-content: flex-end; }

a.header-nav-button:visited { color: white; }

@media (max-width: 560px) {
  .help-dialog { width: calc(100vw - 1rem); }
  .microphone-help-shell { padding: 1rem; max-height: calc(100vh - 1rem); }
  .help-dialog-heading { flex-wrap: nowrap; }
}


.headset-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid #b2ccff;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff5ff 0%, #ffffff 100%);
}

.headset-callout-icon {
  display: grid;
  place-items: center;
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 14px;
  background: white;
  border: 1px solid #cdd9ee;
  font-size: 2rem;
}

.headset-callout strong {
  display: block;
  margin-bottom: .25rem;
  font-size: 1rem;
}

.headset-callout p {
  margin: 0;
  color: #344054;
  line-height: 1.5;
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(3px);
}

.analysis-overlay-card {
  width: min(480px, calc(100vw - 2rem));
  padding: 1.4rem 1.35rem;
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
  text-align: center;
  border: 1px solid #d7dfeb;
}

.analysis-overlay-card h3 {
  margin: .3rem 0 .5rem;
}

.analysis-overlay-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.analysis-spinner {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  border: 4px solid #d9e6ff;
  border-top-color: var(--accent);
  animation: analysis-spin 1s linear infinite;
}

@keyframes analysis-spin {
  to { transform: rotate(360deg); }
}

/* Vue-Template-Bootstrap */
.bootstrap-loading,
.bootstrap-error {
  max-width: 760px;
  margin: 4rem auto;
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.bootstrap-loading {
  color: var(--muted);
  text-align: center;
}

.bootstrap-error h1 { margin-top: 0; }
