:root {
  --honey-100: #fff8de;
  --honey-200: #ffe7a3;
  --honey-300: #ffd15f;
  --honey-400: #f8bc31;
  --honey-500: #eaa614;
  --ink-900: #20190f;
  --ink-700: #3d3223;
  --ink-500: #6a5b46;
  --paper: #fffef8;
  --danger: #9f2e2e;
  --ring: rgba(248, 188, 49, 0.35);
  --shadow-strong: 0 24px 48px rgba(40, 27, 8, 0.2);
  --shadow-soft: 0 10px 24px rgba(40, 27, 8, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 241, 176, 0.5), transparent 32%),
    radial-gradient(circle at 88% 24%, rgba(255, 211, 95, 0.42), transparent 30%),
    linear-gradient(160deg, #fffaf0 0%, #ffe7a8 52%, #ffd77a 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(30deg, rgba(255, 255, 255, 0.17) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.17) 87.5%, rgba(255, 255, 255, 0.17)),
    linear-gradient(150deg, rgba(255, 255, 255, 0.17) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.17) 87.5%, rgba(255, 255, 255, 0.17)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 2%, transparent 2.5%);
  background-size: 54px 94px, 54px 94px, 27px 47px;
  background-position: 0 0, 0 0, 0 0;
  opacity: 0.35;
}

.app-shell {
  width: min(920px, 92vw);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.8rem) 0 3.6rem;
  position: relative;
  z-index: 1;
}

.hero {
  margin-bottom: 1.15rem;
}

.mode-switch {
  margin-top: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.mode-switch-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-700);
}

.mode-nav {
  margin-top: 0;
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid rgba(44, 30, 7, 0.2);
  background: rgba(255, 249, 227, 0.8);
}

.mode-nav a {
  padding: 0.33rem 0.72rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-700);
  transition: background-color 120ms ease, color 120ms ease;
}

.mode-nav a.active {
  background: #f6c33a;
  color: #2c1d06;
}

.mode-nav a:not(.active):hover {
  background: rgba(246, 195, 58, 0.36);
  color: #2c1d06;
}

.mode-switch .mode-nav {
  margin-top: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 800;
  color: #7e5511;
}

.eyebrow::before {
  content: "";
  width: 32px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1c160f 0 33%, #ffbf2f 33% 66%, #1c160f 66% 100%);
}

.mode-beans .eyebrow::before {
  width: 18px;
  height: 12px;
  border-radius: 56% 44% 62% 38% / 58% 42% 58% 42%;
  transform: rotate(-18deg);
  background:
    radial-gradient(circle at 35% 32%, rgba(255, 232, 196, 0.9) 0 17%, transparent 18%),
    linear-gradient(135deg, #8b5228 0%, #6a3f1f 55%, #533115 100%);
  box-shadow: inset -2px -1px 0 rgba(35, 18, 5, 0.35), 0 1px 0 rgba(255, 255, 255, 0.4);
}

h1 {
  margin: 0.35rem 0 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #23190d;
}

.subtitle {
  margin: 0.8rem 0 0;
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--ink-700);
  max-width: 46ch;
}

.card {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: 20px;
  border: 1px solid rgba(76, 55, 15, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 253, 245, 0.93)),
    var(--paper);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(2px);
}

.dropzone {
  position: relative;
  display: grid;
  place-content: center;
  gap: 0.45rem;
  text-align: center;
  min-height: 220px;
  border: 2px dashed #c88b11;
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 232, 157, 0.55), transparent 42%),
    linear-gradient(165deg, var(--honey-100), var(--honey-200));
  color: #3e2e17;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dropzone:hover,
.dropzone.drag-active {
  transform: translateY(-3px);
  border-color: #a87009;
  box-shadow: 0 0 0 6px var(--ring);
}

.dropzone::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  border: 1px solid rgba(48, 35, 13, 0.18);
  pointer-events: none;
}

.dropzone.has-file {
  border-style: solid;
  border-color: #7f5f1b;
}

.dropzone-text {
  font-size: clamp(1.06rem, 2vw, 1.18rem);
  font-weight: 700;
  color: #2c2011;
}

.dropzone-hint {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-500);
}

.preview {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  margin-top: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(92, 65, 18, 0.26);
  box-shadow: var(--shadow-soft);
  background: #fff8dd;
}

.intensity-control {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(84, 58, 12, 0.2);
  border-radius: 14px;
  background: rgba(255, 247, 212, 0.78);
}

.intensity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.intensity-head h2 {
  margin: 0;
  font-size: 0.98rem;
}

.intensity-head output {
  font-size: 0.9rem;
  font-weight: 700;
  color: #5a4317;
}

#bee-level {
  width: 100%;
  margin: 0;
  height: 24px;
  padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.range-arrow {
  font-size: 1.08rem;
  line-height: 1;
  font-weight: 800;
  color: #8a651a;
  user-select: none;
}

.range-arrow.left {
  transform: translateY(-1px);
}

.range-arrow.right {
  transform: translateY(-1px);
}

#bee-level::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe7a5 0%, #ffc640 100%);
}

#bee-level::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #2b1b05;
  background: #ffce53;
  box-shadow: 0 2px 8px rgba(58, 38, 8, 0.3);
}

#bee-level::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe7a5 0%, #ffc640 100%);
}

#bee-level::-moz-range-thumb {
  margin-top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #2b1b05;
  background: #ffce53;
  box-shadow: 0 2px 8px rgba(58, 38, 8, 0.3);
}

#bee-level::-moz-focus-outer {
  border: 0;
}

.intensity-ends {
  margin-top: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--ink-500);
}

.intensity-ends span:last-child {
  text-align: right;
}

.action-row {
  margin-top: 0.95rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.action-row > button {
  margin-top: 0;
}

.turnstile-container {
  margin-top: 0;
  margin-left: auto;
  min-height: 66px;
}

button,
.download {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1.12rem;
  border-radius: 12px;
  border: 0;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #251704;
  background: linear-gradient(180deg, #ffcf55 0%, #f2b522 100%);
  text-decoration: none;
  cursor: pointer;
  transition: transform 130ms ease, filter 130ms ease;
  box-shadow: 0 8px 16px rgba(115, 76, 8, 0.26);
}

button:hover:not(:disabled),
.download:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:active:not(:disabled),
.download:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.25);
}

body.is-loading .dropzone {
  pointer-events: none;
  opacity: 0.75;
}

body.is-loading .intensity-control {
  pointer-events: none;
  opacity: 0.75;
}

body.is-loading .turnstile-container {
  pointer-events: none;
  opacity: 0.75;
}

.status {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  font-size: 0.95rem;
  color: var(--danger);
}

#loading {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  text-align: center;
}

#loading p {
  margin: 0;
  font-weight: 700;
  color: #5d471e;
}

.spinner {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: conic-gradient(#1e170f 0 18%, #ffcb4f 18% 60%, #f0af18 60% 100%);
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 0);
  animation: spin 0.9s linear infinite;
  position: relative;
}

.spinner::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #f3bf40;
  border: 3px solid #251a0d;
  transform: translate(-50%, -50%);
}

h2 {
  margin: 0.1rem 0 0.25rem;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: -0.02em;
}

.result-meta {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-700);
}

.hidden {
  display: none !important;
}

.enter-1,
.enter-2,
.enter-3,
.enter-4 {
  opacity: 0;
  transform: translateY(10px);
  animation: riseIn 500ms ease forwards;
}

.enter-2 {
  animation-delay: 90ms;
}

.enter-3 {
  animation-delay: 180ms;
}

.enter-4 {
  animation-delay: 270ms;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes riseIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(96vw, 920px);
    padding-top: 1.4rem;
  }

  .card {
    border-radius: 16px;
    padding: 0.9rem;
  }

  .dropzone {
    min-height: 170px;
    border-radius: 14px;
  }

  .intensity-head {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.25rem;
  }

  .intensity-ends {
    font-size: 0.74rem;
  }

  .range-row {
    gap: 0.35rem;
  }

  .range-arrow {
    font-size: 0.95rem;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .action-row > button {
    width: 100%;
  }

  .turnstile-container {
    margin-left: 0;
  }

  .mode-nav {
    margin-top: 0.65rem;
  }

  .mode-switch .mode-nav {
    margin-top: 0;
  }

  .mode-switch {
    margin-top: 0.65rem;
    gap: 0.45rem;
  }

  .mode-switch-label {
    font-size: 0.8rem;
  }
}
