:root {
  --bg: #f5f4ef;
  --panel: #ffffff;
  --panel-alt: #fbfaf6;
  --text: #1b1e1c;
  --muted: #6c7268;
  --accent: #2f6f5e;
  --accent-hover: #24594b;
  --accent-soft: #e4f0ea;
  --border: #e6e2d6;
  --error: #b5432f;
  --good: #2f6f5e;
  --improve: #b07a1e;
  --mistake: #b5432f;
  --shadow-sm: 0 1px 2px rgba(30, 30, 20, 0.05);
  --shadow-md: 0 10px 30px -14px rgba(30, 40, 30, 0.22);
  --radius: 14px;
}

* { box-sizing: border-box; }

button {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: inherit;
}
button strong, button span { -webkit-text-decoration: none; text-decoration: none; color: inherit; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 15% -10%, #eef4ee 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #f3ede1 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

header.hero {
  padding: 44px 0 28px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
h1 {
  margin: 0 0 6px;
  font-family: "Fraunces", "Inter", serif;
  font-weight: 800;
  font-size: 3rem;
  letter-spacing: -0.02em;
}
.subtitle { margin: 0; color: var(--muted); font-size: 0.95rem; }

main { display: flex; flex-direction: column; gap: 18px; }

.screen {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

h2 { margin: 0 0 6px; font-family: "Fraunces", serif; font-weight: 600; font-size: 1.4rem; }
h3 { margin: 0 0 10px; font-size: 0.95rem; }

.scenario-card p { margin: 0 0 8px; line-height: 1.5; }
.scenario-card p:last-child { margin-bottom: 0; }

/* Buttons */
.primary-btn, .secondary-btn, .ring-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 16px -6px rgba(47, 111, 94, 0.55);
}
.primary-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }

.secondary-btn {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.secondary-btn:hover { background: #d7ebe2; }

.back-btn { margin-bottom: 14px; }

.ring-btn {
  background: var(--accent);
  color: white;
  min-width: 240px;
  box-shadow: 0 8px 22px -8px rgba(47, 111, 94, 0.6);
}
.ring-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
#ptt-btn.recording {
  background: var(--error);
  box-shadow: 0 8px 22px -8px rgba(181, 67, 47, 0.6);
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}
.ring-btn:disabled {
  background: #c7c3b6;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0; }
.error-msg { color: var(--error); font-weight: 600; }

/* Level select */
.level-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 4px;
}
.level-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.level-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.level-num {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.level-btn[data-level="mittel"] .level-num { background: #f5ecd7; color: var(--improve); }
.level-btn[data-level="schwer"] .level-num { background: #f6e2dc; color: var(--mistake); }
.level-copy { display: flex; flex-direction: column; gap: 2px; }
.level-copy strong { font-size: 0.98rem; }
.level-copy span { font-size: 0.82rem; color: var(--muted); }

.level-card { display: flex; flex-direction: column; }
.level-card .level-btn { width: 100%; }

.tip-banner {
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdf1e8;
  border: 1px solid #f0d5b8;
  font-size: 0.83rem;
}
.tip-banner-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tip-link {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-hover);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.tip-content {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e3c49a;
  line-height: 1.45;
}
.tip-content .tip-objection { font-weight: 700; display: block; margin-bottom: 4px; }

.progress-cta {
  margin: 6px 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-trend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-alt);
}
.progress-trend-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.progress-trend-label { color: var(--muted); }

.feedback-columns-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 680px) { .feedback-columns-2 { grid-template-columns: 1fr; } }
.fb-mistakes-readonly li { background: #f8e9e4; border-left: 4px solid var(--mistake); }

/* History panel */
.history-panel {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.history-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.history-panel-header h3 { margin: 0; }
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.history-item:hover { border-color: var(--accent); transform: translateX(2px); }
.history-outcome-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.history-outcome-dot.win { background: var(--good); }
.history-outcome-dot.loss { background: var(--mistake); }
.history-item .h-name { font-weight: 600; margin-right: auto; }
.history-item .h-level {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ece8dc;
  color: var(--muted);
}
.history-item .h-time { color: var(--muted); font-size: 0.78rem; }

/* Conversation screen */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
#customer-name { font-weight: 700; font-size: 1.15rem; margin-right: auto; font-family: "Fraunces", serif; }

.status-indicator, .level-badge {
  font-size: 0.75rem;
  padding: 4px 11px;
  border-radius: 999px;
  font-weight: 600;
}
.status-indicator { background: #eeece4; color: var(--muted); }
.status-indicator.speaking { background: var(--accent-soft); color: var(--accent); }
.status-indicator.listening { background: #f6e2dc; color: var(--error); }
.status-indicator.thinking { background: #f5ecd7; color: var(--improve); }

.level-badge { background: #e8e4d8; color: var(--text); }
.level-badge.level-leicht { background: var(--accent-soft); color: var(--good); }
.level-badge.level-mittel { background: #f5ecd7; color: var(--improve); }
.level-badge.level-schwer { background: #f6e2dc; color: var(--mistake); }

.headphone-gate {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 4px 0 16px;
  border-radius: 10px;
  background: #fdf1e8;
  border: 1px solid #f0d5b8;
  font-size: 0.86rem;
  line-height: 1.4;
  cursor: pointer;
}
.headphone-gate input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.headphone-gate em { font-style: normal; color: var(--muted); }

/* Unterlevel-Auswahl */
.sublevel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.sublevel-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.sublevel-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sublevel-card.completed { border-color: var(--good); background: var(--accent-soft); }
.sublevel-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8e4d8;
  color: var(--text);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.sublevel-card.completed .sublevel-num { background: var(--good); color: white; }
.sublevel-desc { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.sublevel-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  color: var(--good);
}

.system-note {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  margin: 10px 0;
}

.transcript {
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  background: var(--panel-alt);
}

.bubble {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  max-width: 88%;
  align-items: flex-end;
}
.bubble.user { margin-left: auto; flex-direction: row-reverse; }
.bubble-text {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 0.94rem;
  box-shadow: var(--shadow-sm);
}
.bubble.customer .bubble-text { background: #eeecdf; color: var(--text); border-bottom-left-radius: 4px; }
.bubble.user .bubble-text { background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.bubble-avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
}
.bubble.customer .bubble-avatar { background: #8a8571; }
.bubble.user .bubble-avatar { background: var(--accent-hover); }

.controls { text-align: center; }
#feedback-btn { margin-top: 4px; }
#skip-farewell-btn { display: block; margin: 10px auto 0; }

/* Feedback */
.feedback-outcome { font-weight: 600; margin-top: -4px; }

.timings-block {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-alt);
}
.timings-summary { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.timings-list li {
  font-size: 0.85rem;
  padding: 7px 12px;
  border-left: 4px solid transparent;
  background: #f0efe6;
  border-radius: 8px;
  margin-bottom: 4px;
}
.timings-list li.timing-good { border-left-color: var(--good); }
.timings-list li.timing-mid { border-left-color: var(--improve); }
.timings-list li.timing-bad { border-left-color: var(--mistake); }

.feedback-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0 24px;
}
@media (max-width: 680px) {
  .feedback-columns { grid-template-columns: 1fr; }
}

.feedback-col h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.95rem;
}
.col-icon { width: 17px; height: 17px; flex: none; }
.feedback-col-good h3 { color: var(--good); }
.feedback-col-mid h3 { color: var(--improve); }
.feedback-col-bad h3 { color: var(--mistake); }

.fb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fb-list li {
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 0.88rem;
  line-height: 1.4;
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-sm);
}
.fb-positive li { background: var(--accent-soft); border-left-color: var(--good); }
.fb-improvable li { background: #f7efdc; border-left-color: var(--improve); }
.fb-mistakes li {
  background: #f8e9e4;
  border-left-color: var(--mistake);
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.fb-mistakes li:hover { box-shadow: var(--shadow-md); }
.fb-mistakes li .suggestion {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0,0,0,0.15);
  font-style: italic;
}
.fb-mistakes li.open .suggestion { display: block; }
.fb-mistakes li::after {
  content: "Vorschlag anzeigen \25BE";
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.65;
}
.fb-mistakes li.open::after { content: "Vorschlag ausblenden \25B4"; }

.transcript-block { margin-top: 22px; }

#restart-btn { display: block; margin: 0 auto; }
