﻿*{box-sizing:border-box}

html, body{
  height:100%;
  margin:0;
}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background:#0b0f14;
  color:#e9eef5;
  overflow:hidden; /* Seite fix: kein Body-Scroll */
}

/* Hauptcontainer: fix auf Viewport (dvh ist mobile-freundlich) */
.wrap{
  max-width:860px;
  margin:0 auto;
  height:100dvh;
  display:flex;
  flex-direction:column;
  padding:16px;
  gap:12px;
  min-height:0; /* wichtig für flex-child scroll */
}

.top{
  display:flex;
  gap:12px;
  align-items:center;
  flex:0 0 auto;
}

.headtxt{min-width:0}

.avatar{
  width:52px;
  height:52px;
  border-radius:14px;
  object-fit:cover;
  background:#1b2430;
  flex:0 0 auto;
}

.title{font-size:18px;font-weight:800}
.sub{font-size:13px;opacity:.75}

.iconbtn{
  margin-left:auto;
  border:1px solid #1b2430;
  background:#0f1620;
  color:#e9eef5;
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
}

/* Chatfenster: nimmt Resthöhe ein + scrollt intern */
.chat{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
  border:1px solid #1b2430;
  border-radius:16px;
  background:#0f1620;

  min-height:0;          /* KRITISCH: erlaubt echtes Shrinking */
  overflow-y:auto;       /* Scrollbar */
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

/* Messages */
.b{
  max-width:80%;
  padding:10px 12px;
  border-radius:14px;
  line-height:1.35;
  white-space:pre-wrap;
  word-wrap:break-word;
}

.u{align-self:flex-end;background:#1b2430}
.a{align-self:flex-start;background:#121a24;border:1px solid #1b2430}
.meta{font-size:12px;opacity:.7;margin-top:4px}

/* Inputbar bleibt unten sichtbar */
.bar{
  display:flex;
  gap:8px;
  flex:0 0 auto;

  position:sticky;
  bottom:0;
  padding-top:10px;

  /* Hintergrund damit es nicht "durchscheint" beim Scrollen */
  background:#0b0f14;
}

.bar input,.bar button{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #1b2430;
  background:#0f1620;
  color:#e9eef5;
}

#auth{width:220px}
#msg{flex:1}
.bar button{cursor:pointer}

/* Honeypot */
.hp{position:absolute;left:-9999px;top:-9999px;opacity:0}

/* Modal */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:9999;
}
.modal-backdrop.open{display:flex}

.modal{
  width:100%;
  max-width:520px;
  border-radius:16px;
  border:1px solid #1b2430;
  background:#0f1620;
  box-shadow:0 10px 40px rgba(0,0,0,.35);
}
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 12px;
  border-bottom:1px solid #1b2430;
}
.modal-title{font-weight:800}
.modal-body{padding:12px;display:flex;flex-direction:column;gap:14px}
.modal-footer{padding:12px;border-top:1px solid #1b2430;display:flex;justify-content:flex-end}

.field .label{font-weight:700;margin-bottom:6px}
.field .hint{font-size:12px;opacity:.7;margin-top:6px}

.btnrow{display:flex;gap:8px;flex-wrap:wrap}
.btnrow button{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid #1b2430;
  background:#0f1620;
  color:#e9eef5;
  cursor:pointer;
}
.danger{border-color:#5b2230}

/* Mobile: Auth-Feld kleiner */
@media (max-width: 520px){
  #auth{width:140px}
  .b{max-width:92%}
}
