:root {
  --brand-color: #007aff;
  --brand-hover: #0062cc;
  --bg-color: #f2f2f7;
  --card-bg: #ffffff;
  --text-primary: #1c1c1e;
  --text-secondary: #8e8e93;
  --border-color: #e5e5ea;
  --track-color: #e5e5ea;
  --success-color: #34c759;
  --danger-color: #ff3b30;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --border-radius: 16px;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-color: #0a84ff;
    --brand-hover: #006ee6;
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --border-color: #2c2c2e;
    --track-color: #38383a;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: env(safe-area-inset-top, 20px) 16px env(safe-area-inset-bottom, 20px);
  accent-color: var(--brand-color);
}

.container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 24px;
}

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

.logo-icon {
  font-size: 44px;
  margin-bottom: 8px;
}

.header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  transition: all 0.25s ease;
}

.hidden {
  display: none !important;
}

/* Visually Hidden Input for iOS Compatibility */
.visually-hidden {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Choose File Card */
.dropzone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  border: 2px dashed var(--border-color);
  background-color: var(--card-bg);
}

.choose-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--brand-color);
  color: #ffffff;
  padding: 16px 28px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.choose-button:active {
  transform: scale(0.96);
  background-color: var(--brand-hover);
}

.choose-button .icon {
  font-size: 20px;
}

.hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 14px;
}

/* Queue Card */
.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.queue-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.text-btn {
  background: none;
  border: none;
  color: var(--brand-color);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-color);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.file-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-right: 8px;
}

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

.file-size {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

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

.actions {
  display: flex;
  gap: 10px;
}

.primary-btn {
  flex: 2;
  background: var(--brand-color);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary-btn:active {
  transform: scale(0.97);
  background: var(--brand-hover);
}

.secondary-btn {
  flex: 1;
  background: var(--bg-color);
  color: var(--brand-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

.secondary-btn:active {
  transform: scale(0.97);
}

/* Progress Section */
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.upload-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.spinner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--brand-color);
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

.percentage-badge {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-color);
}

/* Accessible and WebKit Progress Bar */
.progress-track {
  width: 100%;
  margin-bottom: 10px;
}

progress {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background-color: var(--track-color);
  transition: width 0.2s ease;
}

progress::-webkit-progress-bar {
  background-color: var(--track-color);
  border-radius: 6px;
}

progress::-webkit-progress-value {
  background-color: var(--brand-color);
  border-radius: 6px;
  transition: width 0.2s ease;
}

progress::-moz-progress-bar {
  background-color: var(--brand-color);
  border-radius: 6px;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.current-file-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  background: var(--bg-color);
  padding: 8px 12px;
  border-radius: 8px;
}

.file-label {
  color: var(--text-secondary);
}

.file-name-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Success & Error Cards */
.success-card, .error-card {
  text-align: center;
  padding: 36px 20px;
}

.success-icon, .error-icon {
  font-size: 52px;
  margin-bottom: 12px;
}

.success-card h2, .error-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.success-card p, .error-card p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}
