.tab-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.tab {
  font-size: 1.1rem;
  font-weight: 600;
  color: #6b7280;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 8px 20px;
  position: relative;
  top: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.dark-mode .tab {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.tab:hover {
  filter: brightness(1.08);
}

.dark-mode .tab:hover {
  filter: brightness(1.15);
}

.tab.active {
  background: #ffffff;
  color: #111827;
  border: 2px solid #3b82f6;
  border-bottom: 2px solid #ffffff;
  box-shadow: 0 -2px 8px rgba(59, 130, 246, 0.15);
  z-index: 1;
  font-weight: 700;
}

.tab.active:hover {
  filter: none;
}

.dark-mode .tab.active {
  background: #111827;
  color: #f3f4f6;
  border-color: #3b82f6;
  border-bottom-color: #111827;
  box-shadow: 0 -2px 8px rgba(59, 130, 246, 0.3);
}

/* Per-tab colors (inactive: light tint; active: full color) */
.tab[data-tab="arithmetic"] { background: #dbeafe; color: #1e40af; }
.tab[data-tab="arithmetic"].active { background: #3b82f6; color: #fff; border-color: #2563eb; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="arithmetic"] { background: #1e3a5f; color: #93c5fd; }
.dark-mode .tab[data-tab="arithmetic"].active { background: #1d4ed8; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="fractions"] { background: #dcfce7; color: #166534; }
.tab[data-tab="fractions"].active { background: #22c55e; color: #fff; border-color: #16a34a; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="fractions"] { background: #14532d; color: #86efac; }
.dark-mode .tab[data-tab="fractions"].active { background: #15803d; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="fractions2"] { background: #ccfbf1; color: #0f766e; }
.tab[data-tab="fractions2"].active { background: #14b8a6; color: #fff; border-color: #0d9488; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="fractions2"] { background: #134e4a; color: #5eead4; }
.dark-mode .tab[data-tab="fractions2"].active { background: #0f766e; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="time"] { background: #ffedd5; color: #c2410c; }
.tab[data-tab="time"].active { background: #f97316; color: #fff; border-color: #ea580c; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="time"] { background: #7c2d12; color: #fdba74; }
.dark-mode .tab[data-tab="time"].active { background: #ea580c; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="colors"] { background: #f3e8ff; color: #7c3aed; }
.tab[data-tab="colors"].active { background: #a855f7; color: #fff; border-color: #9333ea; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="colors"] { background: #4c1d95; color: #c4b5fd; }
.dark-mode .tab[data-tab="colors"].active { background: #7e22ce; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="shapes"] { background: #fef9c3; color: #a16207; }
.tab[data-tab="shapes"].active { background: #eab308; color: #1f2937; border-color: #ca8a04; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="shapes"] { background: #713f12; color: #fde047; }
.dark-mode .tab[data-tab="shapes"].active { background: #ca8a04; color: #1f2937; border-bottom-color: #111827; }

.tab[data-tab="angles"] { background: #fee2e2; color: #b91c1c; }
.tab[data-tab="angles"].active { background: #ef4444; color: #fff; border-color: #dc2626; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="angles"] { background: #7f1d1d; color: #fca5a5; }
.dark-mode .tab[data-tab="angles"].active { background: #dc2626; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="planets"] { background: #e0e7ff; color: #3730a3; }
.tab[data-tab="planets"].active { background: #6366f1; color: #fff; border-color: #4f46e5; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="planets"] { background: #312e81; color: #a5b4fc; }
.dark-mode .tab[data-tab="planets"].active { background: #4f46e5; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="moon"] { background: #e2e8f0; color: #475569; }
.tab[data-tab="moon"].active { background: #64748b; color: #fff; border-color: #475569; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="moon"] { background: #334155; color: #cbd5e1; }
.dark-mode .tab[data-tab="moon"].active { background: #475569; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="calendar"] { background: #fce7f3; color: #be185d; }
.tab[data-tab="calendar"].active { background: #ec4899; color: #fff; border-color: #db2777; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="calendar"] { background: #831843; color: #f9a8d4; }
.dark-mode .tab[data-tab="calendar"].active { background: #db2777; color: #fff; border-bottom-color: #111827; }

.tab[data-tab="rakat"] { background: #d1fae5; color: #047857; }
.tab[data-tab="rakat"].active { background: #10b981; color: #fff; border-color: #059669; border-bottom-color: #ffffff; }
.dark-mode .tab[data-tab="rakat"] { background: #064e3b; color: #6ee7b7; }
.dark-mode .tab[data-tab="rakat"].active { background: #059669; color: #fff; border-bottom-color: #111827; }

.editor-wrapper {
  position: relative;
  flex: 0.5;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  overflow: hidden;
  min-height: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.dark-mode .editor-wrapper {
  border-color: #374151;
  background: #1f2937;
}

.highlights {
  position: absolute;
  inset: 0;
  padding: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 2.25rem;
  line-height: 1.6;
  color: transparent;
  pointer-events: none;
  transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  backface-visibility: hidden;
  will-change: transform;
  -webkit-text-stroke: 0.01px transparent;
}

textarea {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  padding: 20px;
  background: transparent;
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 2.25rem;
  line-height: 1.6;
  color: #111827;
  outline: none;
  z-index: 1;
  transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  backface-visibility: hidden;
  will-change: transform;
  transition: color 0.3s ease;
}

.dark-mode textarea {
  color: #f3f4f6;
}

.hand-display {
  margin-bottom: 16px;
  padding: 24px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  flex: 2;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.dark-mode .hand-display {
  background: #1f2937;
  border-color: #374151;
}

.expression-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.hand-label {
  font-size: 1.5rem;
  font-weight: 600;
  color: #6b7280;
  display: none;
  transition: color 0.3s ease;
}

.dark-mode .hand-label {
  color: #9ca3af;
}

.expression-visual {
  font-size: 3.5rem;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  min-height: 100px;
  width: 100%;
}

.item-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-start;
}

.item-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  max-width: 100%;
}

.item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.item-row-spacer {
  visibility: hidden;
  min-height: 3rem;
  height: 3rem;
}

.item {
  display: inline-block;
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}

.item-count-label {
  font-size: 1.8rem;
  color: #4b5563;
  font-weight: 700;
  text-align: center;
  min-height: 2rem;
  transition: color 0.3s ease;
}

.dark-mode .item-count-label {
  color: #d1d5db;
}

.item-count {
  font-size: 1.5rem;
  color: #6b7280;
  font-weight: 600;
  transition: color 0.3s ease;
}

.dark-mode .item-count {
  color: #9ca3af;
}

.operator-display {
  font-size: 3.5rem;
  font-weight: 700;
  color: #4b5563;
  margin: 0 16px;
  display: flex;
  align-items: center;
  align-self: center;
  min-height: 100px;
  transition: color 0.3s ease;
}

.dark-mode .operator-display {
  color: #d1d5db;
}

/* Responsive font sizing for many items */
.expression-visual.many-items .item {
  font-size: 2rem;
}

.expression-visual.many-items .operator-display {
  font-size: 2.5rem;
  min-height: 80px;
}

.expression-visual.many-items .item-count-label {
  font-size: 1.4rem;
}

.expression-visual.many-items .item-row-spacer {
  min-height: 2rem;
  height: 2rem;
}

.expression-visual.very-many-items .item {
  font-size: 1.5rem;
}

.expression-visual.very-many-items .operator-display {
  font-size: 2rem;
  min-height: 60px;
}

.expression-visual.very-many-items .item-count-label {
  font-size: 1.2rem;
}

.expression-visual.very-many-items .item-row-spacer {
  min-height: 1.5rem;
  height: 1.5rem;
}

.expression-visual.extremely-many-items .item {
  font-size: 1rem;
}

.expression-visual.extremely-many-items .operator-display {
  font-size: 1.5rem;
  min-height: 50px;
}

.expression-visual.extremely-many-items .item-count-label {
  font-size: 1rem;
}

.expression-visual.extremely-many-items .item-row-spacer {
  min-height: 1rem;
  height: 1rem;
}

.highlights .expr {
  color: transparent !important;
}

.expr.correct {
  background-color: #bbf7d0;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
  padding: 1px 2px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dark-mode .expr.correct {
  background-color: #065f46;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.expr.incorrect {
  background-color: #fecaca;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.6);
  padding: 1px 2px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dark-mode .expr.incorrect {
  background-color: #7f1d1d;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.8);
}

/* Mobile notice modal */
.mobile-notice-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-notice-modal.is-visible {
  opacity: 1;
  visibility: visible;
}

.mobile-notice-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.mobile-notice-card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.dark-mode .mobile-notice-card {
  background: #1f2937;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.mobile-notice-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

.dark-mode .mobile-notice-title {
  color: #f3f4f6;
}

.mobile-notice-text {
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.5;
  color: #4b5563;
}

.dark-mode .mobile-notice-text {
  color: #d1d5db;
}

.mobile-notice-btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: #3b82f6;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.mobile-notice-btn:hover {
  background: #2563eb;
}

.mobile-notice-btn:active {
  transform: scale(0.98);
}

.dark-mode .mobile-notice-btn {
  background: #2563eb;
}

.dark-mode .mobile-notice-btn:hover {
  background: #1d4ed8;
}

