:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --error: #dc2626;
  --error-light: #fef2f2;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 40px;
}

/* ===== Landing Page ===== */
#landing-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85dvh;
  text-align: center;
}

.landing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rings-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: #b45309;
}

.landing-subtitle {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.landing-names {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-divider {
  width: 48px;
  height: 2px;
  background: var(--border);
  margin: 20px 0;
  border-radius: 1px;
}

.landing-message {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 32px;
}

#landing-continue {
  padding: 14px 36px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: var(--shadow-md);
}

#landing-continue:hover {
  background: var(--primary-hover);
}

#landing-continue:active {
  transform: scale(0.97);
}

/* ===== Password Gate ===== */
#password-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  text-align: center;
}

.lock-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--primary);
}

#password-section h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

#password-section p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

#password-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

#password-input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}

#password-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#password-form button {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#password-form button:hover {
  background: var(--primary-hover);
}

#password-form button:active {
  transform: scale(0.97);
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 12px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

#password-form.shake {
  animation: shake 0.4s ease;
}

/* ===== Upload Section ===== */
#event-info {
  text-align: center;
  margin-bottom: 24px;
}

#event-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

#event-info p {
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.welcome-message {
  background: var(--primary-light);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.welcome-message p {
  color: var(--primary);
  font-size: 0.85rem;
  line-height: 1.6;
  font-weight: 500;
}

/* ===== Drop Zone ===== */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  color: var(--text-muted);
  background: var(--surface);
}

#drop-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

#drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}

#drop-zone svg {
  margin-bottom: 10px;
  opacity: 0.4;
}

#drop-zone p {
  font-size: 0.85rem;
}

#file-input, #camera-input {
  display: none;
}

/* ===== Action Buttons (Choose / Camera) ===== */
#action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#action-buttons button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  box-shadow: var(--shadow);
}

#action-buttons button:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

#action-buttons button:active {
  transform: scale(0.97);
}

#action-buttons button svg {
  opacity: 0.6;
}

/* ===== Upload Queue ===== */
#upload-queue {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, opacity 0.2s;
  animation: slideIn 0.2s ease;
}

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

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

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

.file-card .name {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card .size {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-card .remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.file-card .remove:hover {
  color: var(--error);
  background: var(--error-light);
}

.file-card .progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 0 0 var(--radius) var(--radius);
}

.file-card.uploading .progress-bar {
  animation: pulse 1.5s infinite;
}

.file-card.done {
  border-color: #bbf7d0;
}

.file-card.done .progress-bar {
  background: var(--success);
  width: 100% !important;
}

.file-card.error {
  border-color: #fecaca;
}

.file-card.error .progress-bar {
  background: var(--error);
  width: 100% !important;
}

.file-card .status-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Upload Button ===== */
#upload-btn {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: var(--shadow-md);
}

#upload-btn:hover {
  background: var(--primary-hover);
}

#upload-btn:active {
  transform: scale(0.98);
}

#upload-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== Toast Notifications ===== */
#toast {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  text-align: center;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

#toast.success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

#toast.fail {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid #fecaca;
}

#toast.warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ===== Upload Summary ===== */
#history-section {
  margin-top: 28px;
}

#history-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#history-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#history-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#history-count {
  font-size: 0.85rem;
  font-weight: 600;
}

#history-latest {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

#view-photos-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

#view-photos-btn:hover {
  background: var(--primary-hover);
}

#view-photos-btn:active {
  transform: scale(0.97);
}

/* ===== Utilities ===== */
.hidden { display: none !important; }

#upload-section {
  animation: fadeIn 0.3s ease;
}

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