﻿:root {
  --bg: #08111f;
  --card: rgba(15, 37, 67, 0.96);
  --card-strong: rgba(10, 17, 30, 0.96);
  --border: rgba(255, 255, 255, 0.08);
  --primary: #00b4ff;
  --accent: #22d3ee;
  --text: #f5f9ff;
  --muted: #98adc9;
  --success: #2dd39f;
  --danger: #ff5f7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, "Segoe UI", sans-serif;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(0, 180, 255, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34, 211, 238, 0.12), transparent 28%),
    linear-gradient(180deg, #06111f 0%, #081728 100%);
  color: var(--text);
}

.background {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(0, 180, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(34, 211, 238, 0.18), transparent 24%);
  pointer-events: none;
  z-index: -1;
}

.container {
  width: min(1280px, 94%);
  margin: 0 auto;
  padding: 40px 0 60px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: clamp(2.4rem, 2.7vw, 3.4rem);
  line-height: 1.05;
}

.hero p {
  max-width: 600px;
  color: var(--muted);
  margin-top: 10px;
  font-size: 1rem;
  line-height: 1.8;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.loading {
  background: #315b8c;
}

.ready {
  background: var(--success);
  color: #06111f;
}

.error {
  background: rgba(255, 95, 122, 0.18);
  color: var(--danger);
}

.hint {
  display: inline-block;
  color: var(--muted);
  font-size: 0.95rem;
}

.upload-card,
.result-card,
.image-card,
.detections {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.drop-zone {
  height: 260px;
  border: 2px dashed rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: rgba(0, 180, 255, 0.7);
  transform: scale(1.01);
  background: rgba(0, 180, 255, 0.08);
}

.upload-content {
  text-align: center;
  max-width: 380px;
}

.upload-content h2 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.upload-content p {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.75;
}

#browseBtn,
.primary-button {
  border: none;
  border-radius: 16px;
  padding: 14px 26px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #00b4ff, #0fd4d4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#browseBtn:hover,
.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(0, 180, 255, 0.22);
}

.viewer {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.image-card,
.result-card {
  padding: 26px;
}

.canvas-viewport {
  width: 100%;
  min-height: 420px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 22px;
  padding: 14px;
  display: grid;
  place-items: center;
}

canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  background: #07101d;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.reading,
.confidence {
  margin-bottom: 22px;
}

.title {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

#meterReading {
  display: block;
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--accent);
  word-break: break-all;
}

#confidence {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
}

.prediction-footer {
  margin-top: 16px;
}

.detections {
  margin-top: 32px;
  padding: 26px;
}

.detections h2 {
  margin-bottom: 20px;
}

.detections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.detection-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
}

.detection-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
}

.small-text {
  color: var(--muted);
  line-height: 1.7;
}

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

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 24px 0 40px;
  }

  .drop-zone {
    height: auto;
    padding: 40px 18px;
  }

  .canvas-viewport {
    min-height: 320px;
  }
}
