:root {
  color-scheme: dark;
  --bg: #0c1110;
  --panel: #151b1a;
  --panel-strong: #1b2421;
  --text: #edf4ef;
  --muted: #9badad;
  --line: rgba(237, 244, 239, 0.13);
  --accent: #70d6a8;
  --accent-strong: #22b573;
  --amber: #f6b85a;
  --rose: #f07a8a;
  --blue: #86a8ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(112, 214, 168, 0.14), transparent 34%),
    linear-gradient(320deg, rgba(134, 168, 255, 0.12), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.workspace {
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.model-status,
.presence-strip,
.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.model-status {
  justify-content: flex-end;
  min-width: 250px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 18px rgba(246, 184, 90, 0.7);
}

.model-status.ready .status-dot {
  background: var(--accent);
  box-shadow: 0 0 18px rgba(112, 214, 168, 0.7);
}

.model-status.error .status-dot {
  background: var(--rose);
  box-shadow: 0 0 18px rgba(240, 122, 138, 0.7);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  gap: 22px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 26, 0.88);
  box-shadow: var(--shadow);
}

.upload-panel,
.result-panel {
  padding: 22px;
}

.section-heading {
  margin-bottom: 18px;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.dropzone {
  display: grid;
  gap: 18px;
  place-items: center;
  min-height: 260px;
  padding: 26px;
  border: 1px dashed rgba(112, 214, 168, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(112, 214, 168, 0.09), transparent),
    rgba(255, 255, 255, 0.035);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(134, 168, 255, 0.62);
  outline-offset: 3px;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: rgba(112, 214, 168, 0.14);
  transform: translateY(-1px);
}

.dropzone-copy {
  display: grid;
  gap: 8px;
}

.dropzone-copy strong {
  font-size: 1.2rem;
}

.dropzone-copy span,
.muted,
.status-text {
  color: var(--muted);
}

.preview {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.preview img {
  width: 112px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #0a0e0d;
}

.preview-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.preview-meta strong,
.preview-meta span {
  overflow-wrap: anywhere;
}

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

.btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, border-color 140ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #06110d;
}

.btn-secondary,
.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.btn-ghost {
  color: var(--muted);
}

.status-text {
  min-height: 1.4em;
  margin: 0;
}

.empty-result {
  min-height: 380px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-align: center;
}

.empty-result p {
  max-width: 390px;
  margin-bottom: 0;
}

.result-content {
  display: grid;
  gap: 18px;
}

.verdict {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(112, 214, 168, 0.28);
  border-radius: 8px;
  background: var(--panel-strong);
}

.verdict-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.verdict strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.65rem;
}

.confidence-pill {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(112, 214, 168, 0.14);
  color: var(--accent);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
}

.presence-strip {
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid rgba(134, 168, 255, 0.26);
  border-radius: 8px;
  background: rgba(134, 168, 255, 0.08);
}

.warning {
  padding: 12px 14px;
  border: 1px solid rgba(246, 184, 90, 0.35);
  border-radius: 8px;
  background: rgba(246, 184, 90, 0.1);
  color: #ffdca2;
}

.probability-section {
  padding-top: 2px;
}

.probability-list {
  display: grid;
  gap: 10px;
}

.probability-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(120px, 1fr) 58px;
  gap: 12px;
  align-items: center;
}

.probability-name {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.probability-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.probability-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--amber));
  transition: width 220ms ease;
}

.probability-row.presence .probability-fill {
  background: linear-gradient(90deg, var(--blue), var(--accent));
}

.probability-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.result-meta {
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-status {
    width: 100%;
    justify-content: flex-start;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding: 18px 0;
  }

  .upload-panel,
  .result-panel {
    padding: 16px;
  }

  .dropzone {
    min-height: 220px;
    padding: 18px;
  }

  .preview {
    grid-template-columns: 1fr;
  }

  .preview img {
    width: 100%;
  }

  .actions,
  .verdict {
    flex-direction: column;
    align-items: stretch;
  }

  .confidence-pill {
    width: 100%;
  }

  .probability-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .probability-value {
    text-align: left;
  }
}
