:root {
  --brand: #6db653;
  --brand-dark: #4e8a3b;
  --brand-light: #8fd178;
  --brand-glow: rgba(109, 182, 83, 0.15);
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #1e3a5f;
  --border: #334155;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-bright: #f8fafc;
  --danger: #ef4444;
  --success: #059669;
}

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

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

/* Gate screen */
.gate-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.gate-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  width: 100%;
  max-width: 340px;
}

.gate-logo {
  height: 28px;
  margin-bottom: 1.5rem;
}

.gate-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.gate-box input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  text-align: center;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.gate-box input:focus {
  border-color: var(--brand);
}

.pin-btn {
  width: 100%;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.pin-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-logo {
  height: 32px;
  margin-bottom: 0.75rem;
}

header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

header code {
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Config section */
.config-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.input-group select,
.input-group input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group select:focus,
.input-group input[type="text"]:focus {
  border-color: var(--brand);
}

.input-group select {
  cursor: pointer;
}

.section-row {
  display: flex;
  gap: 0.5rem;
}

.section-row select {
  flex: 0 0 auto;
  min-width: 180px;
}

.section-row input {
  flex: 1;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-glow);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.drop-zone.drag-over .upload-icon,
.drop-zone:hover .upload-icon {
  color: var(--brand);
}

.drop-text {
  font-size: 1rem;
  font-weight: 600;
  color: #cbd5e1;
}

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

.drop-paste {
  font-size: 0.8rem;
  color: var(--brand);
  font-weight: 500;
}

/* Progress bar */
.progress-bar {
  margin: 1rem 0;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: 2px;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { width: 0%; margin-left: 0; }
  50% { width: 50%; margin-left: 25%; }
  100% { width: 0%; margin-left: 100%; }
}

/* Results */
.results-section {
  margin-top: 2rem;
}

.results-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.result-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

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

.result-url {
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 0.5rem;
  background: var(--bg);
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background: var(--brand-dark);
}

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

.btn-secondary:hover {
  background: #475569;
}

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

.btn-icon {
  width: 1rem;
  height: 1rem;
}

/* Error toast */
.error-toast {
  background: var(--danger);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 480px) {
  .container { padding: 1rem 0.75rem; }
  .section-row { flex-direction: column; }
  .section-row select { min-width: 100%; }
  .result-item { flex-direction: column; }
  .result-thumb { width: 100%; height: 160px; }
}
