/* ============== */
/* === DYNBOT === */
/* ============== */

/* === Base === */
:root {
  /* Bubble / action styling (match your manual-decision-button look) */
  --action-bg: #f5f7ff;
  --action-text: #1c2a4b;
  --action-border: #cfd7ff;
  --action-radius: 14px;
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
  /* --chat-font-size: 1.25rem; */
  --chat-font-size: 1.4rem;

  /* layout helpers (JS updates --input-bar-h dynamically) */
  --input-bar-h: 72px;    /* fallback */
  --scroll-btn-gap: 8px; /* was 12px gap above input for the floating button */
}

#chat-container,
#chat-container .message,
#chat-container button,
#chat-container .user-question-bubble,
#chat-container .rag-box,
#chat-container .choices-buttons button,
/* #chat-container .topic-buttons button {
  font-size: var(--chat-font-size);
} */

* { box-sizing: border-box; }

body {
  background: #fff;
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  height: 100vh;
  display: flex;
  letter-spacing: 0.02em;
  flex-direction: column;
}

/* === App Layout === */
#chat-container {
  display:flex;
  flex-direction:column;
  height:100vh;          /* or the app’s fixed height */
  min-height:0;
}

/* wrapper for scroller (messages) */
#chat-wrapper {
  position: relative !important; 
  display:flex; 
  flex-direction:column;
  flex:1 1 auto;
  height: 100vh;
  min-height:0;                 /* critical so it can shrink */
  overflow-y:auto;              /* <-- scroller */
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  /* keep the last lines visible above the sticky input bar */
  /* padding-top: 0 !important;  */
  padding-bottom: calc(var(--input-bar-h, 56px) + 24px);
}

/* #scroll-anchor {
  width: 100%;
  height: 1px;
  overflow-anchor: auto;
} */

#scroll-anchor {
  width: 100%;
  height: 1px;
  pointer-events: none;
  opacity: 0;
}

/* === Scrollable chat area === */
#chat-output {
  position: relative;
  max-height: none !important;
  overflow: visible !important; /* ensure growth bubbles up to wrapper */
  width: 100%;
  padding: 0 1rem;
  /* overflow-anchor: none; */
}

#chat-output.expanded {
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  opacity: 1;
  padding-top: 1rem;
}

.ref-box,
[id^="refbox-"] {
  overflow: visible !important;
  contain: none !important;
}

.reply-spacer { 
  display:block; 
}

#chat-wrapper .user-anchor-slot {
  height: 1px;
  margin: 0;
  padding: 0;
  pointer-events: none;
  opacity: 0;
}

/* invisible tail spacer; just reserves height, never blocks clicks */
/* .reserve-tail {
  opacity: 0;
  pointer-events: none;
  display: block;
  position: relative !important;   /* was absolute */
  /* bottom: auto !important;
} */

.reserve-tail {
  height: 61px;         /* default only */
  min-height: 0;
  max-height: none;      /* <-- MUST be removed from 120px */
  pointer-events: none;
  opacity: 0;
  flex-shrink: 0;
}

/* Messages */
.message {
  margin: 1rem 0;
  white-space: pre-wrap;
  padding-top: 30px;
  padding-bottom:20px;
  line-height: 1.5;
  border: 1px solid #777;
  border-radius: 50px;
  border-color: #212D4F;
  color: #222;
}

/* compact, centered loading bubble */
.message.is-loading{
  /* your tweaks */
  padding: 4px 10px;
  min-height: 90px;
  border-radius: 50px;
  font-size: 1.4rem;
  white-space: normal;
  line-height: 1;

  /* make it a horizontal row */
  display: flex;
  flex-direction: row;       /* ⬅ force row, overrides any column rule */
  align-items: center;
  justify-content: flex-start;  /* 'left' is invalid; use flex-start */
  gap: 8px;
  flex-wrap: nowrap;         /* prevent wrapping */
}

/* prevent children from expanding to full width */
.message.is-loading > *{
  flex: 0 0 auto;           /* ⬅ don’t grow, don’t shrink into zero */
}

/* make sure the spinner isn’t a row hog */
.message.is-loading .spinner{
  display: inline-block;     /* ⬅ be a compact inline box */
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;          /* light gray circle */
  border-top-color: #212D4F;       /* dark top arc for motion visibility */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.message.assistant.is-loading {
  min-height: 85px;         /* 🧱 prevent layout collapse before stream fills in */
  display: flex;
  align-items: center;
}

.spinner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.user { text-align: right; font-weight: bold; }

.assistant { 
  text-align: left;
  padding-left: 10px;
  font-size: 1.2rem;
}

.assistant p {
  font-size: 1.2rem;
}

/* Info text (optional hint above input) */
.info-text {
  background: #fff;
  color: #000;
  text-align: center;
  margin: 1vh 0 1.5vh;
  border-radius: 0;
  font-size: 2.0rem;
  font-weight: 550;
  padding-top: 10px;
  padding-bottom: 16px;
}

#infoText {
  transition: opacity 0.4s ease, max-height 0.4s ease;
  opacity: 1;
  overflow: hidden;
}

#infoText.collapsing {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}

/* === Input Bar === */
#input-area {
  background: #fff;
  box-shadow: 0 -1px 5px rgba(0,0,0,0.05);
  z-index: 1;
  padding: 0.75rem 1rem;
}

#input-box {
  display: flex;
  align-items: flex-end;          /* align input & button baseline */
  /* background: rgb(248,248,248); */
  border: 1px solid #000;
  border-radius: 4rem;  /* was 1rem, then 0.00001*/
  /* border-color: #212D4F; */
  padding: 0.5rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

#messageInput {
  flex: 1 1 auto;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Segoe UI', sans-serif;
  letter-spacing: 1px;
  font-weight: 500;
  min-height: 100px;
  font-size: 1.4rem;
  background: transparent;
  padding-left: 2.5vw;
  padding-right: 2.5vw;
  padding-top: 0.8rem;
  padding-bottom:0.8rem;
  /* color: black;
  /* color: rgb(48,48,48) !important; */
  -webkit-text-fill-color: rgb(0,0,0) !important;
  transition: font-size 0.4s ease, font-weight 0.4s ease;
}

#messageInput.highlighted {
  font-size: 1.7rem;
  /* font-weight: 600; */
}

#messageInput::placeholder {
    font-style: regular;
    /* padding-top: 0.3rem;
    padding-left: 1.75vw; */
    font-size: 1.4rem;
    opacity: 1;
  }

#send-button-wrapper,
.send-button-wrapper {
  display: flex;
  align-items: flex-end;
  padding-right: 1rem;
  padding-bottom: 0.9rem;
}

#sendButton {
  background-color: #212D4F;
  border: none;
  border-radius: 50%;
  width: 2.5rem; height: 2.5rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
  position: relative;
}
#sendButton:hover { background-color: rgb(163,163,163); }

.send-icon svg {
  width: 22px; height: 22px;
  /* stroke: #fff; fill: none; */
  stroke: #fff; fill: none;  /* was #EEBE43  */
  display: block;
  margin-top: 2px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  /* border-top-color:#EEBE43; */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Topic & Choices Buttons === */
.topic-buttons {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 4vh 4vw 1rem;
  align-items: center; justify-content: center;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
@media (max-width: 600px) {
  .topic-buttons { justify-content: flex-start; }
}

#topic-buttons.collapsed { max-height: 0; opacity: 0; overflow: hidden; }

.topic-buttons button,
.choices-buttons button {
  background: #212D4F;
  color: white;
  border: none;
  font-family: 'Roboto';
  font-weight: 500;
  padding-top: 2vh;
  padding-bottom: 2vh;
  padding-left: 2.2vw;
  padding-right: 2.2vw;
  border-radius: 30px; /* was 12px then 0 */
  cursor: pointer;
  font-size: 20px;
  letter-spacing: 0px;
}

.choices-buttons {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 5vh 1rem 1rem;
  justify-content: center;
}

/* --- Shared base styling for ALL topic + choice buttons --- */
.topic-buttons button,
.choices-buttons button {
  background: #232D4D;     /* initial */
  color: #fff;              /* always white text */
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

/* --- Hover (neutral state only) --- */
.topic-buttons button:hover:not(.is-selected):not(.is-deselected),
.choices-buttons button:hover:not(.is-selected):not(.is-deselected) {
  background: #455482;      /* initial hover */
}

/* --- SELECTED --- */
.topic-buttons button.is-selected,
.choices-buttons button.is-selected {
  background: #232D4D;       /* selected base color */
  color: #fff;
}

.topic-buttons button.is-selected:hover,
.choices-buttons button.is-selected:hover {
  background: #455482;       /* selected hover */
}

/* --- DESELECTED --- */
.topic-buttons button.is-deselected,
.choices-buttons button.is-deselected {
  background: #959EB1;       /* deselected */
  color: #fff;
}

.topic-buttons button.is-deselected:hover,
.choices-buttons button.is-deselected:hover {
  background: #455482;       /* deselected hover */
}

/* === RAG explanation box (optional) === */
.rag-box {
  /* background-color: #e6f0ff; */
  /* background-color: #020C20; */
  /* background-color: #02113b; */
  background-color: #212D4F;
  color: #fff;   /* was   EEBE43  */
  padding: 0px;
  padding-top: 0px;
  padding-bottom: 30px;
  border-radius: 50px;  /* was 6px then 0 */
  margin-top: 30px;
  line-height: 1.4;
}

/*
.rag-box span {
  font-size: 1.4rem;
  margin-left: 0vw;
} */

.rag-box.is-loading {
  min-height: 90px;
}


/* === User Question Bubble (right-aligned) === */
.user-question-bubble {
  background: #212D4F;
  color: white;
  /* border: 1px solid var(--action-border); */
  border-radius: 35px;  
  /* box-shadow: var(--shadow-sm); */
  padding-top: 2.0vh;
  padding-bottom: 2.0vh;
  padding-left: 2.2vw;
  padding-right: 2.2vw;
  max-width: min(75%, 680px);
  margin: 40px 8px 16px auto;  /* right aligned */
  line-height: 1.45;
  font-size: 1.3rem;
  transition: border-radius 0.15s ease;
  letter-spacing: 0.1px;
  /* word-wrap: break-word; */
}

.user-question-meta {
  font-size: 12px;
  color: #6b7280;
  text-align: right;
  margin: -10px 8px 12px auto;
  max-width: min(75%, 680px);
}

/* === “Scroll to end” floating button (circular, centered) ===
   Lives inside #chat-container (NOT inside the scroller) */
.scroll-to-end {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* bottom: calc(var(--input-bar-h) + var(--scroll-btn-gap)); */
  width: 44px; height: 44px;
  border-radius: 50%;
  display: none; /* toggled by JS */
  align-items: center; justify-content: center;
  /* background: #fff; */
  background-color: rgba(255, 255, 255, 0.5);
  /* backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); 
  /* border-color: rgba(0, 0, 0, 0.08); */
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 22px rgba(0,0,0,0.14);
  cursor: pointer;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* bottom: calc(var(--input-bar-h) + var(--scroll-btn-gap)); */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  /* background: #fff; */
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  /* margin-bottom: 85px; */
  /* z-index: 5; /* above input bar */
  bottom: calc(var(--input-bar-h) + var(--scroll-btn-gap) + 12px) !important;
  z-index: 2; /* above messages, below anything super-high */
}

.scroll-to-end svg { 
  width: 22px; 
  height: 22px;
  margin-top: 4px;
  /* transform: translateY(2px); */
}
.scroll-to-end:hover { filter: brightness(0.98); }
.scroll-to-end:focus { outline: 2px solid #c7d2fe; outline-offset: 2px; }

.scroll-btn-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* === Intro / Restart === */
#intro-wrapper {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}
#intro-wrapper.collapsed { max-height: 0; opacity: 0; }

#restart-area {
  text-align: center;
  padding: 1rem 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#restart-area.visible { opacity: 1; }

#restartButton {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  font-size: 1.4rem;
  font-weight: bold;
  background-color: #212D4F;/* was #e1e1e1; */
  color: #fff;
  border: none;
  border-radius: 4rem;    /*  was 1.5rem then 0.00001  */
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease;
}
#restartButton:hover { background-color: #4D5772; }

/* === Optional: unify manual decision button look with bubbles === */
/*
.manual-decision-button {
  background: var(--action-bg);
  color: var(--action-text);
  border: 1px solid var(--action-border);
  border-radius: var(--action-radius);
}  */

/* Instructions copy tidy */
#instructions {
  font-size: 2.0rem;
  color: #000;
  font-weight: 550;
  margin-top: 20px;
  margin-bottom: 50px;
  margin-left: 0;
  margin-right: 0;
  padding: 0 10px;
  text-align: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

#instructions.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* Start state: input directly below intro-wrapper */
#chat-container.start-mode #input-area {
  position: static;   /* flow directly after intro-wrapper */
  box-shadow: none;   /* optional: remove bottom bar look */
  margin: 1rem 0;     /* small spacing below topic buttons */
}

/* After first send (normal mode) */
#chat-container:not(.start-mode) #input-area {
  position: sticky;
  bottom: 0;
  width: 100%;
}

#chat-container:not(.start-mode) #chat-output{
  padding-bottom: 70px; /* calc(var(--input-bar-h) + 16px) !important; /* was 40px */
}

/* Start state: show input directly below intro; hide scroller */
/* #chat-container.start-mode #chat-wrapper {
  display: none;        
}  */

#chat-container.start-mode #chat-wrapper{
  max-height:0;
  opacity:0;
  transition:max-height .4s ease, opacity .2s ease;
  display: none;
}

#chat-container.start-mode #input-area {
  position: static;       /* flow under intro-wrapper */
  box-shadow: none;       /* optional: less "bar" look at start */
  margin: 0.75rem 1rem 0; /* small spacing under the topic buttons */
}

.footer-wrap {
  margin-top: 24px;   /* ~2 line breaks above */
}

.quote-box {
  margin-bottom: 24px;  /* space below quote */
  padding: 10px 12px;
  border-left: 3px solid #ccd;
  font-style: italic;
  opacity: .9;
}

.rag-box .rag-quote {
  border-left: none !important;
  padding-left: 0;
  margin-left: 0;
  font-style: italic;         /* optional polish */
  opacity: .95;               /* optional polish */
}

/* 
.cta-box {
  margin-top: 24px;   
  line-height: 1.4;
  border-left: 3px solid #02113b;
  padding-left: 12px;
}

.cta-box a {
  font-weight: bold;
  text-decoration: none;
  color: #212D4F;
}

.cta-box a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.02em; 
  text-underline-offset: 5px;      
  text-decoration-skip-ink: auto;
}
*/

.cta-box {
  margin-top: 24px;
  line-height: 1.5;
  text-align: center;
  padding: 1rem 2rem;
  /* border-left: 3px solid #02113b; 
  border-radius: 8px; */
  background: #f9f9f9;
  color: #000;
}

/* First sentence block */
.cta-quote {
    font-size: 1.7rem;
    font-family: Times New Roman;
    font-weight: 350;
    padding-left: 5vw;
    padding-right: 5vw;
    margin-bottom: 4rem;
}

/* First sentence block */
.cta-headline {
    font-size: 1.5rem;
    font-weight: 350;
    padding-left: 20vw;
    padding-right: 20vw;
    margin-bottom: 2rem;
}

/* Second sentence block */
.cta-body {
    font-size: 1.5rem;
    font-weight: 350;
    padding-left: 20vw;
    padding-right: 20vw;
    margin-bottom: 1rem;
}

/* Button wrapper (for vertical spacing if needed) */
.cta-button-wrap {
  text-align: center;
}

/* Button look for the link */
.cta-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  margin-bottom: 4vh;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: #212D4F;
  color: white;
  text-decoration: none;
  border-radius: 30px;
  transition: background-color 0.2s ease;
}

.cta-button:hover {
  background-color: #3a4a7f;
}

/* === House of PM Referenzstory (box-in-the-box) === */
.rag-box .ref-empf { 
  text-align: left; 
  margin-top: 10px;
  font-size: 1.4em;
  font-weight: 600;
  margin-bottom: 0px;
}

/* FINAL override for the Referenzstory headline inside the rag box */
.rag-box p.ref-empf,
.rag-box p.ref-empf * {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* handles WebKit gradient/clip cases */
}

/* if the label is a link or contains a link, force link states too */
.rag-box p.ref-empf a:link,
.rag-box p.ref-empf a:visited,
.rag-box p.ref-empf a:hover,
.rag-box p.ref-empf a:active {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* === House of PM Referenzstory (box-in-the-box) === */
.rag-box .ref-intro { 
  text-align: left; 
  margin-top: 0px;
  margin-bottom: 0px;
  margin-left: 1vw;
  margin-right: 1vw;
  padding-top: 1vh;
  font-size: 1.4em;
  font-weight: 600;
  /* margin: 8px 2vw 0; */
}

.rag-box .ref-intro a {
  /* color: #EEBE43;  /* was   EEBE43  */
  text-decoration: none;
  font-size: 1rem;
  text-decoration-thickness: 0.02em; /* or try 0.5px */
  text-underline-offset: 5px;        /* moves the line a bit down = lighter feel */
  text-decoration-color: currentColor;
  text-decoration-skip-ink: auto;
  cursor: pointer;
}

/* FINAL override for the Referenzstory headline inside the rag box */
.rag-box p.ref-intro,
.rag-box p.ref-intro * {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* handles WebKit gradient/clip cases */
  margin-bottom: 0px !important;
  padding-top: 0px;
}

/* if the label is a link or contains a link, force link states too */
.rag-box p.ref-intro a:link,
.rag-box p.ref-intro a:visited,
.rag-box p.ref-intro a:hover,
.rag-box p.ref-intro a:active {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.rag-box .ref-box {
  margin-left: 1vw;
  margin-right: 1vw;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .35s ease, opacity .35s ease;
  overflow-anchor: none;
}
.rag-box .ref-box.open {
  max-height: none; /*200vh;  /* plenty for smooth expand */
  opacity: 1;
}

.ref-story { 
  line-height: 1.5; 
}

/*
.rag-box .ref-story-frame {
  border: 0px solid #EEBE43;  
  border: 16px solid #fff;
}
*/

/* existing globals — keep */
.ref-section {
  padding: 0 0;
  /* border-top: 1px solid rgba(255,255,255,.15); */
}
.ref-section:first-child {
  border-top: none;
}

/* scoped tweak for the framed story only */
.ref-story-frame > .ref-section:first-child {
  padding-top: 0;   /* removes the 5px gap at the very top */
  /* border-top already none via the global :first-child rule */
}

/* (optional) if the first child element has default top margin */
.ref-story-frame > .ref-section:first-child > :first-child {
  margin-top: 0;
}

/* optional label line inside a section */
.ref-section .ref-tag {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: .9;
}

.rag-box .ref-section ul,
.rag-box .ref-section ol {
  padding-left: 2vw;   /* or 2vw, whichever you prefer */
  padding-right: 2vw;   /* or 2vw, whichever you prefer */
}

.rag-box .ref-section li {
  margin-bottom: 0.6rem;  /* spacing between bullets */
  line-height: 1.5;
}

/* Tag-specific hooks (example; style freely per tag) */
.ref-titel   {
  display: block;
  background-color: #212D4F;
  font-size: 1.4em;
  color: white;
  font-size: 2.0rem !important;
  padding-left: 1vw;
  padding-top: 4vh !important;
  border-top: none !important;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-beschreibung-titel{
  background-color: #212D4F;
  color: white;
  font-size: 2.0rem !important;
  padding-top: 1vh;
  padding-left: 1vw;
}

.ref-beschreibung{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-beschreibung-highlight{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-beschreibung-finish{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-beschreibung-branche{
  background-color: #212D4F;
  color: white;
  font-size: 1.2rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-beitrag{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-zitat{
  background-color: #212D4F;
  color: white;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  padding-top: 5vh;
  padding-bottom: 3vh;
  width:85vw;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-subtitel{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}
  
.ref-problem {
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-loesung {
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}

.ref-ergebnis{
  background-color: #212D4F;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
  border-top: 1px solid rgba(255,255,255,.15);
}


/* weisse linie und leicht hellerer blau Hintergrund 

.ref-titel   {
  display: block;
  background-color: #2d3a63;
  font-size: 1.4em;
  color: white;
  font-size: 1.4rem;
  padding-left: 1vw;
  padding-top: 7vh !important;
  border-top: 2px solid white;
}

.ref-beschreibung-titel{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-beschreibung{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-beschreibung-highlight{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-beschreibung-finish{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-beitrag{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-zitat{
  background-color: #2d3a63;
  color: white;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  padding-top: 5vh;
  padding-bottom: 3vh;
  width:85vw;
  padding-left: 1vw;
}

.ref-subtitel{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}
  
.ref-problem {
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-loesung {
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}

.ref-ergebnis{
  background-color: #2d3a63;
  color: white;
  font-size: 1.4rem;
  padding-top: 5vh;
  padding-left: 1vw;
}


*/


/* 

.ref-titel   {
  display: block;
  background-color: white;
  font-size: 1.4em;
  color: black;
  padding-left: 1vw;
  padding-top: 60px !important;
}

.ref-beschreibung-titel{
  background-color: white;
  color: black;
  padding-left: 1vw;
}

.ref-beschreibung{
  background-color: #212D4F;
  color: white;
  padding-left: 1vw;
}

.ref-beschreibung-highlight{
  background-color: white;
  color: black;
  padding-left: 1vw;
}

.ref-beschreibung-finish{
  background-color: #212D4F;
  color: white;
  padding-left: 1vw;;
}

.ref-beitrag{
  background-color: white;
  color: black;
  padding-left: 1vw;
}

.ref-zitat{
  background-color: #212D4F;
  color: white;
  padding-left: 1vw;
}

.ref-subtitel{
  background-color: white;
  color: black;
  padding-left: 1vw;
}
.ref-problem {
  background-color: white;
  color: black;
  padding-left: 1vw;
}
.ref-loesung {
  background-color: white;
  color: black;
  padding-left: 1vw;
}
.ref-ergebnis{
  background-color: white;
  color: black;
  padding-left: 1vw;
}

*/

/* Hide Einordnung block in the RAG box if it ever appears */
.rag-box .ref-section.ref-einordnung { display: none !important; }

/* Make the video responsive and give it breathing room */
.rag-box .ref-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  margin: 0 0 12px;               /* space below the video */
  border-radius: 12px;
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,.08));
  background: #000;               /* nice while loading */
}

/* Since a video now precedes the first section, use :first-of-type */
.rag-box .ref-story > .ref-section:first-of-type {
  padding-top: 0;
  border-top: none;
}

/* layout + spacing */
.ref-intro{
  display:flex;
  align-items:baseline;
  gap:.5ch;                 /* base spacing between items */

}

/* visual order: mark, intro text, chevron, link */
.ref-mark{ order:0; }
.ref-intro-text{ order:1; }
.ref-open{ order:3; }

/* Remove the faulty sibling selector rules */
.ref-caret { display:none; }

/* New caret */

.ref-caret {
  margin: 0 .5ch;
  margin-left: 0 !important;
  font-weight: 600;
}

.ref-intro {
  display: inline-block;
  white-space: normal;
  padding-bottom: 6vh;
}



.ref-intro-text,
.ref-caret,
.ref-open {
  display: inline;
}


/* optional: keep link tidy */
.ref-open{ white-space:nowrap; }


/* === Width control for Referenzstory inside the RAG box === */
.rag-box{
  /* one knob to rule width; tweak to taste */
  --ref-max: clamp(52ch, 58vw, 76ch);
}

/* keep the collapsible wrapper flush; the frame will add its own padding */
.rag-box .ref-box{
  margin-left: 0;     /* was 1vw – reset to avoid double inset */
  margin-right: 0;
}

/* the actual content column for the Referenzstory */
.rag-box .ref-box .ref-story-frame{
  /* max-width: var(--ref-max); */
  margin-inline: auto;                     /* center the column */
  /* padding-inline: min(2vw, 24px);       inner side breathing room */
  box-sizing: border-box;
  /* border-top: 2px solid white;  */
  background-color: #212D4F;
}

/* sections live inside the frame: never spill wider than the column */
.rag-box .ref-section{
  max-width: 100%;
  margin-inline: auto;
}

/* safety: media should never overflow the column */
.rag-box .ref-section img,
.rag-box .ref-section video{
  max-width: 100%;
  height: auto;
  display: block;
}

.app-title{
  text-align:center;
  letter-spacing: 3px;
  font-family: Nunito;
  font-size:3.3rem;           /* your existing size */
  font-weight: 500;
  line-height:1.1;         /* tweak if needed */
  transition: font-size 0.3s ease;
  align-items: center;
  margin: 0;
  line-height: 1;           /* Reduce height footprint */
  display: flex;            /* Fix vertical centering issue */
}

.project-title{
  text-align: center;
  font-family: Nunito;
  font-weight: 500;
  font-size: 4.3rem;
  margin-top: 5px;
  transition: font-size 0.3s ease;
  letter-spacing: 2px;
  margin-bottom: 35px;
}

/*
#project-title.with-caret::after {
  content: "|";
  animation: blink 1s steps(2, start) 3 forwards;
  animation-fill-mode: forwards;
  display: inline-block;
  opacity: 1;
  margin-left: 4px;
}*/

@keyframes blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}


/* -------------------------- */

#header-area {
  display: flex;
  flex-direction: column;
  align-items: center; /* center everything horizontally */
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 2.5vh;
  transition: all 0.3s ease;
}

.logo-icon {
  height: 3.3vw;
  width: 3.3vw;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
  margin-bottom: 0.5vh;
  /* added */
  animation: pop-in 600ms ease both;
  animation-play-state: paused; /* start paused */
}

/* Start running when .play class is added via JS */
.logo-icon.play {
  animation-play-state: running;
}

/* Keyframes for the pop-in entrance */
@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.logo-icon svg {
  display: block; /* Removes inline whitespace below */
  width: 100%;
  height: 100%;
}

.logo-icon .animated-logo {
  width: 100%;
  height: 100%;
}

/* Shrink after first submission */
.header-shrink .top-row {
  margin-top: 0.5vh;
  gap: 0px;
}

.header-shrink .logo-icon {
  transform: scale(0.8);
  opacity: 1.0;
  padding-top: 3px;
  height: 1.4vw;
  width: 1.4vw;
}

.header-shrink .app-title {
  font-size: 1.2rem;
}

.header-shrink .project-title {
  font-size: 1.3rem !important;
  text-align: center;
  margin-left: 1vw;
}


/* -------------------------- */

/* Animation keyframes */
@keyframes growBlack {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes growWhite {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes moveWhite {
  0%   { transform: translateX(0); }
  100% { transform: translateX(60px); }
}

/* Apply animation */
#black-circle {
  animation: growBlack 2s linear forwards;
  transform-origin: center center;
}

#white-circle {
  transform: scale(0);
  animation:
    growWhite 2s linear 2s forwards,
    moveWhite 2s linear 4s forwards;
  transform-origin: center center;
}


/* -------------------------- */

/* tiny “TM-like” icon */
.tm-icon{
  width:0.9em;             /* scales with text size */
  height:auto;
  margin-left:0.25em;      /* gap from the text */
  vertical-align:middle;   /* baseline alignment first… */
  transform:translateY(-0.15em); /* …then lift it slightly */
  /* fine-tune: try -0.1em to -0.25em depending on look */
}

.rag-video-box{
  margin-top: 2rem;
  /* padding: 1rem; 
  background: var(--action-bg);
  border: 1px solid var(--action-border); */
  border-radius: var(--action-radius);
}
.rag-video-title{
  margin: 0 0 .5rem;
  font-size: 1rem;
  color: var(--action-text);
}
.rag-video{
  width: 100%;
  height: auto;
  /* max-height: 60vh; */
  display: block;
  border-radius: 5rem;
}

.choices-question{
  /* margin: .5rem 0 .25rem; */
  font-size: 2.0rem; /* was 1.6 */
  color: #000;
  margin-top: 5.0vw;
  margin-bottom: 2.0vw;
  font-weight: 550;    
  text-align: center; 
  /* color: var(--action-text, #1c2a4b); */
  letter-spacing: .1px;
}

/* tighten spacing to the buttons that follow */
.choices-question + .choices-buttons{
  margin-top: .25rem;
}

/* Badge under the input box */
#input-area .powered-by {
  display: block;           /* forces a new line under the input row */
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.2;
  color: black;
  letter-spacing: 0.02em;   /* matches your global preference */
  /* opacity: .6;              /* subtle in both light/dark */
  user-select: none;
  align-self: flex-start;   /* works if #input-area is flex */
  flex: 0 0 100%;           /* if #input-area is flex, span full width */
  order: 99;                /* ensure it sits last in a flex container */
  margin-left: 3vw;
}

#input-area .powered-by a {
  color: inherit;
  text-decoration: none;
  color: black;
  font-weight: 600;
  /* border-bottom: 1px dotted currentColor; /* tiny hint without loud underline */
}

/* Neustart under the input box */
#input-area .neu-start {
  display: block;           /* forces a new line under the input row */
  margin-top: -15px;
  font-size: 1.4rem;
  line-height: 1.2;
  color: black;
  letter-spacing: 0.02em;   /* matches your global preference */
  /* opacity: .6;              /* subtle in both light/dark */
  user-select: none;
  align-self: flex-start;   /* works if #input-area is flex */
  flex: 0 0 100%;           /* if #input-area is flex, span full width */
  order: 99;                /* ensure it sits last in a flex container */
  text-align: center;
}

#input-area .neu-start a {
  color: inherit;
  text-decoration: none;
  color: black;
  font-weight: 600;
  /* border-bottom: 1px dotted currentColor; /* tiny hint without loud underline */
}

#input-area .powered-by a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.02em; /* or try 0.5px */
  text-underline-offset: 5px;        /* moves the line a bit down = lighter feel */
  text-decoration-color: currentColor;
  text-decoration-skip-ink: auto;
}

/* 1) Theme tokens */
:root{
  --sb-track:  #f2f4f7;   /* track/background */
  --sb-thumb:  #bcc4d0;   /* thumb */
  --sb-hover:  #9aa6b2;   /* thumb on hover */
  --sb-size:   100px;      /* thickness */
}

/* 2) Attach to your scrollable container */
.scrollable{
  overflow: auto;

  /* Firefox */
  scrollbar-width: thin;                          /* auto | thin | none */
  scrollbar-color: var(--sb-thumb) var(--sb-track);

  /* Optional: avoid layout shift when the bar appears */
  scrollbar-gutter: stable both-edges;
}

/* 3) WebKit browsers (Chrome/Edge/Safari) */
.scrollable::-webkit-scrollbar{
  width: var(--sb-size);
  height: var(--sb-size);                         /* horizontal bars */
}
.scrollable::-webkit-scrollbar-track{
  background: var(--sb-track);
  border-radius: 999px;
}
.scrollable::-webkit-scrollbar-thumb{
  background: var(--sb-thumb);
  border-radius: 999px;
  border: 2px solid var(--sb-track);              /* creates a nice inset look */
}
.scrollable::-webkit-scrollbar-thumb:hover{
  background: var(--sb-hover);
}
.scrollable::-webkit-scrollbar-corner{
  background: transparent;                        /* removes corner square on two-axis scroll */
}

/* 4) Dark mode tweak (optional) */
@media (prefers-color-scheme: dark){
  :root{
    --sb-track:#0f1115;
    --sb-thumb:#3b4350;
    --sb-hover:#566075;
  }
}

/* 5) If you ever want to hide the bar but keep scrolling */
.no-scrollbar{
  scrollbar-width: none;                  /* Firefox */
}
.no-scrollbar::-webkit-scrollbar{
  display: none;                          /* WebKit */
}

/* === Streaming dynamics === */
/* Remove border from the white primary message once tokens start arriving */
.message.has-stream {
  border: none !important;
  margin-top: -30px !important;
  padding-top: 4vh !important;
}

.message.assistant.summary {
  border: none !important;
  margin-top: -30px !important;
  padding-top: 0 !important;
  border-radius: 0; /* optional: keep edges consistent */
}

/* Tighten the RAG (blue) box once its content is ready */
.rag-box.is-filled {
  border-radius: 3px !important;
  transition: border-radius .25s ease;
}

.bullets { list-style-type: disc; margin: 0; padding-left: 1.25rem; }
.bullets.tight li { margin: 0 0 .25rem 0; }           /* remove big gaps */
.bullets li strong { display: inline; }               /* headline inline */
.bullets li br { content: ""; }                       /* normal line break */

.message ul { margin: 0; padding-left: 1.25rem; }
.message li { margin: 0 0 .25rem 0; }

.rag-box.has-stream {
  border-radius: 3px;
  padding-top: 35px;
  /* padding-left: 0.1vw;
  padding-bottom: 1vh; */
}

p.ref-intro.ref-empf.rag-header {
  margin-left: 1.5vw;
  margin-right: 1.5vw;
  margin-top: -1.3vh;
  margin-bottom: -5vh !important;
  font-size: 2.2rem; /* wsas 1.8 */
}

.rag-box.has-stream p {
  margin-left: 0.5vw;
  margin-right: 0.5vw;
  margin-top: -1.4vh;
  margin-bottom: 3.3vh;
}

.rag-box.has-stream hr {
  margin-left: 1vw;
  margin-right: 1vw;
  border: 1px solid #fff;
  opacity: 0.5; /* 50% transparent */
  margin-top: 4vh;
  margin-bottom: 4vh;
}

.rag-stream.bullet-expl {
  font-weight: 400;
}

.rag-stream {
  padding-top: 25px;
  padding-left: 0.5vw;
  padding-right: 0.5vw;
  font-size: 1.3rem;
}

.rag-stream p {
  padding-top: 25px;
  padding-left: 0.5vw;
  padding-right: 0.5vw;
  font-size: 1.3rem;
}

/* .ref-wrapper span.ref-intro-text { 
  padding-left: 1vw;
  padding-right: 1vw; 
  padding-top: 1vw; 
  padding-bottom: 1vw; 
} */

.ref-intro-text {
  padding-left: 1vw;     /* indent ALL lines */
  padding-right: 1vw;
  text-indent: -1vw;     /* pull back the first line */
  /* padding-right: 1vw; */
  font-size: 1.8rem !important;
  white-space: normal;   /* allow text to wrap */
  display: inline;
}

.rag-box .ref-wrapper { 
  margin-top: 60px; 
  min-height: 7vh; 
  
}

/* TEMP: ensure growth bubbles up (remove inner scroll/absolute/contain) */
/* #chat-wrapper > * { position: static !important; overflow: visible !important; } */
/* .ref-box, [id^="refbox-"] { overflow: visible !important; contain: none !important; } */


/* Collapsed state: fully non-interactive and clipped */
.rag-box .ref-box[aria-hidden="true"] {
  overflow: hidden !important;
  pointer-events: none;      /* prevent invisible content from catching clicks */
  opacity: 0;                /* already there, keep for fade */
  max-height: 0;             /* already there, keep for collapse */
}

/* Open state: allow natural growth again */
.rag-box .ref-box.open {
  overflow: visible !important;
  pointer-events: auto;
}


.rag-box.is-temporarily-hidden {
  display: none !important;
}

.rag-box {
  transition: opacity 0.3s ease, height 0.3s ease;
}

/*
.rag-box.is-temporarily-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  transition: opacity 0.3s ease;
} */


/* for DEBUG only */

/*
html, body {
  height: 100%;
  overflow: hidden;      
}
#chat-container {
  height: 100vh;
}
#chat-wrapper {
  height: calc(100vh - var(--input-bar-h, 120px));
  overflow-y: auto;         
  overscroll-behavior: contain;
  overflow-anchor: none;     
}
#chat-output {
  overflow: visible;       
}  */

/* #bottom-sentinel { height: 1px; width: 100%; opacity: 0; pointer-events: none; } */
#bottom-sentinel { height: 1px; width: 100%; pointer-events: none; }

/* .rag-box.is-hidden { display: none; } */

/* #chat-wrapper { scroll-behavior: auto !important; } */

/* ++++++++++++++++++++++  Parsing Redenring starts here  ++++++++++++++++++++++++++ */


/* ===== PRIMARY STREAMED BULLETS (white box) ===== */

/*
.message-text ul {
  padding-left: 1.2em;
  margin: 0;
}

.message-text li {
  margin: 0;
  padding: 0;
  line-height: 1.4;
  list-style-type: disc;
}

.message-text li p {
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

.message-text li p strong {
  display: block;   
  margin-bottom: 0.15em;
} */


.message-text {
  font-size: 1.3rem;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  display: block;
  overflow: hidden;        /* 🔑 collapses inline spacing quirks */
}


.message-text ul {
  margin: 0;
  padding-left: 1.4em;
  display: block;
  line-height: 1.5;
  /* 🔥 here's the key to kill invisible spacing: It really works, don't remove! */
  overflow: hidden;
}

.message-text p {
  margin: 0 0 0.3em 0;     /* tighten bottom spacing */
  margin-left: 1vw;
  font-size: 1.3rem;
  padding: 0;
  line-height: 1.5;
}

.message-text p:first-child {
  margin-top: 0;
  padding-top: 0;
}

.message-text > ul:first-of-type {
  margin-top: 0.1em;      /* even tighter if needed */
}

.message-text {
  line-height: normal;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.rag-stream ul {
  list-style: disc;
  padding-left: 1.5em;
  margin: 0;
}
.rag-stream li {
  margin: 0 0 0.8em 0;
  line-height: 1.4;
  margin-bottom: 0.5vh;
}

.rag-stream li strong {
  display: block;
  /* margin-bottom: -1.5vh; */
}

.rag-stream li p {
  margin: 0;
  padding: 0;
}

/* Visible separators inside assistant message lists */
.message.assistant hr,
.stream-bullets hr,
hr.bullet-separator {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.5);
  margin: 1.2em 0;
  height: 0;
  margin-left: 0.8vw;
  margin-right: 1.8vw;
  margin-top: 0.001vh;
  margin-bottom: 0.001vh;
  opacity: 0.6;
}

/* ===== NEW separate primary and RAG styling based on new flush funtions class assignment  ====== */


.intro {
  margin-bottom: 1.2em;
  line-height: 1.6;
}

.stream-bullets {
  list-style: none;
  margin: 1.5em 0;
  padding: 0;
}

.stream-bullet + .stream-bullet {
  margin-top: 1.5em;
  border-top: 1px solid #ddd;
  padding-top: 1.2em;
}

.bullet-title {
  font-weight: 700;
  margin-bottom: 0.3em;
}

.bullet-expl {
  font-weight: 400;
  line-height: 1.6;
  margin-left: 0; /* no indent */
}

.stream-chunk {
  opacity: 0;
  display: inline-block;
  animation: fadeInStream 150ms ease forwards;
}

@keyframes fadeInStream {
  from {
    opacity: 0;
    transform: translateY(1px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.logo-wrapper {
  display: inline-block;
  width: auto;          /* allow wrapper to shrink naturally */
  height: auto;
  line-height: 0;       /* remove extra vertical whitespace */
  margin-right: 0.3vw;  /* controls distance to text */
}

.assistant-thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
  padding-left: 0vw;    /* greatly reduced, adjust as desired */
  border-radius: 14px;
  max-width: 70%;
}

.thinking-text {
  margin-left: -1.5vw;
  font-size: 1rem;
  color: #444;
  padding-bottom: 0;      /* remove extra spacing */
}

.assistant-thinking-bubble .logo-icon {
  margin: 0 !important;      /* remove bottom margin */
  padding: 0 !important;     /* ensure no padding */
}