* { box-sizing: border-box; margin: 0; }

/* Atribut hidden musí vyhrát nad display:flex u #chat a #composer */
[hidden] { display: none !important; }

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #d9dce1;
  --accent: #b91c1c;
  --me: #fee2e2;
  --them: #eef0f3;
  --ok: #157347;
  --ok-bg: #d9f2e5;
  --wait: #92600a;
  --wait-bg: #fdf0d5;
  --err: #b3261e;
  --err-bg: #fbdddb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1e2126;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --border: #33373e;
    --accent: #ef4444;
    --me: #4a1d1d;
    --them: #2a2e35;
    --ok: #4ade80;
    --ok-bg: #14342a;
    --wait: #fbbf24;
    --wait-bg: #3a2f14;
    --err: #f87171;
    --err-bg: #401a18;
  }
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
}

h1 { font-size: 22px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
h1 img { border-radius: 7px; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }

#joinForm { display: flex; flex-direction: column; gap: 14px; }

.stats {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.stats b { color: var(--text); }

.langs {
  margin-top: 10px;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}
.langs a { color: var(--muted); text-decoration: none; padding: 2px 4px; }
.langs a:hover { color: var(--accent); }
.langs a.active { color: var(--accent); font-weight: 600; }
#joinForm label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }

input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }

#chat { display: flex; flex-direction: column; height: 80vh; max-height: 700px; }

header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
header strong { font-size: 17px; }
#toggleCt { background: transparent; color: var(--accent); font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); }

.status { font-size: 13px; padding: 3px 10px; border-radius: 20px; display: inline-block; margin-top: 4px; }
.status.wait { background: var(--wait-bg); color: var(--wait); }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.err { background: var(--err-bg); color: var(--err); }

.safety {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.safety code { display: block; margin-top: 4px; font-size: 15px; letter-spacing: 1px; color: var(--text); }

#messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }

.msg { max-width: 80%; padding: 8px 12px; border-radius: 10px; }
.msg.me { align-self: flex-end; background: var(--me); }
.msg.them { align-self: flex-start; background: var(--them); }
.msg .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.msg .body { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg .ct { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; margin-top: 6px; word-break: break-all; }

.sys { align-self: center; font-size: 12.5px; color: var(--muted); text-align: center; }

#composer { display: flex; gap: 8px; margin-top: 12px; }
#composer input { flex: 1; }
