:root {
  color-scheme: light;
  --bg: #f6f1e6;
  --ink: #3a2e22;
  --muted: #8a7360;
  --line: #e3d3bc;
  --accent: #a67c45;
  --accent-dark: #8b6434;
  --paper: #fffdf8;
  --bubble: #f3e6d0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  font: 16px/1.45 Georgia, "Iowan Old Style", serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; }
.mark {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4vw;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  letter-spacing: 0.04em;
}
.mark a {
  color: var(--accent-dark);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--bubble);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 1px 0 rgba(166, 124, 69, 0.15);
}
#chat-root { min-height: 0; }
.desk-chat { height: 100%; display: grid; grid-template-rows: 1fr auto; }
.xchat-log { overflow: auto; overflow-anchor: none; padding: 16px 4vw 28px; display: grid; gap: 10px; align-content: start; }
.xchat-log article { max-width: min(520px, 84%); background: var(--paper); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 10px 4px; }
.xchat-log .visitor { justify-self: end; background: var(--bubble); border-radius: 16px 16px 4px 16px; }
.xchat-log p { margin: 0; white-space: pre-wrap; }
.xchat-log time { display: block; text-align: right; color: var(--muted); font-size: 11px; margin-top: 4px; }
.xchat-log img, .xchat-log video { width: min(100%, 360px); border-radius: 10px; display: block; margin-top: 6px; }
.xchat-log audio { width: min(100%, 280px); height: 40px; display: block; margin-top: 6px; }
.composer { display: grid; gap: 8px; padding: 12px 3vw 16px; background: linear-gradient(#f6f1e6, #f3eadc); border-top: 1px solid var(--line); }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.clip, .voice, .send {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(166, 124, 69, 0.18);
  font: inherit;
}
.clip, .voice {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}
.clip svg, .voice svg { width: 22px; height: 22px; display: block; }
.voice.recording { background: #a33b32; color: #fffdf8; border-color: #a33b32; }
.send {
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  background: linear-gradient(#c79655, var(--accent-dark));
  color: #fffdf8;
  border-color: #8b6434;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.send:hover, .clip:hover, .voice:hover, .mark a:hover { filter: brightness(0.97); }
.composer-bar input[name="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--ink);
}
input, button { font: inherit; color: var(--ink); }
.composer input[name="name"] {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 240px;
}
.xchat-error { min-height: 1em; margin: 0; color: #a14a3a; font-size: 13px; }
@media (max-width: 700px) {
  .composer-bar { gap: 6px; }
  .send { padding: 0 12px; }
}
