* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f6f8fb;
  color: #1f2937;
}

.eqsy-algebra {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  min-height: 620px;
}

h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.2;
}

.intro {
  margin: 0 0 20px;
  color: #4b5563;
  line-height: 1.6;
}

.mode-tabs {
  display: inline-flex;
  gap: 10px;
  margin: 10px 0 18px;
  background: #f3f4f6;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

.mode-btn.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 16px;
}

.example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.example-label {
  font-size: 14px;
  font-weight: 700;
}

.example-btn {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

.example-btn:hover {
  background: #eef4ff;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.option-row {
  margin: 6px 0 12px;
  color: #4b5563;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.daily-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
}

.daily-date {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
}

.option-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.primary-btn,
.secondary-btn {
  min-width: 160px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: #0073e6;
  color: #fff;
  border: none;
}

.secondary-btn {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
}

.mode-hint {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 8px;
}

.mode-panel {
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f9fafb;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.muted {
  color: #6b7280;
  font-size: 14px;
}

.practice-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.practice-prompt {
  font-weight: 700;
  margin-bottom: 8px;
}

.practice-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

#practiceInput {
  flex: 1;
  min-width: 240px;
  margin-bottom: 0;
  width: auto;
}

.practice-feedback {
  min-height: 18px;
  font-weight: 700;
}

.practice-feedback.success {
  color: #065f46;
}

.practice-feedback.error {
  color: #b91c1c;
}

.practice-history {
  margin-top: 8px;
}

.practice-history ol {
  margin: 4px 0 0;
  padding-left: 18px;
}

.practice-history li {
  margin: 3px 0;
  line-height: 1.4;
}

.practice-history .ok {
  color: #065f46;
}

.practice-history .skip {
  color: #2563eb;
}

.practice-history .mark {
  display: inline-block;
  width: 18px;
  font-weight: 700;
}

.small {
  font-size: 13px;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
}

.leaderboard {
  margin-top: 12px;
  border-top: 1px dashed #d1d5db;
  padding-top: 10px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 700;
}

.leaderboard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.small-input {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  min-width: 120px;
}

.leaderboard-top {
  margin-bottom: 6px;
}

.leaderboard-list {
  margin: 0;
  padding-left: 18px;
}

.leaderboard-list .lb-header {
  font-weight: 700;
  color: #374151;
}


  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
}

.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.answer-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.answer-header,
.steps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.answer-label,
.steps-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  color: #374151;
}

.answer-text {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.steps-box {
  background: #fafafa;
  border: 1px solid #e5e7eb;
}

.small-btn {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
}

#stepsList {
  margin: 14px 0 0;
  padding-left: 22px;
  line-height: 1.7;
}

#stepsList li + li {
  margin-top: 12px;
}
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 2px;
  min-width: 18px;
}

.math-frac .top,
.math-frac .bottom {
  display: block;
  padding: 0 2px;
  text-align: center;
  white-space: nowrap;
}

.math-frac .bar {
  width: 100%;
  border-top: 1.6px solid currentColor;
  margin: 2px 0;
}

.step-eq {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.7;
}

.answer-text {
  font-family: Georgia, "Times New Roman", serif;
}

.math-times,
.math-div,
.math-minus {
  display: inline-block;
  padding: 0 1px;
}
.step-eq {
  display: block;
  font-family: "Courier New", monospace;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  white-space: pre-wrap;
}

.copy-msg {
  margin-top: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  padding: 14px 16px;
  max-width: 420px;
  width: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-title {
  font-weight: 800;
  font-size: 18px;
}

.modal-body {
  color: #111827;
  line-height: 1.5;
}

.modal-name-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.small-input {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  min-width: 160px;
}

@media (max-width: 640px) {
  .card {
    padding: 18px;
  }

  h1 {
    font-size: 26px;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}