*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f9;
  margin: 0;
  padding: 1rem;
  color: #333;
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
}

body.dark {
  background: #1a1a1a;
  color: #e0e0e0;
}

h1, h2, h3 {
  font-weight: 700;
  color: #2c3e50;
  margin: 1rem 0;
  text-align: center;
}

body.dark h1, body.dark h2, body.dark h3 {
  color: #bbd1ea;
}

.mode-switch {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.mode-btn {
  background: #ddd;
  color: #555;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  flex: 1;
  max-width: 140px;
  transition: background 0.3s, color 0.3s;
}

.mode-btn.active {
  background: #3498db;
  color: white;
}

body.dark .mode-btn {
  background: #444;
  color: #ccc;
}

body.dark .mode-btn.active {
  background: #3498db;
  color: white;
}

.dark-mode-toggle {
  text-align: center;
  margin: 0.5rem 0 1rem;
}

#darkModeBtn {
  background: #555;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.3s;
}

body.dark #darkModeBtn {
  background: #3498db;
}

#darkModeBtn:hover {
  background: #777;
}

body.dark #darkModeBtn:hover {
  background: #2980b9;
}

.panel {
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
  transition: background 0.3s, box-shadow 0.3s;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

body.dark .panel {
  background: #2d2d2d;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

.slider-row label {
  flex: 1;
  font-weight: 600;
}

.slider-row input[type="range"] {
  flex: 2;
  height: 32px;
  -webkit-appearance: none;
  background: #ddd;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

body.dark .slider-row input[type="range"] {
  background: #444;
}

.slider-row input[type="range"]:focus {
  outline: 2px solid #3498db;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: #3498db;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  transition: background 0.3s;
}

.slider-row input[type="range"]:hover::-webkit-slider-thumb {
  background: #2980b9;
}

.slider-row span {
  min-width: 32px;
  text-align: center;
  font-weight: bold;
  font-size: 1rem;
  color: #2c3e50;
}

body.dark .slider-row span {
  color: #bbd1ea;
}

.chart-box {
  height: 280px;
  margin-top: 0.5rem;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.btn-center {
  text-align: center;
  margin: 1.2rem 0;
}

.btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 0.75rem 1.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.3s;
  max-width: 320px;
  width: 100%;
}

body.dark .btn {
  background: #2980b9;
}

.btn:hover {
  background: #2980b9;
}

.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.toggle-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  width: 140px;
  margin: 1rem auto;
  display: block;
}

body.dark .toggle-btn {
  background: #2980b9;
}

.toggle-btn:hover {
  background: #2980b9;
}

.report {
  background: #fff;
  padding: 1.3rem;
  margin: 2rem auto;
  max-width: 900px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  font-size: 1rem;
  line-height: 1.4;
  color: #333;
  overflow-y: auto;
  max-height: 80vh;
}

body.dark .report {
  background: #2d2d2d;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
}

/* NEW: Grid for side-by-side charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

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

.chart-container {
  text-align: center;
}

.chart-container h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

.chart-container canvas {
  max-width: 100%;
  height: 280px !important;
  display: block;
  margin: 0 auto;
}

.language-card {
  border-left: 4px solid #3498db;
  padding: 0.9rem 1rem;
  margin: 0.8rem 0;
  background: #eef4fa;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(44,62,80,0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #222;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

body.dark .language-card {
  background: #3a3a3a;
  color: #bbd1ea;
}

.language-card::before {
  content: attr(data-emoji);
  font-size: 1.3rem;
  display: inline-block;
  margin-right: 0.5rem;
}

.language-card.score-high {
  border-color: #2ecc71;
  background-color: #dff0d8;
}

body.dark .language-card.score-high {
  background-color: #276327;
}

.language-card.score-medium {
  border-color: #f1c40f;
  background-color: #fff8dc;
}

body.dark .language-card.score-medium {
  background-color: #6a6000;
}

.language-card.score-low {
  border-color: #e74c3c;
  background-color: #f8d7da;
}

body.dark .language-card.score-low {
  background-color: #7a2027;
}

.paired-columns {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.paired-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

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

.report-section {
  border-radius: 10px;
  margin: 1rem 0;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.05rem;
}

.warning-section {
  background: linear-gradient(90deg, #fff3cd 60%, #ffe0e0 100%);
  color: #b35f05;
  border-left: 8px solid #e67e22;
}

.good-news-section {
  background: linear-gradient(90deg, #eafcec 60%, #bbe3cc 100%);
  color: #218c54;
  border-left: 8px solid #2ecc71;
}

.praise-section {
  background: linear-gradient(90deg, #e1eaff 60%, #f8fcfa 100%);
  color: #2460af;
  border-left: 8px solid #5dade2;
}

.insight-section {
  background: linear-gradient(90deg, #fbeee6 60%, #f2cdcd 100%);
  color: #4e3a28;
  border-left: 8px solid #c97f63;
}

.report-icon {
  font-size: 2.1rem;
  line-height: 1;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 62, 80, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.hidden {
  display: none !important;
}

.onboarding-content {
  background: #fff;
  padding: 2rem;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  text-align: center;
  color: #2c3e50;
}

body.dark .onboarding-content {
  background: #2c3e50;
  color: #bbd1ea;
}
