:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gemini: #4285f4;
  --openai: #10a37f;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

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

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

header p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* Info Box */
.info-box {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-box .icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.info-box p {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.info-box strong { color: var(--gray-800); }

/* API Mode Selector */
.api-mode-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.api-mode-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.mode-option {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.mode-option:hover {
  border-color: var(--gray-300);
}

.mode-option.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.02);
}

.mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.mode-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.mode-option.basic .mode-icon {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.mode-option.advanced .mode-icon {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.mode-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--gray-800);
}

.mode-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.mode-option.basic .mode-badge {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.mode-option.advanced .mode-badge {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.mode-desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* API Keys Section */
.api-keys-section {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

.api-keys-section.show {
  display: block;
}

.api-key-group {
  margin-bottom: 1rem;
}

.api-key-group:last-child {
  margin-bottom: 0;
}

.api-key-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.api-key-label .provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.api-key-label .provider-dot.gemini { background: var(--gemini); }
.api-key-label .provider-dot.openai { background: var(--openai); }

.api-key-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: monospace;
  color: var(--gray-800);
  background: var(--gray-50);
}

.api-key-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: white;
}

.api-key-input::placeholder {
  color: var(--gray-400);
}

.api-key-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.375rem;
}

.api-key-hint a {
  color: var(--primary);
  text-decoration: none;
}

.api-key-hint a:hover {
  text-decoration: underline;
}

/* Security Warning */
.security-warning {
  background: rgba(202, 138, 4, 0.1);
  border: 1px solid rgba(202, 138, 4, 0.3);
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--warning);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.security-warning .warning-icon {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

/* Settings Row */
.settings-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-item label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
}

.setting-item select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  color: var(--gray-800);
  cursor: pointer;
}

.setting-item select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Upload Section */
.upload-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.02);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.upload-zone.has-file {
  border-color: var(--success);
  border-style: solid;
  background: rgba(22, 163, 74, 0.02);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.upload-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
}

input[type="file"] { display: none; }

.file-list { margin-top: 1rem; }

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.file-item .file-icon { color: var(--success); }

.file-item .file-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}

.file-item input {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  width: 140px;
}

.file-item .remove-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  line-height: 1;
}

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

/* Buttons */
.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

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

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

.btn-success:hover { opacity: 0.9; }

/* Loading */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loading-overlay.show { display: flex; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

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

.loading-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.loading-step {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.progress-steps {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.progress-step {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-300);
}

.progress-step.active { background: var(--primary); }
.progress-step.complete { background: var(--success); }

/* Results */
.results-section { display: none; }
.results-section.show { display: block; }

.export-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Overall Result */
.overall-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  border: 1px solid var(--gray-200);
}

.overall-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.overall-judgment {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.overall-judgment.low { color: var(--success); }
.overall-judgment.some-concerns { color: var(--warning); }
.overall-judgment.high { color: var(--danger); }

.overall-meta {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Comparison Grid */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.reviewer-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.reviewer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.reviewer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.reviewer-avatar.gemini { background: rgba(66, 133, 244, 0.1); color: var(--gemini); }
.reviewer-avatar.openai { background: rgba(16, 163, 127, 0.1); color: var(--openai); }

.reviewer-info h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
}

.reviewer-info span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.reviewer-overall {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.reviewer-overall.low { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.reviewer-overall.some-concerns { background: rgba(202, 138, 4, 0.1); color: var(--warning); }
.reviewer-overall.high { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

.domain-list {
  list-style: none;
  padding: 0.5rem 0;
}

.domain-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 1.25rem;
}

.domain-item:not(:last-child) {
  border-bottom: 1px solid var(--gray-100);
}

.domain-name {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.domain-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
}

.domain-badge.low { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.domain-badge.some-concerns { background: rgba(202, 138, 4, 0.1); color: var(--warning); }
.domain-badge.high { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* Consensus Section */
.consensus-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.consensus-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.consensus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.consensus-item {
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  border-left: 3px solid var(--gray-300);
}

.consensus-item.low { border-left-color: var(--success); }
.consensus-item.some-concerns { border-left-color: var(--warning); }
.consensus-item.high { border-left-color: var(--danger); }

.consensus-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.consensus-item-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
}

.consensus-agree {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.consensus-agree.agree { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.consensus-agree.disagree { background: rgba(202, 138, 4, 0.1); color: var(--warning); }

.consensus-votes {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}

.consensus-votes span {
  padding: 0.125rem 0.5rem;
  background: white;
  border-radius: 4px;
  color: var(--gray-600);
}

.consensus-result {
  font-size: 0.75rem;
  font-weight: 600;
}

.consensus-result.low { color: var(--success); }
.consensus-result.some-concerns { color: var(--warning); }
.consensus-result.high { color: var(--danger); }

/* Methods Preview */
.methods-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.methods-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.methods-preview {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.8125rem;
  color: var(--gray-600);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* Detailed Output */
.output-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
}

.tab {
  flex: 1;
  padding: 0.875rem;
  background: none;
  border: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.tab:hover { color: var(--gray-700); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  padding: 1rem;
}

.tab-content.active { display: block; }

.output-text {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.8125rem;
  color: var(--gray-600);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* Error */
.error-message {
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--danger);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.875rem;
  display: none;
}

.error-message.show { display: block; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  .comparison-grid { grid-template-columns: 1fr; }
  .consensus-grid { grid-template-columns: 1fr; }
  .settings-row { flex-direction: column; }
  .mode-options { grid-template-columns: 1fr; }
}
