:root {
  --bg-color: #fcfcfc;
  --text-color: #444444;
  --primary-color: #a7c7e7; /* Soft Blue */
  --secondary-color: #c1e1c1; /* Soft Green */
  --accent-color: #ffb7b2; /* Soft Pink */
  --warm-color: #fdfd96; /* Soft Yellow */
  --border-radius: 20px;
  --font-family: "Outfit", sans-serif;
  --transition: all 0.3s ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.app-container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo .icon {
  font-size: 2rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-color);
}

.language-selector {
  display: flex;
  gap: 10px;
}

.lang-btn {
  background: white;
  border: 2px solid #eee;
  padding: 5px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

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

.lang-btn:hover:not(.active) {
  background-color: #f0f0f0;
}

/* Main Content Area */
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Home Screen */
.home-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 20px 0;
}

.hero-text h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.hero-text p {
  font-size: 1.1rem;
  opacity: 0.8;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 20px;
}

.table-card {
  background: white;
  border: none;
  padding: 30px 20px;
  border-radius: var(--border-radius);
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
  border-bottom: 5px solid #eee;
}

.table-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.05);
}

.table-card:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.table-card.color-1 {
  background-color: #f8dbdb;
  border-color: #f1b3b3;
}
.table-card.color-2 {
  background-color: #dbf8db;
  border-color: #b3f1b3;
}
.table-card.color-3 {
  background-color: #dbdbf8;
  border-color: #b3b3f1;
}
.table-card.color-4 {
  background-color: #f8f8db;
  border-color: #f1f1b3;
}
.table-card.color-5 {
  background-color: #f8dbf8;
  border-color: #f1b3f1;
}
.table-card.color-6 {
  background-color: #dbf8f8;
  border-color: #b3f1f1;
}
.table-card.color-7 {
  background-color: #ffe5d9;
  border-color: #ffcad1;
}
.table-card.color-8 {
  background-color: #d8e2dc;
  border-color: #b7b7a4;
}
.table-card.color-9 {
  background-color: #ffcad2;
  border-color: #ff8fa3;
}
.table-card.color-10 {
  background-color: #e2ece9;
  border-color: #94d2bd;
}

/* Table View */
.view-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

.back-btn {
  background: white;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.table-display {
  background: white;
  padding: 40px;
  border-radius: var(--border-radius);
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.multiplication-row {
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  padding: 10px;
  border-bottom: 2px dashed #f0f0f0;
}

.multiplication-row:last-child {
  border-bottom: none;
}

.practice-btn {
  margin-top: 30px;
  background-color: var(--secondary-color);
  color: #444;
  border: none;
  padding: 15px 30px;
  border-radius: 15px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  align-self: center;
  box-shadow: 0 4px 0 #a9cba9;
}

.practice-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

/* Quiz Screen */
.quiz-container {
  background: white;
  padding: 50px;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.question {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 30px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.option-btn {
  background: #f9f9f9;
  border: 3px solid #eee;
  padding: 20px;
  border-radius: 15px;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

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

.feedback {
  margin-top: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  height: 30px;
}

.score-display {
  margin-bottom: 20px;
  font-weight: 600;
}

/* Footer */
.main-footer {
  text-align: center;
  padding: 20px 0;
  opacity: 0.6;
  font-size: 0.9rem;
}

/* Board Button */
.board-btn {
  margin-top: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 15px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 0 #5568d3;
}

.board-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #5568d3;
}

/* Board Container */
.board-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.board-instruction {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: #666;
}

/* Chips Container */
.chips-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chip {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  cursor: grab;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.chip:hover {
  transform: scale(1.1);
}

.chip:active {
  cursor: grabbing;
}

/* Multiplication Grid */
.multiplication-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr); /* 11 columns: 1 for axis + 10 data */
  gap: 3px;
  background: white;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  max-width: 650px;
  width: 100%;
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}

/* Axis cells (headers) */
.axis-cell {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 800;
  border: none;
}

.corner-cell {
  background: transparent;
}

/* Data cells (where chips can be placed) */
.data-cell {
  background: #f9f9f9;
  border: 2px solid #e0e0e0;
  color: transparent; /* Hide the number initially */
}

.data-cell:hover {
  background: #e8f4f8;
  border-color: #b3d9f2;
}

/* Show hint on hover */
.data-cell.show-hint::before {
  content: attr(data-hint);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
}

/* Highlighted axis cells */
.axis-cell.highlighted {
  background: linear-gradient(135deg, #ff6b9d 0%, #ff8fa3 100%);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.4);
  z-index: 10;
}

.placed-chip {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 10;
}

.placed-chip:hover {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 600px) {
  .table-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .question {
    font-size: 2rem;
  }
  
  .multiplication-grid {
    gap: 2px;
    padding: 10px;
  }
  
  .grid-cell {
    font-size: 0.7rem;
  }
  
  .chip {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .placed-chip {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
}
