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

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
}

.container {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* ── Title ── */
.title {
  font-size: 1.6rem;
  font-weight: 500;
  color: #333;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ── Upload card ── */
.upload-area {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  background: #d9d9d9;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
  outline: none;
  user-select: none;
}

.upload-area:hover,
.upload-area:focus {
  background: #ccc;
}

.upload-area.drag-over {
  background: #bbb;
  outline: 3px dashed #888;
}

.preview-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  border-radius: 6px;
}

.plus-icon {
  width: 80px;
  height: 80px;
  z-index: 1;
}

.plus-icon svg {
  width: 100%;
  height: 100%;
  fill: #666;
}

.upload-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-size: 0.8rem;
  color: #555;
  pointer-events: none;
  z-index: 2;
}

/* ── Analyze button ── */
.btn-analyze {
  padding: 12px 36px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: #222;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-analyze:disabled {
  background: #aaa;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-analyze:not(:disabled):hover {
  background: #000;
}

/* Spinner inside button */
.btn-analyze.loading {
  position: relative;
  pointer-events: none;
}

.btn-analyze.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

/* ── Result card ── */
.result-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

.result-header {
  background: #222;
  color: #fff;
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.authentic {
  background: #d4edda;
  color: #155724;
}

.badge.fake {
  background: #f8d7da;
  color: #721c24;
}

.badge.unknown {
  background: #fff3cd;
  color: #856404;
}

.result-class {
  font-size: 1.15rem;
  font-weight: 700;
  color: #222;
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.confidence-label {
  font-size: 0.78rem;
  color: #888;
  min-width: 70px;
}

.confidence-bar-wrap {
  flex: 1;
  height: 8px;
  background: #e9e9e9;
  border-radius: 4px;
  overflow: hidden;
}

.confidence-bar {
  height: 100%;
  border-radius: 4px;
  background: #222;
  transition: width 0.5s ease;
}

.confidence-pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
  min-width: 36px;
  text-align: right;
}

.top-predictions {
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pred-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pred-name {
  font-size: 0.78rem;
  color: #555;
  min-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-bar-wrap {
  flex: 1;
  height: 6px;
  background: #e9e9e9;
  border-radius: 3px;
  overflow: hidden;
}

.pred-bar {
  height: 100%;
  border-radius: 3px;
  background: #888;
}

.pred-pct {
  font-size: 0.75rem;
  color: #888;
  min-width: 34px;
  text-align: right;
}

/* ── Error ── */
.error-msg {
  width: 100%;
  max-width: 420px;
  background: #f8d7da;
  color: #721c24;
  border-radius: 6px;
  padding: 12px 18px;
  font-size: 0.85rem;
  text-align: center;
}
