/* ==========================================================================
   Hausiheld – gemeinsames Layout für alle Quiz-Apps (Multiple Choice)
   Baut auf hausiheld.css auf und sieht genauso aus wie die älteren Apps:
   Karte mit Frage, große Antwort-Knöpfe, Trefferquote rechts, Sterne hinten.
   ========================================================================== */
html, body { overflow: hidden; }

/* ---------- Spielbereich ---------- */
#game {
  position: fixed; left: 0; right: 0; top: 0;
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr; gap: 10px;
  padding: 16px 124px max(16px, env(safe-area-inset-bottom)) 16px;
  z-index: 10;
}
header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
header .pills, header .tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#progPill { position: relative; overflow: hidden; }
#progBar { position: absolute; left: 0; bottom: 0; height: 5px; width: 0; background: var(--accent); transition: width .4s; }
.spacer { flex: 1; }

main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(12px, 2.4vh, 26px); min-height: 0;
  overflow-y: auto; overflow-x: hidden;
}
#card {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(6px, 1.2vh, 14px);
  padding: clamp(12px, 2.4vh, 26px) clamp(20px, 5vw, 56px);
  border-radius: 36px;
  max-width: 100%;
}
#tag { font-size: clamp(14px, 2vw, 22px); font-weight: 800; color: var(--accent); min-height: 1.3em; }

/* ---------- Frage (Prompt) ---------- */
#prompt { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.q-emoji { font-size: clamp(72px, 17vh, 168px); line-height: 1; filter: drop-shadow(0 10px 22px rgba(0,0,0,.4)); }
.q-text {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(38px, 8.5vh, 92px); line-height: 1.1;
  text-shadow: 0 6px 0 rgba(0,0,0,.25);
  text-align: center;
  overflow-wrap: anywhere;
}
.q-text.small { font-size: clamp(28px, 5.5vh, 60px); }
.q-sub { font-size: clamp(16px, 2.6vh, 28px); font-weight: 800; opacity: .85; text-align: center; }
.q-html { max-width: min(900px, 92vw); text-align: center; }
.q-html .q-sentence {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(26px, 5vh, 56px); line-height: 1.3;
}
.q-passage {
  max-width: min(780px, 94vw); text-align: left;
  background: rgba(0,0,0,.24); border-radius: 16px; padding: 12px 16px;
  font-size: clamp(15px, 2.3vh, 23px); line-height: 1.5; font-weight: 700;
}
.q-passage h3 { font-family: var(--font-head); margin: 0 0 5px; font-size: 1.15em; color: var(--accent); }
.q-passage p { margin: 0; }
.q-ask {
  margin-top: 10px; text-align: center;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(19px, 3vh, 30px);
}
.gap { display: inline-block; min-width: 2.4em; border-bottom: .12em solid var(--accent); }
.swatch { display: inline-block; width: 1.4em; height: 1.4em; border-radius: 30%; border: 3px solid rgba(255,255,255,.6); vertical-align: middle; }
.shape { width: clamp(110px, 20vh, 190px); height: auto; }
.money { font-family: var(--font-head); font-weight: 700; }
.q-img { width: clamp(96px, 20vh, 180px); height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(0,0,0,.4)); }
#answers button img.opt-img { width: clamp(46px, 9vh, 84px); height: auto; display: block; margin: 0 auto; }

#clock {
  font-family: var(--font-head);
  font-size: clamp(18px, 2.8vw, 32px); font-weight: 600;
  font-variant-numeric: tabular-nums; opacity: .9;
}

#feedback { font-size: clamp(18px, 3.2vw, 38px); font-weight: 800; min-height: 1.3em; text-align: center; }
#feedback.ok { color: var(--good); }
#feedback.bad { color: var(--bad-soft); }

/* ---------- Antworten ---------- */
#answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(720px, 94%); }
#answers[data-cols="1"] { grid-template-columns: 1fr; width: min(760px, 94%); }
#answers[data-cols="3"] { grid-template-columns: repeat(3, 1fr); width: min(860px, 96%); }
#answers button {
  border: 3px solid rgba(255,255,255,.2); border-radius: 20px;
  background: var(--card); color: var(--text);
  min-height: clamp(58px, 9vh, 90px);
  padding: 8px 14px;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(21px, 3.6vh, 36px);
  box-shadow: var(--press);
  transition: transform .06s, box-shadow .06s, background .15s, border-color .15s;
  overflow-wrap: anywhere;
}
#answers button.long { font-size: clamp(17px, 2.8vh, 28px); min-height: clamp(52px, 7.5vh, 74px); }
#answers button:hover { border-color: var(--accent); background: var(--card-strong); }
#answers button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
#answers button.emoji { font-size: clamp(34px, 6vh, 58px); line-height: 1.1; }
#answers button.ok { border-color: var(--good); background: rgba(62,226,122,.28); animation: hh-pop .5s; }
#answers button.bad { border-color: var(--bad); background: rgba(255,90,110,.25); animation: hh-shake .5s; }
#answers button.ok:hover { border-color: var(--good); background: rgba(62,226,122,.28); }
#answers button.bad:hover { border-color: var(--bad); background: rgba(255,90,110,.25); }
#answers button:disabled { cursor: default; }

/* ---------- Trefferquote am Rand ---------- */
#rate {
  position: fixed; right: 16px; top: 16px; width: 96px;
  height: calc(100vh - 32px); height: calc(100dvh - 32px);
  border-radius: 24px;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 8px; gap: 6px;
  z-index: 10;
}
#rateNum { font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.rate-label { font-size: 13px; opacity: .8; font-weight: 700; margin-top: -6px; }
.track {
  position: relative; flex: 1; width: 34px; min-height: 80px;
  background: rgba(0,0,0,.3); border-radius: 99px; overflow: visible;
}
#rateFill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  border-radius: 99px; background: var(--good);
  transition: height .5s, background .5s;
}
.goal {
  position: absolute; left: -10px; right: -10px; height: 3px;
  background: var(--accent); bottom: 90%;
}
.goal span {
  position: absolute; right: -2px; top: -18px;
  font-size: 11px; font-weight: 900; color: var(--accent);
}
.tick { position: absolute; left: 38px; font-size: 10px; opacity: .55; transform: translateY(50%); }
#counts { font-size: 15px; font-weight: 800; text-align: center; line-height: 1.5; }
#hearts { font-size: 17px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; }
#heartsLabel { font-size: 10px; opacity: .75; text-align: center; }

#avgBox { text-align: center; }
#avgNum { font-family: var(--font-head); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
#avgBox .rate-label { margin-top: 0; }
#avgNum.fast { color: var(--good); }

#resumeBtn { margin-top: 22px; }

/* ---------- Handy hochkant ---------- */
@media (max-width: 600px) {
  #game { padding: 10px 84px max(10px, env(safe-area-inset-bottom)) 10px; gap: 8px; }
  header { gap: 6px; }
  header .pills { order: 3; flex-basis: 100%; gap: 6px; flex-wrap: nowrap; }
  header .pill .lbl { display: none; }
  header .tools { gap: 6px; }
  header .pill { font-size: 13px; padding: 5px 10px; }
  #bestPill { display: none; }
  header .icon-btn { width: 40px; height: 40px; font-size: 18px; }
  main { gap: 10px; justify-content: space-evenly; }
  #card { width: 100%; padding: 10px 12px; border-radius: 24px; gap: 6px; }
  .q-emoji { font-size: clamp(58px, 15vh, 110px); }
  .q-text { font-size: clamp(30px, 8vh, 56px); }
  .q-text.small { font-size: clamp(22px, 6vh, 42px); }
  .q-html .q-sentence { font-size: clamp(20px, 5.6vh, 40px); }
  .q-passage { font-size: 14px; padding: 9px 12px; line-height: 1.4; }
  .q-ask { font-size: 17px; margin-top: 7px; }
  #tag { font-size: 13px; }
  #clock { font-size: 16px; }
  #feedback { font-size: 16px; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
  #answers { width: 100%; gap: 8px; }
  #answers button { min-height: clamp(52px, 8.5dvh, 72px); font-size: 20px; border-radius: 16px; }
  #answers button.long { font-size: 16px; }
  #answers button.emoji { font-size: 38px; }
  #rate { width: 66px; right: 8px; top: 10px; height: calc(100dvh - 20px); padding: 10px 4px; border-radius: 18px; gap: 4px; }
  #rateNum { font-size: 18px; }
  .rate-label { font-size: 11px; }
  .tick { display: none; }
  #counts { font-size: 13px; }
  #avgNum { font-size: 16px; }
  #hearts { font-size: 13px; }
  #heartsLabel { font-size: 9px; }
}
/* ---------- Handy quer (wenig Höhe) ---------- */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  #game { padding: 8px 96px 8px max(12px, env(safe-area-inset-left)); gap: 6px; }
  header, header .pills { flex-wrap: nowrap; gap: 6px; }
  header .pills { overflow: hidden; min-width: 0; }
  header .tools { flex-wrap: nowrap; gap: 6px; }
  header .pill { font-size: 13px; padding: 5px 10px; }
  header .pill .lbl { display: none; }
  #bestPill { display: none; }
  header .icon-btn { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
  main { flex-direction: row; gap: 16px; }
  #card { flex: 0 1 auto; min-width: 0; padding: 8px 16px; border-radius: 24px; gap: 4px; }
  .q-emoji { font-size: min(30vh, 130px); }
  .q-text { font-size: clamp(28px, 12dvh, 60px); }
  .q-text.small { font-size: clamp(22px, 8dvh, 44px); }
  .q-html .q-sentence { font-size: clamp(20px, 7dvh, 40px); }
  .q-passage { font-size: 13px; padding: 8px 10px; line-height: 1.35; }
  .q-ask { font-size: 16px; margin-top: 6px; }
  #tag { font-size: 13px; }
  #clock { font-size: 15px; }
  #feedback { font-size: 15px; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
  #answers { flex: 1 1 auto; width: min(440px, 52vw); gap: 6px; }
  #answers[data-cols="1"] { width: min(560px, 62vw); }
  #answers button { min-height: max(34px, calc((100dvh - 90px) / 2 - 6px)); font-size: 19px; border-radius: 12px; }
  #answers button.long { font-size: 15px; }
  #answers button.emoji { font-size: 32px; }
  #rate { width: 76px; top: 8px; right: 8px; height: calc(100dvh - 16px); padding: 6px 4px; gap: 2px; border-radius: 18px; }
  #rateNum { font-size: 17px; }
  .rate-label { font-size: 11px; margin-top: 0; }
  .tick { display: none; }
  .track { min-height: 30px; width: 24px; }
  #counts { font-size: 12px; line-height: 1.3; }
  #avgNum { font-size: 14px; }
  #hearts { font-size: 11px; }
  #heartsLabel { display: none; }
}
