:root {
  color-scheme: light;
  --canvas: #f3eee5;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #292322;
  --muted: #675d5a;
  --line: #d6c9bc;
  --wine: #742f3b;
  --wine-dark: #58212b;
  --wine-soft: #ead9d8;
  --danger: #8b271f;
  --focus: #106ba3;
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 0.1875rem solid var(--focus);
  outline-offset: 0.1875rem;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-strong);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.page-shell,
.site-footer {
  width: min(calc(100% - 2rem), 68rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 0.0625rem solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--wine);
  color: #ffffff;
}

.local-label,
.role-label,
.eyebrow,
.contract-badge {
  color: var(--wine-dark);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.page-shell {
  padding-block: 2rem 3rem;
}

.intro,
.result-header {
  max-width: 48rem;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0.5rem;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

p,
small {
  color: var(--muted);
}

.tryon-form {
  display: grid;
  gap: 2rem;
}

.step {
  padding-top: 1.5rem;
  border-top: 0.0625rem solid var(--line);
}

.step-heading {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.step-heading > div {
  min-width: 0;
}

.step-heading p {
  margin-bottom: 0;
}

.step-number {
  display: grid;
  flex: 0 0 2rem;
  height: 2rem;
  place-items: center;
  border: 0.0625rem solid var(--wine);
  border-radius: 50%;
  color: var(--wine-dark);
  font-weight: 750;
}

.upload-grid {
  display: grid;
  gap: 1rem;
}

.upload-field {
  position: relative;
  min-width: 0;
  padding: 1rem;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.upload-field:focus-within {
  border-color: var(--focus);
}

.upload-copy p {
  min-height: 3rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.file-picker {
  display: grid;
  min-height: 8rem;
  place-content: center;
  padding: 1rem;
  border: 0.0625rem dashed #a48f82;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  text-align: center;
  cursor: pointer;
}

.file-picker.is-dragging {
  border-color: var(--wine);
  background: var(--wine-soft);
}

.picker-title {
  color: var(--wine-dark);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.picker-help {
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-field > input[type="file"] {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  overflow: hidden;
  opacity: 0;
}

.preview {
  margin-top: 1rem;
}

.preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #ded5ca;
}

.preview-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.text-button {
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--wine-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.mode-options {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.mode-option:has(input:checked) {
  border-color: var(--wine);
  box-shadow: inset 0.25rem 0 var(--wine);
}

.mode-option input,
.consent-row input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  accent-color: var(--wine);
}

.mode-option span {
  display: grid;
  gap: 0.25rem;
}

.consent-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 48rem;
  margin-bottom: 1rem;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.125rem;
  border-radius: var(--radius-sm);
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 0.0625rem solid var(--wine);
  background: var(--wine);
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  background: var(--wine-dark);
}

.primary-button:disabled {
  border-color: #aaa09a;
  background: #aaa09a;
  cursor: not-allowed;
}

.secondary-button {
  border: 0.0625rem solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.danger-button {
  border: 0.0625rem solid var(--danger);
  background: transparent;
  color: var(--danger);
}

.status-message {
  min-height: 1.5rem;
  margin-top: 0.75rem;
  color: var(--ink);
  font-weight: 650;
}

.status-message.is-error {
  color: var(--danger);
}

.demo-notice {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.875rem 1rem;
  border-left: 0.25rem solid var(--wine);
  background: var(--wine-soft);
}

.demo-notice span {
  color: #4d3c3c;
}

.compare-section {
  padding-top: 1.5rem;
  border-top: 0.0625rem solid var(--line);
}

.section-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
}

.contract-badge {
  padding: 0.4rem 0.625rem;
  border: 0.0625rem solid #b99094;
  border-radius: 999rem;
  background: var(--surface);
  letter-spacing: 0;
}

.compare-view {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-top: 0.75rem;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius-sm);
  background: #d8cec4;
}

.compare-view > img,
.compare-result,
.compare-result img {
  width: 100%;
  height: 100%;
}

.compare-view img {
  display: block;
  object-fit: contain;
}

.compare-result {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 0);
}

.compare-label {
  position: absolute;
  top: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgb(34 30 29 / 82%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 750;
}

.before-label {
  right: 0.75rem;
}

.after-label {
  left: 0.75rem;
}

.range-label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 700;
}

.compare-range {
  width: 100%;
  accent-color: var(--wine);
}

.empty-state {
  padding: 2rem 1rem;
  border-block: 0.0625rem solid var(--line);
  text-align: center;
}

.loading-mark {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.75rem;
  border: 0.2rem solid var(--wine-soft);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.site-footer {
  padding-block: 1rem 2rem;
  border-top: 0.0625rem solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.visually-hidden {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 48rem) {
  .page-shell {
    padding-block: 3rem 4rem;
  }

  .upload-grid,
  .mode-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-view {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 27rem) {
  .local-label {
    display: none;
  }

  .result-actions > * {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
