/* —— basic reset —— */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* —— body + fonts —— */
body {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  color: #1f1b16;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(196, 154, 86, 0.18), transparent 32%),
    linear-gradient(135deg, #fffdf8 0%, #f5efe4 100%);
}

.page-wrapper {
  width: 90%;
  max-width: 960px;
}

/* header */
.site-header {
  text-align: center;
  padding-top: 44px;
}

.brand-logo {
  width: min(300px, 80vw);
  height: auto;
  margin-bottom: 24px;
}

.site-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  color: #090909;
}

.site-subtitle {
  max-width: 620px;
  margin: 0 auto;
  color: #5d5144;
  font-size: clamp(15px, 2.5vw, 18px);
  line-height: 1.6;
}

/* chat window */
.chatbox {
  margin: 36px 0;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid rgba(196, 154, 86, 0.35);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.1);
}

.chat-window {
  height: min(58vh, 520px);
  min-height: 380px;
  border: 1px solid #e3d5bd;
  border-radius: 22px;
  padding: clamp(16px, 3vw, 24px);
  font-size: 16px;
  line-height: 1.5;
  overflow-y: auto;
  background: #fffaf2;
}

/* messages */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  margin-bottom: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.msg.user {
  align-items: flex-end;
  margin-left: auto;
}

.msg.ai {
  align-items: flex-start;
  margin-right: auto;
}

.msg-label {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #77644c;
}

.msg-bubble {
  padding: 13px 16px;
  border-radius: 20px;
  white-space: pre-wrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.msg.user .msg-bubble {
  border-bottom-right-radius: 6px;
  background: #090909;
  color: #fffaf2;
}

.msg.ai .msg-bubble {
  border: 1px solid #eadcc2;
  border-bottom-left-radius: 6px;
  background: #ffffff;
  color: #2c251d;
}

.typing .msg-bubble {
  color: #6f5b3d;
  font-style: italic;
}

.status-message {
  min-height: 20px;
  margin-top: 10px;
  color: #6d5940;
  font-size: 14px;
}

/* input row */
.chat-form {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #d8c8ad;
  border-radius: 999px;
  background: #fffdf8;
  color: #1f1b16;
  font-size: 16px;
}

.chat-form input:focus {
  outline: 3px solid rgba(196, 154, 86, 0.45);
  outline-offset: 2px;
  border-color: #8b6f3f;
}

.chat-form button {
  flex: 0 0 auto;
  font-size: 18px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50%;
  padding: 13px;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s, opacity 0.2s;
}

.chat-form button .material-icons {
  font-size: 24px;
}

.chat-form button:hover {
  background: #4b3a20;
  transform: translateY(-1px);
}

.chat-form button:focus {
  outline: 3px solid rgba(196, 154, 86, 0.55);
  outline-offset: 2px;
}

.chat-form button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

/* visually hidden */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* footer */
.site-footer {
  margin: 48px 0 40px;
  text-align: center;
  font-size: 14px;
  color: #655847;
}

.site-footer nav {
  margin-top: 12px;
}

.site-footer a {
  margin: 0 8px;
  color: #000;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  color: #8b6f3f;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .page-wrapper {
    width: 94%;
  }

  .site-header {
    padding-top: 28px;
  }

  .chatbox {
    border-radius: 20px;
  }

  .chat-window {
    min-height: 420px;
  }

  .msg {
    max-width: 92%;
  }

  .chat-form {
    gap: 8px;
  }

  .chat-form input {
    font-size: 15px;
    padding: 13px 14px;
  }

  .chat-form button {
    width: 50px;
    height: 50px;
  }
}
