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

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg-card:     #161b27;
  --bg-input:    #1a2030;
  --bg-hover:    #1f2840;
  --border:      #252d3f;
  --border-hi:   #3b4a6b;
  --accent:      #E84D3D;
  --accent-glow: rgba(232,77,61,.20);
  --accent-dim:  rgba(232,77,61,.10);
  --green:       #22c55e;
  --green-bg:    rgba(34,197,94,.10);
  --green-border:rgba(34,197,94,.22);
  --red-bg:      rgba(239,68,68,.10);
  --red-border:  rgba(239,68,68,.22);
  --t1:          #f0f4f8;
  --t2:          #8899b4;
  --t3:          #3d4f6a;
  --mono:        'JetBrains Mono', monospace;
  --sans:        'Plus Jakarta Sans', sans-serif;
  --r:           12px;
  --r-sm:        8px;
  --ease:        .17s ease;
}

/* ── Base ───────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 40% at 50% 0%,
    rgba(232,77,61,.06) 0%, transparent 65%);
  color: var(--t1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13,17,23,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo-text {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--t1);
  letter-spacing: -.2px;
}
.logo-dot { color: var(--accent); }
.header-nav { display: flex; gap: 2px; }
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 7px;
  transition: var(--ease);
}
.nav-link:hover { color: var(--t1); background: var(--bg-hover); }

/* ── Main ───────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 52px 18px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}
.badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(232,77,61,.24);
  padding: 5px 12px;
  border-radius: 100px;
}
.hero-title {
  font-size: clamp(24px, 5.5vw, 34px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.7px;
}
.hero-sub {
  font-size: 14.5px;
  color: var(--t2);
  line-height: 1.6;
  max-width: 360px;
}

/* ── Card ───────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,.35), 0 12px 40px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Drop Zone (label wraps input — no aria-hidden needed) ──────────── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  border: 1.5px dashed var(--border-hi);
  border-radius: var(--r);
  padding: 42px 20px;
  background: var(--bg-input);
  cursor: pointer;
  transition: var(--ease);
  position: relative;
  user-select: none;
}
.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--accent);
  background: rgba(232,77,61,.04);
}
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.01);
}
.dropzone-icon {
  color: var(--t3);
  transition: var(--ease);
}
.dropzone:hover .dropzone-icon,
.dropzone.drag-over .dropzone-icon {
  color: var(--accent);
}
.dropzone-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--t1);
}
.dropzone-sub {
  font-size: 13px;
  color: var(--t2);
}
/* The real file input — visually hidden but accessible via label */
.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* ── File Preview ───────────────────────────────────────────────────── */
.file-preview {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  animation: fadeUp .2s ease;
}
.fp-icon { color: var(--accent); flex-shrink: 0; }
.fp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fp-size {
  font-size: 11.5px;
  color: var(--t2);
  font-family: var(--mono);
}
.fp-clear {
  background: none;
  border: none;
  color: var(--t3);
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: var(--ease);
}
.fp-clear:hover { color: var(--t1); background: var(--bg-hover); }

/* ── Upload Button ──────────────────────────────────────────────────── */
.btn-upload {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 13px 20px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
  position: relative;
}
.btn-upload::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.09) 0%, transparent 60%);
  pointer-events: none;
}
.btn-upload:hover:not(:disabled) {
  background: #d44030;
  box-shadow: 0 4px 22px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-upload:active:not(:disabled) { transform: translateY(0); }
.btn-upload:disabled {
  background: var(--bg-hover);
  color: var(--t3);
  cursor: not-allowed;
}
.btn-upload:disabled .btn-icon { opacity: .35; }

/* spinner state */
.btn-upload.uploading .btn-icon { display: none; }
.btn-upload.uploading #btnLabel::after {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

/* ── Progress ───────────────────────────────────────────────────────── */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeUp .2s ease;
}
.progress-track {
  height: 3px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 100px;
  transition: width .3s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}
.progress-fill.indeterminate {
  width: 38% !important;
  animation: indeterminate 1.1s ease-in-out infinite;
}
.progress-text {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--t2);
  text-align: center;
}

/* ── Result Boxes ───────────────────────────────────────────────────── */
.result {
  border-radius: var(--r-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeUp .22s ease;
}
.success-box {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}
.error-box {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}
.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dot-green { background: rgba(34,197,94,.18); color: var(--green); }
.dot-red   { background: rgba(239,68,68,.18); color: #ef4444; }
.result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
}

/* ── URL Block ──────────────────────────────────────────────────────── */
.url-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.url-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--t2);
  font-family: var(--mono);
}
.url-row {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.url-text {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t1);
  padding: 10px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.url-btns {
  display: flex;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}
.icon-btn {
  background: none;
  border: none;
  color: var(--t2);
  cursor: pointer;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  transition: var(--ease);
}
.icon-btn:hover { color: var(--t1); background: var(--bg-hover); }
.icon-btn + .icon-btn { border-left: 1px solid var(--border); }
.icon-btn.copied { color: var(--green); }

.error-text {
  font-size: 13px;
  color: var(--t2);
  line-height: 1.55;
}

/* ── Secondary Button ───────────────────────────────────────────────── */
.btn-secondary {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--t2);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: var(--ease);
  align-self: flex-start;
}
.btn-secondary:hover {
  color: var(--t1);
  border-color: var(--border-hi);
  background: var(--bg-hover);
}

/* ── Pills ──────────────────────────────────────────────────────────── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--t2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 100px;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 18px 20px;
  font-size: 12px;
  color: var(--t3);
  font-family: var(--mono);
  border-top: 1px solid var(--border);
}

/* ── Keyframes ──────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes indeterminate {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .main         { padding: 32px 14px 28px; gap: 22px; }
  .card         { padding: 18px; }
  .dropzone     { padding: 34px 16px; }
  .hero-title   { font-size: 22px; }
  .header-inner { padding: 0 14px; }
  .nav-link     { padding: 5px 8px; font-size: 12px; }
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px;
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
  cursor: pointer;
  transition: var(--ease);
}
.tab:hover:not(.active) {
  color: var(--t1);
  background: var(--bg-hover);
}
.tab.active {
  background: var(--bg-card);
  color: var(--t1);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.tab svg { flex-shrink: 0; }

/* ── URL Import Panel ────────────────────────────────────────────────── */
.url-import-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.url-import-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-hi);
  border-radius: var(--r);
  padding: 0 14px;
  transition: border-color var(--ease);
}
.url-import-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.url-import-field.has-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.url-import-icon { color: var(--t3); flex-shrink: 0; }
.url-import-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--t1);
  padding: 13px 0;
  min-width: 0;
}
.url-import-input::placeholder { color: var(--t3); }
.url-clear-btn {
  background: none;
  border: none;
  color: var(--t3);
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: var(--ease);
}
.url-clear-btn:hover { color: var(--t1); background: var(--bg-hover); }

/* URL image preview */
.url-img-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  animation: fadeUp .2s ease;
}
.url-img-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}
.url-img-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.url-hint {
  font-size: 12px;
  color: var(--t3);
  line-height: 1.55;
}

/* Success image preview */
.success-img-wrap {
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.success-img-wrap img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}