:root {
  /* Brand Colors - Dominantly Pink/Magenta */
  --color-primary: #ff4785; /* Vibrant pink */
  --color-primary-light: #ff75a3;
  --color-primary-dark: #cc396a;
  --color-secondary: #ffb8d2; /* Soft pink */
  
  /* Accents */
  --color-accent-teal: #00d2d3;
  --color-accent-yellow: #ffdf00;
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: #d1fae5;
  --color-error: #ef4444;
  --color-error-bg: #fee2e2;

  /* Neutrals & Backgrounds */
  --bg-main: #fcf8fa; /* Extremely light pinkish-white */
  --bg-card: #ffffff;
  --bg-sidebar: #ffeff5;
  
  /* Text */
  --text-dark: #1f2937;
  --text-body: #4b5563;
  --text-light: #9ca3af;
  --text-white: #ffffff;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(255, 71, 133, 0.05);
  --shadow-md: 0 4px 12px rgba(255, 71, 133, 0.1);
  --shadow-lg: 0 10px 25px rgba(255, 71, 133, 0.15);
  --shadow-glow: 0 0 15px rgba(255, 71, 133, 0.3);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-dark);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Layout */
#app-container {
  display: flex;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* Sidebar */
#sidebar {
  width: 280px;
  background-color: var(--bg-card);
  border-right: 1px solid rgba(255, 184, 210, 0.4);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-xl) 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo {
  padding: 0 var(--spacing-xl) var(--spacing-xl);
  text-align: center;
}

.teacher-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--spacing-md);
}

.teacher-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-primary);
  box-shadow: var(--shadow-md);
  margin-top: -10px; /* pull up slightly */
  background-color: var(--color-secondary); /* pink background behind user image */
}

.logo h1 {
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--text-dark);
}

.logo h1 .highlight {
  color: var(--color-primary);
}

.logo .subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--spacing-xs);
}

#tense-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
}

.menu-item {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-body);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  border: 2px solid transparent;
}

.menu-item:hover {
  background-color: var(--bg-sidebar);
  color: var(--color-primary);
  transform: translateX(4px);
}

.menu-item.active {
  background-color: var(--color-primary);
  color: var(--text-white);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Main Content */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  background: radial-gradient(circle at top right, #fff0f5, var(--bg-main));
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-xl) var(--spacing-2xl);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 184, 210, 0.3);
}

.top-header h2 {
  font-size: 2.5rem;
  color: var(--color-primary);
  text-shadow: 1px 1px 0px rgba(255, 117, 163, 0.1);
}

.view-toggles {
  display: flex;
  background-color: var(--bg-sidebar);
  border-radius: var(--radius-full);
  padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.toggle-btn {
  border: none;
  background: transparent;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  color: var(--color-primary-light);
}

.toggle-btn.active {
  background-color: var(--bg-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Content Area */
#content-display {
  padding: var(--spacing-2xl);
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* Teacher photo inside welcome card — shown only on mobile */
.welcome-teacher-photo {
  display: none;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60vh;
}

.welcome-card {
  background: var(--bg-card);
  padding: var(--spacing-2xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 600px;
  border: 2px solid var(--bg-sidebar);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
}

.welcome-title {
  font-size: 2.2rem;
  margin-bottom: var(--spacing-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent-teal));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-text {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-xl);
  color: var(--text-body);
}

.welcome-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm);
}

.feature-tag {
  background: var(--bg-sidebar);
  color: var(--color-primary-dark);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Learning Details (Rules, Structures) */
.lesson-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 184, 210, 0.4);
  transform-origin: top;
  animation: slideDown 0.4s ease-out forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.lesson-card h3 {
  color: var(--color-primary);
  font-size: 1.8rem;
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.lesson-card p {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-lg);
}

.structure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
}

.structure-box {
  background: var(--bg-sidebar);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
  transition: transform var(--transition-fast);
}

.structure-box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.structure-box h4 {
  margin-bottom: var(--spacing-sm);
  color: var(--color-primary-dark);
  font-size: 1.2rem;
}

.structure-formula {
  font-family: monospace;
  background: rgba(255,255,255,0.7);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: var(--spacing-sm);
  color: var(--text-dark);
  font-weight: bold;
}

.example-text {
  font-style: italic;
  color: var(--text-body);
}

/* Practice Section */
.reading-section {
  background: linear-gradient(135deg, #ffffff, var(--bg-sidebar));
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border-left: 6px solid var(--color-accent-teal);
}

.reading-section h3 {
  font-size: 1.6rem;
  margin-bottom: var(--spacing-md);
  color: var(--color-accent-teal);
}

.reading-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-dark);
}

.quiz-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 184, 210, 0.4);
}

.question-title {
  font-size: 1.3rem;
  margin-bottom: var(--spacing-lg);
  font-weight: 600;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.option-btn {
  background: var(--bg-sidebar);
  border: 2px solid transparent;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-dark);
  font-family: 'Inter', sans-serif;
}

.option-btn:hover:not(:disabled) {
  background: var(--color-secondary);
  color: var(--text-dark);
  transform: translateX(4px);
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.option-btn.correct {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
  font-weight: 600;
}

.option-btn.incorrect {
  background: var(--color-error-bg);
  border-color: var(--color-error);
  color: var(--color-error);
}

.feedback-msg {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-weight: 500;
  display: none; /* hidden by default */
  animation: fadeIn 0.3s ease-out;
}

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

.feedback-msg.show {
  display: block;
}

.feedback-msg.correct-feedback {
  background: var(--color-success-bg);
  color: #065f46;
  border-left: 4px solid var(--color-success);
}

.feedback-msg.incorrect-feedback {
  background: var(--color-error-bg);
  color: #991b1b;
  border-left: 4px solid var(--color-error);
}

/* Sub-Toggles (Sentences/Story) */
.sub-view-toggles {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
}

.sub-toggle-btn {
  background: var(--bg-card);
  border: 2px solid var(--bg-sidebar);
  padding: 0.6rem 2rem;
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.sub-toggle-btn:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

.sub-toggle-btn.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-white);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Animations Helper */
.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Inline Select Drops */
.inline-select {
  appearance: none;
  background: var(--bg-card);
  border: 2px solid var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding: 0.1rem 1.4rem 0.1rem 0.4rem;
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  font-weight: 600;
  cursor: pointer;
  margin: 0 4px;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff75a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.2rem center;
  background-size: 1em;
}

.inline-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 71, 133, 0.2);
}

.inline-select.correct {
  border-color: var(--color-success);
  color: #065f46;
  background-color: var(--color-success-bg);
  background-image: none;
  cursor: default;
}

.inline-select.incorrect {
  border-color: var(--color-error);
  color: #991b1b;
  background-color: var(--color-error-bg);
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Responsive Mobile Adjustments */
@media (max-width: 768px) {
  #app-container {
    flex-direction: column;
  }

  /* ── Sidebar becomes a compact top nav bar ── */
  /* Grid: logo spans full width (row 1), home button + tense menu side by side (row 2) */
  #sidebar {
    width: 100%;
    padding: 0;
    border-right: none;
    border-bottom: 2px solid rgba(255, 184, 210, 0.4);
    box-shadow: 0 3px 8px rgba(255, 71, 133, 0.1);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  /* Hide the teacher photo to save space */
  .teacher-image-container {
    display: none;
  }

  /* Logo spans both grid columns as a slim header row */
  .logo {
    grid-column: 1 / -1;
    padding: 0.6rem var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid rgba(255, 184, 210, 0.25);
  }

  .logo h1 {
    font-size: 1.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Keep title on one line */
  .logo h1 br {
    display: none;
  }

  .logo .subtitle {
    display: none;
  }

  /* Home button — compact pill, left column of nav row */
  #btn-home {
    grid-column: 1;
    grid-row: 2;
    margin: 0 0 0 var(--spacing-md) !important;
    flex: 0 0 auto;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
    min-height: 44px;
    border-radius: var(--radius-full);
    align-self: center;
    white-space: nowrap;
  }

  /* Tense menu — horizontal scrollable row, right column of nav row */
  #tense-menu {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    align-items: center;
  }

  #tense-menu::-webkit-scrollbar {
    display: none;
  }

  .menu-item {
    flex: 0 0 auto;
    font-size: 0.88rem;
    padding: 0.45rem 1rem;
    white-space: nowrap;
    border-radius: var(--radius-full);
    min-height: 44px;          /* touch-friendly tap target */
    display: flex;
    align-items: center;
  }

  /* Disable slide animation on mobile (feels janky) */
  .menu-item:hover {
    transform: none;
  }

  .menu-item.active {
    transform: none;
  }

  /* ── Main content takes the remaining screen ── */
  #main-content {
    height: auto;
    overflow-y: visible;
  }

  /* Top header stacks title + toggles vertically */
  .top-header {
    flex-direction: column;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    gap: var(--spacing-sm);
    text-align: center;
  }

  .top-header h2 {
    font-size: 1.5rem;
  }

  .view-toggles {
    width: 100%;
  }

  .toggle-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem var(--spacing-sm);
    font-size: 0.95rem;
    min-height: 44px;
  }

  /* Content padding */
  #content-display {
    padding: var(--spacing-md);
  }

  /* ── Welcome screen ── */
  .welcome-screen {
    height: auto;
    padding: var(--spacing-xl) 0;
  }

  .welcome-card {
    padding: var(--spacing-lg);
    animation: none; /* disable float on mobile */
  }

  /* Teacher photo visible on mobile welcome screen */
  .welcome-teacher-photo {
    display: block;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-primary);
    box-shadow: var(--shadow-md);
    margin: 0 auto var(--spacing-md);
  }

  .welcome-icon {
    font-size: 2.8rem;
  }

  .welcome-title {
    font-size: 1.6rem;
  }

  .welcome-text {
    font-size: 1rem;
  }

  /* ── Learn section ── */
  .lesson-card {
    padding: var(--spacing-md);
  }

  .lesson-card h3 {
    font-size: 1.3rem;
  }

  .lesson-card p {
    font-size: 1rem;
  }

  .structure-grid {
    grid-template-columns: 1fr;   /* one column on narrow screens */
  }

  .structure-box {
    padding: var(--spacing-md);
  }

  .structure-box:hover {
    transform: none;
  }

  /* ── Practice section ── */
  .sub-view-toggles {
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .sub-toggle-btn {
    flex: 1;
    padding: 0.55rem var(--spacing-sm);
    font-size: 0.95rem;
    min-height: 44px;
  }

  .sub-toggle-btn.active {
    transform: none;
  }

  .reading-section {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
  }

  .reading-section h3 {
    font-size: 1.2rem;
  }

  /* Story text — keep line-height roomy for dropdowns but not excessive */
  .reading-text {
    font-size: 1.05rem;
    line-height: 2.6 !important;
  }

  /* Inline story dropdowns */
  .inline-select {
    font-size: 0.9rem;
    padding: 0.15rem 1.2rem 0.15rem 0.3rem;
    max-width: 130px;
    background-position: right 0.15rem center;
  }

  /* Question cards */
  .question-card {
    padding: var(--spacing-md);
  }

  .question-title {
    font-size: 1.05rem;
    margin-bottom: var(--spacing-md);
  }

  /* Option buttons — full width, easy to tap */
  .option-btn {
    padding: 0.75rem var(--spacing-md);
    font-size: 1rem;
    min-height: 48px;
    text-align: left;
  }

  .option-btn:hover:not(:disabled) {
    transform: none;
  }

  /* Feedback messages */
  .feedback-msg {
    font-size: 0.95rem;
  }
}
