:root {
  color-scheme: dark;
  font: 17px/1.5 system-ui, sans-serif;
  background: #0e1714;
  color: #e8f4ec;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(760px, 100%); margin: auto; padding: 22px; }
header, .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
header { justify-content: space-between; }
h1 { margin: 0; color: #a4e7ba; font-size: clamp(2.4rem, 8vw, 4rem); letter-spacing: -.06em; }
#chat { height: clamp(170px, 40vh, 550px); overflow: auto; padding: 14px; background: #17231e; border-radius: 16px; }
#chat .welcome { margin: 0; }
.chat-message { width: fit-content; max-width: 90%; margin-bottom: 12px; padding: 9px 13px; border: 1px solid #456052; border-radius: 12px; }
.chat-message:last-child { margin-bottom: 0; }
.chat-message-bambi { background: #20342b; border-left: 3px solid #a4e7ba; }
.chat-message-user { margin-left: auto; background: #293747; border-color: #536d86; }
.chat-author { font-size: .82rem; font-weight: 700; color: #a4e7ba; margin-bottom: 4px; }
.chat-message-user .chat-author { color: #badbff; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-text code { font-size: .88em; background: #142019; border-radius: 4px; padding: .08em .25em; }
.chat-text pre { margin: .45em 0; padding: 8px; overflow-x: auto; white-space: pre; background: #142019; border-radius: 6px; }
.chat-text pre code { padding: 0; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chat-actions:empty { display: none; }
@media (max-width: 420px) { .chat-message { max-width: 96%; } }
.welcome, #status { color: #b6c8bd; }
#status { min-height: 1.5em; margin: 8px 0; }
#timers:empty { display: none; }
input, textarea, button { font: inherit; }
textarea, button { background: #1c2c24; color: inherit; border: 1px solid #536a5b; border-radius: 10px; padding: 8px 12px; }
textarea { width: 100%; margin: 4px 0 8px; resize: vertical; }
button { cursor: pointer; min-height: 44px; }
button:disabled { opacity: .6; cursor: default; }
#send { margin-left: auto; background: #a4e7ba; color: #102217; font-weight: 650; }
.attachments { margin-bottom: 12px; }
.attachments label, #files { display: block; max-width: 100%; }
#file-summary { color: #b6c8bd; font-size: .85rem; margin: 4px 0; overflow-wrap: anywhere; }
#chat button { margin: 4px 0; max-width: 100%; overflow-wrap: anywhere; }

#project { margin: 12px 0; padding: 10px 14px; border: 1px solid #536a5b; border-radius: 12px; }
#project summary { cursor: pointer; }
#project-editor label, #project-editor input, #project-editor select { display: block; }
#project-editor input, #project-editor select { width: 100%; margin: 4px 0 8px; padding: 8px; font: inherit; }
#project-content { font-family: monospace; }
#project-status:empty { display: none; }

#chat a { color: #a4e7ba; text-decoration: underline; }

.settings { margin: 12px 0; padding: 10px 14px; border: 1px solid #536a5b; border-radius: 12px; }
.settings summary { cursor: pointer; }
.settings fieldset { border: 0; padding: 0; margin: 4px 0; min-width: 0; }
.settings label { display: block; margin-top: 6px; }
.settings select, .settings input:not([type=checkbox]) { display: block; width: 100%; margin: 4px 0 8px; padding: 8px; font: inherit; }
#secrets-status:empty { display: none; }


/* Bambi – Abendblau */
:root { background: #07142c; color: #ecf5ff; }
body { min-height: 100vh; isolation: isolate; }
body::before {
  content: "";
  position: fixed;
  inset: -9%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 10% 12%, rgba(32, 132, 197, .72), transparent 49%),
    radial-gradient(ellipse at 78% 72%, rgba(54, 75, 171, .64), transparent 52%),
    radial-gradient(ellipse at 48% 106%, rgba(16, 113, 142, .6), transparent 45%),
    linear-gradient(145deg, #102750, #07142c 62%, #101e46);
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: bambi-abendblau 32s ease-in-out infinite alternate; }
}
@keyframes bambi-abendblau {
  from { transform: translate(-2%, -1%) scale(1.02); }
  to { transform: translate(3%, 2%) scale(1.07); }
}
h1, .chat-author, #chat a { color: #b6eaff; }
#chat { background: rgba(8, 24, 49, .88); box-shadow: inset 0 0 0 1px rgba(173, 211, 255, .16); }
.chat-message-bambi { background: #173450; border-color: #48708c; border-left-color: #91dbff; }
.chat-message-user { background: #25395b; }
#project, .settings { background: rgba(10, 29, 55, .82); border-color: #486784; }
textarea, button { background: #152e4c; border-color: #577593; }
#send { background: #a7e4ff; color: #09213a; }
.welcome, #status, #file-summary { color: #d3e2f2; }

/* Nachrichtenfeld unter dem Gespräch */
main { display: flex; flex-direction: column; }
main > #chat { height: clamp(9rem, calc(70vh - 7rem), 55rem); height: clamp(9rem, calc(70svh - 7rem), 55rem); }
main > #form { width: min(100%, 38rem); margin: 0 auto 1rem; }
main > details { order: 1; }
#message { display: block; }

/* Einzelnes Eingabefeld vor dem Abendhimmel */
main > :where(:not(#form)), #form > :not(#message) { display: none; }
#form > label[for="message"] { display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
main { min-height: 100vh; min-height: 100dvh; padding: 0 22px; display: grid; grid-template-rows: 3fr auto 1fr; }
main > #form { grid-row: 2; margin: 0 auto; }
#message { margin: 0; resize: none; }

/* Startansicht und Gespräch teilen sich den Bereich über der Eingabe. */
main { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: minmax(0, 3fr) auto minmax(0, 1fr); }
main > header { display: block; grid-area: 1 / 1; align-self: end; text-align: center; padding-bottom: 1.4rem; }
main > header > button { display: none; }
.bambi-subtitle { margin: .15rem 0 0; color: #d3e2f2; font-size: clamp(1rem, 2vw, 1.2rem); }
main:has(#chat > :not(.welcome)) > header { display: none; }
main > #chat:has(> :not(.welcome)) { display: block; grid-area: 1 / 1; align-self: end; justify-self: center; width: min(100%, 38rem); height: auto; max-height: calc(100% - 1.5rem); min-height: 0; overflow-y: auto; margin-bottom: .75rem; }
#chat:has(> :not(.welcome)) > .welcome { display: none; }
main > #status:not(:empty) { display: block; grid-area: 3 / 1; align-self: start; justify-self: center; width: min(100%, 38rem); }

main > #timers:not(:empty) { display: grid; gap: .45rem; position: fixed; z-index: 2; top: max(.8rem, env(safe-area-inset-top)); left: max(.8rem, env(safe-area-inset-left)); margin: 0; padding: 0; list-style: none; max-width: calc(100vw - 1.6rem); max-height: 28vh; overflow: auto; }
#timers li { display: flex; align-items: center; gap: .75rem; background: #102b49; color: #e7f6ff; border: 1px solid #60839e; border-radius: 14px; padding: .3rem .5rem .3rem .85rem; box-shadow: 0 3px 14px #06172e66; font-variant-numeric: tabular-nums; }
#timers button { font-size: .85rem; }

#form { position: relative; }
#form > #bambi-add-files { display: grid; place-items: center; position:absolute; left:8px; top:10px; height:44px; width:44px; padding:0; border-radius:50%; font-size:1.55rem; }
#form #message { padding-left:62px; min-height:66px; }

#form > #bambi-add-files { overflow:hidden; background:#152e4c; border:1px solid #577593; cursor:pointer; }
#bambi-add-files #files { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
#form > #send { display:grid; place-items:center; position:absolute; top:10px; right:8px; width:44px; height:44px; border-radius:50%; padding:0; }
#form #message { padding-right:62px; }
.chat-message img { display:block; max-width:100%; height:auto; border-radius:8px; }

main > #jarvis-toggle { display:block; grid-area:3 / 1; justify-self:center; align-self:start; margin-top:.5rem; border-radius:2rem; background:#102b49; color:#d5ecff; padding:6px 16px; }
main:has(#status:not(:empty)) > #jarvis-toggle { margin-top:0; }
main:has(#jarvis-toggle) > #status:not(:empty) { margin-top:3.3rem; text-align:center; }
#jarvis-toggle[aria-pressed=true] { border-color:#70d9ff; }

#bambi-voice-open { position:fixed; z-index:3; top:max(.8rem, env(safe-area-inset-top)); right:max(.8rem, env(safe-area-inset-right)); border-radius:2rem; background:#102b49; }
#bambi-voice-dialog { color:#ecf5ff; background:#102843; border:1px solid #597893; border-radius:16px; width:min(24rem,90vw); padding:1rem; }
#bambi-voice-dialog::backdrop { background:#041020aa; }
#bambi-voice-dialog details { margin:0; }
#bambi-voice-dialog [role=status]:empty { display:none; }
