:root {
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --card: rgba(255, 255, 255, 0.84);
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --good: #0c8a43;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(70px);
  z-index: 0;
  pointer-events: none;
}

.bg-glow.one {
  top: -120px;
  left: -90px;
  background: rgba(115, 182, 255, 0.42);
}

.bg-glow.two {
  right: -110px;
  bottom: -130px;
  background: rgba(178, 210, 255, 0.4);
}

.top-nav,
.app {
  position: relative;
  z-index: 1;
}

.top-nav {
  position: sticky;
  top: 0;
  backdrop-filter: saturate(180%) blur(14px);
  background: rgba(245, 245, 247, 0.72);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.top-nav p,
.top-nav span {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.app {
  width: min(980px, 100% - 28px);
  margin: 14px auto 28px;
  display: grid;
  gap: 12px;
}

.hero,
.card {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
}

.hero {
  padding: 22px 18px;
  position: relative;
  overflow: hidden;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(2rem, 9vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 38ch;
  line-height: 1.5;
}

.guinea {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 170px;
  max-width: 40vw;
  filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.15));
}

#guineaCutout {
  width: 100%;
  height: auto;
  display: block;
}

.card {
  padding: 16px;
}

h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

#fileInput {
  margin-top: 10px;
  width: 100%;
}

.preview-wrap {
  margin-top: 10px;
  width: 100%;
  min-height: 220px;
  border-radius: 20px;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#imagePreview {
  display: none;
  width: 100%;
  max-width: 100%;
}

#previewHint {
  margin: 0;
  color: #8c8c91;
  font-size: 0.93rem;
}

.action {
  width: 100%;
  margin-top: 12px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
}

.action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top-result {
  margin: 10px 0;
  color: var(--good);
  font-size: 1.05rem;
  font-weight: 800;
}

.result-photo-wrap {
  margin-bottom: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  min-height: 160px;
  display: grid;
  place-items: center;
}

#resultPhoto {
  width: 100%;
  height: auto;
  display: none;
}

.result-bars {
  display: grid;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: 104px 1fr 60px;
  gap: 8px;
  align-items: center;
  font-size: 0.9rem;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e7e7ed;
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  transition: width 220ms ease;
  background: linear-gradient(90deg, #60a5fa, #0071e3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 820px) {
  .app {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .hero {
    grid-column: 1 / -1;
    min-height: 280px;
    padding: 30px 28px;
  }

  .hero-copy {
    font-size: 1.08rem;
  }

  .guinea {
    right: 18px;
    bottom: 18px;
    width: 240px;
    max-width: 32vw;
  }
}
