/* ============================================================
   WGMDA Test-Site — angelehnt an wasgehtmichdasan.wdr.de:
   Creme-Papier, schwarze Konturen, harte Offset-Schatten,
   Pastell-Kacheln, gelber KI-Assistenz-Button.
   ============================================================ */

:root {
  --cream: #f0eee1;
  --card: #ffffff;
  --ink: #141414;
  --muted: #4d4d45;
  --yellow: #fbd75e;
  --yellow-deep: #ffb400;
  --tile-1: #f2efd8; --tile-1-s: #e5c95a;
  --tile-2: #e3f0dd; --tile-2-s: #7ec96e;
  --tile-3: #c3d4c4; --tile-3-s: #4d9e57;
  --tile-4: #c8e4ee; --tile-4-s: #57b6d8;
  --tile-5: #e6c7f4; --tile-5-s: #b13fe0;
  --border: 2px solid var(--ink);
  --shadow-hard: 4px 4px 0 rgba(20, 20, 20, .85);
  --shadow-soft: 5px 5px 0 rgba(20, 20, 20, .18);
  --font: "Fira Sans", -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
}

/* ---------------- Header ---------------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 36px 0;
}
.wdr-mark { width: 92px; display: block; }

.title-card {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow-soft);
  padding: 14px 22px 12px;
  position: relative;
  max-width: 360px;
}
.title-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.title-card .rule {
  height: 6px;
  background: var(--yellow);
  margin: 8px 0 6px;
}
.title-card .claim {
  font-size: 15px;
  color: var(--ink);
  text-align: right;
  display: block;
}
.bulb {
  position: absolute;
  right: 34px;
  top: 100%;
  width: 54px;
  filter: drop-shadow(2px 3px 0 rgba(20,20,20,.15));
  animation: sway 5s ease-in-out infinite;
  transform-origin: top center;
}
@keyframes sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2.5deg); }
}

/* ---------------- Hauptbereich ---------------- */
main {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 20px 140px;
}
main h2 {
  font-size: 27px;
  font-weight: 700;
  margin: 0 0 10px;
}
.intro { color: var(--ink); margin: 0 0 6px; }
.prompt {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  margin: 34px 0 6px;
}
.prompt-arrow { text-align: center; font-size: 22px; margin-bottom: 12px; }

/* Themen-Kacheln */
.tiles { display: flex; flex-direction: column; gap: 22px; }
.tile {
  border: var(--border);
  border-radius: 4px;
  padding: 20px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--tile-1);
  box-shadow: 5px 5px 0 var(--tile-1-s);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:nth-child(5n+2) { background: var(--tile-2); box-shadow: 5px 5px 0 var(--tile-2-s); }
.tile:nth-child(5n+3) { background: var(--tile-3); box-shadow: 5px 5px 0 var(--tile-3-s); }
.tile:nth-child(5n+4) { background: var(--tile-4); box-shadow: 5px 5px 0 var(--tile-4-s); }
.tile:nth-child(5n+5) { background: var(--tile-5); box-shadow: 5px 5px 0 var(--tile-5-s); }
.tile:hover { transform: translate(-2px, -2px); }
.tile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(20,20,20,.5); }
.tile h3 { margin: 0; font-size: 17px; font-weight: 700; }
.tile p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* ---------------- Themenseite ---------------- */
#back {
  background: var(--card);
  border: var(--border);
  box-shadow: 3px 3px 0 rgba(20,20,20,.6);
  padding: 7px 14px;
  font: 600 14px var(--font);
  cursor: pointer;
  margin-bottom: 26px;
}
#back:hover { transform: translate(-1px, -1px); }

.theme-head { text-align: center; margin-bottom: 30px; }
#theme-title { font-size: 26px; font-weight: 700; margin: 0; }
.theme-sub { color: var(--muted); font-size: 15px; }

.chapter { margin-bottom: 44px; }
.chapter-title {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow-soft);
  text-align: center;
  font-weight: 700;
  font-size: 17px;
  padding: 13px 18px;
  margin: 0 auto 22px;
  max-width: 430px;
}

/* Frage als schwarzer Sprechblasen-Button, Antwort als Karte */
details.qa { margin: 14px 0; }
details.qa > summary {
  list-style: none;
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 15.5px;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  border: var(--border);
  box-shadow: 3px 3px 0 rgba(20,20,20,.3);
  transition: transform .1s;
  position: relative;
}
details.qa > summary::-webkit-details-marker { display: none; }
details.qa > summary:hover { transform: translate(-1px, -1px); }
details.qa[open] > summary { border-radius: 4px 4px 0 0; box-shadow: none; }
details.qa[open] > summary::after {
  content: "";
  position: absolute;
  left: 22px; top: 100%;
  border: 8px solid transparent;
  border-top-color: var(--ink);
}
.qa-answer {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 4px;
  padding: 18px 22px 14px;
  margin-top: 12px;
  animation: pop .18s ease both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-4px); }
}
.answer-short { font-weight: 400; margin: 0 0 8px; }
.answer-short strong, .answer-long strong { font-weight: 700; }

details.more { margin-top: 10px; }
details.more > summary {
  list-style: none;
  display: inline-block;
  background: #eceada;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { background: var(--yellow); }
.answer-long { color: #262620; font-size: 15px; margin-top: 10px; }
.answer-long p { margin: 8px 0; }
.answer-long ul, .answer-long ol { margin: 6px 0; padding-left: 20px; }

/* ---------------- KI-Assistenz (Floating Widget) ---------------- */
#chat-launcher {
  position: fixed;
  left: 26px;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 40;
  padding: 0;
}
.launcher-bulb {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--yellow);
  border: var(--border);
  box-shadow: 3px 3px 0 rgba(20,20,20,.45);
  display: grid;
  place-items: center;
  font-size: 24px;
  transition: transform .12s;
}
#chat-launcher:hover .launcher-bulb { transform: scale(1.06) rotate(-3deg); }
.launcher-label {
  background: var(--card);
  border: var(--border);
  box-shadow: 3px 3px 0 rgba(20,20,20,.45);
  font: 600 16px var(--font);
  padding: 8px 16px;
  margin-left: -6px;
}

/* Vollbild-Modal wie im Original */
#chat {
  position: fixed;
  inset: 0;
  background: #f2f1ec;
  z-index: 41;
  overflow: hidden;
  animation: chatfade .25s ease both;
}
#chat[hidden] { display: none; }
@keyframes chatfade { from { opacity: 0; } }

.chat-blob {
  position: absolute;
  left: 50%; top: 34%;
  width: 720px; height: 620px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side at 42% 38%, rgba(140, 160, 200, .55), transparent 68%),
    radial-gradient(closest-side at 62% 52%, rgba(235, 190, 120, .5), transparent 66%),
    radial-gradient(closest-side at 50% 66%, rgba(215, 150, 160, .42), transparent 70%);
  filter: blur(46px);
  pointer-events: none;
}

.chat-close {
  position: absolute;
  top: 26px; left: 26px;
  display: flex; align-items: center;
  background: none; border: none; padding: 0;
  cursor: pointer;
  z-index: 2;
}
.launcher-bulb.small { width: 56px; height: 56px; font-size: 20px; font-weight: 700; }

.data-chip {
  position: absolute;
  top: 116px; left: 0;
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  color: var(--ink);
  z-index: 2;
}
.data-btn {
  background: #cfe4e6;
  border: var(--border);
  border-left: none;
  padding: 8px 14px;
  font-size: 18px;
  font-weight: 700;
}
.data-text { font-size: 15px; line-height: 1.3; }

.chat-stage {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 90px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.chat-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  text-align: center;
  margin: 0;
}
.chat-status { margin: -8px 0 0; font-size: 13px; color: #77776b; min-height: 18px; }

#chat-messages {
  width: 100%;
  max-height: 46vh;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}
#chat.chatting #chat-messages { display: flex; }
#chat.chatting .chat-title { font-size: 20px; }
#chat.user-active .examples { display: none; }

.msg {
  max-width: 78%;
  padding: 10px 16px;
  font-size: 15px;
  white-space: pre-wrap;
  border-radius: 18px;
  box-shadow: 0 2px 6px rgba(20,20,20,.12);
}
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; }
.msg.pending { opacity: .65; }

.ask-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 640px;
}
.ask-pill {
  flex: 1;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(20,20,20,.14);
  padding: 6px 6px 6px 24px;
}
.ask-pill input {
  flex: 1;
  border: none;
  background: none;
  font: 400 17px var(--font);
  color: var(--ink);
  padding: 10px 0;
}
.ask-pill input:focus { outline: none; }
.ask-pill input::placeholder { color: #9a9a8e; }
.ask-pill button {
  width: 66px; height: 44px;
  border: none;
  border-radius: 999px;
  background: #e4e2da;
  font-size: 20px;
  color: #55554b;
  cursor: pointer;
  transition: background .15s;
}
.ask-pill button:hover:not(:disabled) { background: var(--yellow); color: var(--ink); }
.ask-pill button:disabled { opacity: .5; cursor: default; }
#chat-mic {
  width: 58px; height: 58px;
  flex: none;
  border-radius: 50%;
  background: var(--yellow);
  border: var(--border);
  box-shadow: 2px 3px 0 rgba(20,20,20,.35);
  font-size: 21px;
  cursor: pointer;
  transition: transform .12s;
}
#chat-mic:hover:not(:disabled) { transform: scale(1.06); }
#chat-mic:disabled { opacity: .45; cursor: default; }
#chat-mic.active { background: #e2574c; color: #fff; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 2px 3px 0 rgba(20,20,20,.35), 0 0 0 0 rgba(226,87,76,.4); }
  50% { box-shadow: 2px 3px 0 rgba(20,20,20,.35), 0 0 0 12px rgba(226,87,76,0); }
}

.examples { text-align: center; width: 100%; }
.examples-label { font-weight: 600; margin: 10px 0 12px; }
#chat-examples { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.example-pill {
  background: #fff;
  border: 1px solid #d8d6cc;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(20,20,20,.1);
  font: 400 15px var(--font);
  color: #55554b;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
}
.example-pill:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(20,20,20,.16); color: var(--ink); }

.hint { color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  header { padding: 18px 16px 0; flex-direction: column-reverse; gap: 16px; align-items: stretch; }
  .title-card { max-width: none; }
  .bulb { display: none; }
  main { padding: 26px 14px 160px; }
}
