:root {
  --bg: #07111f;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-soft: rgba(30, 41, 59, 0.72);
  --border: rgba(148, 163, 184, 0.22);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #34d399;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.2), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(52, 211, 153, 0.16), transparent 28%),
    linear-gradient(145deg, #07111f 0%, #111827 52%, #0f172a 100%);
  color: var(--text);
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  gap: 24px;
  align-content: center;
}

.hero-panel,
.result-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  min-height: 280px;
  padding: clamp(24px, 5vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 28px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro {
  max-width: 62ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.upload-panel {
  display: grid;
  gap: 12px;
}

.file-picker,
button {
  min-height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
}

.file-picker {
  border: 1px dashed rgba(56, 189, 248, 0.5);
  background: rgba(2, 6, 23, 0.34);
  color: var(--text);
  cursor: pointer;
}

.file-picker input {
  display: none;
}

button {
  border: 1px solid rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.14);
  color: var(--text);
  cursor: pointer;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.result-panel {
  min-height: 360px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.image-preview,
.clasificacion {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.28);
}

.image-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 18px;
}

.image-preview img {
  display: none;
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  object-fit: contain;
}

.image-preview img.show {
  display: block;
}

.image-preview img.show + .empty-preview {
  display: none;
}

.empty-preview,
.empty-result {
  color: var(--muted);
  text-align: center;
}

.clasificacion {
  padding: 22px;
  overflow: auto;
}

.clasificacion h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 1.3rem;
}

.clasificacion ul {
  margin: 0 0 14px;
  padding: 14px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.clasificacion b {
  text-transform: capitalize;
}

progress {
  width: min(260px, 100%);
  accent-color: var(--accent-2);
}

.error {
  color: var(--danger);
  font-weight: 800;
}

.loader {
  width: 58px;
  height: 58px;
  display: none;
  position: fixed;
  left: calc(50% - 29px);
  top: calc(50% - 29px);
  z-index: 10;
  border: 5px solid rgba(148, 163, 184, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader.show {
  display: block;
}

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

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