:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #f8fafb;
  --panel-border: #d9e1e7;
  --text: #182027;
  --muted: #64717d;
  --primary: #176b87;
  --primary-strong: #0f5068;
  --accent: #9a6b2f;
  --success: #24724d;
  --warning: #996213;
  --error: #b34040;
  --surface: #ffffff;
  --surface-soft: #f1f5f7;
  --shadow: 0 18px 48px rgba(31, 45, 61, 0.1);
  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font-display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel--results {
  min-height: 780px;
}

.panel__intro {
  margin-bottom: 18px;
}

.panel__intro h1,
.panel__intro h2,
.results-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0;
}

.panel__intro p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.results-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.field-block,
.field {
  display: grid;
  gap: 10px;
}

.field-block {
  margin-bottom: 18px;
}

.field-block__label,
.field > span {
  font-size: 14px;
  font-weight: 700;
  color: #34424d;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.field--full {
  grid-column: 1 / -1;
}

.field--inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field--inline > span {
  margin: 0;
  white-space: nowrap;
}

.field--compact input {
  width: 88px;
  padding: 10px 12px;
  text-align: center;
}

.choice-row {
  display: grid;
  gap: 10px;
}

.choice-row--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-row--wrap {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choice-row--feedback {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-chip {
  position: relative;
  display: block;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d7e0e6;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.choice-chip input:checked + span {
  border-color: rgba(23, 107, 135, 0.48);
  background: #e7f3f7;
  color: var(--primary);
}

.upload-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.upload-grid[data-layout="single"] {
  grid-template-columns: 1fr;
}

.upload-grid[data-layout="double"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  border: 1px dashed #b9c8d3;
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.upload-grid[data-layout="double"] .upload-card {
  min-height: 220px;
}

.upload-card[data-disabled="true"] {
  background: var(--surface-soft);
}

.upload-card__copy {
  display: block;
}

.upload-card__label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 750;
}

.upload-card__copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.upload-card__placeholder {
  color: var(--muted);
  line-height: 1.5;
}

.upload-card__file-field {
  display: grid;
  gap: 8px;
  justify-self: start;
  color: var(--primary);
  font-weight: 700;
}

.upload-card__input {
  width: min(100%, 320px);
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
}

.upload-card__input::file-selector-button {
  margin-right: 12px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  background: var(--primary);
  color: #f7fbfc;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.upload-card__input::file-selector-button:hover {
  background: var(--primary-strong);
}

.upload-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.upload-grid[data-layout="double"] .upload-card img {
  height: 140px;
}

.upload-card__disabled-note {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.aspect-section {
  display: grid;
  gap: 10px;
}

.aspect-follow {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #e7f3f7;
}

.aspect-follow__value {
  color: var(--primary);
  font-weight: 700;
}

.aspect-follow__note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(91, 79, 67, 0.16);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(24, 67, 58, 0.16);
  border-color: rgba(23, 107, 135, 0.42);
}

.button {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
  transform: none;
}

.button--primary {
  width: 100%;
  color: #f7fbfc;
  background: var(--primary);
}

.button--primary:hover {
  background: var(--primary-strong);
}

.button--secondary {
  color: var(--primary);
  background: #e7f3f7;
  border: 1px solid #bed7e0;
}

.button--ghost {
  width: 100%;
  color: var(--primary);
  background: rgba(24, 67, 58, 0.1);
}

.button--subtle {
  width: 100%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(91, 79, 67, 0.12);
}

.results-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.results-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.results-progress {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.results-progress__bar {
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #dce7ed;
}

.results-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.24s ease;
}

.results-progress__text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.results-progress[data-tone="loading"] .results-progress__fill {
  background: var(--warning);
}

.results-progress[data-tone="success"] .results-progress__fill {
  background: var(--success);
}

.results-progress[data-tone="error"] .results-progress__fill {
  background: var(--error);
}

.results-progress[data-tone="loading"] .results-progress__text {
  color: var(--warning);
}

.results-progress[data-tone="success"] .results-progress__text {
  color: var(--success);
}

.results-progress[data-tone="error"] .results-progress__text {
  color: var(--error);
}

.results-count {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #e7f3f7;
  color: var(--primary);
  font-weight: 700;
}

.button--results {
  width: auto;
  min-width: 148px;
  padding: 12px 18px;
}

.results-board {
  position: relative;
}

.gallery {
  display: grid;
  gap: 16px;
}

.gallery[data-layout="single"] {
  grid-template-columns: 1fr;
}

.gallery[data-layout="double"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery[data-layout="triple"],
.gallery[data-layout="grid"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--panel-border);
  text-decoration: none;
  color: inherit;
}

.gallery-card__status {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(248, 250, 251, 0.92);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(24, 20, 16, 0.08);
}

.gallery[data-layout="single"] .gallery-card {
  min-height: 620px;
}

.gallery[data-layout="double"] .gallery-card {
  min-height: 360px;
}

.gallery[data-layout="triple"] .gallery-card,
.gallery[data-layout="grid"] .gallery-card {
  min-height: 300px;
}

.gallery-card--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4f7, #ffffff);
}

.gallery-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface-soft);
}

.gallery-card__image--placeholder {
  background: linear-gradient(135deg, #eef4f7, #ffffff);
}

.gallery-card__label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(24, 20, 16, 0.72);
  color: #f8fafb;
  font-size: 12px;
  font-weight: 700;
}

.gallery-empty {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.feedback-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 32, 39, 0.38);
  backdrop-filter: blur(4px);
}

.feedback-modal__dialog {
  position: relative;
  width: min(680px, 100%);
  padding: 24px;
  border: 1px solid rgba(91, 79, 67, 0.12);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.feedback-modal__dialog h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
}

.feedback-modal__desc {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.feedback-modal__field {
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel--results {
    min-height: auto;
  }
}

@media (max-width: 960px) {
  .results-header {
    grid-template-columns: 1fr;
  }

  .results-actions {
    justify-items: start;
  }

  .results-progress__text {
    text-align: left;
  }
}

@media (max-width: 840px) {
  .field-grid,
  .choice-row--three,
  .choice-row--wrap,
  .upload-grid[data-layout="double"],
  .feedback-modal__actions,
  .gallery[data-layout="double"],
  .gallery[data-layout="triple"],
  .gallery[data-layout="grid"] {
    grid-template-columns: 1fr;
  }

  .field--inline {
    justify-content: space-between;
  }

  .gallery[data-layout="single"] .gallery-card,
  .gallery[data-layout="double"] .gallery-card,
  .gallery[data-layout="triple"] .gallery-card,
  .gallery[data-layout="grid"] .gallery-card {
    min-height: 300px;
  }

  .page-shell {
    width: min(100%, calc(100% - 20px));
    padding: 16px 0 28px;
  }
}
