* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #14181f;
  color: #e8eaed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: #1d232e;
  border-bottom: 1px solid #2c3542;
}
header h1 { font-size: 20px; margin: 0; }

.badge {
  background: #2c3542;
  border-radius: 10px;
  padding: 3px 10px;
  font-size: 12px;
  color: #9fb0c3;
}

section { padding: 20px 24px; flex: 1; }

.scan-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.scan-header h2 { font-size: 17px; margin: 0; font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  max-width: 740px;
}
.grid img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #000;
  border: 1px solid #2c3542;
  border-radius: 4px;
  image-rendering: pixelated;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

button {
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
}
button.primary { background: #2f7d4f; color: #fff; }
button.primary:hover { background: #37945e; }
button.secondary { background: #34558b; color: #fff; }
button.secondary:hover { background: #3f66a3; }

.upload {
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed #3a4656;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.upload label { font-size: 14px; color: #9fb0c3; }
.upload input[type="file"] { color: #9fb0c3; font-size: 13px; max-width: 340px; }
.upload-msg {
  flex-basis: 100%;
  margin: 8px 0 0;
  background: #5c2323;
  border: 1px solid #a04040;
  color: #ffd7d7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.result { max-width: 640px; margin-top: 10px; }
.percent { font-size: 56px; font-weight: 700; margin: 8px 0 12px; }

.bar {
  height: 26px;
  background: #7a2e2e; /* red = high risk */
  border-radius: 5px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: #2f9e5f; /* green = low risk */
  transition: width 0.8s ease;
}
.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #9fb0c3;
  margin-top: 4px;
}
.label { font-size: 20px; font-weight: 600; margin-top: 14px; }
.model-line { color: #9fb0c3; font-size: 13px; }
.read-more { color: #9fb0c3; font-size: 13px; margin-top: 6px; max-width: 640px; }
.read-more a { color: #7fb3e8; }

.error {
  background: #5c2323;
  border: 1px solid #a04040;
  color: #ffd7d7;
  padding: 10px 16px;
  margin: 12px 24px 0;
  border-radius: 6px;
  font-size: 14px;
  white-space: pre-wrap;
}

.spinner {
  position: fixed;
  top: 70px;
  right: 24px;
  background: #2c3542;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: 0.6; } to { opacity: 1; } }

.hidden { display: none !important; }

footer {
  padding: 12px 24px;
  font-size: 12px;
  color: #6b7889;
  border-top: 1px solid #2c3542;
}

@media (max-width: 640px) {
  header { padding: 12px 16px; flex-wrap: wrap; }
  section { padding: 16px; }
  .percent { font-size: 40px; }
  .upload input[type="file"] { max-width: 100%; }
}
