:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #6e675e;
  --line: #e0d8cc;
  --card: #fffdf8;
  --accent: #0f6e68;
  --accent-ink: #f7fffd;
  --mine: #0f6e68;
  --theirs: #fffdf8;
  --warn: #8a3d12;
  --danger: #8f2d2d;
  --shadow: 0 10px 30px rgba(48, 36, 18, 0.08);
  font-family: "Source Sans 3", "Noto Sans Telugu", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  background: var(--bg);
  font-family: "Noto Sans Telugu", "Source Sans 3", sans-serif;
  line-height: 1.45;
}

button, input, textarea, select { font: inherit; color: inherit; }
button, input, textarea, select { border-radius: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 22px 22px;
}
.mark {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}
h1 { font-size: 1.7rem; line-height: 1.2; margin: 8px 0; }
.lede { color: var(--muted); margin-top: 0; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="password"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
}
button {
  margin-top: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.error { min-height: 1.2em; color: var(--danger); }

.chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  padding-top: max(12px, env(safe-area-inset-top));
}
.who { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.settings { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.settings-label { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.lang { font-size: 0.85rem; color: var(--muted); min-width: 140px; }
.lang select { margin-top: 4px; padding: 8px 10px; }
.log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: min(85%, 520px);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--theirs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.mine {
  margin-left: auto;
  background: var(--mine);
  color: var(--accent-ink);
  border-color: transparent;
}
.meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.8;
}
.ticks.read { color: #b7fff4; }
.bubble:not(.mine) .ticks.read { color: var(--accent); }
.toggle, .retry {
  margin: 6px 0 0;
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}
.badge { font-size: 0.75rem; color: var(--warn); margin: 4px 0 0; }
.bubble.mine .badge { color: #ffe3c4; }
.typing, .status {
  margin: 0;
  padding: 0 14px 4px;
  min-height: 1.1em;
  color: var(--muted);
  font-size: 0.85rem;
}
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
}
.composer button { margin-top: 0; }
.composer.drag { outline: 2px dashed var(--accent); outline-offset: -6px; }
.file {
  position: relative;
  margin: 0;
  padding: 12px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.pending {
  margin: 0;
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
.pending button {
  margin: 0 0 0 8px;
  padding: 0;
  background: none;
  color: var(--danger);
  text-decoration: underline;
}
.preview { display: block; width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; margin-bottom: 6px; background: #000; }
audio.preview { width: 100%; background: transparent; }
.doc { display: block; margin-bottom: 6px; color: inherit; font-weight: 600; }
.empty { color: var(--muted); text-align: center; margin: auto; }
