:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: rgba(17, 24, 39, 0.9);
  --panel-2: rgba(15, 23, 42, 0.94);
  --line: rgba(255, 255, 255, 0.2);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --shadow: 0 26px 80px rgba(2, 6, 23, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 12%, rgba(56, 189, 248, 0.16), transparent 34rem),
    radial-gradient(circle at 88% 88%, rgba(34, 197, 94, 0.13), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px;
}

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

.sidebar {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.brand {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
label {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.92;
}

p {
  color: var(--muted);
}

.controls {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
}

label,
.file-label {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

select option {
  background: #111827;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.tabs ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tabs a,
button,
.file-cta {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.tabs .is-active a,
button,
.file-cta {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(14, 165, 233, 0.9));
  color: #03131a;
}

.file-input {
  display: none;
}

.file-name {
  min-height: 40px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.28);
  color: var(--muted);
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url {
  display: grid;
  gap: 10px;
}

.source-card {
  display: grid;
  gap: 8px;
  margin: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.28);
}

.source-card a {
  color: var(--text);
  font-weight: 900;
}

.stage {
  min-width: 0;
}

.classifier-panel {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.stage-top {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.panel-block,
.empty-state {
  min-height: 0;
  padding: 18px;
}

.card {
  display: grid;
  grid-template-columns: minmax(260px, 0.46fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.card-image {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.34);
  overflow: hidden;
}

img {
  width: 100%;
  max-height: 620px;
  display: block;
  object-fit: contain;
}

#result {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#result li {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  padding: 12px;
}

#result progress {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.45);
}

#result progress::-webkit-progress-bar {
  background: rgba(2, 6, 23, 0.45);
}

#result progress::-webkit-progress-value {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(14, 165, 233, 0.9));
}

.empty-state {
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.empty-state__title {
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 900;
}

.loading-status {
  opacity: 0.45;
}

.loading-ring {
  position: fixed;
  top: calc(50% - 40px);
  left: calc(50% - 40px);
  width: 80px;
  height: 80px;
  z-index: 4;
}

.loading-ring::after {
  content: "";
  display: block;
  width: 64px;
  height: 64px;
  margin: 8px;
  border-radius: 50%;
  border: 6px solid var(--accent-2);
  border-color: var(--accent-2) transparent var(--accent) transparent;
  animation: spin 1.2s linear infinite;
}

.notification {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  font-weight: 900;
}

.notification.is-success {
  border-color: rgba(34, 197, 94, 0.7);
}

.notification.is-danger {
  border-color: rgba(251, 113, 133, 0.7);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

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

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar,
  .classifier-panel {
    min-height: auto;
  }

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