:root {
  --bg: #0f1221;
  --fg: #ffffff;
  --muted: #a9b0c0;
  --accent: #53c7ff;
  --box: #1a1f35;
  --outline: rgba(255, 255, 255, 0.08);
  --header-gap: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.uploading .status {
  display: none;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  background:
    radial-gradient(900px 500px at 0% -10%, rgba(83, 199, 255, 0.12), transparent 70%),
    radial-gradient(900px 500px at 100% 10%, rgba(138, 125, 255, 0.10), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;

  color: var(--fg);
  display: grid;
  grid-template-rows: auto 1fr;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--outline);
  backdrop-filter: saturate(140%) blur(6px);
  background: rgba(15, 18, 33, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.logo {
  font-size: 1.2rem;
}

.header-actions select {
  background: var(--box);
  color: var(--fg);
  border: 1px solid var(--outline);
  padding: 8px 10px;
  border-radius: 10px;
}

.container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 18px;
  text-align: center;
}

h1 {
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  margin: 14px 0 10px;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(83, 199, 255, 0.3);
}

.status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.image-wrapper {
  position: relative;
  display: inline-block;
  margin-top: 1.2rem;
}

#image {
  max-width: 100%;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: 0 0 30px rgba(83, 199, 255, 0.15);
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

#image:hover {
  transform: scale(1.01);
}

.zoom-icon {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.1rem;
  padding: 6px 10px;
  border-radius: 20px;
  display: none;
  pointer-events: none;
  font-weight: 700;
}

.image-wrapper:hover .zoom-icon {
  display: block;
}

.link-box {
  margin: 1.2rem auto 0;
  background: var(--box);
  padding: 1rem;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--outline);
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  background: #131830;
  color: var(--fg);
  border: 1px solid var(--outline);
  border-radius: 10px;
  text-align: center;
}

.btn-outline {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: transparent;
  color: var(--fg);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-outline:hover {
  border-color: var(--accent);
  background: rgba(83, 199, 255, 0.08);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 33, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
  z-index: 50;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--outline);
}

#toast-stack {
  position: fixed;
  top: 70px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  background: rgba(18, 21, 40, 0.95);
  color: #fff;
  padding: 12px 14px 12px 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  font-size: 15px;
  font-weight: 500;
  position: relative;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: auto;
}

.toast.enter {
  animation: toastIn .28s ease forwards;
}

.toast.leave {
  animation: toastOut .28s ease forwards;
}

.toast::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  color: currentColor;
  text-shadow: 0 0 8px currentColor;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  background: none;
}

.toast--success {
  border-color: rgba(0, 200, 140, .5);
  box-shadow: 0 0 16px rgba(0, 200, 140, .25);
}

.toast--success::before {
  content: "✓";
  color: #00ffaa;
  text-shadow: 0 0 8px rgba(0, 255, 170, .6);
}

.toast--error {
  border-color: rgba(255, 70, 70, .45);
  box-shadow: 0 0 16px rgba(255, 70, 70, .25);
}

.toast--error::before {
  content: "✕";
  color: #ff6b6b;
  text-shadow: 0 0 8px rgba(255, 107, 107, .55);
}

.toast--info {
  border-color: rgba(83, 199, 255, .55);
  box-shadow: 0 0 16px rgba(83, 199, 255, .25);
}

.toast--info::before {
  content: "ℹ";
  color: #53c7ff;
  text-shadow: 0 0 8px rgba(83, 199, 255, .55);
}

.toast--warning {
  border-color: rgba(255, 200, 70, .5);
  box-shadow: 0 0 16px rgba(255, 200, 70, .25);
}

.toast--warning::before {
  content: "!";
  color: #ffd166;
  text-shadow: 0 0 8px rgba(255, 209, 102, .55);
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
  }

  60% {
    opacity: 1;
    transform: translateY(3px) scale(1.02);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
  }
}

.toast:empty {
  display: none;
}

@media (max-width: 600px) {
  .link-row {
    grid-template-columns: 1fr;
  }

  #image {
    max-height: 60vh;
  }
}

.dropzone {
  margin-top: 1.5rem;
  padding: 7rem;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.dropzone.dragover {
  background: rgba(83, 199, 255, 0.05);
  border-color: var(--fg);
}

.upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 500;
  z-index: 5;
}

.upload-overlay .progress {
  width: 80%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.upload-overlay .progress-bar {
  height: 100%;
  width: 0%;
  background: #4cafef;
  transition: width 0.2s ease;
}

.overlay-box {
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(18, 21, 40, .9);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 26px rgba(0, 0, 0, .35);
  color: #fff;
  text-align: center;
}

.overlay-box .progress {
  width: 100%;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
}

#uploadText {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

.cooldown-banner {
  position: fixed;
  left: 0;
  right: 0;
  top: 70px;
  padding: 8px 16px;
  z-index: 3000;
  backdrop-filter: blur(8px) saturate(120%);
  background: linear-gradient(180deg, rgba(15, 18, 33, .7), rgba(15, 18, 33, .55));
  border-bottom: 1px solid var(--outline);
}

.cooldown-banner-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: .95rem;
  max-width: 1100px;
  margin: 0 auto 6px;
}

.cooldown-banner .pill {
  background: rgba(83, 199, 255, .12);
  border: 1px solid var(--outline);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--accent);
}

.cooldown-banner-track {
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  max-width: 1100px;
  margin: 0 auto;
}

.cooldown-banner-bar {
  height: 100%;
  width: 0%;
  background:
    linear-gradient(90deg, var(--accent), #7cf7ff) no-repeat,
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(255, 255, 255, .15) 24px 48px);
  background-size: 100% 100%, 200px 100%;
  animation: shimmer 1.2s linear infinite;
  box-shadow: 0 0 12px rgba(124, 247, 255, .35);
  transition: width .1s linear;
}

@keyframes shimmer {
  from {
    background-position: 0 0, 0 0;
  }

  to {
    background-position: 0 0, 200px 0;
  }
}

.dropzone.disabled {
  opacity: .45;
  filter: grayscale(20%);
  pointer-events: none;
}

.recent {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #cfe2ff;
  font-weight: 600;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.recent-card {
  position: relative;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  overflow: hidden;
  background: #0b1020;
  transition: transform .15s ease, box-shadow .15s ease;
}

.recent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}

.recent-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.recent-meta {
  padding: 6px 8px;
  font-size: 12px;
  color: #a9bddb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.recent-meta a {
  color: #7fd8ff;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.recent-meta .badge {
  border: 1px solid #2a4a60;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
  color: #a8ecff;
  background: rgba(0,207,255,.08);
  flex: 0 0 auto;
}
