:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f6f0e4;
  color: #292826;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 55% 45%, rgba(228, 203, 156, .25) 0, rgba(246, 240, 228, 0) 24rem),
    radial-gradient(circle at 94% 80%, rgba(212, 171, 102, .12) 0, rgba(246, 240, 228, 0) 22rem),
    #f6f0e4;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 440px;
  height: 440px;
  content: "";
  border: 1px solid rgba(180, 130, 49, .12);
  border-radius: 50%;
  pointer-events: none;
}

body::before { top: 21%; right: 8%; }
body::after { right: 14%; bottom: -180px; width: 600px; height: 600px; }

button, textarea { font: inherit; }

.chat-shell {
  width: min(1240px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 96px;
  border-bottom: 1px solid rgba(86, 75, 57, .14);
}

.assistant-identity { display: flex; align-items: baseline; justify-self: start; gap: 14px; }
.brand-lockup { display: flex; align-items: center; justify-self: center; min-width: 106px; }
.brand-logo { display: block; width: 106px; height: auto; filter: brightness(0); }

.identity-title { font-size: 1.05rem; font-weight: 400; letter-spacing: -.02em; }
.identity-detail { color: #ad7727; font-size: .61rem; font-weight: 600; letter-spacing: .19em; text-transform: uppercase; }

.language-switcher {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
  color: #8d867a;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .14em;
}

.language-button {
  padding: 3px 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
}

.language-button:hover,
.language-button.is-active { color: #292826; }
.language-button.is-active { text-decoration: underline; text-decoration-color: #bd7d28; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.language-divider { color: #c9b99d; }

.messages {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 38px 0 22px;
}

.message {
  width: fit-content;
  max-width: min(720px, 78%);
  padding: 19px 22px 20px;
  border-radius: 2px 20px 20px 20px;
  white-space: pre-wrap;
  line-height: 1.58;
  box-shadow: 0 16px 35px rgba(81, 60, 30, .045);
}

.message.assistant {
  align-self: flex-start;
  background: rgba(255, 253, 248, .78);
  border: 1px solid rgba(90, 76, 53, .16);
}

.message.user {
  align-self: flex-end;
  color: #27231c;
  background: linear-gradient(135deg, #d4aa63, #bd7d28);
  border-radius: 20px 2px 20px 20px;
  box-shadow: 0 14px 28px rgba(142, 96, 31, .18);
}

.message.error {
  align-self: flex-start;
  color: #812f22;
  background: #fff4ee;
  border: 1px solid rgba(145, 53, 35, .24);
}

.message-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #ae7626;
  font-size: .61rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.message.user .message-label { color: rgba(39, 35, 28, .68); }
.message.error .message-label { color: #9d3c2b; }
.message-icon { width: 14px; height: 14px; object-fit: contain; transform: translateY(-1px); }
.user-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  transform: translateY(-1px);
}
.user-icon::before {
  position: absolute;
  top: 1px;
  left: 5px;
  width: 4px;
  height: 4px;
  content: "";
  border: 1px solid currentColor;
  border-radius: 50%;
}
.user-icon::after {
  position: absolute;
  bottom: 1px;
  left: 2px;
  width: 10px;
  height: 5px;
  content: "";
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}
.message-content { margin: 0; }

.composer {
  position: sticky;
  bottom: 22px;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: auto 0 22px;
  padding: 13px 13px 13px 22px;
  background: rgba(255, 253, 248, .93);
  border: 1px solid rgba(90, 76, 53, .2);
  border-radius: 2px;
  box-shadow: 0 18px 42px rgba(71, 54, 29, .1);
  backdrop-filter: blur(14px);
}

textarea {
  width: 100%;
  height: 46px;
  min-height: 46px;
  max-height: 180px;
  padding: 11px 0 7px;
  resize: vertical;
  color: #292826;
  background: transparent;
  border: 0;
  outline: 0;
  line-height: 1.5;
}

textarea::placeholder { color: #8c8579; }

#model-select {
  width: min(210px, 28vw);
  min-height: 46px;
  padding: 0 32px 0 12px;
  color: #514b41;
  background: transparent;
  border: 1px solid rgba(90, 76, 53, .22);
  border-radius: 0;
  outline: 0;
  font-size: .76rem;
  cursor: pointer;
}

#model-select:disabled { color: #9b9489; cursor: not-allowed; }

.composer button {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex: none;
  min-height: 46px;
  padding: 0 17px 0 20px;
  color: #fffdf8;
  background: #2b2926;
  border: 1px solid #2b2926;
  border-radius: 0;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .02em;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.composer button:hover { background: #bb7d29; border-color: #bb7d29; transform: translateY(-1px); }
.composer button:disabled { color: #d3cbc0; background: #777168; border-color: #777168; cursor: wait; transform: none; }
.send-arrow { color: #d9ad68; font-size: 1.2rem; line-height: 1; }
.composer button:hover .send-arrow { color: #fffdf8; }

.status { min-height: 20px; margin: -13px 0 14px; color: #80796f; font-size: .77rem; letter-spacing: .01em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .chat-shell { width: min(100% - 32px, 1240px); }
  .app-header { min-height: 78px; }
  .assistant-identity { display: grid; gap: 3px; justify-items: start; }
  .identity-detail { font-size: .52rem; }
  .messages { padding-top: 28px; }
  .message { max-width: 92%; padding: 16px 17px; }
  .composer { gap: 8px; padding: 9px 9px 9px 15px; }
  #model-select { width: min(180px, 32vw); }
  .composer button { gap: 0; padding: 0 14px; }
  .send-arrow { display: none; }
}

@media (max-width: 430px) {
  .identity-detail { display: none; }
  .brand-lockup { min-width: 82px; }
  .brand-logo { width: 82px; }
  .language-switcher { gap: 5px; font-size: .6rem; }
  .message { max-width: 96%; }
  .composer button { font-size: .75rem; }
}
