:root {
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --secondary: #64748b;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --danger: #ef4444;
  --success: #10b981;
}

body {
  margin: 0;
  font-family: 'Noto Sans TC', sans-serif;
  background-color: var(--bg-color);
  color: #334155;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 30px;
}

.logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: #1e293b;
  letter-spacing: -1px;
}

.meta {
  color: var(--secondary);
  font-weight: 500;
}

/* Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: #1e293b;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* Inputs */
.input-block {
  margin-bottom: 20px;
}

.input-block label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #475569;
}

.input-block .hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 5px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.2s;
}

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

textarea {
  height: 120px;
  resize: vertical;
}

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

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: 0;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 16px;
  background: #e2e8f0;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.btn-sm:hover {
  background: #cbd5e1;
}

.btn-xl {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

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

.btn-magic {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  transition: transform 0.2s;
}

.btn-magic:hover {
  transform: scale(1.05);
}

/* Source Specifics */
.my-source {
  border-top: 4px solid var(--primary);
}

.comp-source {
  border-top: 4px solid var(--danger);
}

.divider {
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 15px 0;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Report Styles */
.score-banner {
  display: flex;
  align-items: center;
  gap: 30px;
  background: white;
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 24px;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #fefffe;
  border: 5px solid var(--danger);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  font-weight: 900;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.score-circle small {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-top: -5px;
}

.radar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.radar-box {
  background: white;
  border-radius: 12px;
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stats-box {
  background: white;
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
}

.comp-table th,
.comp-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.comp-table .my-side {
  color: var(--primary);
  font-weight: 600;
}

.comp-table .comp-side {
  color: var(--danger);
  font-weight: 600;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.analysis-item {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 4px solid #ccc;
}

.weak .analysis-item {
  border-left-color: var(--danger);
}

.strength .analysis-item {
  border-left-color: var(--success);
}

.advice {
  background: #f8fafc;
  padding: 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 8px;
  color: #475569;
}

.visual-gen-section {
  text-align: center;
  background: white;
  padding: 40px;
  border-radius: 16px;
}

.img-box {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 20px;
}

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

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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