/* 鹅外援视觉概念 v1 — 仅换肤。移除本文件引用即可回退视觉，不影响数据和业务。 */
:root {
  --goose-yellow: #F5E58F;
  --goose-yellow-soft: #FFF9DA;
  --wing-white: #FFFFFF;
  --ink: #20212A;
  --ink-soft: #505461;
  --cobalt: #304BDB;
  --cobalt-dark: #2138B1;
  --beak: #F47B35;
  --fog: #F3F5F7;
  --line: #D8DCE3;
  --success: #087443;
  --warning: #865900;
  --danger: #B42318;
  --focus: rgba(48,75,219,.34);
  --canvas: #F3F5F7;
  --paper: #FFFFFF;
  --purple: #304BDB;
  --purple-dark: #2138B1;
  --purple-pale: #EEF1FF;
  --peach: #FFF0E7;
  --peach-pale: #FFF7F2;
  --muted: #5B6270;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--fog); }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }

/* Frame and brand */
.app-shell { grid-template-columns: 208px minmax(0,1fr); min-height: 100dvh; background: var(--fog); }
.sidebar {
  position: relative;
  overflow: hidden;
  border: 0;
  border-right: 2px solid var(--ink);
  padding: 24px 16px 20px;
  background: var(--goose-yellow);
}
.sidebar::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: 72px;
  width: 116px;
  height: 180px;
  border: 4px solid var(--ink);
  border-right: 0;
  border-radius: 58% 0 0 58%;
  opacity: .09;
  pointer-events: none;
}
.brand { position: relative; z-index: 1; align-items: center; gap: 12px; padding: 0 5px 30px; overflow: visible; }
.brand > div { min-width: 0; flex: 1; }
.brand-symbol {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  flex: none;
  border: 2px solid var(--ink);
  border-radius: 15px 15px 15px 5px;
  background: var(--wing-white);
  box-shadow: 4px 4px 0 var(--ink);
}
.brand-symbol img { width: 51px; height: 51px; object-fit: contain; object-position: center 20%; transform: scale(1.2); }
.brand strong { display: block; color: var(--ink); font-size: 20px; font-weight: 850; letter-spacing: -.04em; }
.brand small { display: block; margin-top: 1px; color: #3E414B; font-size: 10px; font-weight: 650; line-height: 1.5; white-space: normal; overflow: visible; }
.main-nav { position: relative; z-index: 1; gap: 7px; }
.nav-button {
  min-height: 46px;
  border: 2px solid transparent;
  border-radius: 11px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
}
.nav-button span { display: grid; place-items: center; width: 24px; color: var(--ink); font-size: 18px; }
.nav-button:hover { border-color: rgba(32,33,42,.22); background: rgba(255,255,255,.45); }
.nav-button.is-active { border-color: var(--ink); background: var(--wing-white); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.sidebar-end { position: relative; z-index: 1; border-color: rgba(32,33,42,.28); color: #3E414B; font-size: 12px; }
.main-panel { min-width: 0; background: var(--fog); }

/* Top utility area */
.preview-notice {
  justify-content: flex-start;
  min-height: 42px;
  padding: 10px clamp(22px,4vw,56px) 7px;
  border: 0;
  background: var(--ink);
  color: #E9EBF0;
  font-size: 12px;
}
.preview-notice strong { color: var(--goose-yellow); }
.notice-pip { width: 8px; height: 8px; border: 2px solid var(--goose-yellow); background: transparent; }
.context-bar {
  min-height: 50px;
  padding: 7px clamp(22px,4vw,56px);
  border-bottom: 1px solid var(--line);
  background: var(--wing-white);
  color: var(--ink-soft);
}
.context-bar select { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--wing-white); color: var(--ink); }
.context-bar #accountName { color: var(--ink-soft); }
.status { border: 2px solid var(--ink); border-radius: 10px; background: var(--goose-yellow); color: var(--ink); box-shadow: 4px 4px 0 rgba(32,33,42,.22); font-weight: 700; }

/* Shared type and controls */
h1,h2,h3,strong { color: var(--ink); }
.hero-copy h1,.flow-header h1,.auth-panel h1 { font-family: inherit; font-weight: 850; letter-spacing: -.045em; }
.button,.nav-button,.inline-action,.tone,.intent,.lab-choice,.pick-button,.back-button,.task-entry,.vent-entry,.subject-list-item,.compare-toggle,.conversation-item button,.chat-composer button {
  transition: background-color 140ms ease,color 140ms ease,border-color 140ms ease,box-shadow 140ms ease,transform 140ms ease,opacity 140ms ease;
}
.button {
  min-height: 44px;
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 760;
}
.button.primary { border: 2px solid var(--cobalt); background: var(--cobalt); color: white; box-shadow: 3px 3px 0 var(--ink); }
.button.primary:hover:not(:disabled) { border-color: var(--ink); background: var(--cobalt-dark); box-shadow: 4px 4px 0 var(--ink); }
.button.outlined { border: 2px solid var(--ink); background: var(--wing-white); color: var(--ink); }
.button.outlined:hover:not(:disabled) { background: var(--goose-yellow-soft); box-shadow: 3px 3px 0 var(--ink); }
.button.text-button,.inline-action,.back-button,.vent-entry { color: var(--cobalt-dark); font-weight: 750; }
.button.text-button:hover:not(:disabled),.inline-action:hover:not(:disabled),.back-button:hover:not(:disabled),.vent-entry:hover:not(:disabled) { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.button:active:not(:disabled),.nav-button:active:not(:disabled),.tone:active:not(:disabled),.intent:active:not(:disabled),.task-entry:active:not(:disabled),.subject-list-item:active:not(:disabled),.compare-toggle:active:not(:disabled),.conversation-item button:active:not(:disabled),.chat-composer button:active:not(:disabled) { transform: translate(1px,1px) scale(.995); box-shadow: 1px 1px 0 var(--ink); }
button:focus-visible,[role="button"]:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
button:disabled,[aria-disabled="true"] { opacity: .5; filter: grayscale(.3); cursor: not-allowed; box-shadow: none !important; }
button[aria-busy="true"] { cursor: wait; }
textarea,input,select { accent-color: var(--cobalt); }
textarea::placeholder,input::placeholder { color: #737987; opacity: 1; }

/* Home */
.home-view { padding: 38px clamp(24px,4.2vw,60px) 60px; background: var(--fog); }
.home-content { max-width: 1160px; }
.home-grid { grid-template-columns: minmax(0,1.42fr) minmax(340px,.9fr); gap: clamp(38px,5vw,72px); }
.hero-area { padding-top: 18px; }
.hero-copy { position: relative; }
.hero-copy::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -14px;
  top: -8px;
  width: 84px;
  height: 18px;
  border-radius: 2px;
  background: var(--goose-yellow);
  transform: rotate(-2deg);
}
.hero-copy h1 { position: relative; z-index: 1; max-width: 660px; margin: 0; font-size: clamp(40px,4.2vw,58px); line-height: 1.18; }
.hero-area .hero-input-block { margin-top: 34px; }
.hero-copy p { margin: 18px 0 22px; color: var(--ink-soft); font-size: 18px; }
.hero-input-block {
  border: 2px solid var(--ink);
  border-radius: 18px 18px 18px 6px;
  padding: 17px 18px 15px;
  background: var(--wing-white);
  box-shadow: 6px 6px 0 var(--goose-yellow);
}
.hero-input-block:focus-within { border-color: var(--cobalt); box-shadow: 6px 6px 0 var(--goose-yellow),0 0 0 3px var(--focus); }
.hero-input-block textarea { min-height: 112px; padding: 2px; color: var(--ink); font-size: 16px; line-height: 1.65; }
.home-tone { margin-top: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.home-tone > span,.tone-bar > span { color: var(--ink-soft); font-weight: 680; }
.tone { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--wing-white); color: var(--ink-soft); }
.tone:hover:not(:disabled) { border-color: var(--ink); }
.tone.is-active { border: 2px solid var(--ink); background: var(--goose-yellow); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.tone.is-active::before { content: "✓"; margin-right: 5px; font-weight: 900; }
.hero-form-foot { padding-top: 13px; }

.message-desk { position: relative; padding: 4px 0 0; }
.message-desk::before {
  content: "";
  position: absolute;
  z-index: 0;
  right: -12px;
  top: 38px;
  width: 80%;
  height: 260px;
  border: 2px solid var(--ink);
  border-radius: 42% 58% 47% 53% / 56% 38% 62% 44%;
  opacity: .08;
  pointer-events: none;
}
.message-desk > * { position: relative; z-index: 1; }
.desk-heading { margin-bottom: 14px; }
.desk-heading h2,.desk-editor h2 { font-size: 20px; font-weight: 820; }
.desk-heading span { border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; background: var(--wing-white); color: var(--ink-soft); }
.message-curve { color: var(--beak); width: 40px; }
.paper-message { border: 2px solid var(--ink); border-radius: 14px; padding: 15px 17px; }
.paper-message.incoming { background: var(--goose-yellow-soft); border-radius: 14px 14px 14px 4px; box-shadow: 4px 4px 0 var(--beak); }
.paper-message.outgoing { background: var(--wing-white); border-radius: 14px 14px 4px 14px; box-shadow: 4px 4px 0 var(--cobalt); }
.paper-message span { color: var(--ink-soft); }
.lab-switch { border-color: var(--line); }
.lab-choice { color: var(--ink-soft); }
.lab-choice:hover { border-color: var(--ink); color: var(--ink); }
.lab-choice.is-selected { border-color: var(--cobalt); color: var(--ink); }
.lab-choice.is-selected::before { color: var(--beak); }
.lab-condition { color: var(--ink-soft); }
.desk-editor { border: 2px solid var(--ink); border-radius: 16px 16px 16px 5px; padding: 18px; background: var(--wing-white); box-shadow: 5px 5px 0 var(--goose-yellow); }
.desk-editor textarea,.desk-editor-result { border-color: var(--line); background: var(--wing-white); }

.task-section { margin-top: 44px; padding-top: 25px; border-top: 2px solid var(--ink); }
.task-grid { gap: 0; }
.task-entry {
  min-height: 150px;
  border: 0;
  border-radius: 0;
  padding: 13px 30px 13px 0;
  background: transparent;
  color: var(--ink);
}
.task-entry + .task-entry { border-left: 1px solid var(--line); padding-left: 30px; }
.task-entry:hover { border-color: var(--line); background: linear-gradient(90deg,rgba(255,228,92,.34),transparent 72%); box-shadow: none; transform: none; }
.task-entry strong { font-size: 20px; }
.task-entry strong::after { content: " ↗"; color: var(--beak); }
.task-entry > span,.task-entry .task-preview { color: var(--ink-soft) !important; }
.vent-entry { margin-top: 10px; }

/* Workflows */
.flow-view { padding: 30px clamp(24px,4vw,58px) 64px; }
.back-button { min-height: 42px; }
.flow-header { margin: 20px 0 28px; }
.flow-header h1 { margin: 8px 0 7px; font-size: clamp(30px,3vw,42px); line-height: 1.22; }
.flow-header h1::after { content: ""; display: inline-block; width: .52em; height: .52em; margin-left: .22em; border-radius: 50% 50% 50% 18%; background: var(--beak); vertical-align: .05em; }
.flow-header p { color: var(--ink-soft); }
.flow-layout { gap: 26px; }
.flow-form-card,.flow-result,.flow-placeholder {
  border: 0;
  border-radius: 14px;
  padding: 24px;
  background: var(--wing-white);
  box-shadow: 0 1px 0 var(--line);
}
.flow-form-card { border-top: 5px solid var(--goose-yellow); }
.flow-result { border-top: 5px solid var(--cobalt); }
.flow-placeholder { border: 2px dashed #BFC5CF; background: transparent; }
.flow-form-card textarea,.auth-panel input,.profile-form input,.profile-form textarea,.profile-inline input,.profile-panel select,.profile-subjects > input,.import-area input,.import-area select,.import-area textarea,.rewrite-area textarea,.live-flow-result textarea,.compare-menu > input,.paper-message textarea {
  border: 1px solid #BFC5CF;
  border-radius: 9px;
  background: var(--wing-white);
  color: var(--ink);
}
.flow-form-card textarea:focus,.auth-panel input:focus,.profile-form input:focus,.profile-form textarea:focus,.import-area textarea:focus,.live-flow-result textarea:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--focus); outline: none; }
.intent { min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--wing-white); color: var(--ink); }
.intent:hover { border-color: var(--ink); }
.intent.is-active { border: 2px solid var(--ink); background: var(--goose-yellow); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.intent.is-active::before { content: "✓"; margin-right: 5px; }
.inline-error { border-left: 4px solid var(--danger); background: #FFF0EE; color: #7A1D17; }
.flow-placeholder span { color: var(--beak); }
.result-head span { color: var(--ink-soft); }
.reply-option { border-color: var(--line); border-radius: 10px; }
.reply-option.is-selected { border: 2px solid var(--cobalt); background: #F3F5FF; box-shadow: 3px 3px 0 var(--goose-yellow); }
.option-head strong,.pick-button,.analysis-list span { color: var(--cobalt-dark); }
.analysis-list article { border-left-color: var(--cobalt); }
.analysis-list article.takeaway { border-color: var(--beak); background: #FFF6E9; }
.rehearsal-turn { border-left: 4px solid var(--cobalt); border-radius: 0 9px 9px 0; background: #EEF1FF; }
.rehearsal-turn.other { border-color: var(--beak); background: #FFF2E9; }
.rewrite-area,.import-area { border-color: var(--line); }
.image-queue-item { border-left: 4px solid var(--cobalt); border-radius: 8px; background: var(--fog); }
.image-queue-item button { border: 1px solid var(--line); background: white; }
.task-history p,.rehearsal-thread p { border-color: var(--line); }
.task-history strong,.rehearsal-thread .simulated-other::before,#taskImageStatus { color: var(--cobalt-dark); }

/* Chat */
.chat-view { background: var(--wing-white); }
.chat-top { min-height: 80px; border-color: var(--line); background: var(--wing-white); }
.chat-eyebrow { color: var(--cobalt-dark); font-weight: 800; }
.chat-eyebrow::before { content: "●"; margin-right: 6px; color: var(--beak); }
.chat-top h1 { font-size: 20px; font-weight: 820; }
.tone-bar { border-color: var(--line); background: var(--fog); }
.chat-scroll { background: linear-gradient(90deg,var(--wing-white),#FAFBFC 50%,var(--wing-white)); }
.chat-messages { max-width: 860px; padding-top: 34px; }
.chat-intro { color: var(--ink-soft); }
.chat-message.user p { border: 1px solid #E0C949; border-radius: 15px 15px 4px 15px; background: var(--goose-yellow-soft); color: var(--ink); }
.chat-message.assistant { position: relative; }
.assistant-label { color: var(--ink); font-weight: 820; }
.assistant-label span { border: 2px solid var(--ink); border-radius: 50% 50% 50% 18%; background: var(--beak); color: var(--ink); }
.chat-message.assistant p,.chat-message.assistant .live-answer { line-height: 1.75; }
.chat-demo-note { border-color: var(--beak); background: #FFF6E9; color: var(--ink); }
.chat-composer { max-width: 860px; }
.chat-composer textarea { border: 2px solid var(--ink); border-radius: 13px 13px 13px 5px; background: var(--wing-white); }
.chat-composer textarea:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--focus); outline: none; }
.chat-composer button { border: 2px solid var(--ink); border-radius: 11px; background: var(--goose-yellow); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.chat-composer button:disabled { border-color: #BFC5CF; background: #E7E9ED; color: #757B87; }

/* Profile, records, compare */
.profile-view { background: var(--fog); }
.profile-grid { gap: 34px 48px; }
.profile-panel { border-top: 4px solid var(--ink); padding-top: 15px; }
.profile-panel:nth-child(3n+1) { border-top-color: var(--cobalt); }
.profile-panel:nth-child(3n+2) { border-top-color: var(--beak); }
.profile-panel:nth-child(3n) { border-top-color: var(--ink); }
.profile-panel h2 { font-size: 20px; font-weight: 820; }
.profile-panel p { color: var(--ink-soft); }
.profile-panel #memoryStatus { display: inline-block; border-radius: 6px; padding: 3px 7px; background: var(--goose-yellow); color: var(--ink); }
.profile-panel .danger { color: var(--danger); }
.subject-list-item { border: 1px solid var(--line); border-radius: 8px; background: var(--wing-white); color: var(--ink); }
.subject-list-item.is-active { border: 2px solid var(--ink); background: var(--goose-yellow); box-shadow: 2px 2px 0 var(--ink); }
.memory-item,.conversation-item { border-color: var(--line); }
.memory-item p { color: var(--ink); }
.conversation-item { min-height: 72px; }
.conversation-title { color: var(--ink); font-weight: 700; }
.conversation-item button { border: 1px solid transparent; color: var(--cobalt-dark); }
.conversation-item button:hover { border-color: var(--ink); background: var(--goose-yellow-soft); text-decoration: none; }
.save-feedback { color: var(--success) !important; }
.compare-toggle { border: 2px solid var(--ink); border-radius: 9px; background: var(--wing-white); }
.compare-menu { border: 2px solid var(--ink); border-radius: 10px; box-shadow: 5px 5px 0 var(--goose-yellow); }
.compare-options label:hover { background: var(--goose-yellow-soft); }
.compare-selected span { border: 1px solid #C7CEFA; border-radius: 6px; background: #EEF1FF; color: var(--ink); }
.compare-chat-context { border-left: 5px solid var(--beak); background: #FFF5E8; }

/* Login / invitation */
.auth-gate { background: var(--goose-yellow); }
.auth-gate::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(135deg,transparent 0 42px,rgba(32,33,42,.055) 42px 44px);
  pointer-events: none;
}
.auth-panel { position: relative; width: min(100%,440px); border: 3px solid var(--ink); border-radius: 18px 18px 18px 6px; padding: 30px; box-shadow: 9px 9px 0 var(--ink); }
.auth-kicker { display: inline-block; border-radius: 5px; padding: 3px 7px; background: var(--goose-yellow); color: var(--ink); font-weight: 800; }
.auth-panel h1 { font-size: 32px; }
.auth-panel p { color: var(--ink-soft); }
.auth-panel #authError { color: var(--danger); }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 178px minmax(0,1fr); }
  .home-grid { grid-template-columns: minmax(0,1.15fr) minmax(310px,.9fr); gap: 32px; }
  .hero-copy h1 { font-size: clamp(38px,5vw,50px); }
}

@media (max-width: 768px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .main-panel { height: calc(100dvh - 68px); min-height: 0; overflow: hidden; }
  .sidebar { position: fixed; z-index: 15; inset: auto 0 0; display: grid; grid-template-columns: auto 1fr; align-items: center; min-height: 64px; padding: 7px 10px max(7px,env(safe-area-inset-bottom)); border: 0; border-top: 2px solid var(--ink); }
  .sidebar::after,.sidebar-end { display: none; }
  .brand { gap: 6px; padding: 0 8px 0 0; }
  .brand-symbol { width: 38px; height: 38px; border-radius: 10px 10px 10px 4px; box-shadow: 2px 2px 0 var(--ink); }
  .brand-symbol img { width: 38px; height: 38px; }
  .brand strong { font-size: 14px; }
  .brand small { display: none; }
  .main-nav { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
  .nav-button { justify-content: center; min-height: 43px; padding: 0 7px; font-size: 12px; }
  .nav-button span { display: none; }
  .nav-button.is-active { box-shadow: 2px 2px 0 var(--ink); }
  .preview-notice { padding-inline: 16px; }
  .context-bar { justify-content: flex-start; padding: 7px 16px; }
  .context-bar select { min-width: 120px; flex: 1; }
  .home-view { padding: 30px 20px 50px; }
  .home-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero-area { padding-top: 8px; }
  .message-desk { max-width: 560px; }
  .task-section { margin-top: 42px; }
  .flow-view { padding: 24px 20px 52px; }
  .flow-layout { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .chat-view { min-height: 0; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .preview-notice { align-items: flex-start; flex-wrap: wrap; gap: 3px 7px; font-size: 11px; }
  .context-bar { gap: 5px 7px; }
  .context-bar label { width: auto; }
  .context-bar #accountName { display: none; }
  .hero-copy h1 { font-size: 38px; }
  .hero-area .hero-input-block { margin-top: 26px; }
  .hero-copy p { font-size: 16px; }
  .hero-input-block { padding: 14px; box-shadow: 4px 4px 0 var(--goose-yellow); }
  .home-tone { align-items: flex-start; flex-direction: column; }
  .home-tone > div { justify-content: flex-start; }
  .tone { padding: 6px 8px; font-size: 11px; }
  .paper-message.incoming { width: calc(100% - 28px); }
  .paper-message.outgoing { width: calc(100% - 34px); margin-left: 16px; margin-right: 18px; }
  .task-grid { grid-template-columns: 1fr; }
  .task-entry { min-height: 0; padding: 15px 0 20px; }
  .task-entry + .task-entry { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
  .flow-form-card,.flow-result,.flow-placeholder { padding: 19px 16px; }
  .flow-header h1 { font-size: 32px; }
  .tone-bar { align-items: flex-start; flex-direction: column; padding: 10px 16px; }
  .tone-bar > div { width: 100%; }
  .chat-top { padding-inline: 16px; }
  .chat-messages { padding: 24px 18px 28px; }
  .chat-message.user p { max-width: 88%; }
  .chat-composer { padding: 12px 15px max(15px,env(safe-area-inset-bottom)); }
  .profile-view { padding-inline: 18px; }
  .auth-panel { padding: 24px 20px; box-shadow: 6px 6px 0 var(--ink); }
  .conversation-item { grid-template-columns: 1fr; align-items: start; }
  .conversation-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  *:active { transform: none !important; }
}
