:root{
  --bg:#f5f5f5;
  --text:#1a1a1a;
  --secondary:#666666;
  --link:#3390EC;
	  --link-hover:#2481cc;
  --typing:#8a8a8a;
  --surface:#ffffff;
  --surface-muted:#eceff2;
  --border:#d8dde3;
  --overlay:rgba(15,23,42,.56);
  --focus:#1677c8;
  --focus-shadow:rgba(22,119,200,.12);
  --button-text:#ffffff;
  --notice-shadow:0 8px 28px rgba(15,23,42,.14);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:#0f0f10;
    --text:#e8e8e8;
    --secondary:#9a9a9a;
    --link:#ffffff;
    --typing:#8f8f8f;
    --surface:#1b1b1e;
    --surface-muted:#26262a;
    --border:#3a3a40;
    --overlay:rgba(0,0,0,.72);
    --focus:#72b7ee;
    --focus-shadow:rgba(114,183,238,.14);
    --button-text:#0f0f10;
    --notice-shadow:0 8px 28px rgba(0,0,0,.34);
  }
}

*{
  box-sizing:border-box;
}

html{
  scrollbar-gutter:stable;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}

body.modal-open{
  overflow:hidden;
}

button,
textarea{
  font:inherit;
}

button{
  color:inherit;
}

.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;
}

.container{
  max-width:680px;
  margin:0 auto;
  padding:60px 20px 56px;
}

.header{
  text-align:center;
  margin-bottom:40px;
}

.avatar{
  width:96px;
  height:96px;
  border-radius:50%;
  object-fit:cover;
  display:block;
  margin:0 auto 14px;
}

h1{
  margin:0;
  font-size:clamp(24px,2vw,32px);
  line-height:1.2;
  font-weight:700;
}

.subtitle{
  margin-top:6px;
  color:var(--secondary);
  font-size:16px;
  line-height:1.4;
}

#chat{
  min-height:1px;
}

.message{
  font-size:clamp(17px,1.1vw,20px);
  line-height:1.7;
  margin:0 0 28px;
  word-wrap:break-word;
}

.hidden{
  display:none;
}

.typing{
  display:none;
  gap:4px;
  margin:4px 0 28px;
  align-items:center;
  height:14px;
}

.dot{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--typing);
  animation:blink 1s infinite;
}

.dot:nth-child(2){ animation-delay:.15s; }
.dot:nth-child(3){ animation-delay:.3s; }

@keyframes blink{
  0%, 80%, 100% { opacity:.2; }
  40% { opacity:1; }
}

	.link{
	  color:var(--link);
	  text-decoration:none;
	  font-weight:500;
	}

	.link:hover{
	  color:var(--link-hover);
	  text-decoration:underline;
	}

.footer{
  margin-top:50px;
  color:var(--secondary);
  opacity:0;
  transition:opacity .6s ease;
  font-size:16px;
  line-height:1.5;
}

.footer.visible{
  opacity:1;
}

.future-chat{
  margin-top:76px;
  opacity:0;
  transition:opacity 2s ease;
  pointer-events: none;
}

.future-chat.visible{
  opacity:1;
  pointer-events: auto;
}

.future-chat-prompt{
  width:100%;
  max-width:520px;
  margin-left:auto;
  text-align:right;
}

.quick-questions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
  margin-bottom:16px;
}

.quick-question{
  max-width:100%;
  min-height:36px;
  padding:7px 12px;
  border:0;
  border-radius:18px;
  background:var(--surface-muted);
  color:var(--text);
  font-size:16px;
  line-height:1.3;
  cursor:pointer;
  transition:background-color .18s ease, color .18s ease;
}

.quick-question:hover{
  background:var(--border);
}

.quick-question:disabled{
  cursor:default;
  opacity:.62;
}

.chat-messages{
  display:flex;
  flex-direction:column;
  gap:20px;
  margin:28px 0 40px;
}

.chat-messages:empty{
  display:none;
}

.chat-message{
  max-width:100%;
  color:var(--text);
  font-size:clamp(17px,1.1vw,20px);
  line-height:1.6;
  animation:chat-message-in .22s ease-out both;
}

.chat-message ul {
  margin: 0.8em 0 1.2em;
  padding-left: 1.8em;
}

.chat-message li {
  padding-left: 0.35em;
}

.chat-message p {
  margin: 1.1em 0;
}

.chat-message li::marker {
  font-size: 1.15em;
}

.chat-message-content{
  overflow-wrap:anywhere;
}

.chat-message-assistant .chat-message-content p,
.chat-message-assistant .chat-message-content h3,
.chat-message-assistant .chat-message-content h4,
.chat-message-assistant .chat-message-content h5,
.chat-message-assistant .chat-message-content ul,
.chat-message-assistant .chat-message-content ol,
.chat-message-assistant .chat-message-content pre{
  margin:0 0 18px;
}

.chat-message-assistant .chat-message-content h3,
.chat-message-assistant .chat-message-content h4,
.chat-message-assistant .chat-message-content h5 {
  padding-top: 12px;
}

.chat-message-assistant .chat-message-content > :last-child{
  margin-bottom:0;
}

.chat-message-assistant .chat-message-content h3,
.chat-message-assistant .chat-message-content h4,
.chat-message-assistant .chat-message-content h5{
  font-size:1em;
  font-weight:600;
  line-height:1.45;
}

.chat-message-assistant .chat-message-content h3 {
  font-size: 1.4em;
}

.chat-message-assistant .chat-message-content h4 {
  font-size: 1.2em;
}

.chat-message-assistant .chat-message-content ul,
.chat-message-assistant .chat-message-content ol{
  padding-left:2.2em;
}

.chat-message-assistant .chat-message-content a{
  color:var(--link);
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
}

.chat-message-assistant .chat-message-content code{
  padding:.12em .32em;
  border-radius:5px;
  background:var(--surface-muted);
  font-family:ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size:.88em;
}

.chat-message-assistant .chat-message-content pre{
  max-width:100%;
  overflow-x:auto;
  padding:14px 16px;
  border-radius:12px;
  background:var(--surface-muted);
  font-size:.88em;
  line-height:1.5;
  white-space:pre;
}

.chat-message-assistant .chat-message-content pre code{
  padding:0;
  background:transparent;
  font-size:inherit;
}

.chat-message-note{
  margin-top:8px;
  color:var(--secondary);
  font-size:14px;
  line-height:1.45;
}

.chat-message-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
}

.chat-message-action{
  min-height:36px;
  padding:7px 12px;
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--surface);
  color:var(--text);
  font:inherit;
  cursor:pointer;
}

.chat-message-action-primary{
  border-color:var(--link);
  background:var(--link);
  color:var(--button-text);
}

.chat-message-action:disabled{
  cursor:default;
  opacity:.6;
}

.chat-message-user{
  width:fit-content;
  max-width:80%;
  margin-left:auto;
}

.chat-message-assistant + .chat-message-user{
  margin-top:16px;
}

.chat-message-user .chat-message-content{
  padding:11px 15px;
  border-radius:18px;
  background:var(--surface-muted);
  white-space:pre-wrap;
}

.chat-message-assistant{
  align-self:flex-start;
}

.chat-message-error .chat-message-content{
  color:var(--secondary);
}

.chat-message-pending{
  min-height:22px;
}

.chat-typing{
  display:flex;
  align-items:center;
  gap:5px;
  min-height:22px;
}

.chat-typing span{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--typing);
  opacity:.35;
  animation:chat-typing-dot 1.35s ease-in-out infinite;
}

.chat-typing span:nth-child(2){ animation-delay:.16s; }
.chat-typing span:nth-child(3){ animation-delay:.32s; }

@keyframes chat-message-in{
  from{
    opacity:0;
    transform:translateY(8px);
  }

  to{
    opacity:1;
    transform:translateY(0);
  }
}

@keyframes chat-typing-dot{
  0%, 60%, 100%{
    opacity:.3;
    transform:translateY(0);
  }

  30%{
    opacity:1;
    transform:translateY(-3px);
  }
}

.quick-question:focus-visible,
.response-language-trigger:focus-visible,
.response-language-option:focus-visible,
.chat-submit:focus-visible,
.service-link:focus-visible,
.modal-close:focus-visible,
.modal-confirm:focus-visible{
  outline:2px solid var(--focus);
  outline-offset:2px;
}

.chat-form{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:2px;
  padding:6px;
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--surface);
}

.chat-form.expanded{
  gap:2px;
}

.chat-form:focus-within{
  border-color:var(--focus);
  box-shadow:0 0 0 3px var(--focus-shadow);
}

.chat-textarea{
  display:block;
  flex:1 1 auto;
  width:100%;
  min-width:0;
  min-height:42px;
  max-height:168px;
  padding:9px 10px 10px;
  border:0;
  outline:0;
  resize:none;
  overflow-y:auto;
  background:transparent;
  color:var(--text);
  font-size:16px;
  line-height:1.45;
  scrollbar-width:thin;
  scrollbar-color:var(--typing) transparent;
}

.chat-textarea.scrollable{
  padding-bottom:16px;
}

.chat-textarea::-webkit-scrollbar{
  width:6px;
}

.chat-textarea::-webkit-scrollbar-track{
  margin-block:8px;
  background:transparent;
}

.chat-textarea::-webkit-scrollbar-thumb{
  border-radius:3px;
  background:var(--typing);
}

.chat-textarea::-webkit-scrollbar-button{
  display:none;
  width:0;
  height:0;
}

.chat-textarea::placeholder{
  color:var(--secondary);
  opacity:.9;
}

.chat-toolbar{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-width:0;
  gap:4px;
}

.contact-mode-cancel{
  min-height:32px;
  padding:5px 10px;
  border:0;
  border-radius:16px;
  background:var(--surface-muted);
  color:var(--secondary);
  font-size:14px;
  cursor:pointer;
}

.contact-mode-cancel:hover{
  color:var(--text);
  background:var(--border);
}

.response-language{
  flex:0 1 auto;
}

.response-language-trigger{
  display:flex;
  align-items:center;
  gap:5px;
  min-height:36px;
  max-width:100%;
  padding:7px 9px 7px 11px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--secondary);
  font-family:inherit;
  font-size:13px;
  line-height:1.2;
  white-space:nowrap;
  cursor:pointer;
  transition:background-color .18s ease, color .18s ease;
}

.response-language-trigger:hover,
.response-language-trigger[aria-expanded="true"]{
  background:var(--surface-muted);
  color:var(--text);
}

.response-language-trigger svg{
  flex:0 0 auto;
  width:14px;
  height:14px;
  fill:none;
  stroke:currentColor;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-width:1.8;
  transition:transform .18s ease;
}

.response-language-trigger[aria-expanded="true"] svg{
  transform:rotate(180deg);
}

.response-language-menu{
  position:absolute;
  z-index:20;
  right:0;
  bottom:calc(100% + 10px);
  width:min(320px, calc(100vw - 48px));
  padding:8px;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--surface);
  box-shadow:var(--notice-shadow);
}

.response-language-menu[hidden]{
  display:none;
}

.response-language-title{
  padding:8px 10px 10px;
  color:var(--text);
  font-size:13px;
  font-weight:600;
  line-height:1.3;
}

.response-language-option{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  width:100%;
  padding:10px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--text);
  font-family:inherit;
  text-align:left;
  cursor:pointer;
}

.response-language-option:hover{
  background:var(--surface-muted);
}

.response-language-copy{
  display:flex;
  flex-direction:column;
  min-width:0;
  gap:3px;
}

.response-language-name{
  font-size:14px;
  font-weight:500;
  line-height:1.3;
}

.response-language-description{
  color:var(--secondary);
  font-size:12px;
  line-height:1.35;
}

.response-language-check{
  flex:0 0 auto;
  width:18px;
  height:18px;
  fill:none;
  stroke:var(--link);
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-width:2;
  opacity:0;
}

.response-language-option[aria-selected="true"] .response-language-check{
  opacity:1;
}

.chat-actions{
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:4px;
}

.chat-icon-button{
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:44px;
  height:44px;
  padding:0;
  border:0;
  border-radius:50%;
  cursor:pointer;
}

.chat-icon-button svg{
  width:20px;
  height:20px;
  fill:none;
  stroke:currentColor;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-width:2;
}

.chat-voice{
  background:transparent;
  color:var(--secondary);
  transition:background-color .18s ease, color .18s ease;
}

.chat-voice[hidden]{
  display:none;
}

.chat-voice:hover,
.chat-voice.listening{
  background:var(--surface-muted);
  color:var(--text);
}

.chat-voice:disabled{
  cursor:default;
  opacity:.55;
}

.chat-submit{
  background:var(--link);
  color:var(--button-text);
  transition:background-color .18s ease, opacity .18s ease;
}

.chat-submit:hover:not(:disabled){
  opacity:.82;
}

.chat-submit:disabled{
  background:var(--surface-muted);
  color:var(--secondary);
  cursor:default;
  opacity:.7;
}

.service-info{
  display:flex;
  align-items:flex-start;
  flex-direction:column;
  gap:3px;
  margin-top:24px;
  padding:0;
  color:var(--secondary);
  font-size:12px;
  line-height:1.35;
  text-align:left;
}

.service-owner{
  white-space:nowrap;
}

.service-actions{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:wrap;
  gap:0 5px;
}

.service-link{
  display:inline-flex;
  align-items:center;
  min-height:0;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  font-size:inherit;
  line-height:inherit;
  cursor:pointer;
  transition:color .18s ease;
}

.service-link:hover{
  color:var(--text);
}

.modal{
  position:fixed;
  z-index:1000;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:var(--overlay);
  opacity:0;
  transition:opacity .2s ease;
}

.modal[hidden]{
  display:none;
}

.modal.open{
  opacity:1;
}

.modal-dialog{
  position:relative;
  display:flex;
  flex-direction:column;
  width:min(100%, 600px);
  max-height:min(82vh, 760px);
  overflow:hidden;
  padding:0;
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--surface);
  box-shadow:var(--notice-shadow);
  transform:translateY(6px) scale(.97);
  transition:transform .2s ease;
  overflow-wrap:anywhere;
}

.modal.open .modal-dialog{
  transform:translateY(0) scale(1);
}

.modal-title{
  flex:0 0 auto;
  margin:0;
  padding:28px 72px 22px 28px;
  font-size:clamp(21px, 3vw, 26px);
  line-height:1.25;
}

.modal-close{
  position:absolute;
  top:14px;
  right:14px;
  display:grid;
  place-items:center;
  width:44px;
  height:44px;
  padding:0;
  border:0;
  border-radius:50%;
  background:transparent;
  color:var(--secondary);
  font-size:28px;
  line-height:1;
  cursor:pointer;
}

.modal-close:hover{
  background:var(--surface-muted);
  color:var(--text);
}

.modal-copy{
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:0 28px 28px;
  font-size:15px;
  line-height:1.65;
}

.modal-copy p{
  margin:0 0 14px;
}

.modal-copy p:last-child{
  margin-bottom:0;
}

.modal-copy ul{
  margin:0 0 16px;
  padding-left:22px;
}

.modal-copy a{
  color:var(--link);
  overflow-wrap:anywhere;
}

.modal-copy h4{
  margin:0 0 8px;
  font-size:15px;
}

.modal-copy h4:not(:first-child){
  margin-top:20px;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:20px;
}

.modal-confirm{
  min-height:40px;
  padding:8px 16px;
  border:0;
  border-radius:13px;
  background:var(--surface-muted);
  color:var(--text);
  font-weight:600;
  cursor:pointer;
  transition:opacity .18s ease;
}

.modal-confirm:hover{
  opacity:.78;
}

.long-value{
  overflow-wrap:anywhere;
  word-break:break-word;
}

@media (prefers-reduced-motion:reduce){
  .footer,
  .future-chat,
  .quick-question,
  .chat-message,
  .chat-submit,
  .modal,
  .modal-dialog{
    transition:none;
  }

  .dot{
    animation:none;
    opacity:.7;
  }

  .chat-message{
    animation-duration:.01ms;
    transform:none;
  }

  .chat-typing span{
    animation:none;
    opacity:.65;
  }
}

@media (max-width:600px){
  .container{
    padding:40px 18px 48px;
  }

  .header{
    margin-bottom:32px;
  }

  .message{
    margin-bottom:24px;
  }

  .chat-messages{
    margin-bottom:32px;
  }

  .future-chat{
    margin-top:54px;
  }

  .chat-message-user{
    max-width:92%;
  }

  .modal{
    align-items:flex-end;
    padding:12px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .modal-dialog{
    max-height:88vh;
    padding:0;
    border-radius:18px;
  }

  .modal-title{
    padding:24px 62px 18px 18px;
  }

  .modal-copy{
    padding:0 18px 24px;
  }

  .modal-close{
    top:8px;
    right:8px;
  }

}
