:root {
  --app-vh: 100dvh;
  --keyboard-offset: 0px;
  --bg-main: #13100e;
  --bg-secondary: #191513;
  --ink-main: #f2ebe3;
  --ink-muted: #ad9e91;
  --hero-soft: #8d7a69;
  --card-bg: #1d1814;
  --card-edge: #2b231e;
  --line: #332922;
  --bubble-in: #2a211c;
  --bubble-out: #4f3528;
  --bubble-out-strong: #5b3d2d;
  --bubble-text: #f8f2ec;
  --accent: #b86a43;
  --accent-hover: #ca7650;
  --status-ok: #7ca06a;
  --status-error: #de8973;
  --shadow: 0 34px 84px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(850px 420px at 0% 0%, rgba(185, 129, 92, 0.16), transparent 72%),
    radial-gradient(840px 420px at 100% 100%, rgba(155, 108, 79, 0.14), transparent 73%),
    linear-gradient(155deg, var(--bg-main) 0%, var(--bg-secondary) 100%);
  color: var(--ink-main);
  padding: 36px 24px;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(68px);
}

.glow-one {
  width: 340px;
  height: 340px;
  background: rgba(184, 106, 67, 0.2);
  top: -130px;
  right: -110px;
}

.glow-two {
  width: 380px;
  height: 380px;
  background: rgba(95, 67, 51, 0.28);
  left: -150px;
  bottom: -170px;
}

.layout {
  width: min(1220px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(560px, 1.1fr);
  gap: clamp(26px, 4vw, 72px);
  align-items: stretch;
}

.hero {
  padding: 18px 8px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.17em;
  color: var(--hero-soft);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(38px, 5.2vw, 70px);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.subtitle {
  margin: 22px 0 0;
  max-width: 46ch;
  color: var(--ink-muted);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.72;
}

.hero-points {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.hero-points p {
  margin: 0;
  color: var(--ink-muted);
}

.hero-points span {
  color: var(--ink-main);
  font-weight: 700;
  margin-right: 8px;
}

.panel {
  background: linear-gradient(180deg, #1d1713 0%, #19130f 100%);
  border: 1px solid var(--card-edge);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: min(86vh, 790px);
  display: grid;
  grid-template-rows: auto 1fr;
}

.status {
  border-radius: 12px;
  font-size: 13px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border: 1px solid transparent;
}

.status.ok {
  color: var(--status-ok);
  background: rgba(124, 160, 106, 0.08);
  border-color: rgba(124, 160, 106, 0.22);
}

.status.error {
  color: var(--status-error);
  background: rgba(222, 137, 115, 0.08);
  border-color: rgba(222, 137, 115, 0.22);
}

.setup {
  margin: auto 2px;
}

.setup h2 {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 3vw, 36px);
}

.setup p {
  margin: 0 0 16px;
  color: var(--ink-muted);
}

.setup-note {
  margin: 12px 2px 0;
  color: #938477;
  font-size: 13px;
  line-height: 1.45;
}

.setup-form {
  display: flex;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  background: #201a16;
  border: 1px solid #342a23;
  border-radius: 14px;
  color: var(--ink-main);
  font: inherit;
  padding: 12px 14px;
}

textarea {
  resize: none;
  min-height: 50px;
}

input::placeholder,
textarea::placeholder {
  color: #877768;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #6b4c39;
  box-shadow: 0 0 0 3px rgba(184, 106, 67, 0.2);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff4ec;
  background: linear-gradient(165deg, var(--accent) 0%, #9f5a39 100%);
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.56;
  cursor: default;
  transform: none;
  filter: none;
}

.ghost {
  background: #2a211b;
  border: 1px solid #3a2d25;
  color: #d9c9bc;
}

.icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.icon.recording {
  background: rgba(191, 71, 71, 0.18);
  color: #ffb9ab;
  border-color: rgba(191, 71, 71, 0.36);
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 3px 4px;
}

.chat-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.chat-nickname {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.chat-actions button {
  white-space: nowrap;
}

.messages {
  background: linear-gradient(180deg, #18120f 0%, #15100c 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-height: 420px;
  height: min(60vh, 600px);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 84%;
  border-radius: 16px;
  padding: 10px 11px;
  display: grid;
  gap: 6px;
}

.message.owner {
  align-self: flex-start;
  background: var(--bubble-in);
  border-bottom-left-radius: 8px;
}

.message.visitor {
  align-self: flex-end;
  background: linear-gradient(165deg, var(--bubble-out) 0%, var(--bubble-out-strong) 100%);
  border-bottom-right-radius: 8px;
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  color: var(--bubble-text);
}

.message.owner .message-body {
  color: #e8ddd2;
}

.message-media {
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-media img,
.message-media video {
  max-width: 100%;
  display: block;
}

.message-media audio {
  width: 100%;
}

.message-file {
  display: inline-block;
  color: #f8d2bc;
  text-decoration: none;
  font-weight: 600;
  word-break: break-word;
}

.message-file:hover {
  text-decoration: underline;
}

.message-meta {
  font-size: 11px;
  color: rgba(255, 240, 229, 0.62);
}

.message.owner .message-meta {
  color: rgba(226, 210, 194, 0.6);
}

.message-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.message-form textarea {
  height: 42px;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  line-height: 1.35;
}

.composer-action-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.hidden {
  display: none;
}

@media (max-width: 1020px) {
  body {
    padding: 24px 16px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero {
    padding: 6px 2px 4px;
  }

  .subtitle {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .setup-form {
    flex-direction: column;
  }

  html,
  body {
    height: var(--app-vh, 100dvh);
    overflow: hidden;
    overscroll-behavior: none;
  }

  .hero {
    display: none;
  }

  body {
    padding: 0;
  }

  .layout {
    gap: 0;
    height: 100%;
    width: 100%;
    max-width: none;
  }

  .panel {
    height: var(--app-vh, 100dvh);
    min-height: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .chat-header {
    padding: 2px;
  }

  .chat-title {
    display: none;
  }

  .chat-actions #notifyButton {
    display: none;
  }

  .chat {
    min-height: 0;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .messages {
    min-height: 180px;
    height: 100%;
    border-radius: 14px;
    padding: 10px 10px 94px;
  }

  .message {
    max-width: 90%;
  }

  .message-form {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom) + 8px);
    z-index: 40;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    padding: 6px;
    border: 1px solid #3a2d25;
    border-radius: 14px;
    background: linear-gradient(180deg, #1b1512 0%, #18120f 100%);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.24);
  }

  .icon {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .message-form textarea {
    height: 38px;
    min-height: 38px;
    padding: 8px 10px;
  }
}
