:root {
  --primary: #6B46C1;
  --primary-dark: #553C9A;
  --primary-light: #9333EA;
  --secondary: #EC4899;
  --background: #FAFAFA;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-light: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --danger: #EF4444;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary);
  text-decoration: none;
  font-size: 16px;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 0.8;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.subtitle {
  color: var(--text-light);
  font-size: 18px;
  margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--primary-light));
  width: 0%;
  transition: width 0.3s ease;
}

/* Pattern Cards */
.pattern-container {
  flex: 1;
  margin-bottom: 40px;
}

.pattern-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.pattern-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pattern-card.selected {
  border-color: var(--primary);
  background: linear-gradient(to right, rgba(107, 70, 193, 0.05), rgba(147, 51, 234, 0.05));
}

.pattern-card.dismissed {
  opacity: 0;
  transform: translateX(-100%);
  pointer-events: none;
}

.pattern-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pattern-icon {
  font-size: 24px;
}

.pattern-items {
  list-style: none;
  margin-bottom: 20px;
}

.pattern-items li {
  padding: 8px 0;
  color: var(--text-light);
  border-bottom: 1px solid var(--background);
  font-size: 16px;
}

.pattern-items li:last-child {
  border-bottom: none;
}

/* Pattern Actions */
.pattern-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 120px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-confirm {
  background: var(--primary);
  color: white;
}

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

.btn-modify {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-modify:hover {
  background: rgba(107, 70, 193, 0.05);
}

.btn-dismiss {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
}

.btn-dismiss:hover {
  background: var(--background);
}

/* Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 60px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Analysis Panel */
.analysis-panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-lg);
}

.analysis-panel h2 {
  font-size: 24px;
  margin-bottom: 24px;
  color: var(--primary);
}

.analysis-content {
  margin-bottom: 32px;
  line-height: 1.8;
}

.analysis-content p {
  margin-bottom: 16px;
}

.confidence-meter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 16px;
  background: var(--background);
  border-radius: 8px;
}

.confidence-label {
  font-weight: 600;
  color: var(--text-light);
}

.confidence-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.analysis-actions {
  display: flex;
  gap: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

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

.btn-secondary:hover {
  background: var(--background);
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0;
  color: var(--text-light);
  font-size: 14px;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .container {
    padding: 16px;
  }
  
  .header h1 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  .pattern-card {
    padding: 20px;
  }
  
  .pattern-title {
    font-size: 18px;
  }
  
  .pattern-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .analysis-panel {
    padding: 24px;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pattern-card {
  animation: fadeIn 0.4s ease;
}

/* Focus States for Accessibility */
.btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --primary: #5B21B6;
    --text: #000000;
    --background: #FFFFFF;
    --border: #000000;
  }
}