*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #08080c;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: #f5f5f7;
  --text-muted: rgba(255, 255, 255, 0.45);
  --text-dim: rgba(255, 255, 255, 0.25);
  --accent: #f5b942;
  --accent-bright: #ffd166;
  --accent-dim: rgba(245, 185, 66, 0.12);
  --accent-glow: rgba(245, 185, 66, 0.25);
  --success: #4ade80;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 72px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background glows — style FlashWorld */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: rgba(245, 185, 66, 0.06);
  top: -200px;
  right: -100px;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: rgba(120, 80, 255, 0.04);
  bottom: -150px;
  left: -100px;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(8, 8, 12, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-fa {
  color: var(--accent);
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 4px;
}

.nav-link {
  padding: 8px 22px;
  background: none;
  border: none;
  border-radius: 50px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-family: 'Consolas', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.server-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px 28px;
  background: var(--accent);
  border: none;
  border-radius: 50px;
  color: #0a0a0a;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-outline {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: 50px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all var(--transition);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy {
  padding: 10px 18px;
  background: var(--accent-dim);
  border: 1px solid rgba(245, 185, 66, 0.2);
  border-radius: 50px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-copy:hover {
  background: var(--accent);
  color: #0a0a0a;
}

.btn-copy.copied {
  background: rgba(74, 222, 128, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.btn-danger {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 50px;
  color: var(--danger);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: var(--danger);
  color: #0a0a0a;
  border-color: var(--danger);
}

/* Main */
.main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 48px) 32px 80px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section intro — style FlashWorld */
.section-intro {
  margin-bottom: 40px;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.section-title em {
  font-style: normal;
  color: var(--text-muted);
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* Upload */
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 640px;
  backdrop-filter: blur(10px);
}

.dropzone {
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 24px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.dropzone-icon {
  color: var(--text-dim);
  margin-bottom: 12px;
}

.dropzone-text {
  font-size: 1rem;
  color: var(--text-muted);
}

.dropzone-text .accent {
  color: var(--accent);
  font-weight: 500;
}

.dropzone-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.preview-area {
  position: relative;
  display: flex;
  justify-content: center;
}

.preview-area img {
  max-height: 280px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.btn-remove-preview {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  background: var(--danger);
  border: none;
  border-radius: 50%;
  color: #0a0a0a;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-row {
  margin-bottom: 24px;
}

.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.form-row input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.93rem;
  transition: border-color var(--transition);
}

.form-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Result */
.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  margin-top: 24px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 20px;
}

.result-check {
  width: 24px;
  height: 24px;
  background: rgba(74, 222, 128, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.result-preview {
  text-align: center;
  margin-bottom: 20px;
}

.result-preview img {
  max-height: 200px;
  border-radius: var(--radius-sm);
}

.url-box {
  margin-bottom: 12px;
}

.url-box label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.url-row {
  display: flex;
  gap: 8px;
}

.url-row input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Consolas', monospace;
  font-size: 0.82rem;
}

/* Gallery toolbar + search */
.gallery-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 12px 40px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.93rem;
  transition: all var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(245, 185, 66, 0.04);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-clear {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--border);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition);
}

.search-clear:hover {
  background: var(--border-hover);
  color: var(--text);
}

.filter-select {
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  min-width: 180px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.gallery-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.gallery-card-img {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  position: relative;
}

.gallery-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-card-img img {
  transform: scale(1.05);
}

.gallery-card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 8, 12, 0.6), transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-card:hover .gallery-card-img::after {
  opacity: 1;
}

.gallery-card-body {
  padding: 14px 16px;
}

.gallery-card-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.gallery-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  text-transform: lowercase;
}

.gallery-card-actions {
  display: flex;
  gap: 6px;
}

.gallery-card-actions button {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.gallery-card-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: #111116;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: all var(--transition);
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-content > img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.modal-info h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-all;
}

.modal-info .tag {
  display: inline-block;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .btn-outline {
  flex: 1;
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

.footer-sep {
  margin: 0 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 22px;
  background: #111116;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 50px;
  color: var(--success);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 300;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .header {
    height: auto;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .main {
    padding: calc(var(--header-h) + 80px) 16px 60px;
  }

  .header-actions {
    gap: 6px;
  }

  .server-badge span:last-child {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gallery-toolbar {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }
}
