:root {
  --bg: #0a0a0f;
  --bg-2: #120a1f;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.55);
  --card: rgba(22, 18, 36, 0.55);
  --card-border: rgba(139, 92, 246, 0.18);
  --text: #f4f2fb;
  --text-dim: #a09bb8;
  --text-mute: #6f6a86;
  --success: #34d399;
  --danger: #f87171;
  --radius: 18px;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(
      1200px 600px at 80% -10%,
      rgba(139, 92, 246, 0.18),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
      600px 400px at 15% 110%,
      rgba(167, 139, 250, 0.14),
      transparent 70%
    ),
    radial-gradient(500px 300px at 90% 80%, rgba(139, 92, 246, 0.1), transparent 70%);
  z-index: 0;
}

/* HEADER */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  max-width: 1240px;
  margin: 0 auto;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px #fff;
  animation: pulse 2.4s ease-in-out infinite;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}

.brand-tag {
  font-size: 0.74rem;
  color: var(--text-mute);
  letter-spacing: 0.4px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 8px 14px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(14px);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 1.8s ease-in-out infinite;
}

/* LAYOUT */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 40px 80px;
}

.hero {
  margin: 28px 0 36px;
  max-width: 720px;
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.5px;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 580px;
}

.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}

.col-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px;
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: rise 0.5s ease both;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-head h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.badge-soft {
  font-size: 0.72rem;
  color: var(--accent-2);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--card-border);
  padding: 5px 11px;
  border-radius: 999px;
}

.badge-success {
  font-size: 0.72rem;
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 5px 11px;
  border-radius: 999px;
}

/* DROPZONE */
.dropzone {
  border: 1.6px dashed rgba(139, 92, 246, 0.4);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  background: rgba(139, 92, 246, 0.03);
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.14);
  box-shadow: inset 0 0 40px rgba(139, 92, 246, 0.15);
  transform: scale(1.01);
}

.drop-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--accent-2);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--card-border);
}

.drop-title {
  font-weight: 600;
  font-size: 1rem;
}

.drop-sub {
  color: var(--text-mute);
  font-size: 0.84rem;
  margin: 8px 0;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent-2);
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* PREVIEW */
.drop-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.preview-media img {
  max-height: 180px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.preview-icon {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--card-border);
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.preview-name {
  font-size: 0.92rem;
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.btn-clear:hover {
  color: var(--danger);
}

/* PRIMARY BUTTON */
.btn-primary {
  margin-top: 22px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 0.96rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 8px 26px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 36px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.error-msg {
  margin-top: 14px;
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
}

/* RESULTS */
.result-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.result-key {
  color: var(--text-mute);
  font-size: 0.82rem;
}

.result-val {
  font-size: 0.9rem;
  font-weight: 500;
}

.result-val.mono {
  font-family: "Space Grotesk", monospace;
  color: var(--accent-2);
  font-size: 0.82rem;
}

.actions-block {
  margin: 20px 0 4px;
}

.actions-list {
  list-style: none;
  margin-top: 12px;
  display: grid;
  gap: 9px;
}

.actions-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-dim);
  animation: rise 0.4s ease both;
}

.actions-list li::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-2), var(--accent));
  box-shadow: 0 0 10px var(--accent-glow);
}

/* HISTORY */
.history-card {
  position: sticky;
  top: 24px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
}

.history-empty {
  color: var(--text-mute);
  font-size: 0.86rem;
  text-align: center;
  padding: 30px 10px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(139, 92, 246, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  animation: rise 0.4s ease both;
}

.history-item:hover {
  border-color: var(--card-border);
  background: rgba(139, 92, 246, 0.12);
  transform: translateX(3px);
}

.hist-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
}

.hist-info {
  flex: 1;
  min-width: 0;
}

.hist-name {
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-time {
  font-size: 0.72rem;
  color: var(--text-mute);
  margin-top: 2px;
}

/* OVERLAY */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(6, 5, 12, 0.78);
  backdrop-filter: blur(8px);
  animation: fade 0.3s ease;
}

.overlay-card {
  text-align: center;
  padding: 40px;
}

.orbit {
  width: 90px;
  height: 90px;
  margin: 0 auto 26px;
  position: relative;
}

.orbit span {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
}

.orbit span:nth-child(1) {
  border-top-color: var(--accent);
  animation: spin 1.1s linear infinite;
}

.orbit span:nth-child(2) {
  inset: 14px;
  border-right-color: var(--accent-2);
  animation: spin 1.5s linear infinite reverse;
}

.orbit span:nth-child(3) {
  inset: 28px;
  border-bottom-color: #fff;
  animation: spin 0.9s linear infinite;
}

.overlay-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.overlay-sub {
  color: var(--accent-2);
  font-size: 0.86rem;
  margin-top: 8px;
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 999px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .site-header,
  .layout {
    padding-left: 22px;
    padding-right: 22px;
  }
  .history-card {
    position: static;
  }
}
