:root {
  --bg: #f5efe3;
  --bg-accent: #e5d1b8;
  --surface: rgba(255, 251, 245, 0.84);
  --surface-strong: #fffdf8;
  --text: #1f271b;
  --muted: #57624b;
  --primary: #355834;
  --primary-strong: #233a21;
  --secondary: #c96d42;
  --border: rgba(53, 88, 52, 0.14);
  --shadow: 0 24px 80px rgba(73, 54, 28, 0.15);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 109, 66, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(53, 88, 52, 0.18), transparent 24%),
    linear-gradient(180deg, #f8f2e8 0%, var(--bg) 100%);
}

img {
  max-width: 100%;
  display: block;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

/* ─── Hero ─── */

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: 36px;
  padding: 38px;
}

.hero-card {
  border-radius: 32px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(53, 88, 52, 0.95), rgba(35, 58, 33, 0.96));
  color: #fefbf4;
}

.eyebrow,
.card-label,
.result-label {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.hero h1,
.panel h2,
.rankings-header h3,
.prediction-card h3 {
  font-family: "Space Grotesk", sans-serif;
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1.02;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-pills span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(53, 88, 52, 0.08);
  color: var(--primary-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ─── Species list in hero card ─── */

.species-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  flex: 1;
}

.species-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.species-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(254, 251, 244, 0.5);
  flex-shrink: 0;
}

.hero-card-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(254, 251, 244, 0.18);
}

.hero-card-stat {
  font-size: 0.88rem;
  opacity: 0.8;
}

/* ─── Dashboard ─── */

.dashboard {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 24px;
}

.panel {
  padding: 28px;
  border-radius: var(--radius-lg);
}

.panel-header h2,
.rankings-header h3 {
  margin: 0;
  font-size: 1.5rem;
}

.panel-header p,
.prediction-card p,
#predictionConfidence,
#classesCount,
.status-box {
  color: var(--muted);
}

/* ─── Dropzone ─── */

.dropzone {
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 24px;
  margin-top: 18px;
  border: 2px dashed rgba(53, 88, 52, 0.28);
  border-radius: 24px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(229, 209, 184, 0.34));
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--secondary);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(201, 109, 66, 0.1));
}

.dropzone input {
  display: none;
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.dropzone-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.dropzone-subtitle {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

/* ─── Preview ─── */

.preview-shell {
  position: relative;
  min-height: 280px;
  margin-top: 18px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(53, 88, 52, 0.12), rgba(201, 109, 66, 0.12));
}

#previewImage {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: none;
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
}

/* ─── Buttons ─── */

.actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  background: var(--primary);
  color: #fdf8f1;
}

.ghost-btn {
  background: rgba(53, 88, 52, 0.08);
  color: var(--primary-strong);
}

/* ─── Results ─── */

.status-box,
.prediction-card,
.results-list {
  border-radius: var(--radius-md);
}

.status-box {
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(53, 88, 52, 0.08);
}

.status-box.error {
  background: rgba(201, 109, 66, 0.16);
  color: #7c3215;
}

.status-box.success {
  background: rgba(53, 88, 52, 0.12);
  color: var(--primary-strong);
}

.prediction-card {
  margin: 18px 0;
  padding: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.prediction-card h3 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2vw, 2.4rem);
}

.rankings {
  margin-top: 18px;
}

.rankings-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.results-list {
  margin-top: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(53, 88, 52, 0.08);
}

.result-item + .result-item {
  margin-top: 12px;
}

.result-item-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.meter {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(53, 88, 52, 0.08);
}

.meter-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
}

/* ─── Footer ─── */

.app-footer {
  margin-top: 32px;
  padding: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

.app-footer p {
  margin: 0;
}

.footer-credit {
  margin-top: 6px !important;
  font-size: 0.85rem;
}

.footer-credit a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 160ms ease;
}

.footer-credit a:hover {
  color: var(--secondary);
}

/* ─── Responsive ─── */

@media (max-width: 980px) {
  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: 14ch;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 22px;
  }

  .actions,
  .rankings-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
