:root {
  color-scheme: dark;
  --bg: #080d18;
  --panel: rgba(15, 24, 41, 0.82);
  --panel-solid: #101a2d;
  --line: rgba(155, 180, 211, 0.17);
  --line-strong: rgba(155, 180, 211, 0.32);
  --text: #f2f6fc;
  --muted: #9cabc0;
  --faint: #64728a;
  --cyan: #63e6db;
  --blue: #75a7ff;
  --danger: #ff8c9d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

/* The chat composer is the single interaction surface. The legacy split
   file workspace remains in the DOM only for shared option controls. */
.mode-tabs,
#file-workspace,
#result-panel {
  display: none !important;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% -20%, #172b4b 0, var(--bg) 48rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

button, input { font: inherit; }
button { color: inherit; }

.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }

.background-glow {
  position: fixed;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.11;
  pointer-events: none;
}

.background-glow-left { top: 22rem; left: -20rem; background: var(--cyan); }
.background-glow-right { right: -18rem; bottom: 6rem; background: var(--blue); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0;
  border-bottom: 1px solid rgba(155, 180, 211, 0.1);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(99, 230, 219, 0.42);
  border-radius: 12px;
  color: var(--cyan);
  font-size: 25px;
  line-height: 1;
  transform: rotate(-14deg);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: 0.01em; }
.brand small { margin-top: 4px; color: var(--faint); font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; }

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #e6b76c; box-shadow: 0 0 12px currentColor; }
.service-pill[data-state="ready"] { color: #a2e9d8; border-color: rgba(99, 230, 219, 0.28); }
.service-pill[data-state="ready"] .status-dot { background: var(--cyan); }
.service-pill[data-state="error"] { color: var(--danger); border-color: rgba(255, 140, 157, 0.28); }
.service-pill[data-state="error"] .status-dot { background: var(--danger); }

.hero { max-width: 740px; padding: 92px 0 58px; }
.eyebrow, .section-label { margin: 0 0 15px; color: var(--cyan); font-size: 10px; font-weight: 700; letter-spacing: 0.19em; }
.hero h1 { margin: 0; font-size: clamp(3.2rem, 8vw, 6.8rem); font-weight: 650; letter-spacing: -0.075em; line-height: 0.94; }
.hero h1 em { color: var(--cyan); font-style: normal; }
.hero-copy { max-width: 590px; margin: 29px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }

.mode-tabs { display: flex; gap: 6px; width: fit-content; margin-bottom: 16px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(15, 24, 41, 0.68); }
.mode-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.mode-tab span { color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.mode-tab:hover, .mode-tab:focus-visible { color: var(--text); outline: none; }
.mode-tab.is-active { background: rgba(99, 230, 219, 0.13); color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(99, 230, 219, 0.2); }
.mode-tab.is-active span { color: var(--cyan); }

.workspace { display: grid; grid-template-columns: 1.06fr 0.94fr; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.upload-panel, .action-panel { min-height: 354px; padding: 26px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0; font-size: 22px; font-weight: 580; letter-spacing: -0.04em; }
.section-label { margin-bottom: 9px; color: var(--faint); }
.format-note { max-width: 130px; color: var(--faint); font-size: 10px; letter-spacing: 0.06em; line-height: 1.5; text-align: right; text-transform: uppercase; }

.dropzone {
  display: flex;
  width: 100%;
  min-height: 220px;
  margin-top: 25px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px dashed rgba(99, 230, 219, 0.32);
  border-radius: 15px;
  background: rgba(99, 230, 219, 0.035);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { border-color: var(--cyan); background: rgba(99, 230, 219, 0.09); outline: none; transform: translateY(-1px); }
.upload-icon { display: grid; width: 46px; height: 46px; margin-bottom: 5px; place-items: center; border: 1px solid rgba(99, 230, 219, 0.38); border-radius: 50%; color: var(--cyan); font-size: 24px; }
.dropzone-title { font-size: 15px; font-weight: 600; }
.dropzone-subtitle { color: var(--muted); font-size: 12px; }

.file-card { display: flex; align-items: center; gap: 13px; min-height: 220px; margin-top: 25px; padding: 20px; border: 1px solid rgba(99, 230, 219, 0.25); border-radius: 15px; background: rgba(99, 230, 219, 0.06); }
.file-icon { display: grid; width: 48px; height: 58px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(117, 167, 255, 0.38); border-radius: 8px; color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: 0.06em; }
.file-meta { min-width: 0; }
.file-meta strong, .file-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta strong { max-width: 250px; font-size: 14px; }
.file-meta span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.icon-button { width: 30px; height: 30px; margin-left: auto; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--danger); color: var(--danger); outline: none; }

.actions-grid { display: grid; gap: 12px; margin-top: 25px; }
.action-card { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 17px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.025); text-align: left; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.action-card:hover:not(:disabled), .action-card:focus-visible:not(:disabled) { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); outline: none; transform: translateX(2px); }
.action-card:disabled { cursor: not-allowed; opacity: 0.38; }
.action-card-primary { border-color: rgba(99, 230, 219, 0.37); background: linear-gradient(105deg, rgba(99, 230, 219, 0.12), rgba(117, 167, 255, 0.08)); }
.action-card-primary:hover:not(:disabled), .action-card-primary:focus-visible:not(:disabled) { border-color: var(--cyan); }
.action-card-icon { color: var(--cyan); font-size: 25px; line-height: 1; }
.action-card strong, .action-card small { display: block; }
.action-card strong { font-size: 14px; }
.action-card small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.action-arrow { color: var(--faint); font-size: 18px; }

.options { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 17px; }
.options summary { color: var(--muted); cursor: pointer; font-size: 12px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; padding-top: 15px; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.check-row input { accent-color: var(--cyan); }

.text-workspace { display: block; }
.text-editor-panel { display: flex; min-height: 390px; flex-direction: column; padding: 24px; }
.text-area { width: 100%; min-height: 245px; flex: 1; margin-top: 23px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; outline: none; background: rgba(3, 8, 17, 0.48); color: var(--text); font: 13px/1.75 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.text-area:focus { border-color: rgba(99, 230, 219, 0.55); box-shadow: 0 0 0 3px rgba(99, 230, 219, 0.08); }
.text-area::placeholder { color: var(--faint); }
.text-input, .text-cleaned { padding: 15px; }
.text-findings { padding: 15px; color: #ffccd3; }
.text-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--faint); font-size: 10px; }
.text-help { min-height: 31px; margin: 12px 0 0; color: var(--faint); font-size: 10px; line-height: 1.5; }
.text-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 10px; }
.primary-button, .secondary-button, .copy-button { border-radius: 10px; cursor: pointer; font-size: 12px; font-weight: 650; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.primary-button, .secondary-button { padding: 13px 17px; }
.primary-button { border: 1px solid rgba(99, 230, 219, 0.45); background: linear-gradient(105deg, rgba(99, 230, 219, 0.18), rgba(117, 167, 255, 0.14)); color: var(--cyan); }
.secondary-button, .copy-button { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); color: var(--muted); }
.copy-button { padding: 6px 9px; font-size: 10px; }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .copy-button:hover:not(:disabled) { border-color: var(--cyan); transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .copy-button:disabled { cursor: not-allowed; opacity: 0.4; }
.result-badge[data-state="found"] { border-color: rgba(255, 140, 157, 0.4); color: var(--danger); }
.result-badge[data-state="none"] { border-color: rgba(99, 230, 219, 0.4); color: var(--cyan); }

.chat-panel { display: flex; min-height: 680px; flex-direction: column; overflow: hidden; padding: 0; }
.chat-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 25px 27px 21px; border-bottom: 1px solid var(--line); }
.chat-heading h2 { margin: 0; font-size: 22px; font-weight: 580; letter-spacing: -0.04em; }
.chat-capability { color: var(--faint); font-size: 10px; letter-spacing: 0.05em; line-height: 1.6; text-align: right; }
.chat-messages { display: flex; min-height: 430px; max-height: min(62vh, 620px); flex: 1; flex-direction: column; overflow-y: auto; padding: 30px clamp(18px, 7vw, 92px); scrollbar-color: rgba(155, 180, 211, 0.28) transparent; }
.chat-empty { display: flex; min-height: 380px; flex: 1; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.chat-empty-mark { display: grid; width: 52px; height: 52px; margin-bottom: 17px; place-items: center; border: 1px solid rgba(99, 230, 219, 0.35); border-radius: 17px; color: var(--cyan); font-size: 25px; box-shadow: 0 0 45px rgba(99, 230, 219, 0.1); }
.chat-empty h3 { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; }
.chat-empty p { margin: 10px 0 0; font-size: 12px; line-height: 1.7; }
.chat-empty strong { color: var(--cyan); }
.chat-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 23px; }
.chat-suggestions span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--faint); font-size: 10px; }
.chat-message { display: flex; align-items: flex-start; gap: 11px; width: min(840px, 100%); max-width: 840px; margin: 0 auto 24px; animation: message-in 180ms ease-out; }
.chat-message.user { flex-direction: row-reverse; justify-content: flex-start; margin-left: auto; margin-right: 0; }
.chat-message.assistant { justify-content: flex-start; margin-left: 0; margin-right: auto; }
.chat-avatar { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--cyan); font-size: 11px; }
.chat-message.user .chat-avatar { border-color: rgba(117, 167, 255, 0.36); color: var(--blue); }
.chat-bubble { max-width: min(760px, calc(100% - 42px)); border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, 0.035); color: var(--text); font-size: 13px; line-height: 1.75; }
.chat-message.user .chat-bubble { border-color: rgba(117, 167, 255, 0.25); border-top-right-radius: 5px; background: rgba(117, 167, 255, 0.1); }
.chat-message.assistant .chat-bubble { border-top-left-radius: 5px; }
.chat-message.user .chat-bubble, .chat-message.assistant .chat-bubble { padding: 13px 16px; }
.chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-file-chip { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 9px; border: 1px solid rgba(99, 230, 219, 0.24); border-radius: 8px; color: var(--cyan); font-size: 11px; }
.chat-file-chip span { color: var(--faint); }
.chat-result-block { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: rgba(3, 8, 17, 0.4); }
.chat-result-block:first-child { margin-top: 0; }
.chat-result-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.chat-result-block pre { max-height: 210px; margin: 0; overflow: auto; padding: 11px; color: #c5d2e4; font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-result-block.findings pre { color: #ffc8d0; }
.chat-copy-button { border: 0; background: transparent; color: var(--cyan); cursor: pointer; font-size: 10px; }
.chat-copy-button:hover { color: var(--text); }
.chat-download-button { display: inline-block; margin-top: 12px; padding: 7px 10px; border: 1px solid rgba(99, 230, 219, 0.28); border-radius: 8px; background: rgba(99, 230, 219, 0.07); }
.chat-message-status { margin-top: 9px; color: var(--faint); font-size: 10px; }
.chat-message-status.chat-error { color: var(--danger); }
.chat-loading { color: var(--muted); }
.chat-loading::after { display: inline-block; width: 18px; margin-left: 4px; overflow: hidden; vertical-align: bottom; content: "..."; animation: loading-dots 1.2s steps(4, end) infinite; }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes loading-dots { 0% { width: 0; } 33% { width: 6px; } 66% { width: 12px; } 100% { width: 18px; } }

.composer { position: relative; min-height: 156px; margin: 0 18px 18px; padding: 14px 16px 11px; border: 2px solid rgba(99, 230, 219, 0.32); border-radius: 21px; background: linear-gradient(145deg, rgba(11, 21, 36, 0.98), rgba(5, 12, 23, 0.96)); box-shadow: 0 16px 35px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.025); transition: border-color 160ms ease, box-shadow 160ms ease; }
.composer:focus-within, .composer.is-dragging { border-color: rgba(99, 230, 219, 0.72); box-shadow: 0 0 0 3px rgba(99, 230, 219, 0.1), 0 16px 35px rgba(0, 0, 0, 0.24); outline: none; }
.composer.is-dragging { background: rgba(99, 230, 219, 0.1); }
.composer.is-dragging::after { position: absolute; inset: 9px; display: grid; place-items: center; border: 1px dashed var(--cyan); border-radius: 14px; background: rgba(4, 15, 24, 0.82); color: var(--cyan); content: "松开以上传文件"; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; pointer-events: none; }
.composer-row { display: flex; min-height: 132px; align-items: flex-end; gap: 11px; }
.composer-row textarea { min-height: 122px; max-height: 260px; flex: 1; align-self: stretch; resize: none; border: 0; border-radius: 12px; outline: none; background: rgba(255, 255, 255, 0.018); color: var(--text); font: 14px/1.55 ui-sans-serif, system-ui, sans-serif; padding: 10px 12px; }
.composer-row textarea::placeholder { color: var(--faint); }
.composer-icon-button, .send-button { display: grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border-radius: 10px; cursor: pointer; transition: background 160ms ease, color 160ms ease, border-color 160ms ease; }
.composer-icon-button { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 21px; line-height: 1; }
.composer-icon-button:hover, .composer-icon-button:focus-visible { border-color: var(--cyan); color: var(--cyan); outline: none; }
.send-button { border: 1px solid rgba(99, 230, 219, 0.4); background: var(--cyan); color: #07131b; font-size: 20px; font-weight: 800; line-height: 1; }
.send-button:hover:not(:disabled), .send-button:focus-visible:not(:disabled) { background: #a7fff5; outline: none; transform: translateY(-1px); }
.send-button:disabled { cursor: not-allowed; opacity: 0.35; }
.composer-footer { display: flex; align-items: center; gap: 13px; min-height: 22px; margin: 7px 42px 0; color: var(--faint); font-size: 10px; }
.composer-hint { margin-left: auto; }
.attachment-preview { display: flex; align-items: center; gap: 9px; width: fit-content; max-width: 100%; margin: 0 0 8px 40px; padding: 7px 9px; border: 1px solid rgba(99, 230, 219, 0.28); border-radius: 9px; background: rgba(99, 230, 219, 0.07); color: var(--muted); font-size: 11px; }
.attachment-preview-icon { display: grid; width: 26px; height: 30px; place-items: center; border: 1px solid rgba(117, 167, 255, 0.35); border-radius: 5px; color: var(--blue); font-size: 7px; font-weight: 800; }
.attachment-preview-name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { width: 22px; height: 22px; margin-left: 3px; border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer; }
.attachment-remove:hover { color: var(--danger); background: rgba(255, 140, 157, 0.1); }

.result-panel { margin-top: 16px; padding: 26px; }
.result-heading { align-items: center; }
.result-badge { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.result-badge[data-state="suspicious"] { border-color: rgba(255, 140, 157, 0.4); color: var(--danger); }
.result-badge[data-state="clean"] { border-color: rgba(99, 230, 219, 0.4); color: var(--cyan); }
.result-message { margin: 23px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.result-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.stat { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; }
.stat strong { margin-right: 4px; color: var(--text); font-size: 14px; }
.report-details { margin-top: 21px; border-top: 1px solid var(--line); padding-top: 15px; }
.report-details summary { color: var(--faint); cursor: pointer; font-size: 11px; }
.report-details pre { max-height: 320px; margin: 14px 0 0; overflow: auto; padding: 14px; border-radius: 10px; background: #080d16; color: #b9c8dd; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.error-banner { margin: 16px 0 0; padding: 14px 17px; border: 1px solid rgba(255, 140, 157, 0.35); border-radius: 12px; background: rgba(255, 140, 157, 0.08); color: var(--danger); font-size: 13px; line-height: 1.5; }
.trust-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin: 35px 0; color: var(--faint); font-size: 10px; letter-spacing: 0.08em; }
.trust-row span:first-child { color: var(--cyan); font-weight: 700; letter-spacing: 0.17em; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 36px; border-top: 1px solid rgba(155, 180, 211, 0.1); color: var(--faint); font-size: 10px; letter-spacing: 0.04em; }

@media (max-width: 760px) {
  .shell { width: min(100% - 30px, 560px); }
  .site-header { padding: 20px 0; }
  .service-pill { max-width: 42px; padding: 8px; overflow: hidden; white-space: nowrap; }
  .service-pill .status-dot { flex: 0 0 auto; }
  .hero { padding: 64px 0 42px; }
  .hero h1 { font-size: clamp(3.1rem, 15vw, 5rem); }
  .hero-copy { font-size: 14px; }
  .mode-tabs { width: 100%; }
  .mode-tab { flex: 1; justify-content: center; }
  .workspace { grid-template-columns: 1fr; }
  .text-workspace { display: block; }
  .chat-panel { min-height: 650px; }
  .chat-heading { padding: 21px; }
  .chat-capability { max-width: 115px; }
  .chat-messages { min-height: 400px; padding: 25px 14px; }
  .composer { min-height: 142px; margin: 0 10px 10px; padding: 11px 12px 9px; }
  .composer-row { min-height: 120px; }
  .composer-row textarea { min-height: 110px; }
  .composer-footer { margin-left: 40px; }
  .composer-hint { display: none; }
  .text-editor-panel { min-height: 330px; }
  .text-actions { justify-content: stretch; }
  .text-actions button { flex: 1; }
  .upload-panel, .action-panel, .result-panel { padding: 21px; }
  .options-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 8px; }
}
