:root {
  --primary:      #2563eb;
  --primary-light:#4f8cff;
  --bg:           #0d1117;
  --card:         #161b22;
  --card2:        #1c2333;
  --border:       rgba(255,255,255,.08);
  --text:         #e6edf3;
  --muted:        #7d8590;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --font-ui:      'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --shadow:       0 8px 40px rgba(0,0,0,.35);
  --radius:       10px;
  --radius-lg:    16px;
  --trans:        0.18s ease;
}

/* ── Light ── */
html[data-theme="light"] {
  --bg:           #f0f4f8;
  --card:         #ffffff;
  --card2:        #f8fafc;
  --border:       rgba(0,0,0,.08);
  --text:         #0f172a;
  --muted:        #64748b;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --shadow:       0 8px 40px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
  position: relative;
  transition: background-color var(--trans), color var(--trans);
}

/* Grid bg texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(79,140,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,140,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 0;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--card); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  height: 52px;
  background: rgba(13,17,23,.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}

html[data-theme="light"] .topbar {
  background: rgba(248,250,252,.92);
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}

.topbar-left {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  min-width: 0;
}

.topbar-logo-icon {
  font-size: 22px;
  color: var(--primary-light);
  flex-shrink: 0;
}

.logo-name {
  font-size: 14px; font-weight: 700;
  letter-spacing: .2px; white-space: nowrap;
}

.logo-accent { color: var(--primary-light); }

.topbar-center {
  display: flex; align-items: center; justify-content: center;
}

.topbar-page-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 12px;
  background: rgba(79,140,255,.07);
  border: 1px solid rgba(79,140,255,.14);
  border-radius: 20px;
  white-space: nowrap;
}

.topbar-right {
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
}

.header-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  transition: background var(--trans);
  flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.status-dot.offline { background: var(--danger);  box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

.btn-icon {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); text-decoration: none;
  flex-shrink: 0;
}
.btn-icon:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
  background: rgba(79,140,255,.07);
}
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn-icon.btn-danger-icon:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239,68,68,.08);
}
.btn-icon .material-icons-round { font-size: 16px; }
.btn-icon.btn-sm .material-icons-round { font-size: 15px; }

/* Moon/Sun toggle */
html[data-theme="dark"]  #themeToggle .icon-sun  { display: none; }
html[data-theme="dark"]  #themeToggle .icon-moon { display: block; }
html[data-theme="light"] #themeToggle .icon-moon { display: none; }
html[data-theme="light"] #themeToggle .icon-sun  { display: block; }

/* ── WRAP ── */
.wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 540px;
  margin-top: 68px;
}

/* ── PAGE HEAD ── */
.page-head {
  text-align: center; margin-bottom: 28px;
}

.head-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(79,140,255,.08);
  border: 1px solid rgba(79,140,255,.2);
  padding: 4px 14px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: #4f8cff; text-transform: uppercase; margin-bottom: 14px;
}
.head-badge .material-icons-round { font-size: 13px; }

.page-head h1 {
  font-size: 1.85rem; font-weight: 800; letter-spacing: -.5px;
  color: var(--text); margin-bottom: 8px; line-height: 1.2;
}
html[data-theme="dark"] .page-head h1 { color: #fff; }
.page-head h1 span { color: var(--primary-light); }

.page-head p {
  font-size: 13px; color: var(--muted); line-height: 1.6;
  max-width: 380px; margin: 0 auto;
}

/* ── BANNER CARD ── */
.banner-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
html[data-theme="dark"] .banner-card { border-color: rgba(79,140,255,.12); }

.banner-img-wrap {
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(37,99,235,.18) 0%, rgba(79,140,255,.08) 100%);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .banner-img-wrap {
  border-bottom-color: rgba(79,140,255,.12);
}

.banner-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.banner-card:hover .banner-img { transform: scale(1.02); }

.banner-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.banner-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--primary-light);
  background: rgba(79,140,255,.08);
  border: 1px solid rgba(79,140,255,.2);
  border-radius: 20px;
  padding: 4px 12px;
  width: fit-content;
}
.banner-tag .material-icons-round { font-size: 12px; }

.banner-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── MAIN CARD ── */
.main-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
html[data-theme="dark"] .main-card { border-color: rgba(79,140,255,.12); }

.section-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; letter-spacing: 2px; font-weight: 700;
  text-transform: uppercase; color: var(--muted);
}
.section-label .material-icons-round { font-size: 15px; color: var(--primary-light); }

/* ── DROP ZONE ── */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center; cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(79,140,255,.05);
}
.drop-zone.dragover { border-style: solid; }
.drop-icon { font-size: 36px; color: var(--primary-light); opacity: .7; margin-bottom: 4px; }
.drop-title { font-size: .93rem; font-weight: 600; color: var(--text); }
.drop-sub { font-size: .78rem; color: var(--muted); }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ── PREVIEW GRID ── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}
.preview-item {
  position: relative; border-radius: 8px;
  overflow: hidden; background: var(--card2);
  border: 1px solid var(--border);
  aspect-ratio: 1;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; transform:scale(.94); } to { opacity:1; transform:scale(1); } }
.preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-item .overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.52);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  opacity: 0; transition: opacity var(--trans);
}
.preview-item:hover .overlay { opacity: 1; }
.preview-item .file-name {
  font-size: .62rem; color: #fff;
  font-family: var(--font-mono);
  padding: 0 6px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.preview-remove {
  background: var(--danger); border: none; cursor: pointer;
  color: #fff; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.preview-remove .material-icons-round { font-size: 14px; }

/* Upload state overlay */
.preview-item .upload-overlay {
  position: absolute; inset: 0;
  background: rgba(13,15,20,.76);
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-item .done-check { font-size: 26px; color: var(--success); }

/* ── SUBMIT BUTTON ── */
.btn-submit {
  width: 100%; padding: 13px;
  border-radius: 11px;
  border: none; background: var(--primary); color: #fff;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter var(--trans), transform .1s, box-shadow var(--trans);
  box-shadow: 0 4px 20px rgba(37,99,235,.3);
}
.btn-submit:not(:disabled):hover { filter: brightness(1.1); box-shadow: 0 6px 28px rgba(37,99,235,.4); }
.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { opacity: .4; cursor: not-allowed; }
.btn-submit .material-icons-round { font-size: 18px; }

/* ── URL LIST ── */
.url-list { display: flex; flex-direction: column; gap: 8px; }

.url-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  animation: fadeIn .2s ease;
}
.url-thumb {
  width: 38px; height: 38px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.url-info { flex: 1; min-width: 0; }
.url-filename {
  font-size: .8rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.url-link {
  font-family: var(--font-mono); font-size: .7rem; color: var(--primary-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
  margin-top: 2px;
}
.url-copy {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); cursor: pointer; padding: 6px;
  display: flex; align-items: center; flex-shrink: 0;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.url-copy:hover { color: var(--primary-light); border-color: var(--primary-light); background: rgba(79,140,255,.07); }
.url-copy .material-icons-round { font-size: 15px; }
.url-copy.copied { color: var(--success); border-color: var(--success); background: rgba(34,197,94,.1); }

/* ── HISTORY CARD ── */
.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
html[data-theme="dark"] .history-card { border-color: rgba(79,140,255,.12); }

.history-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.history-head h3 { font-size: 13px; font-weight: 700; }
.history-actions { display: flex; align-items: center; gap: 6px; }

.history-list { display: flex; flex-direction: column; }

.history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
  animation: fadeIn .2s ease;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(255,255,255,.02); }

.history-thumb {
  width: 38px; height: 38px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card2);
  display: flex; align-items: center; justify-content: center;
}
.history-info { flex: 1; min-width: 0; }
.history-name {
  font-size: .82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.history-copy {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); cursor: pointer; padding: 5px;
  display: flex; align-items: center; flex-shrink: 0;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.history-copy:hover { color: var(--primary-light); border-color: var(--primary-light); background: rgba(79,140,255,.07); }
.history-copy .material-icons-round { font-size: 15px; }

/* ── EMPTY STATE ── */
.empty-state {
  padding: 36px 20px; text-align: center;
  color: var(--muted); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state .material-icons-round { font-size: 36px; opacity: .25; }

/* ── TOAST ── */
.toast-container {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 9999; width: 92%; max-width: 380px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  pointer-events: auto;
  font-size: .82rem; color: var(--text);
  animation: toastIn .2s ease;
}
.toast.removing { animation: toastOut .2s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(-12px) scale(.96); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(-8px) scale(.96); } }

.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(239,68,68,.3); }
.toast.info    { border-color: rgba(79,140,255,.3); }

.toast .material-icons-round {
  font-size: 17px; flex-shrink: 0; margin-top: 1px;
}
.toast.success .material-icons-round { color: var(--success); }
.toast.error   .material-icons-round { color: var(--danger); }
.toast.info    .material-icons-round { color: var(--primary-light); }

/* ── FOOTER ── */
.page-footer {
  margin-top: 24px; text-align: center;
  font-size: 10px; color: var(--muted); opacity: .45;
  letter-spacing: .5px; position: relative; z-index: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 420px) {
  .page-head h1 { font-size: 1.5rem; }
  .main-card { padding: 18px; }
  .header-status .status-label { display: none; }
}

/* ── MATERIAL SYMBOLS ROUNDED ── */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.btn-docs-topbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(79,140,255,.28);
  background: rgba(79,140,255,.08);
  color: var(--primary-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-docs-topbar:hover {
  background: rgba(79,140,255,.18);
  border-color: var(--primary-light);
  box-shadow: 0 0 12px rgba(79,140,255,.2);
  transform: translateY(-1px);
}
.btn-docs-topbar:active {
  transform: translateY(0);
}
@media (max-width: 380px) {
  .btn-docs-topbar span { display: none; }
  .btn-docs-topbar { width: 30px; justify-content: center; padding: 0; }
}

.docs-cta {
  margin-bottom: 16px;
}

.btn-docs-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(79,140,255,.22);
  background: linear-gradient(135deg, rgba(37,99,235,.08) 0%, rgba(79,140,255,.04) 100%);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-docs-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79,140,255,.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-docs-cta:hover {
  border-color: rgba(79,140,255,.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,99,235,.18);
}
.btn-docs-cta:hover::before { opacity: 1; }
.btn-docs-cta:active { transform: translateY(0); }

.btn-docs-cta > .material-icons-round {
  font-size: 22px;
  color: var(--primary-light);
  flex-shrink: 0;
  position: relative;
}

.btn-docs-cta-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}

.btn-docs-cta-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.btn-docs-cta-sub {
  font-size: 11px;
  color: var(--muted);
}

.btn-docs-arrow {
  color: var(--primary-light);
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
  position: relative;
}
.btn-docs-cta:hover .btn-docs-arrow {
  transform: translateX(3px);
  opacity: 1;
   }
