    :root {
      color-scheme: light;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--ink);
      background: var(--root-background);
      font-synthesis: none;
      text-rendering: optimizeLegibility;

      --ink: #292929;
      --muted: #777777;
      --root-background: #f1f1f1;
      --page-background: #eef3f1;
      --mobile-background: #fff;
      --card-background: #fff;
      --card-border: rgba(207, 221, 216, .9);
      --assistant-message-ink: #2c3a38;
      --code-background: #e9f0ed;
      --table-border: #dce6e2;
      --reference-background: #fff;
      --composer-background: #fff;
      --input-background: #f9fbfa;
      --input-border: #dbe5e1;
      --input-focus-background: #fff;
      --placeholder: #87938f;
      --scrollbar-thumb: #cbd9d4;
      --dialog-background: #fff;
      --disclaimer-ink: #40504c;
      --button-background: #fff;
      --warning-color: #8a5a12;
      --danger-color: #9a3028;
      --security-color: #9a4b37;

      --primary: #666666;
      --primary-rgb: 102, 102, 102;
      --primary-dark: #4a4a4a;
      --primary-light: #c9c9c9;
      --primary-soft: #eeeeee;
      --primary-foreground: #fff;

      --accent: #858585;
      --accent-rgb: 133, 133, 133;
      --accent-dark: #626262;
      --accent-light: #d6d6d6;
      --accent-soft: #e9e9e9;

      --line: #e2e2e2;
      --soft: #f8f8f8;
    }

    :root.dark-mode {
      color-scheme: dark;
      --ink: #edf3f1;
      --muted: #a8b6b0;
      --root-background: #101513;
      --page-background: #101513;
      --mobile-background: #101513;
      --card-background: #181f1d;
      --card-border: #303c37;
      --line: #33413b;
      --soft: #222c28;
      --assistant-message-ink: #e1eae6;
      --code-background: #2a3530;
      --table-border: #3a4942;
      --reference-background: #202a26;
      --composer-background: #181f1d;
      --input-background: #202a26;
      --input-border: #3b4b44;
      --input-focus-background: #26332e;
      --placeholder: #a0aea8;
      --scrollbar-thumb: #4a5a52;
      --dialog-background: #1b2420;
      --disclaimer-ink: #d0dbd6;
      --button-background: #202a26;
      --warning-color: #e8b65d;
      --danger-color: #ff9b8f;
      --security-color: #f0a18e;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      width: 100%;
      max-width: 100%;
      overflow-x: hidden;
    }

    body {
      min-height: 100vh;
      min-height: 100svh;
      min-width: 0;
      margin: 0;
      padding: 24px;
      -webkit-text-size-adjust: 100%;
      background:
        radial-gradient(ellipse at 15% 0%, rgba(var(--primary-rgb), .12), transparent 34rem),
        var(--page-background);
    }

    button,
    input,
    select {
      font: inherit;
    }

    button,
    select {
      -webkit-tap-highlight-color: transparent;
    }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible {
      outline: 3px solid rgba(var(--primary-rgb), .3);
      outline-offset: 2px;
    }

    .app-shell {
      width: min(100%, 880px);
      max-width: 100%;
      height: min(820px, calc(var(--keyboard-viewport-height, 100svh) - 48px));
      min-height: 540px;
      margin: 0 auto;
    }

    .chat-card {
      position: relative;
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      overflow: hidden;
      border: 1px solid var(--card-border);
      border-radius: 24px;
      background: var(--card-background);
      box-shadow: 0 24px 70px rgba(35, 65, 58, .12), 0 3px 10px rgba(35, 65, 58, .04);
    }

    .chat-content {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      min-height: 0;
      transition: filter .2s ease;
    }

    .chat-card.disclaimer-active .chat-content {
      filter: blur(4px);
    }

    .topbar {
      display: flex;
      align-items: center;
      gap: 16px;
      min-height: 68px;
      padding: 12px 22px;
      border-bottom: 1px solid var(--line);
    }

    .identity {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      margin-right: auto;
    }

    .brand-mark {
      display: grid;
      flex: 0 0 42px;
      width: 42px;
      height: 42px;
      place-items: center;
      border-radius: 14px;
      color: var(--primary-foreground);
      background: linear-gradient(145deg, var(--primary), var(--primary-dark));
      box-shadow: 0 5px 12px rgba(var(--primary-rgb), .2);
    }

    .brand-mark svg {
      width: 23px;
      height: 23px;
    }

    .identity-copy {
      min-width: 0;
    }

    .brand-name {
      display: block;
      overflow: hidden;
      color: var(--ink);
      font-size: 14px;
      font-weight: 720;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .brand-caption {
      display: block;
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    button:disabled,
    select:disabled {
      cursor: not-allowed;
      opacity: .55;
    }

    .welcome-panel {
      padding: 28px 30px 20px;
    }

    .welcome-panel h1 {
      margin: 0;
      color: var(--ink);
      font-size: clamp(23px, 4vw, 30px);
      font-weight: 720;
      letter-spacing: -.045em;
      line-height: 1.2;
    }

    .welcome-panel p {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.55;
    }

    #messages {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      gap: 16px;
      min-height: 0;
      overflow-y: auto;
      padding: 10px 30px 24px;
      overscroll-behavior: contain;
      scrollbar-color: var(--scrollbar-thumb) transparent;
      scrollbar-width: thin;
      scroll-behavior: smooth;
    }

    .message {
      max-width: min(82%, 650px);
      padding: 13px 16px;
      border: 1px solid var(--line);
      border-radius: 5px 18px 18px 18px;
      background: var(--soft);
      color: var(--assistant-message-ink);
      font-size: 14px;
      line-height: 1.65;
      overflow-wrap: anywhere;
      animation: arrive .2s ease-out both;
    }

    .message.user {
      align-self: flex-end;
      border-color: var(--primary);
      border-radius: 18px 5px 18px 18px;
      background: var(--primary);
      color: var(--primary-foreground);
    }

    .message.assistant {
      align-self: flex-start;
    }

    .message.thinking {
      border-color: transparent;
      color: var(--muted);
      background:
        linear-gradient(var(--soft), var(--soft)) padding-box,
        linear-gradient(110deg, var(--primary), var(--accent), #72a8ff, #c785f5, #ff91c8, var(--primary)) border-box;
      background-size: 100% 100%, 300% 100%;
      background-position: 0 0, 0 0;
      box-shadow: 0 0 0 1px rgba(76, 177, 239, .12), 0 0 16px rgba(112, 139, 255, .22);
      animation: arrive .2s ease-out both, thinking-shine 3.2s linear infinite;
    }

    .answer-content> :first-child {
      margin-top: 0;
    }

    .answer-content> :last-child {
      margin-bottom: 0;
    }

    .answer-content p {
      margin: .65em 0;
    }

    .answer-content h1,
    .answer-content h2,
    .answer-content h3,
    .answer-content h4,
    .answer-content h5,
    .answer-content h6 {
      margin: 1em 0 .45em;
      color: var(--ink);
      font-size: 1.08em;
      line-height: 1.35;
    }

    .answer-content ul,
    .answer-content ol {
      padding-left: 1.4em;
    }

    .answer-content li+li {
      margin-top: .3em;
    }

    .answer-content a {
      color: var(--accent-dark);
      text-underline-offset: 2px;
    }

    .message.user .answer-content a {
      color: var(--primary-foreground);
    }

    .answer-content pre {
      max-width: 100%;
      overflow: auto;
      padding: 12px;
      border-radius: 10px;
      background: var(--code-background);
      font-size: 12px;
    }

    .answer-content table {
      display: block;
      max-width: 100%;
      overflow-x: auto;
      border-collapse: collapse;
    }

    .answer-content th,
    .answer-content td {
      padding: 6px 9px;
      border: 1px solid var(--table-border);
      text-align: left;
    }

    .reference-links {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 12px;
    }

    .reference-links a {
      padding: 5px 10px;
      border: 1px solid var(--accent-light);
      border-radius: 999px;
      background: var(--reference-background);
      color: var(--accent-dark);
      font-size: 12px;
      line-height: 1.4;
      text-decoration: none;
    }

    .reference-links a:hover {
      background: var(--accent-soft);
    }

    .message.user .reference-links a {
      border-color: rgba(255, 255, 255, .48);
      color: var(--primary-foreground);
      background: rgba(255, 255, 255, .12);
    }

    .composer-area {
      flex: 0 0 auto;
      padding: 16px 16px 5px;
      border-top: 1px solid var(--line);
      background: var(--composer-background);
    }

    #chat-form {
      display: flex;
      align-items: stretch;
      gap: 8px;
    }

    .question-input-wrap {
      padding: 2px 6px;
      border: 1px solid var(--input-border);
      border-radius: 25px;
      background: var(--input-background);
      transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
    }

    .question-input-wrap:focus-within {
      border-color: var(--primary-light);
      background: var(--input-focus-background);
      box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
    }
    .question-input-wrap:focus-within #question { background: transparent; }

    .dark-mode .answer-content a,
    .dark-mode .reference-links a {
      color: var(--accent-light);
    }

    .dark-mode .reference-links a:hover {
      background: var(--soft);
    }

    .dark-mode #reset:hover:not(:disabled),
    .dark-mode #download-chat:hover:not(:disabled),
    .dark-mode #report-chat:hover:not(:disabled) {
      background: var(--soft);
      color: var(--ink);
    }

    .dark-mode #report-feedback {
      color: var(--primary-light);
    }

    .composer-entry {
      position: relative;
      display: flex;
      align-items: center;
      flex: 1 1 auto;
      gap: 10px;
      min-width: 0;
    }

    .question-input-wrap {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      justify-content: center;
      min-width: 0;
      min-height: 54px;
    }

    #question {
      display: block;
      width: 100%;
      min-width: 0;
      min-height: 48px;
      max-height: 144px;
      padding: 13px 5px;
      border: 0;
      outline: 0;
      background: transparent;
      color: var(--ink);
      font-size: 14px;
      line-height: 22px;
      overflow-x: hidden;
      overflow-y: hidden;
      resize: none;
      overflow-wrap: anywhere;
      font-family: inherit;
    }

    #question::placeholder {
      color: var(--placeholder);
    }

    #question:focus-visible {
      outline: 0;
    }
    #question-count {
      align-self: flex-end;
      padding: 0 5px 2px;
      font-variant-numeric: tabular-nums;
      color: var(--muted);
      font-size: 9px;
      line-height: 1;
      pointer-events: none;
      transition: color .16s ease, background .16s ease;
    }
    #question-count[hidden] { display: none; }
    #question-count.near-limit { color: var(--warning-color); }
    #question-count.at-limit { color: var(--danger-color); }

    #send {
      display: inline-flex;
      flex: 0 0 auto;
      align-items: center;
      justify-content: center;
      width: 50px;
      height: 50px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: var(--primary);
      color: var(--primary-foreground);
      cursor: pointer;
      box-shadow: 0 2px 5px rgba(var(--primary-rgb), .2);
      transition: background .16s ease, transform .16s ease;
    }

    #send:hover:not(:disabled) {
      background: var(--primary-dark);
      transform: translateY(-1px);
    }

    #send:disabled {
      cursor: default;
    }


    button:disabled {
      background: var(--primary-light);
      cursor: default;
    }

    #send svg {
      width: 22px;
      height: 22px;
    }

    .send-actions {
      position: relative;
      display: flex;
      flex: 0 0 auto;
      align-items: center;
      align-self: center;
      gap: 8px;
    }

    #send-menu-toggle {
      display: inline-flex;
      width: 42px;
      height: 42px;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 1px solid var(--line);
      border-radius: 50%;
      background: var(--button-background);
      color: var(--muted);
      cursor: pointer;
      transition: background .16s ease;
    }

    #send-menu-toggle:hover:not(:disabled) {
      background: var(--primary-soft);
      color: var(--ink);
    }

    #send-menu-toggle:disabled {
      cursor: default;
      opacity: .55;
    }

    #send-menu-toggle svg {
      width: 22px;
      height: 22px;
    }

    #send-menu-toggle:focus-visible,
    #send:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    #send-menu {
      position: absolute;
      z-index: 2;
      right: 0;
      bottom: calc(100% + 8px);
      min-width: 220px;
      padding: 5px;
      border: 1px solid var(--line);
      border-radius: 11px;
      background: var(--card-background);
      box-shadow: 0 8px 24px rgba(28, 48, 42, .15);
    }

    #reset,
    #download-chat,
    #report-chat {
      display: flex;
      width: 100%;
      min-height: 36px;
      align-items: center;
      gap: 8px;
      padding: 0 9px;
      border: 0;
      border-radius: 7px;
      background: transparent;
      color: var(--ink);
      font-size: 12px;
      text-align: left;
      cursor: pointer;
    }

    #reset:hover:not(:disabled),
    #download-chat:hover:not(:disabled),
    #report-chat:hover:not(:disabled) {
      background: var(--primary-soft);
      color: var(--primary-dark);
    }

    #reset:disabled,
    #download-chat:disabled,
    #report-chat:disabled {
      opacity: .55;
      cursor: default;
      background: transparent;
    }

    #reset svg,
    #download-chat svg,
    #report-chat svg {
      width: 15px;
      height: 15px;
    }

    #send-menu button:disabled {
      background-color: transparent;
    }

    .security-check {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 0;
      padding: 8px 4px 0;
    }

    #turnstile-widget {
      max-width: 100%;
    }

    #turnstile-widget iframe {
      max-width: 100%;
    }

    #security-status:empty {
      display: none;
    }

    #security-status {
      color: var(--security-color);
      font-size: 12px;
    }

    #turnstile-widget:empty {
      display: none;
    }

    .disclaimer-overlay {
      position: absolute;
      z-index: 10;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 24px;
      background: rgba(18, 32, 29, .24);
    }

    .disclaimer-dialog {
      width: min(100%, 560px);
      max-height: calc(100% - 16px);
      overflow-y: auto;
      padding: 28px;
      border: 1px solid var(--line);
      border-radius: 20px;
      background: var(--dialog-background);
      box-shadow: 0 18px 54px rgba(10, 25, 22, .28);
    }

    #report-dialog {
      width: min(calc(100% - 32px), 520px);
      max-height: calc(100% - 32px);
      padding: 26px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: var(--dialog-background);
      color: var(--ink);
      box-shadow: 0 18px 54px rgba(10, 25, 22, .28);
    }

    #report-dialog::backdrop {
      background: rgba(18, 32, 29, .42);
    }

    #report-dialog h2 {
      margin: 0 0 10px;
      font-size: 21px;
    }

    #report-description {
      margin: 0 0 18px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
    }

    #report-field-label {
      display: block;
      margin-bottom: 6px;
      font-size: 13px;
      font-weight: 650;
    }

    #report-details {
      display: block;
      width: 100%;
      min-height: 120px;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 9px;
      background: var(--input-background);
      color: var(--ink);
      font: inherit;
      font-size: 14px;
      resize: vertical;
    }

    #report-error {
      margin: 10px 0 0;
      color: var(--danger-color);
      font-size: 13px;
    }

    #report-error:empty,
    #report-feedback:empty {
      display: none;
    }

    .report-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 18px;
    }

    .report-actions button {
      min-height: 40px;
      padding: 0 14px;
      border: 1px solid var(--line);
      border-radius: 9px;
      background: var(--button-background);
      color: var(--ink);
      font: inherit;
      font-size: 13px;
      cursor: pointer;
    }

    .report-actions #report-submit {
      border-color: var(--primary);
      background: var(--primary);
      color: var(--primary-foreground);
      font-weight: 650;
    }

    .report-actions button:disabled {
      cursor: not-allowed;
      opacity: .55;
    }

    #report-feedback {
      padding: 5px 4px 0;
      color: var(--primary-dark);
      font-size: 12px;
    }

    .disclaimer-dialog h2 {
      margin: 0 0 14px;
      color: var(--ink);
      font-size: 22px;
      line-height: 1.3;
    }

    #disclaimer-copy {
      margin: 0;
      color: var(--disclaimer-ink);
      font-size: 14px;
      line-height: 1.7;
      white-space: pre-line;
    }

    #disclaimer-error {
      margin: 12px 0 0;
      color: var(--danger-color);
      font-size: 13px;
    }

    #disclaimer-error:empty {
      display: none;
    }

    #disclaimer-accept {
      display: block;
      width: 100%;
      min-height: 46px;
      margin-top: 22px;
      padding: 10px 16px;
      border: 0;
      border-radius: 11px;
      background: var(--primary);
      color: var(--primary-foreground);
      font-size: 14px;
      font-weight: 650;
      cursor: pointer;
    }

    #disclaimer-accept:hover {
      background: var(--primary-dark);
    }

    #security-retry {
      padding: 5px 9px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--button-background);
      color: var(--accent-dark);
      font-size: 12px;
      cursor: pointer;
    }

    [hidden] {
      display: none !important;
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      clip-path: inset(50%);
    }

    @keyframes arrive {
      from {
        opacity: 0;
        transform: translateY(5px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .thinking-dots {
      display: inline-flex;
      gap: 4px;
      margin-left: 8px;
      vertical-align: middle;
    }

    .thinking-dots span {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #91a7a0;
      animation: pulse 1s infinite ease-in-out;
    }

    .thinking-dots span:nth-child(2) {
      animation-delay: .15s;
    }

    .thinking-dots span:nth-child(3) {
      animation-delay: .3s;
    }

    @keyframes pulse {

      0%,
      60%,
      100% {
        opacity: .35;
        transform: translateY(0);
      }

      30% {
        opacity: 1;
        transform: translateY(-3px);
      }
    }

    @keyframes thinking-shine {
      from {
        background-position: 0 0, 0% 0;
      }

      to {
        background-position: 0 0, 100% 0;
      }
    }

    body.embedded {
      padding: 0;
      background: white;
    }

    body.embedded .app-shell {
      width: 100%;
      height: var(--keyboard-viewport-height, 100svh);
      min-height: 0;
    }

    body.embedded .chat-card {
      box-shadow: none;
    }

    @media (max-width: 600px) {
      body {
        padding: 0;
        background: var(--mobile-background);
      }

      .app-shell {
        width: 100%;
        height: var(--keyboard-viewport-height, 100svh);
        min-height: 0;
      }

      .chat-card {
        border: 0;
        border-radius: 0;
        box-shadow: none;
      }

      .topbar {
        min-height: 62px;
        gap: 8px;
        padding: 10px 14px;
      }

      .brand-mark {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
        border-radius: 12px;
      }

      .identity {
        gap: 9px;
      }

      .brand-caption {
        font-size: 11px;
      }

      .welcome-panel {
        padding: 22px 18px 14px;
      }

      .welcome-panel p {
        font-size: 13px;
      }

      #messages {
        gap: 12px;
        padding: 8px 16px 18px;
      }

      .message {
        max-width: 92%;
        padding: 11px 13px;
        font-size: 13px;
      }

      .composer-area {
        padding: 3px 8px max(6px, env(safe-area-inset-bottom));
      }

      #chat-form {
        gap: 6px;
      }

      .question-input-wrap {
        padding: 2px 4px;
        border-radius: 12px;
      }

      #question {
        min-height: 48px;
        max-height: 132px;
        padding: 7px 4px;
        font-size: 13px;
      }
      #question-count { padding-right: 4px; }

      #send { width: 48px; height: 48px; }
      #send-menu-toggle { width: 40px; height: 40px; }

      .disclaimer-dialog {
        padding: 22px;
        border-radius: 16px;
      }
    }

    @media (max-width: 370px) {
      .brand-mark {
        display: none;
      }
    }

    @media (max-height: 620px) and (min-width: 601px) {
      body {
        padding-top: 12px;
        padding-bottom: 12px;
      }

      .app-shell {
        height: calc(100svh - 24px);
        min-height: 0;
      }

      .welcome-panel {
        padding-top: 18px;
        padding-bottom: 12px;
      }
    }

    @media (prefers-reduced-motion: reduce) {

      *,
      *::before,
      *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
    }

    @media (max-width: 900px), (pointer: coarse) {
      input,
      select,
      textarea {
        font-size: 16px !important;
      }

      #question,
      #report-details {
        font-size: 16px !important;
      }
    }