:root {
  --bg: #ffffff;
  --bg2: #f6f7f9;
  --card: #ffffff;
  --card2: #fafbfc;
  --line: #e6e7eb;
  --text: #16181d;
  --muted: #6b7280;
  --accent: #111111;
  --green: #16a34a;
  --amber: #d97706;
  --orange: #ea580c;
  --red: #dc2626;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(15,17,21,.08);
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 880px; margin: 0 auto; padding: 24px 16px 60px; }
.hero { text-align: center; margin: 18px 0 26px; }
.hero h1 {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4rem);
  letter-spacing: -.5px;
  line-height: 1.05;
}
.hero .sub { color: var(--muted); max-width: 620px; margin: 14px auto 0; font-size: .98rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.upload-card { padding: 28px 20px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--accent); cursor: pointer; font-family: inherit; font-weight: 700;
  border-radius: 999px; padding: 13px 26px; font-size: 1rem;
  background: var(--accent); color: #ffffff;
  transition: opacity .12s ease, transform .12s ease;
}
.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { opacity: 1; background: var(--bg2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn-row .btn { flex: 1 1 200px; max-width: 260px; }

.drop {
  margin: 20px auto; padding: 28px 16px; max-width: 420px;
  border: 2px dashed var(--line); border-radius: 14px; color: var(--muted);
  transition: border-color .2s, background .2s; cursor: pointer; background: var(--bg2);
}
.drop.drag { border-color: var(--accent); background: rgba(17,17,17,.04); }
.drop p small { color: var(--muted); }
.drop img { max-width: 120px; max-height: 120px; border-radius: 12px; margin-bottom: 8px; }

.progress { margin: 18px auto; max-width: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.progress .spinner {
  width: 22px; height: 22px; flex: 0 0 auto;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.progress span { color: var(--muted); font-size: .92rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { margin-top: 30px; }
.result-card { padding: 24px 18px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-head h2 { font-size: 1.3rem; font-weight: 800; }
.badge.composite {
  font-weight: 800; padding: 8px 16px; border-radius: 999px;
  background: var(--accent); color: #ffffff; font-size: 1.05rem;
}

.tone-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.tone-chip {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; font-size: .86rem; font-weight: 600; color: var(--muted);
}
.tone-chip b { color: var(--text); }

.metric-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 6px;
}
.metric {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
}
.metric .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.metric .name { font-weight: 600; font-size: .92rem; }
.metric .val { font-weight: 800; font-size: 1.15rem; }
.metric .track { height: 7px; background: var(--line); border-radius: 8px; overflow: hidden; }
.metric .fill { height: 100%; border-radius: 8px; transition: width .8s cubic-bezier(.2,.8,.2,1); }

.age-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.age-chip {
  flex: 1 1 42%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.age-chip .lbl { color: var(--muted); font-size: .84rem; }
.age-chip .num { font-size: 1.6rem; font-weight: 800; margin-top: 2px; }
.age-chip .num.eye { color: var(--orange); }
.age-chip .num.perceived { color: var(--amber); }

.img-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.img-block h3 { font-size: 1rem; margin-bottom: 8px; color: var(--muted); }
.img-block img {
  width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); display: block;
}

@media (min-width: 720px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .container { padding: 30px 24px 70px; }
}
