      :root {
        color-scheme: light;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
        color: #18212f;
        background: #f7f8fa;
        font-size: 18px;
      }

      * {
        box-sizing: border-box;
      }

      html {
        min-height: 100%;
        scroll-behavior: smooth;
      }

      body {
        min-height: 100dvh;
        margin: 0;
        background: #f7f8fa;
      }

      button,
      input,
      textarea {
        font: inherit;
      }

      button {
        min-height: 44px;
        border: 0;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 650;
      }

      button:disabled {
        cursor: not-allowed;
        opacity: 0.58;
      }

      .page {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
      }

      .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        border-bottom: 1px solid #e2e5e9;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(14px);
      }

      .topbar-inner {
        width: min(920px, calc(100vw - 32px));
        margin: 0 auto;
        padding: 14px 0;
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .history-menu-button {
        min-width: 44px;
        width: 44px;
        height: 44px;
        padding: 0;
        display: grid;
        place-items: center;
        color: #18212f;
        background: #eef2f6;
      }

      .brand-mark {
        width: 34px;
        height: 34px;
        flex: 0 0 auto;
        border-radius: 8px;
        display: grid;
        place-items: center;
        color: #ffffff;
        background: #0f766e;
      }

      .topbar h1 {
        margin: 0;
        color: #111827;
        font-size: 18px;
        line-height: 1.3;
        letter-spacing: 0;
      }

      .login-shell,
      .chat-shell,
      .composer-inner {
        width: min(920px, calc(100vw - 32px));
        margin: 0 auto;
      }

      .login-shell {
        flex: 1;
        display: grid;
        align-items: center;
        padding: 42px 0;
      }

      .login-panel {
        max-width: 520px;
        margin: 0 auto;
        padding: clamp(24px, 6vw, 40px);
        border: 1px solid #e2e5e9;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
      }

      .login-panel h2 {
        margin: 0 0 10px;
        font-size: 26px;
        line-height: 1.25;
        letter-spacing: 0;
      }

      .login-panel p,
      .hint,
      .footer {
        color: #596579;
        line-height: 1.7;
      }

      .login-row {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 10px;
        margin-top: 24px;
      }

      .passcode-input {
        width: 100%;
        min-height: 52px;
        border: 1px solid #ccd3dc;
        border-radius: 8px;
        padding: 12px 14px;
        color: #111827;
        background: #ffffff;
      }

      .primary-button {
        padding: 0 20px;
        color: #ffffff;
        background: #111827;
      }

      .primary-button:hover {
        background: #263244;
      }

      .chat-shell {
        flex: 1;
        display: none;
        flex-direction: column;
        padding: 28px 0 0;
      }

      .history-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        display: none;
        background: rgba(17, 24, 39, 0.38);
      }

      .history-backdrop.open {
        display: block;
      }

      .history-drawer {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        width: min(86vw, 360px);
        min-height: 100dvh;
        padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        gap: 14px;
        border-right: 1px solid #d7dde5;
        background: #ffffff;
        box-shadow: 18px 0 40px rgba(17, 24, 39, 0.16);
        transform: translateX(-105%);
        transition: transform 180ms ease;
      }

      .history-drawer.open {
        transform: translateX(0);
      }

      .history-search {
        width: 100%;
        min-height: 50px;
        border: 1px solid #ccd3dc;
        border-radius: 8px;
        padding: 11px 13px;
        color: #111827;
        background: #ffffff;
      }

      .new-chat-button {
        width: 100%;
        min-height: 52px;
        color: #ffffff;
        background: #111827;
      }

      .history-list {
        min-height: 0;
        display: flex;
        flex: 1;
        flex-direction: column;
        gap: 8px;
        overflow-y: auto;
        padding-right: 2px;
      }

      .history-item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 6px;
        align-items: stretch;
      }

      .history-select {
        min-width: 0;
        min-height: 62px;
        border: 1px solid transparent;
        border-radius: 8px;
        padding: 8px 10px;
        text-align: left;
        color: #18212f;
        background: #f4f6f9;
        font-weight: 500;
      }

      .history-item.active .history-select {
        border-color: #0f766e;
        background: #e6f4f1;
      }

      .history-title,
      .history-meta,
      .history-snippet {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .history-title {
        color: #111827;
        font-size: 15px;
        font-weight: 750;
      }

      .history-meta,
      .history-snippet,
      .history-empty {
        color: #667085;
        font-size: 13px;
        line-height: 1.45;
      }

      .history-delete {
        min-width: 44px;
        width: 44px;
        min-height: 44px;
        height: 100%;
        padding: 0;
        display: grid;
        place-items: center;
        color: #667085;
        background: #f4f6f9;
      }

      .history-delete:hover {
        color: #b42318;
        background: #fdeceb;
      }

      .history-empty {
        padding: 12px 4px;
      }

      .messages {
        display: flex;
        flex-direction: column;
        gap: 26px;
        padding-bottom: 20px;
      }

      .message {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        column-gap: 14px;
        row-gap: 0;
        align-items: start;
      }

      .message.user {
        grid-template-columns: minmax(0, 1fr);
        justify-items: end;
      }

      .avatar {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: grid;
        place-items: center;
        color: #ffffff;
        background: #0f766e;
        font-size: 15px;
        font-weight: 800;
      }

      .bubble {
        min-width: 0;
        max-width: 100%;
        line-height: 1.75;
        overflow-wrap: anywhere;
      }

      .user .bubble {
        width: fit-content;
        max-width: min(720px, 88vw);
        padding: 12px 15px;
        border-radius: 8px;
        color: #111827;
        background: #e9eef5;
      }

      .assistant .bubble {
        color: #18212f;
      }

      .message-actions {
        grid-column: 2;
        display: flex;
        gap: 6px;
        margin-top: 6px;
      }

      .message-actions button {
        min-width: 28px;
        width: 28px;
        min-height: 28px;
        height: 28px;
        padding: 0;
        display: grid;
        place-items: center;
        border: 1px solid #d7dde5;
        border-radius: 8px;
        color: #667085;
        background: rgba(255, 255, 255, 0.78);
        opacity: 0.58;
        cursor: pointer;
        transition: background 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
      }

      .message-actions button svg {
        width: 16px;
        height: 16px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .message:hover .message-actions button,
      .message-actions button:focus-visible,
      .message-actions button.copied,
      .message-actions button.speaking,
      .message-actions button.selected {
        opacity: 1;
      }

      .message-actions button:hover,
      .message-actions button:focus-visible {
        color: #0f766e;
        border-color: #b7d8d3;
        background: #e6f4f1;
      }

      .copy-button.copied,
      .speak-button.speaking,
      .feedback-buttons button.selected {
        color: #ffffff;
        border-color: #0f766e;
        background: #0f766e;
      }

      .feedback-buttons {
        display: inline-flex;
        gap: 6px;
      }

      .regen-button {
        display: none;
      }

      .message.assistant:last-of-type .regen-button {
        display: grid;
      }

      @media (hover: none) {
        .message-actions button {
          opacity: 1;
          /* 触屏(尤其中老年)加大触控目标 */
          min-width: 38px;
          width: 38px;
          min-height: 38px;
          height: 38px;
        }

        .message-actions button svg {
          width: 19px;
          height: 19px;
        }

        .jump-to-bottom {
          width: 46px;
          height: 46px;
          bottom: calc(150px + env(safe-area-inset-bottom, 0px));
        }
      }

      .jump-to-bottom {
        position: fixed;
        right: 18px;
        bottom: 132px;
        z-index: 40;
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        border: 1px solid #d7dde5;
        border-radius: 50%;
        color: #0f766e;
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
        cursor: pointer;
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity 180ms ease, transform 180ms ease;
      }

      .jump-to-bottom.visible {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
      }

      .font-size-button {
        margin-left: auto;
        min-width: 40px;
        height: 32px;
        padding: 0 10px;
        border: 1px solid rgba(255, 255, 255, 0.45);
        border-radius: 8px;
        color: #ffffff;
        background: rgba(255, 255, 255, 0.12);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
      }

      .font-size-button:hover {
        background: rgba(255, 255, 255, 0.22);
      }

      body.font-large .bubble,
      body.font-large .message-text,
      body.font-large .message-input {
        font-size: 17.5px;
      }

      body.font-xlarge .bubble,
      body.font-xlarge .message-text,
      body.font-xlarge .message-input {
        font-size: 19.5px;
      }

      .markdown .katex-display {
        margin: 10px 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 0;
      }

      .send-button.stop-mode {
        background: #b91c1c;
      }

      .send-button.stop-mode:hover {
        background: #991b1b;
      }

      .message-text {
        white-space: pre-wrap;
      }

      .markdown h1,
      .markdown h2,
      .markdown h3 {
        margin: 1.1em 0 0.45em;
        line-height: 1.35;
        letter-spacing: 0;
      }

      .markdown h1 {
        font-size: 1.55rem;
      }

      .markdown h2 {
        font-size: 1.32rem;
      }

      .markdown h3 {
        font-size: 1.12rem;
      }

      .markdown p,
      .markdown ul,
      .markdown ol,
      .markdown blockquote,
      .markdown pre,
      .markdown table {
        margin: 0 0 0.9em;
      }

      .markdown > :first-child {
        margin-top: 0;
      }

      .markdown > :last-child {
        margin-bottom: 0;
      }

      .markdown ul,
      .markdown ol {
        padding-left: 1.35em;
      }

      .markdown li + li {
        margin-top: 0.25em;
      }

      .markdown blockquote {
        padding: 0.1em 0 0.1em 1em;
        border-left: 4px solid #c7d2df;
        color: #4b5563;
      }

      .markdown a {
        color: #0f766e;
        text-decoration-thickness: 1px;
        text-underline-offset: 3px;
      }

      .markdown table {
        width: 100%;
        border-collapse: collapse;
        display: block;
        overflow-x: auto;
      }

      .markdown th,
      .markdown td {
        padding: 9px 11px;
        border: 1px solid #d7dde5;
        text-align: left;
        vertical-align: top;
      }

      .markdown th {
        background: #eef2f6;
        font-weight: 750;
      }

      .markdown code {
        border-radius: 6px;
        padding: 0.1em 0.28em;
        background: #eef2f6;
        font-size: 0.92em;
      }

      .markdown pre {
        overflow-x: auto;
        padding: 14px;
        border: 1px solid #d7dde5;
        border-radius: 8px;
        background: #f6f8fa;
      }

      .markdown pre code {
        padding: 0;
        background: transparent;
        font-size: 0.9rem;
        line-height: 1.6;
      }

      .mermaid-box {
        margin: 0 0 0.9em;
        overflow-x: auto;
        padding: 12px;
        border: 1px solid #d7dde5;
        border-radius: 8px;
        background: #ffffff;
      }

      .export-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
      }

      .export-preview {
        max-width: min(100%, 720px);
        border: 1px solid #d7dde5;
        border-radius: 8px;
        background: #ffffff;
      }

      .export-button {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: fit-content;
        min-height: 38px;
        padding: 8px 12px;
        border-radius: 8px;
        border: 1px solid rgba(20, 83, 45, 0.25);
        background: #ecfdf5;
        color: #14532d;
        font-weight: 700;
        text-decoration: none;
      }

      .attachment-summary,
      .file-list,
      .preview-strip {
        display: flex;
        gap: 8px;
      }

      .attachment-summary {
        flex-wrap: wrap;
        margin-top: 10px;
      }

      .attachment-pill,
      .file-chip {
        max-width: 100%;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        border: 1px solid #ccd3dc;
        border-radius: 8px;
        padding: 6px 9px;
        color: #344054;
        background: #ffffff;
        font-size: 14px;
      }

      .composer-wrap {
        position: sticky;
        bottom: 0;
        z-index: 15;
        margin-top: auto;
        padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid #e2e5e9;
        background: rgba(247, 248, 250, 0.94);
        backdrop-filter: blur(14px);
      }

      .composer-box {
        border: 1px solid #ccd3dc;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 12px 32px rgba(17, 24, 39, 0.08);
      }

      .preview-area {
        display: none;
        gap: 10px;
        padding: 10px 10px 0;
        overflow-x: auto;
      }

      .preview-area.has-items {
        display: flex;
      }

      .image-preview {
        position: relative;
        width: 88px;
        height: 88px;
        flex: 0 0 auto;
        overflow: hidden;
        border: 1px solid #d7dde5;
        border-radius: 8px;
        background: #eef2f6;
      }

      .image-preview img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
      }

      .remove-attachment {
        position: absolute;
        top: 5px;
        right: 5px;
        min-width: 28px;
        min-height: 28px;
        width: 28px;
        height: 28px;
        border-radius: 999px;
        padding: 0;
        color: #ffffff;
        background: rgba(17, 24, 39, 0.82);
      }

      .file-list {
        display: none;
        flex-wrap: wrap;
        padding: 10px 10px 0;
      }

      .file-list.has-items {
        display: flex;
      }

      .file-chip {
        position: relative;
        padding-right: 38px;
      }

      .file-chip .remove-attachment {
        top: 50%;
        right: 5px;
        transform: translateY(-50%);
      }

      .composer-form {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        align-items: end;
        padding: 10px;
      }

      .tool-buttons {
        display: flex;
        gap: 6px;
        align-items: center;
      }

      .icon-button {
        min-width: 44px;
        width: 44px;
        height: 44px;
        padding: 0;
        display: grid;
        place-items: center;
        color: #374151;
        background: #f1f4f8;
      }

      .icon-button:hover {
        background: #e4e9f0;
      }

      .icon-button.recording {
        color: #ffffff;
        background: #b42318;
      }

      .icon-button.transcribing {
        color: #ffffff;
        background: #0f766e;
      }

      .send-button {
        min-width: 48px;
        width: 48px;
        height: 48px;
        padding: 0;
        display: grid;
        place-items: center;
        color: #ffffff;
        background: #111827;
      }

      .message-input {
        width: 100%;
        min-height: 48px;
        max-height: 35dvh;
        border: 0;
        outline: 0;
        resize: none;
        overflow-y: hidden;
        padding: 11px 4px;
        color: #111827;
        background: transparent;
        line-height: 1.55;
      }

      .message-input.scrolling {
        overflow-y: auto;
      }

      .status-row {
        min-height: 26px;
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 2px 0;
        color: #667085;
        font-size: 14px;
        line-height: 1.45;
      }

      .error {
        color: #b42318;
        font-weight: 700;
      }

      .footer {
        padding: 16px 0 22px;
        text-align: center;
        font-size: 14px;
      }

      .hidden {
        display: none !important;
      }

      @media (max-width: 720px) {
        :root {
          font-size: 17px;
        }

        .topbar-inner,
        .login-shell,
        .chat-shell,
        .composer-inner {
          width: min(100vw - 20px, 920px);
        }

        .topbar-inner {
          padding: 11px 0;
        }

        .login-row {
          grid-template-columns: 1fr;
        }

        .chat-shell {
          padding-top: 18px;
        }

        .messages {
          gap: 22px;
        }

        .message {
          grid-template-columns: 32px minmax(0, 1fr);
          column-gap: 10px;
        }

        .avatar {
          width: 32px;
          height: 32px;
          font-size: 13px;
        }

        .user .bubble {
          max-width: 92vw;
        }

        .composer-form {
          grid-template-columns: 1fr auto;
        }

        .tool-buttons {
          grid-column: 1 / -1;
          overflow-x: auto;
          padding-bottom: 2px;
        }

        .message-input {
          padding-left: 2px;
        }

        .status-row {
          padding-inline: 2px;
        }
      }
