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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  color: #333;
  padding: 40px 20px;
  min-height: 100vh;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
}

h1 {
  color: white;
  text-align: center;
  margin-bottom: 15px;
  font-size: 3em;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  letter-spacing: -0.5px;
}

.question {
  color: rgba(255,255,255,0.95);
  text-align: center;
  margin-bottom: 40px;
  font-size: 1.3em;
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.controls {
  text-align: center;
  margin-bottom: 30px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

button {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  color: #2c3e50;
  border: none;
  padding: 16px 40px;
  font-size: 1.15em;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.clear-model-cache-btn {
  background: transparent;
  border: 1px solid #ddd;
  padding: 8px 12px;
  font-size: 1em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.clear-model-cache-btn:hover {
  background: #f8f9fa;
  border-color: #999;
  transform: none;
  box-shadow: none;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.result-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-height: 200px;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}

.model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #e8ecef;
}

.model-title-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.model-name {
  font-weight: 700;
  color: #2c3e50;
  font-size: 1.2em;
  letter-spacing: -0.3px;
}

.duration {
  font-size: 0.9em;
  color: #95a5a6;
  font-weight: 500;
}

.rank-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.rank-number {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.rank-number.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  font-size: 1.1em;
}

.rank-number.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
}

.rank-number.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #e8a87c);
}

.score-display {
  font-size: 1.2em;
  color: #1e3c72;
}

.score-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, #1e3c72, #2a5298);
  transition: width 0.5s ease;
}

.tradition-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #f0f0f0;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
}

.check-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.check-icon.pass {
  color: #4caf50;
}

.check-icon.fail {
  color: #f44336;
}

.check-label {
  color: #666;
}

.generated-image {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  margin: 15px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-loading {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  color: #999;
  margin: 15px 0;
}

.image-prompt {
  font-size: 0.85em;
  color: #888;
  font-style: italic;
  margin-top: 8px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
  border-left: 3px solid #1e3c72;
}

.analysis-section {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #3498db;
}

.analysis-section h3 {
  margin: 0 0 15px 0;
  font-size: 1.1em;
  color: #2c3e50;
}

.analysis-section .tradition-checks {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.analysis-section p {
  margin: 8px 0;
  color: #555;
  line-height: 1.6;
}

.fabrications-warning {
  margin-top: 12px;
  padding: 12px;
  background: #fff3cd;
  border-left: 3px solid #f39c12;
  border-radius: 4px;
}

.fabrications-warning strong {
  color: #d68910;
  display: block;
  margin-bottom: 8px;
}

.fabrications-warning ul {
  margin: 0 0 0 20px;
  color: #856404;
}

.response {
  line-height: 1.8;
  color: #4a5568;
  font-size: 0.98em;
}

.response p {
  margin-bottom: 14px;
}

.response ul, .response ol {
  margin-left: 22px;
  margin-bottom: 14px;
}

.response li {
  margin-bottom: 8px;
}

.response strong {
  color: #2d3748;
  font-weight: 600;
}

.response em {
  color: #718096;
}

.response code {
  background: #f7fafc;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9em;
  border: 1px solid #e2e8f0;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  color: #999;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1e3c72;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-right: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  color: #d32f2f;
  font-style: italic;
}

.analysis {
  background: white;
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.analysis h2 {
  color: #2c3e50;
  margin-bottom: 28px;
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.ranking-item {
  border-left: 5px solid #3498db;
  padding: 20px;
  margin-bottom: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.ranking-item:hover {
  background: #e8f4f8;
  border-left-color: #2980b9;
  transform: translateX(4px);
}

.score {
  display: inline-block;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 6px 16px;
  border-radius: 25px;
  font-weight: 700;
  margin-left: 12px;
  font-size: 1.05em;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}