* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: #f7f9fc;
  color: #1f2a37;
}

.header {
  color: #fff;
  padding: 20px;
  background: linear-gradient(120deg, #1d4ed8 0%, #2563eb 45%, #1e40af 100%);
  background-size: 200% 200%;
  animation: headerShimmer 18s ease-in-out infinite;
}

@keyframes headerShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.header h1 {
  margin: 0 0 8px;
}

.header p {
  margin: 0;
}

.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 12px 16px;
  background: #e5edff;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c7d2fe #e5edff;
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tabs::-webkit-scrollbar-track {
  background: transparent;
}

.tabs::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 4px;
}

.tab-button {
  flex: 0 0 auto;
  border: none;
  background: #fff;
  color: #1d4ed8;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.tab-button.active {
  background: #1d4ed8;
  color: #fff;
}

.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

.tab-content {
  display: none;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.tab-content.active {
  display: block;
  animation: tabEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tabEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-box p {
  margin: 0 0 12px;
}

.section-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 14px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-title-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.icon-speaker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  color: #52525b;
  background: #fafafa;
  border: 1px solid #d4d4d8;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.icon-speaker-btn:hover {
  background: #f4f4f5;
  border-color: #a1a1aa;
  color: #27272a;
}

.icon-speaker-btn:focus-visible {
  outline: 2px solid #71717a;
  outline-offset: 2px;
}

.icon-speaker-btn:active {
  background: #e4e4e7;
}

.simple-word {
  font-size: 28px;
  text-align: center;
  margin: 10px 0 14px;
  letter-spacing: 0.5px;
}

.settings-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #3f3f46;
  background: #fafafa;
  border: 1px solid #d4d4d8;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.settings-toggle-btn:hover {
  background: #f4f4f5;
  border-color: #a1a1aa;
}

.settings-toggle-btn:focus-visible {
  outline: 2px solid #71717a;
  outline-offset: 2px;
}

.settings-toggle-btn.is-on {
  color: #334155;
  background: #eef2ff;
  border-color: #a5b4fc;
}

.settings-toggle-btn-label {
  text-align: left;
}

.settings-toggle-btn-state {
  flex-shrink: 0;
  min-width: 2.25rem;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-align: center;
  border-radius: 5px;
  background: rgba(63, 63, 70, 0.1);
  color: inherit;
}

.settings-toggle-btn.is-on .settings-toggle-btn-state {
  background: #c7d2fe;
  color: #3730a3;
}

.settings-toggle-btn--compact {
  padding: 7px 11px;
  font-size: 13px;
  gap: 8px;
}

.settings-toggle-btn--compact .settings-toggle-btn-state {
  padding: 3px 8px;
  font-size: 10px;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
  align-items: center;
}

.control-item {
  font-size: 14px;
}

.control-item select,
.control-item input[type="checkbox"] {
  margin-left: 6px;
}

.dashboard-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d7dfeb;
  border-radius: 10px;
  background: #f9fbff;
}

.home-intro {
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 14px;
  color: #1f2937;
}

.home-mode-list {
  margin: 10px 0 0;
  padding-left: 22px;
}

.home-mode-list li {
  margin: 6px 0;
}

.inline-tab-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: underline;
  cursor: pointer;
}

.inline-tab-link:hover {
  color: #1e40af;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.dashboard-card {
  background: white;
  border: 1px solid #d7dfeb;
  border-radius: 8px;
  padding: 10px;
}

.daily-history {
  margin: 8px 0 0;
  padding-left: 20px;
}

.daily-history li {
  margin: 4px 0;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #e5edff;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 14px;
}

.progress-fill {
  height: 100%;
  background: #1d4ed8;
}

.mock-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.options {
  display: grid;
  gap: 8px;
}

.option-btn {
  border: 1px solid #c8d3e1;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
}

.option-btn:hover {
  background: #f3f6fb;
}

.option-btn.option-correct {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e3a8a;
  font-weight: 700;
  animation: optionCorrectPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes optionCorrectPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.option-btn.option-wrong {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
  font-weight: 700;
  animation: optionWrongNudge 0.42s ease-out;
}

@keyframes optionWrongNudge {
  0%,
  100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-5px);
  }
  55% {
    transform: translateX(5px);
  }
}

.option-result-badge {
  float: right;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.option-result-correct {
  background: #bfdbfe;
  color: #1e3a8a;
}

.option-result-wrong {
  background: #fecaca;
  color: #991b1b;
}

.feedback {
  margin-top: 12px;
  font-weight: 600;
}

.next-btn {
  margin-top: 12px;
  border: none;
  background: #1d4ed8;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.result {
  margin-top: 16px;
  font-weight: 700;
}

.review-options {
  margin: 8px 0 10px;
  padding-left: 18px;
}

.review-option {
  margin: 4px 0;
}

.review-option-correct {
  color: #166534;
  font-weight: 700;
}

.review-option-selected {
  color: #92400e;
  font-weight: 600;
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  margin-left: -4px;
  margin-top: -5px;
  opacity: 1;
  animation: confettiBurst var(--burst-dur, 1s) ease-out forwards;
}

@keyframes confettiBurst {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot, 540deg));
    opacity: 0;
  }
}

.streak-line {
  margin: 10px 0 0;
  font-size: 15px;
  color: #1e40af;
}

.home-settings {
  margin: 14px 0 0;
  font-size: 14px;
}


@media (prefers-reduced-motion: reduce) {
  .tab-content.active {
    animation: none;
  }

  .header {
    animation: none;
    background-position: 0% 50%;
  }

  .option-btn.option-correct,
  .option-btn.option-wrong {
    animation: none;
  }

  .confetti-piece {
    animation-duration: 0.55s !important;
  }
}
