:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --text: #18201d;
  --muted: #64706b;
  --line: #dce2dd;
  --panel: #ffffff;
  --accent: #0f8b6f;
  --accent-strong: #09614d;
  --warn: #bf3b2f;
  --soft: #eef7f3;
  --yellow: #f5c84c;
  --ink: #101614;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

.shell {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.home-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.back-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.page-title {
  margin: 12px 0 20px;
}

.page-title.compact {
  margin-bottom: 16px;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-title p:last-child {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.tool-card {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(18, 35, 29, 0.08);
}

.tool-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.tool-card small {
  color: var(--muted);
  line-height: 1.5;
}

.tool-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.analysis-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.panel,
.result-area,
.history-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(20, 30, 26, 0.06);
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 19px;
}

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

.upload-box {
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border: 1.5px dashed #a8b7b0;
  border-radius: 8px;
  background: #fbfcfa;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-title {
  font-size: 18px;
  font-weight: 900;
}

.upload-copy,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.upload-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-box.has-image .upload-title,
.upload-box.has-image .upload-copy {
  position: relative;
  z-index: 1;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
}

.field-stack {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

textarea {
  min-height: 124px;
  resize: vertical;
  padding: 12px;
}

select {
  height: 46px;
  padding: 0 12px;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button.inline {
  width: auto;
  padding: 0 18px;
}

.primary-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.error-box {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid rgba(191, 59, 47, 0.35);
  border-radius: 8px;
  background: #fff2f0;
  color: var(--warn);
  line-height: 1.5;
}

.result-area {
  margin-top: 18px;
  padding: 18px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.result-header h2 {
  margin: 0;
  font-size: 24px;
}

.result-block {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.result-block h3 {
  margin: 0 0 12px;
  font-size: 19px;
}

.summary-line {
  margin: 0 0 10px;
  line-height: 1.7;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

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

.mini-panel {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.mini-panel strong {
  display: block;
  margin-bottom: 6px;
}

.mini-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.rank-list,
.suggestion-list,
.simple-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-item,
.suggestion-item,
.simple-list li {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.rank-title,
.suggestion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 900;
}

.rank-item p,
.suggestion-item p,
.simple-list li {
  color: var(--muted);
  line-height: 1.6;
}

.rank-item p,
.suggestion-item p {
  margin: 4px 0 0;
}

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

.score-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 900;
}

.score-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.score-values span {
  display: block;
  padding: 8px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 900;
  text-align: center;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-card {
  padding: 16px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.image-pair img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.history-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.empty-state h1 {
  margin: 0 0 10px;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 720px);
    padding-top: 14px;
  }

  .analysis-form,
  .upload-grid,
  .two-col,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .upload-box {
    min-height: 220px;
  }

  .topbar,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .ghost-button,
  .back-link {
    width: 100%;
  }

  .image-pair {
    grid-template-columns: 1fr 1fr;
  }
}
