/* ============================================================
   system-mischer CI — Denkhüte-Quiz (mobile-first)
   Tokens aus colors_and_type.css des CI-Skills.
   ============================================================ */

/* ---- Self-hosted Lato (Marke) ---- */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400;
  src: url("/fonts/Lato-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700;
  src: url("/fonts/Lato-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 900;
  src: url("/fonts/Lato-Black.ttf") format("truetype"); font-display: swap; }

:root {
  /* Brand */
  --brand-orange: #E85A2C;
  --brand-orange-deep: #C84A22;
  --brand-teal: #2EC4B6;
  --brand-teal-deep: #1FA396;
  --brand-teal-soft: #C8EEEA;
  --brand-sage: #D8E3D5;
  --brand-sage-soft: #ECF1EA;

  /* Ink / Text */
  --ink: #111111;
  --ink-2: #2A2A2A;
  --ink-3: #5A5A5A;
  --ink-4: #8A8A8A;

  /* Surfaces */
  --paper: #FBF8F4;
  --paper-2: #F2EEE7;
  --white: #FFFFFF;
  --rule: #E4E1DC;

  /* Semantic */
  --ok: #2E9E6D;
  --ok-soft: #E4F3EC;
  --err: #C8392E;
  --err-soft: #F8E5E3;

  /* Radii */
  --r-md: 8px;     /* Inputs */
  --r-lg: 14px;    /* Karten */
  --r-pill: 999px; /* Buttons */

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(20,15,10,.04), 0 2px 6px rgba(20,15,10,.04);
  --shadow-2: 0 4px 14px rgba(20,15,10,.06), 0 2px 4px rgba(20,15,10,.04);

  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 540px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 28px);
  display: flex; flex-direction: column;
}

/* ---------- Screen-Umschaltung ---------- */
.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Branding ---------- */
.brand { display: flex; justify-content: center; margin-bottom: 22px; }
.brand__logo { height: 38px; width: auto; max-width: 74%; object-fit: contain; }

.eyebrow {
  font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--brand-orange);
  text-align: center; margin: 0 0 6px;
}
.title {
  font-weight: 900; font-size: 2rem; line-height: 1.1; letter-spacing: -0.01em;
  text-align: center; color: var(--ink); margin: 0 0 12px; text-wrap: balance;
}
.subtitle {
  text-align: center; color: var(--ink-3);
  margin: 0 auto 26px; max-width: 32em; font-size: 1rem; line-height: 1.6;
}

/* ---------- Startformular ---------- */
.start-form { display: flex; flex-direction: column; gap: 12px; }
.field-label { font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.text-input {
  width: 100%; padding: 15px 16px; font-size: 1.05rem; font-family: inherit;
  border: 1.5px solid var(--rule); border-radius: var(--r-md);
  background: var(--white); color: var(--ink);
}
.text-input::placeholder { color: var(--ink-4); }
.text-input:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 3px var(--brand-teal-soft); }

.btn {
  font-family: inherit; font-size: 1.02rem; font-weight: 700;
  padding: 15px 24px; border: none; border-radius: var(--r-pill);
  cursor: pointer; transition: background .12s ease, transform .08s ease, color .12s ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--brand-teal); color: #fff; }
.btn--primary:hover { background: var(--brand-teal-deep); }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn--ghost:hover { color: var(--brand-orange); border-color: var(--brand-orange); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.error-msg { color: var(--err); text-align: center; font-weight: 700; margin-top: 14px; }

/* ---------- Legende auf Startscreen ---------- */
.hats-legend { margin-top: auto; padding-top: 28px; }
.hats-legend__title {
  font-weight: 700; font-size: .8rem; letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 10px;
}
.hats-legend__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hats-legend__list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 9px 12px; font-size: .9rem; box-shadow: var(--shadow-1);
}
.hats-legend__list img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.hats-legend__list b { font-weight: 700; color: var(--ink); }
.hats-legend__list span { color: var(--ink-3); }

/* ---------- Loading ---------- */
#screen-loading { align-items: center; justify-content: center; text-align: center; gap: 16px; }
.loader {
  width: 52px; height: 52px; border-radius: 50%;
  border: 5px solid var(--rule); border-top-color: var(--brand-teal);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-weight: 900; font-size: 1.15rem; margin: 0; color: var(--ink); }
.loading-sub { color: var(--ink-3); margin: 0; }

/* ---------- Quiz ---------- */
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-pill {
  font-weight: 700; font-size: .82rem; padding: 6px 13px; border-radius: var(--r-pill);
  background: var(--white); border: 1px solid var(--rule); color: var(--ink-2);
}
.progress-pill--score { background: var(--brand-teal); color: #fff; border-color: transparent; }

.progress-bar { height: 6px; background: var(--rule); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 20px; }
.progress-bar__fill { height: 100%; width: 0%; background: var(--brand-teal); transition: width .3s ease; }

.statement-card {
  position: relative; background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: 28px 22px; font-size: 1.28rem; font-weight: 700; line-height: 1.4; color: var(--ink);
  min-height: 130px; display: flex; align-items: center; overflow: hidden;
  margin-bottom: 18px;
}
.statement-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand-orange);
}
.quiz-hint { text-align: center; color: var(--ink-3); margin: 0 0 16px; font-size: .95rem; }

/* Hut-Auswahl */
.hat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hat-btn {
  background: var(--white); border: 1.5px solid var(--rule);
  border-radius: var(--r-lg); padding: 12px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; font-family: inherit; box-shadow: var(--shadow-1);
  transition: border-color .12s ease, transform .08s ease, background .12s ease;
}
.hat-btn:hover { border-color: var(--brand-teal); }
.hat-btn:active { transform: scale(0.97); }
.hat-btn img { width: 52px; height: 52px; object-fit: contain; pointer-events: none; }
.hat-btn span { font-size: .8rem; font-weight: 700; text-align: center; line-height: 1.15; color: var(--ink); }
.hat-btn:disabled { cursor: default; box-shadow: none; }
.hat-btn.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.hat-btn.is-wrong { border-color: var(--err); background: var(--err-soft); }
.hat-btn.is-dim { opacity: .4; }

/* Feedback */
.feedback {
  margin-top: 18px; background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-2);
}
.feedback__headline { font-weight: 900; font-size: 1.12rem; margin: 0 0 6px; color: var(--ink); }
.feedback__headline.ok { color: var(--ok); }
.feedback__headline.no { color: var(--err); }
.feedback__detail { color: var(--ink-3); margin: 0 0 16px; font-size: .95rem; line-height: 1.55; }
.feedback__detail b { color: var(--ink); }
.feedback .btn { width: 100%; }

/* ---------- Result ---------- */
#screen-result { align-items: center; text-align: center; }
.score-ring {
  width: 160px; height: 160px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: conic-gradient(var(--brand-teal) var(--p, 0%), var(--rule) 0);
  margin: 10px 0 20px; position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--paper);
}
.score-ring__num { position: relative; font-size: 3.1rem; font-weight: 900; color: var(--ink); line-height: 1; }
.score-ring__max { position: relative; font-size: 1rem; color: var(--ink-4); font-weight: 700; }
.result-msg { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0 0 24px; max-width: 26em; }

.breakdown { width: 100%; margin-bottom: 24px; }
.breakdown__title {
  font-weight: 700; font-size: .8rem; letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 10px; text-align: left;
}
.breakdown__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.breakdown__list li {
  display: flex; align-items: center; gap: 10px; font-size: .92rem;
  background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 8px 12px; box-shadow: var(--shadow-1);
}
.breakdown__list img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.breakdown__list .b-name { font-weight: 700; color: var(--ink); flex: 1; text-align: left; }
.breakdown__list .b-count { color: var(--ink-3); font-weight: 700; }

#screen-result .btn { width: 100%; max-width: 320px; }
