/* Geschichte & Politische Bildung Trainer — mobile-first */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --red:    #ED2939;
  --white:  #ffffff;
  --black:  #1a1a1a;
  --gold:   #d4860a;
  --grey0:  #f5f5f5;
  --grey1:  #e8e8e8;
  --grey2:  #999;
  --green:  #1a9954;
  --green-bg: #e6f4ec;
  --red-bg: #fdecea;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max: 480px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--grey0);
  color: var(--black);
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
}

/* ── Layout ─────────────────────────────────────────────── */

.screen {
  width: 100%;
  max-width: var(--max);
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100dvh;
}

/* ── App header strip ─────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .flag {
  display: flex;
  flex-direction: column;
  width: 28px;
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.app-header .flag span { flex: 1; display: block; }
.app-header .flag .f1 { background: var(--red); }
.app-header .flag .f2 { background: var(--white); border-top: 1px solid var(--grey1); border-bottom: 1px solid var(--grey1); }
.app-header .flag .f3 { background: var(--red); }

.app-header h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.01em;
}

/* ── Name screen ─────────────────────────────────────────── */

#screen-name {
  justify-content: center;
  gap: 28px;
}

#screen-name h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

#screen-name p.sub {
  text-align: center;
  color: var(--grey2);
  font-size: 0.95rem;
  margin-top: -12px;
}

#name-input {
  width: 100%;
  font-size: 1.25rem;
  padding: 14px 16px;
  border: 2px solid var(--grey1);
  border-radius: var(--radius);
  outline: none;
  text-align: center;
  background: var(--white);
  transition: border-color 0.15s;
}
#name-input:focus { border-color: var(--red); }

/* ── Home screen ─────────────────────────────────────────── */

#home-greeting {
  font-size: 1.5rem;
  font-weight: 700;
}

.today-card {
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.today-card .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
}
.today-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
}
.today-card .sub-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  margin-top: -4px;
}

.section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey2);
  font-weight: 600;
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.type-btn {
  background: var(--white);
  border: 2px solid var(--grey1);
  border-radius: var(--radius);
  padding: 14px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: border-color 0.15s, background 0.15s;
}
.type-btn:active { background: var(--grey1); }
.type-btn .type-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--grey2);
  margin-top: 2px;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn-primary:active { filter: brightness(0.9); }

/* today-card button override */
.today-card .btn-primary {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  margin-top: 4px;
}
.today-card .btn-primary:active { background: rgba(255,255,255,0.3); }

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--grey1);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:active { background: var(--grey1); }

.btn-link {
  background: none;
  border: none;
  color: var(--grey2);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  text-align: center;
  width: 100%;
}

/* ── Exercise screen ─────────────────────────────────────── */

.ex-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ex-type-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey2);
}
#ex-counter {
  font-size: 0.85rem;
  color: var(--grey2);
  font-weight: 500;
}

.progress-track {
  height: 6px;
  background: var(--grey1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Full question text (quiz / zuordnung) */
.ex-question {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.45;
  padding: 8px 4px;
  color: var(--black);
}

/* Sentence with blank (Lückentext) */
.ex-sentence {
  font-size: 1.25rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.6;
}
.blank {
  display: inline-block;
  border-bottom: 3px solid var(--red);
  min-width: 60px;
  padding: 0 4px;
  color: var(--red);
  font-weight: 700;
}

.ex-hint-label {
  font-size: 0.88rem;
  color: var(--grey2);
  text-align: center;
}

/* ── Choice buttons ──────────────────────────────────────── */

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-btn {
  padding: 14px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid var(--grey1);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  color: var(--black);
  line-height: 1.35;
  text-align: left;
}
.choice-btn:active:not(:disabled) { background: var(--grey1); }
.choice-btn:disabled { cursor: default; opacity: 0.7; }
.choice-btn.correct {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
  opacity: 1;
}
.choice-btn.wrong {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
  opacity: 1;
}

/* ── Zeitleiste chips ────────────────────────────────────── */

.word-answer-area,
.word-pool-area {
  min-height: 52px;
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.word-answer-area {
  background: var(--white);
  border: 2px solid var(--red);
}
.word-pool-area {
  background: var(--grey1);
  border: 2px solid transparent;
}

.placeholder {
  color: var(--grey2);
  font-size: 1rem;
  padding: 4px;
}

.word-chip {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter 0.1s;
  line-height: 1.3;
  text-align: left;
}
.word-chip:active { filter: brightness(0.9); }
.pool-chip {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--grey1);
}
.answer-chip {
  background: var(--black);
  color: var(--white);
}
.word-chip:disabled { opacity: 0.6; cursor: default; }

.btn-check {
  width: 100%;
  padding: 16px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-check:disabled { opacity: 0.4; cursor: default; }

/* ── Feedback ─────────────────────────────────────────────── */

.feedback {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feedback-correct {
  background: var(--green-bg);
  color: var(--green);
  border: 1.5px solid var(--green);
}
.feedback-wrong {
  background: var(--red-bg);
  color: var(--red);
  border: 1.5px solid var(--red);
}
.fb-icon { font-size: 1.1rem; }
.fb-correct {
  color: var(--black);
  display: block;
  margin-top: 2px;
}
.fb-rule {
  color: var(--black);
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.8;
}

/* ── Summary screen ──────────────────────────────────────── */

#screen-summary {
  justify-content: center;
  text-align: center;
  gap: 24px;
}
#screen-summary h2 {
  font-size: 1.4rem;
  font-weight: 700;
}
.summary-score-big {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--black);
}
.summary-pct {
  font-size: 1.3rem;
  color: var(--grey2);
  margin-top: -8px;
}
.summary-grade {
  font-size: 1.4rem;
  font-weight: 600;
}
.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ── Stats screen ─────────────────────────────────────────── */

#stats-name { font-size: 1.3rem; font-weight: 700; }

.stats-tabs {
  display: flex;
  gap: 6px;
  background: var(--grey1);
  border-radius: var(--radius);
  padding: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.tab-active {
  background: var(--white);
  color: var(--black);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tab-btn:active:not(.tab-active) { background: var(--grey1); }

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.stat-label { font-weight: 600; font-size: 0.95rem; }
.stat-pct   { font-weight: 700; font-size: 1.1rem; color: var(--red); }
.stat-bar-bg {
  height: 8px;
  background: var(--grey1);
  border-radius: 999px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.stat-sub { font-size: 0.8rem; color: var(--grey2); }

.stats-overall-line {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--grey2);
  text-align: center;
}
