* { box-sizing: border-box; }

body, html {
  margin: 0; padding: 0; width: 100%;
  height: 100vh; height: 100dvh;
  font-family: system-ui, sans-serif; background-color: #000; color: #fff;
  display: flex; flex-direction: column; overflow: hidden;
}

#header {
  background-color: #1a1a1a;
  padding: max(16px, env(safe-area-inset-top)) 16px 12px 16px;
  text-align: center;
}
#header h1 {
  margin: 0; font-size: clamp(16px, 4vw, 20px); font-weight: 800;
  text-transform: uppercase; letter-spacing: 2px;
}
#status { margin-top: 6px; font-size: 12px; color: #999; }
#status::before {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px;
  border: 1px solid #fff; background: transparent;
}
#status[data-state="on"]::before { background: #fff; }
#status[data-state="error"] { color: #ff4d4d; }

#chat-window {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; display: flex; flex-direction: column; gap: 16px;
}

.msg {
  background-color: #2a2a2a; padding: 16px; border-radius: 0;
  width: fit-content; max-width: 90%; font-size: clamp(16px, 4vw, 18px); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.msg .meta { font-size: 0.75em; opacity: 0.6; margin-bottom: 4px; }
.msg.own { background-color: #fff; color: #000; align-self: flex-end; }
.msg.pending { opacity: 0.6; }
.msg.failed { border-left: 4px solid #ff4d4d; }
.msg.failed .meta::after { content: ' – nicht gesendet'; color: #ff4d4d; opacity: 1; }

#input-area {
  display: flex; background-color: #1a1a1a; padding: 16px; gap: 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

input {
  flex: 1; min-width: 0; background-color: #000; color: #fff; border: none;
  padding: 16px; font-size: 16px; /* >=16px verhindert Auto-Zoom auf iOS */
  font-family: system-ui, sans-serif; border-radius: 0; outline: none;
}
input::placeholder { color: #666; }

button {
  background-color: #fff; color: #000; border: none; padding: 16px clamp(16px, 5vw, 40px);
  font-size: clamp(14px, 4vw, 18px); font-weight: 800; font-family: system-ui, sans-serif;
  border-radius: 0; cursor: pointer; text-transform: uppercase; white-space: nowrap;
}
button:active { background-color: #ccc; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  
