:root {
  --bg: #0b0b0f;
  --surface: #14141a;
  --surface-2: #1c1c24;
  --border: #26262f;
  --border-focus: #7c5cff;
  --text: #e7e7ee;
  --muted: #8a8a99;
  --accent: #7c5cff;
  --accent-hover: #6a4ce0;
  --success: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 60px;
}

/* Navbar */
.navbar {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Ad slots (collapsed by default) */
.ad-slot {
  display: none;
  width: 100%;
  max-width: 900px;
  margin: 16px auto;
  text-align: center;
  overflow: hidden;
}

/* Main Layout */
.main-content {
  width: 100%;
  max-width: 900px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.card-header {
  margin-bottom: 24px;
  text-align: center;
}

.card-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.05);
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.drop-text {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 6px;
}

.browse-link {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

kbd {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text);
}

/* Selected File Box inside Dropzone */
.file-selected-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: left;
}

.file-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.file-meta {
  flex: 1;
  overflow: hidden;
}

.file-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.btn-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

.btn-remove:hover {
  color: var(--danger);
}

/* Options Grid */
.options-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .options-panel {
    grid-template-columns: 1fr;
  }
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
}

/* Checkbox */
.checkbox-group {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox::after {
  content: "✓";
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.checkbox-text {
  font-size: 0.9rem;
}

.checkbox-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin-left: 4px;
}

/* Turnstile */
.turnstile-container {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

/* Progress Bar */
.progress-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  transition: width 0.3s ease;
}

.progress-status {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.submit-row {
  margin-top: 20px;
}

.error-box {
  margin-top: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
}

/* Success Card */
.success-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.success-preview-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.success-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.success-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.success-filename {
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-all;
}

.timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--accent);
  font-weight: 600;
}

.embed-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.embed-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.embed-label {
  width: 80px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.embed-field .form-control {
  flex: 1;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.qr-container {
  margin-top: 24px;
  padding: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.qr-caption {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 10px;
}

/* Recent Uploads Drawer */
.history-drawer {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 440px;
  height: 520px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-top-left-radius: var(--radius);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-history {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
  font-size: 0.9rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.history-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.history-info {
  flex: 1;
  overflow: hidden;
}

.history-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
