:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-soft: #f3f4f1;
  --ink: #1f2421;
  --muted: #66706a;
  --line: #deded7;
  --accent: #10a37f;
  --accent-dark: #0c7c62;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(31, 36, 33, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(16, 163, 127, 0.11), transparent 32rem),
    linear-gradient(180deg, #fbfbf9, var(--bg));
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  line-height: 1.6;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  width: min(1060px, calc(100% - 32px));
  min-height: 100vh;
  gap: 18px;
  margin: 0 auto;
  padding: 22px 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.site-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.site-nav a:hover {
  color: var(--accent-dark);
  background: rgba(16, 163, 127, 0.08);
}

.brand__mark,
.chat-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #063227;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.25;
}

.brand small,
.app-header__status,
.profile-hero__lead,
.usage-note {
  color: var(--muted);
}

.brand small,
.app-header__status {
  font-size: 12px;
}

.app-header__status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
}

.app-header__status span:first-child {
  color: var(--accent-dark);
  font-weight: 800;
}

.intro__eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: 0;
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 28px;
  align-items: stretch;
  padding: 42px 0 20px;
}

.profile-hero__copy {
  display: grid;
  align-content: center;
  gap: 16px;
}

.profile-hero__lead {
  max-width: 620px;
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.profile-actions a {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 900;
}

.profile-actions a:first-child {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.profile-card {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(31, 36, 33, 0.1);
}

.profile-photo {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  color: #063227;
  background: var(--accent);
  font-size: 22px;
  font-weight: 900;
}

.profile-meta {
  display: grid;
  gap: 14px;
  margin: 0;
}

.profile-meta div {
  display: grid;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.profile-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.profile-meta dd {
  margin: 0;
  font-weight: 800;
}

.profile-section {
  display: grid;
  gap: 18px;
  padding: 28px 0;
}

.profile-section--about,
.profile-section--notes {
  border-top: 1px solid var(--line);
}

.profile-section--tools {
  margin-top: 14px;
  padding-top: 34px;
  border-top: 2px solid var(--ink);
}

.section-heading {
  display: grid;
  gap: 8px;
}

.section-heading p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.info-card,
.note-list article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.info-card {
  padding: 18px;
}

.info-card h3,
.note-list h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.info-card p,
.note-list p {
  margin-bottom: 0;
  color: var(--muted);
}

.note-list {
  display: grid;
  gap: 10px;
}

.note-list article {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.note-list span {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.tools-intro {
  text-align: center;
}

.tools-intro h2,
.tools-intro p {
  margin-right: auto;
  margin-left: auto;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.mode-tab {
  display: grid;
  gap: 2px;
  min-height: 54px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.mode-tab span {
  font-size: 12px;
  font-weight: 700;
}

.mode-tab--active {
  color: white;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(31, 36, 33, 0.16);
}

.workspace-card {
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tab-panel {
  min-height: inherit;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
}

.chat-toolbar,
.image-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.new-chat {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-soft);
  font-weight: 800;
}

.new-chat:hover {
  border-color: rgba(16, 163, 127, 0.42);
  color: var(--accent-dark);
}

.chat-stage {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel-soft);
}

.chat-messages {
  display: grid;
  gap: 18px;
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.chat-message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
}

.chat-message--user {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.chat-message--user .chat-avatar {
  order: 2;
  color: white;
  background: #4b5563;
}

.chat-bubble {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  white-space: pre-wrap;
}

.chat-message--user .chat-bubble {
  color: white;
  background: var(--ink);
}

.chat-message--error .chat-bubble {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
  background: #fff1f0;
}

.chat-message--loading .chat-bubble {
  color: var(--muted);
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.prompt-grid button {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-align: left;
  font-weight: 800;
}

.prompt-grid button:hover {
  border-color: rgba(16, 163, 127, 0.45);
  background: #eefbf6;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  min-height: 42px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-soft);
  line-height: 1.55;
  outline: 0;
  padding: 10px 12px;
}

.send-button,
.image-submit {
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-weight: 900;
}

.send-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  align-self: end;
  font-size: 20px;
}

.send-button:disabled,
.composer textarea:disabled,
.image-submit:disabled,
.image-form textarea:disabled {
  cursor: wait;
  opacity: 0.58;
}

.image-panel {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr);
  gap: 18px;
  padding-bottom: 18px;
}

.image-panel__header p:last-child {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
}

.image-form {
  display: grid;
  gap: 10px;
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding-top: 18px;
}

.image-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.image-form textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-soft);
  line-height: 1.55;
  outline: 0;
  padding: 12px;
}

.image-form textarea:focus,
.composer textarea:focus {
  border-color: rgba(16, 163, 127, 0.62);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.image-submit {
  min-height: 44px;
}

.image-result {
  display: grid;
  width: min(760px, calc(100% - 32px));
  min-height: 280px;
  place-items: center;
  overflow: hidden;
  margin: 0 auto;
  border: 1px dashed rgba(31, 36, 33, 0.22);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
}

.image-result img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #111;
}

.image-download {
  justify-self: stretch;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--accent-dark);
  background: white;
  font-weight: 900;
  text-align: center;
}

.image-result--error {
  border-color: rgba(180, 35, 24, 0.42);
  color: var(--danger);
  background: #fff1f0;
}

.usage-note {
  margin: 0;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 24px, 760px);
    gap: 14px;
    padding: 14px 0;
  }

  .app-header,
  .chat-toolbar,
  .image-panel__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav,
  .app-header__status {
    justify-content: flex-start;
  }

  .profile-hero,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .workspace-card {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .profile-hero {
    padding-top: 24px;
  }

  .mode-tabs,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .note-list article {
    grid-template-columns: 1fr;
  }

  .chat-message,
  .chat-message--user {
    grid-template-columns: 1fr;
  }

  .chat-avatar {
    display: none;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 40px;
  }
}
