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

:root {
  --bg: #0a0a0a;
  --card: #141414;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --text-dim: #888;
  --accent: #fff;
  --danger: #e74c3c;
  --success: #27ae60;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* Form */
.form-group {
  margin-bottom: 12px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: #ddd;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #3a3a3a;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* Status */
.status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
  display: none;
}

.status.success {
  display: block;
  background: rgba(39, 174, 96, 0.15);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.status.error {
  display: block;
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Upload Area */
.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.03);
}

.file-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  pointer-events: none;
}

.upload-label svg {
  color: #555;
}

.upload-text {
  font-size: 15px;
  font-weight: 500;
}

.upload-hint {
  font-size: 12px;
  color: #555;
}

/* Upload Queue */
.upload-queue {
  margin-top: 12px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.upload-item img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
}

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

.upload-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item-status {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.upload-item-status.done {
  color: var(--success);
}

.upload-item-status.error {
  color: var(--danger);
}

.upload-item-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.upload-item-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.upload-item-url {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.upload-item-url input {
  flex: 1;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-family: monospace;
}

.upload-item-url button {
  font-size: 11px;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #000;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

/* Gallery */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gallery-header h2 {
  margin-bottom: 0;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}

.gallery-item:hover {
  transform: scale(1.03);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .copy-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-item:hover .copy-btn {
  opacity: 1;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  font-size: 13px;
  grid-column: 1 / -1;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.pagination button.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1000;
}

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

.modal-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.modal-content img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-info {
  padding: 16px 20px;
}

.url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.url-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
}

.modal-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: #000;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 16px 12px;
  }

  header h1 {
    font-size: 22px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .modal-content {
    width: 95%;
  }
}
