:root {
  --navy-950: #0d1729;
  --sky-500: #18aeea;
  --sky-600: #079bd9;
  --teal-500: #16b9a3;
  --ink-950: #172033;
  --ink-700: #4e5b70;
  --ink-500: #8490a2;
  --surface: #ffffff;
  --line: #e4e9f1;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--navy-950);
}

body {
  margin: 0;
  color: var(--ink-950);
  background: var(--navy-950);
  font-family: Tahoma, Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.site-shell {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 76% 28%, rgba(44, 73, 117, 0.18), transparent 31rem),
    linear-gradient(145deg, var(--navy-950) 0%, #0c1627 60%, #0b1526 100%);
}

.topbar {
  position: relative;
  z-index: 3;
  width: min(1240px, calc(100% - 48px));
  min-height: 74px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-mark {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: #5ee0c3;
  border: 1px solid rgba(94, 224, 195, 0.3);
  border-radius: 12px 4px 12px 4px;
  background: rgba(22, 185, 163, 0.08);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-copy,
.assistant-copy,
.model-note-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  font-size: 0.82rem;
}

.brand-copy small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.66rem;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  font-size: 0.78rem;
}

.topbar-divider {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.16);
}

.model-pill {
  justify-self: end;
  min-height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #213047;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 9px 30px rgba(0, 0, 0, 0.12);
  font-size: 0.77rem;
  font-weight: 700;
}

.model-pill > span {
  color: var(--sky-500);
}

.content-grid {
  position: relative;
  z-index: 2;
  width: min(1190px, calc(100% - 48px));
  min-height: calc(100svh - 74px);
  margin: 0 auto;
  padding: 42px 0 50px;
  display: grid;
  direction: ltr;
  grid-template-columns: minmax(500px, 570px) minmax(360px, 1fr);
  gap: clamp(70px, 9vw, 135px);
  align-items: center;
}

.brand-panel {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  padding-bottom: 25px;
  color: #fff;
  direction: rtl;
}

.eyebrow {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.eyebrow > span {
  width: 26px;
  height: 2px;
  background: var(--teal-500);
}

.brand-panel h1 {
  max-width: 540px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.55rem, 4.4vw, 4.65rem);
  font-weight: 800;
  line-height: 1.23;
  letter-spacing: -0.055em;
}

.brand-panel > p {
  max-width: 510px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  line-height: 2;
}

.model-note {
  width: fit-content;
  margin-top: 31px;
  padding: 11px 14px 11px 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.model-note-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #62d7f9;
  border-radius: 8px;
  background: rgba(24, 174, 234, 0.1);
}

.model-note small {
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.67rem;
}

.model-note strong {
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 600;
}

.chat-card {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  min-width: 0;
  height: min(680px, calc(100svh - 126px));
  min-height: 570px;
  display: grid;
  direction: rtl;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(0, 6, 20, 0.3);
}

.chat-header {
  min-height: 77px;
  padding: 14px 18px 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.assistant-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.assistant-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 11px;
  background: linear-gradient(145deg, #20b8ea, #079bd9);
  box-shadow: 0 7px 18px rgba(7, 155, 217, 0.22);
}

.assistant-copy strong {
  color: #233047;
  font-size: 0.88rem;
}

.connection-state {
  margin-top: 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  color: var(--ink-500);
  font-size: 0.66rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(132, 144, 162, 0.12);
}

.connection-state.is-ready {
  color: #159070;
}

.connection-state.is-ready .status-dot {
  box-shadow: 0 0 0 3px rgba(21, 144, 112, 0.12);
}

.connection-state.is-error {
  color: #b87812;
}

.connection-state.is-checking .status-dot {
  animation: pulse 1.15s infinite ease-in-out;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #8a95a8;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.2rem;
  transition: 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: #536177;
  background: #f1f4f8;
  outline: none;
}

.message-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 23px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background:
    linear-gradient(rgba(248, 250, 253, 0.93), rgba(248, 250, 253, 0.93)),
    radial-gradient(circle at center, #d5ddea 1px, transparent 1px);
  background-size: auto, 18px 18px;
  scrollbar-color: #ccd4df transparent;
  scrollbar-width: thin;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: message-in 220ms ease-out both;
}

.message-row.is-user {
  flex-direction: row-reverse;
}

.message-avatar {
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: #688097;
  border: 1px solid #dfe5ed;
  border-radius: 8px;
  background: #fff;
  font-size: 0.72rem;
}

.message-row.is-user .message-avatar {
  color: #fff;
  border-color: var(--sky-500);
  background: var(--sky-500);
}

.message-bubble {
  width: fit-content;
  max-width: 82%;
  padding: 11px 13px;
  color: #455267;
  border: 1px solid #e0e6ee;
  border-radius: 4px 13px 13px 13px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(30, 53, 82, 0.035);
  font-size: 0.79rem;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.is-user .message-bubble {
  color: #fff;
  border-color: #0aa6e3;
  border-radius: 13px 4px 13px 13px;
  background: linear-gradient(145deg, #22b6eb, #0a9fdc);
}

.suggestion-list {
  margin: 0 37px 3px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggestion-list button {
  min-height: 33px;
  height: auto;
  padding: 7px 10px;
  color: #607088;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.68rem;
  font-weight: 500;
  white-space: normal;
  transition: 160ms ease;
}

.suggestion-list button:hover,
.suggestion-list button:focus-visible {
  color: #087eb0;
  border-color: #9ed9f0;
  background: #f2fbff;
  outline: none;
}

.typing-bubble {
  min-width: 57px;
  height: 37px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #e0e6ee;
  border-radius: 4px 13px 13px 13px;
  background: #fff;
}

.typing-bubble > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #88a1b8;
  animation: typing 1.1s infinite ease-in-out;
}

.typing-bubble > span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-bubble > span:nth-child(3) {
  animation-delay: 240ms;
}

.composer-wrap {
  padding: 12px 15px 10px;
  border-top: 1px solid #edf0f4;
  background: #fff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: end;
}

.composer textarea {
  field-sizing: content;
  min-height: 46px;
  max-height: 110px;
  resize: none;
  padding: 12px 13px;
  color: #344258;
  border: 1px solid #dbe2eb;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: none;
  font-size: 0.76rem;
  line-height: 1.75;
  outline: none;
}

.composer textarea::placeholder {
  color: #a0a9b8;
}

.composer textarea:focus {
  border-color: #63c9ef;
  box-shadow: 0 0 0 3px rgba(24, 174, 234, 0.11);
}

.send-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, #20b7eb, #0699d7);
  box-shadow: 0 7px 16px rgba(7, 155, 217, 0.2);
  transition: 160ms ease;
}

.send-button:hover:not(:disabled),
.send-button:focus-visible {
  background: linear-gradient(145deg, #12aae0, #068cca);
  outline: none;
}

.send-icon {
  display: block;
  transform: scaleX(-1);
  font-size: 1.05rem;
}

.loading-ring {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.send-button.is-loading .send-icon {
  display: none;
}

.send-button.is-loading .loading-ring {
  display: block;
}

.composer-hint {
  margin: 7px 2px 0;
  color: #a0a8b5;
  font-size: 0.59rem;
  text-align: right;
}

.error-message {
  margin-bottom: 9px;
  padding: 8px 9px;
  color: #a64a33;
  border: 1px solid #f2d2c8;
  border-radius: 7px;
  background: #fff7f4;
  font-size: 0.67rem;
  line-height: 1.7;
}

.chat-footer {
  min-height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: #929cab;
  border-top: 1px solid #edf0f4;
  background: #f8f9fb;
  font-size: 0.62rem;
}

.barcode {
  width: 34px;
  height: 23px;
  opacity: 0.5;
  background: repeating-linear-gradient(
    90deg,
    #536174 0 2px,
    transparent 2px 4px,
    #536174 4px 5px,
    transparent 5px 8px
  );
}

.dot-pattern {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  opacity: 0.48;
  background-image: radial-gradient(circle, #354769 2.1px, transparent 2.3px);
  background-size: 14px 14px;
}

.pattern-one {
  left: 2.8%;
  bottom: 4.5%;
  width: 245px;
  height: 165px;
}

.pattern-two {
  right: 3.8%;
  top: 18%;
  width: 105px;
  height: 105px;
  opacity: 0.18;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@keyframes typing {
  0%,
  65%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  32% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .site-shell {
    overflow: visible;
  }

  .content-grid {
    min-height: auto;
    padding: 36px 0 58px;
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .brand-panel,
  .chat-card {
    grid-column: 1;
  }

  .brand-panel {
    grid-row: 1;
    padding: 12px 3vw 0;
    text-align: center;
  }

  .chat-card {
    grid-row: 2;
    width: min(610px, 100%);
    height: 680px;
    max-height: none;
    margin: 0 auto;
  }

  .eyebrow,
  .model-note {
    margin-right: auto;
    margin-left: auto;
  }

  .brand-panel h1,
  .brand-panel > p {
    margin-right: auto;
    margin-left: auto;
  }

  .brand-panel h1 {
    font-size: clamp(2.45rem, 8vw, 4.2rem);
  }

  .pattern-two {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    width: calc(100% - 28px);
    min-height: 66px;
    grid-template-columns: 1fr auto;
  }

  .topbar-meta {
    display: none;
  }

  .model-pill {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.68rem;
  }

  .brand-icon {
    width: 35px;
    height: 35px;
  }

  .brand-copy small {
    display: none;
  }

  .content-grid {
    width: calc(100% - 24px);
    padding-top: 24px;
    gap: 25px;
  }

  .brand-panel {
    padding-inline: 4px;
  }

  .brand-panel h1 {
    font-size: clamp(2rem, 10vw, 2.75rem);
    letter-spacing: -0.045em;
  }

  .brand-panel > p {
    margin-top: 14px;
    font-size: 0.82rem;
    line-height: 1.9;
  }

  .eyebrow {
    margin-bottom: 14px;
    font-size: 0.7rem;
  }

  .model-note {
    margin-top: 20px;
  }

  .chat-card {
    height: min(690px, calc(100svh - 32px));
    min-height: 570px;
    border-radius: 10px;
  }

  .chat-header {
    min-height: 70px;
    padding-inline: 14px;
  }

  .assistant-avatar {
    width: 40px;
    height: 40px;
  }

  .message-list {
    padding: 18px 12px 14px;
  }

  .message-bubble {
    max-width: 86%;
    font-size: 0.75rem;
  }

  .suggestion-list {
    margin-right: 36px;
    flex-direction: column;
    align-items: flex-start;
  }

  .composer-wrap {
    padding-inline: 11px;
  }

  .composer-hint {
    display: none;
  }

  .chat-footer {
    padding-inline: 13px;
  }

  .dot-pattern {
    opacity: 0.26;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
