:root {
  --ink: #25221f;
  --muted: #6e6861;
  --paper: #fbf8f4;
  --card: rgba(255, 255, 255, 0.78);
  --line: rgba(55, 45, 37, 0.13);
  --rust: #a75135;
  --rust-dark: #7f3825;
  --sage: #71806b;
  --peach: #edc4a9;
  --shadow: 0 24px 70px rgba(73, 52, 38, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: linear-gradient(145deg, #fbf8f4 0%, #f3ebe2 52%, #f8f5f0 100%); }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.ambient { position: fixed; z-index: -1; border-radius: 999px; filter: blur(1px); opacity: .42; pointer-events: none; }
.ambient-one { width: 35rem; height: 35rem; right: -12rem; top: -12rem; background: radial-gradient(circle, #e9bfa0, transparent 67%); }
.ambient-two { width: 27rem; height: 27rem; left: -12rem; top: 45%; background: radial-gradient(circle, #cfd8c6, transparent 68%); }

.site-header, main, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.site-header { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); font-weight: 760; letter-spacing: -.02em; }
.brand-mark { width: 33px; height: 33px; border-radius: 50%; background: #efe1d5; position: relative; display: block; }
.brand-mark i { position: absolute; width: 10px; height: 17px; border-radius: 50% 50% 45% 45%; transform-origin: 50% 100%; bottom: 8px; left: 12px; background: var(--rust); }
.brand-mark i:nth-child(1) { transform: rotate(-47deg); background: #d69b75; }
.brand-mark i:nth-child(2) { transform: rotate(0); background: var(--sage); }
.brand-mark i:nth-child(3) { transform: rotate(47deg); background: var(--rust); }
.eyebrow, .kicker { text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 760; color: var(--rust); }

.hero { display: grid; grid-template-columns: .86fr 1.14fr; gap: clamp(45px, 7vw, 100px); align-items: center; min-height: calc(100vh - 84px); padding: 72px 0 86px; }
.hero-copy { align-self: center; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(3.3rem, 6.4vw, 6rem); line-height: .95; letter-spacing: -.055em; margin: 18px 0 28px; max-width: 700px; }
h1 em { color: var(--rust); font-weight: 400; }
.lead { color: var(--muted); font-size: 1.07rem; line-height: 1.75; max-width: 560px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 34px; font-size: .83rem; color: #4e4944; }
.trust-row span::before { content: "✓"; color: var(--sage); font-weight: 800; margin-right: 7px; }

.upload-card, .result-card, .loading-panel, .error-panel { background: var(--card); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.78); box-shadow: var(--shadow); border-radius: 28px; }
.upload-card { padding: clamp(22px, 3vw, 38px); }
.step-label { display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 800; color: #625a53; margin-bottom: 20px; }
.step-label b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--rust); font-size: .65rem; }
.drop-zone { text-align: center; border: 1.5px dashed #c9b9ac; border-radius: 20px; padding: 33px 22px 26px; background: rgba(255,250,246,.66); transition: .2s ease; outline: none; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--rust); background: #fffaf6; transform: translateY(-2px); }
.camera-icon { margin: 0 auto 16px; width: 58px; height: 50px; position: relative; border: 2px solid var(--rust); border-radius: 14px; }
.camera-icon::before { content: ""; position: absolute; width: 23px; height: 8px; background: var(--rust); border-radius: 6px 6px 0 0; left: 15px; top: -8px; }
.camera-icon::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--rust); border-radius: 50%; inset: 0; margin: auto; }
.camera-icon span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--rust); top: 8px; right: 9px; }
.drop-zone h2 { font-size: 1.05rem; margin-bottom: 7px; }
.drop-zone p { color: var(--muted); font-size: .83rem; line-height: 1.5; margin-bottom: 20px; }
.drop-zone small { color: #81776f; display: block; margin-top: 15px; font-size: .72rem; }
.upload-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.button { border: 0; border-radius: 999px; padding: 12px 19px; cursor: pointer; font-size: .82rem; font-weight: 750; transition: .2s ease; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--rust); box-shadow: 0 9px 24px rgba(167,81,53,.22); }
.button-primary:hover { background: var(--rust-dark); }
.button-secondary { color: var(--ink); background: white; border: 1px solid var(--line); }

.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 17px 0; }
.tips > div { display: flex; gap: 8px; padding: 10px; background: rgba(238,232,225,.6); border-radius: 12px; }
.tips span { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; border-radius: 50%; background: white; color: var(--rust); font-size: .65rem; font-weight: 800; }
.tips p { margin: 0; color: var(--muted); font-size: .64rem; line-height: 1.4; }
.tips b { display: block; color: var(--ink); font-size: .69rem; }
.analyze-button { width: 100%; border: 0; border-radius: 14px; color: white; background: var(--ink); padding: 17px 21px; display: flex; align-items: center; justify-content: space-between; font-weight: 760; cursor: pointer; transition: .2s ease; }
.analyze-button:not(:disabled):hover { background: var(--rust); }
.analyze-button:disabled { opacity: .35; cursor: not-allowed; }
.analyze-button i { font-style: normal; font-size: 1.2rem; }
.privacy-note { text-align: center; color: #81776f; font-size: .68rem; margin: 11px 0 0; }

.preview-wrap { margin: 16px 0; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; }
.text-button { border: 0; background: transparent; color: var(--rust); cursor: pointer; font-size: .72rem; }
.preview-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 9px; }
.preview { aspect-ratio: 1; position: relative; border-radius: 11px; overflow: hidden; background: #eee; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(27,24,22,.78); color: white; cursor: pointer; line-height: 1; }

.loading-panel, .error-panel { margin: 12vh auto; max-width: 720px; padding: 70px 40px; text-align: center; }
.orb { width: 94px; height: 94px; border-radius: 50%; margin: 0 auto 28px; padding: 7px; background: conic-gradient(from 30deg, #a75135, #e9c7ac, #71806b, #a75135); animation: spin 2s linear infinite; }
.orb span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #faf6f1; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-panel h2 { font: 400 clamp(2rem, 4vw, 3.2rem)/1.1 Georgia, serif; }
.loading-panel > p:not(.kicker) { color: var(--muted); }
.progress { max-width: 390px; height: 5px; margin: 28px auto 0; background: #e5ddd5; border-radius: 9px; overflow: hidden; }
.progress i { display: block; width: 8%; height: 100%; background: var(--rust); transition: width 1.4s ease; }

.results { padding: 80px 0; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding-bottom: 42px; }
.results-head h2 { font: 400 clamp(3rem, 6vw, 5.5rem)/.96 Georgia, serif; margin: 12px 0 18px; }
.results-head > div:first-child { max-width: 760px; }
.results-head p:not(.kicker) { color: var(--muted); line-height: 1.7; }
.confidence-ring { flex: 0 0 125px; width: 125px; height: 125px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: conic-gradient(var(--rust) var(--score, 0%), #e7ded7 0); position: relative; }
.confidence-ring::before { content: ""; position: absolute; inset: 9px; background: var(--paper); border-radius: 50%; }
.confidence-ring b, .confidence-ring span { position: relative; }
.confidence-ring b { font: 400 1.8rem Georgia, serif; }
.confidence-ring span { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.warning-box { border: 1px solid #e2b984; background: #fff5e5; padding: 18px 22px; border-radius: 15px; margin-bottom: 22px; color: #775426; font-size: .83rem; line-height: 1.5; }

.axis-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.axis-card { padding: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 18px; }
.axis-card span { text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-size: .65rem; }
.axis-card b { display: block; font: 400 1.45rem Georgia, serif; color: var(--rust); margin: 7px 0; }
.axis-card p { color: var(--muted); font-size: .74rem; line-height: 1.5; margin: 0; }

.result-card { padding: clamp(24px, 4vw, 42px); margin-bottom: 22px; }
.card-heading { display: flex; justify-content: space-between; gap: 25px; border-bottom: 1px solid var(--line); margin-bottom: 27px; }
.card-heading p { max-width: 400px; font-size: .74rem; color: var(--muted); text-align: right; }
.palette-section h3 { font-size: .82rem; margin-bottom: 13px; }
.swatch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.swatch { min-width: 0; }
.swatch-color { width: 100%; aspect-ratio: 1.3; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.swatch b { display: block; font-size: .7rem; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch small { color: var(--muted); font-size: .61rem; }
.swatch[title] { cursor: help; }
.palette-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; margin-top: 31px; }
.swatch-grid.compact { grid-template-columns: repeat(4, 1fr); }

.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.accordion-item { border-top: 1px solid var(--line); padding: 16px 0; }
.accordion-item:first-child { border-top: 0; }
.accordion-item h3 { font-size: .86rem; margin: 0 0 9px; }
.fact-row { display: grid; grid-template-columns: minmax(110px, .7fr) 1.3fr; gap: 15px; padding: 4px 0; font-size: .76rem; line-height: 1.45; }
.fact-row span { color: var(--muted); }
.recommendation-group { padding: 13px 0; border-top: 1px solid var(--line); }
.recommendation-group:first-child { border-top: 0; }
.recommendation-group h3 { font-size: .78rem; margin-bottom: 8px; }
.recommendation-group ul { margin: 0; padding-left: 17px; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.recommendation-group p { color: var(--muted); font-size: .76rem; line-height: 1.55; margin: 0; }

.caution-card { display: grid; grid-template-columns: .65fr 1.35fr; gap: 30px; align-items: center; }
.caution-card > div:first-child > p { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.caution-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.caution-item { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: rgba(255,255,255,.5); }
.caution-swatch { height: 48px; }
.caution-item div:last-child { padding: 10px; }
.caution-item b { font-size: .7rem; }
.caution-item p { color: var(--muted); font-size: .63rem; margin: 5px 0 0; line-height: 1.4; }
.limitations { padding: 18px 0; font-size: .72rem; color: var(--muted); line-height: 1.6; }
.limitations ul { padding-left: 18px; }
.result-actions { display: flex; justify-content: flex-end; gap: 10px; }

.error-panel b { font: 400 2rem Georgia, serif; }
.error-panel p { color: var(--muted); margin: 18px auto 25px; }
footer { min-height: 100px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 30px; color: var(--muted); font-size: .7rem; }
footer span { color: var(--ink); font-weight: 800; }
footer p { margin: 0; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 60px; }
  .hero-copy { text-align: center; }
  .lead { margin-inline: auto; }
  .trust-row { justify-content: center; }
  .axis-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
  .swatch-grid { grid-template-columns: repeat(4, 1fr); }
  .caution-card { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .site-header { height: 68px; }
  .eyebrow { display: none; }
  .hero { padding: 45px 0 60px; gap: 38px; }
  h1 { font-size: 3.3rem; }
  .upload-card { border-radius: 20px; }
  .tips { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: repeat(3, 1fr); }
  .results { padding-top: 45px; }
  .results-head { align-items: flex-start; }
  .confidence-ring { flex-basis: 91px; width: 91px; height: 91px; }
  .confidence-ring b { font-size: 1.35rem; }
  .axis-grid { grid-template-columns: 1fr 1fr; }
  .axis-card { padding: 15px; }
  .card-heading { display: block; }
  .card-heading p { text-align: left; }
  .swatch-grid, .swatch-grid.compact { grid-template-columns: repeat(3, 1fr); }
  .palette-columns { grid-template-columns: 1fr; gap: 25px; }
  .caution-grid { grid-template-columns: 1fr 1fr; }
  .result-actions { flex-direction: column; }
  footer { flex-direction: column; align-items: flex-start; justify-content: center; gap: 7px; }
}

@media print {
  body { background: white; }
  .site-header, .result-actions, footer, .ambient { display: none; }
  .results { padding: 0; }
  .result-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .swatch-color, .caution-swatch { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
