* { box-sizing: border-box; }
:root {
  --bg1: #f6edff;
  --bg2: #e8f4ff;
  --card: #ffffff;
  --text: #1b2433;
  --muted: #526175;
  --primary: #6d28d9;
  --primary2: #1d4ed8;
  --ring: rgba(109, 40, 217, 0.35);
  --good: #15803d;
  --bad: #dc2626;
  --shadow: rgba(15, 23, 42, 0.14);
  --shadow2: rgba(15, 23, 42, 0.08);
  --tile: #f8fafc;
  --tileHover: #eef2ff;
  --tileBorder: #c7d2fe;
  --border: #d6d8ef;
}
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 55%, #f8fafc 100%);
  color: var(--text);
}
body[data-mode="table"] {
  background:
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--accent-soft) 50%, transparent) 0%,
      transparent 60%
    ),
    linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 55%, #f8fafc 100%);
}
:root {
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --accent-ring: rgba(37, 99, 235, 0.28);
  --success: #16a34a;
  --error: #dc2626;
}
body[data-theme="mixed"] {
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --accent-ring: rgba(37, 99, 235, 0.28);
}
body[data-theme="table-1"] {
  --accent: #ef4444;
  --accent-2: #dc2626;
  --accent-soft: rgba(239, 68, 68, 0.14);
  --accent-ring: rgba(239, 68, 68, 0.28);
}
body[data-theme="table-2"] {
  --accent: #f97316;
  --accent-2: #ea580c;
  --accent-soft: rgba(249, 115, 22, 0.14);
  --accent-ring: rgba(249, 115, 22, 0.28);
}
body[data-theme="table-3"] {
  --accent: #b45309;
  --accent-2: #92400e;
  --accent-soft: rgba(180, 83, 9, 0.14);
  --accent-ring: rgba(180, 83, 9, 0.28);
}
body[data-theme="table-4"] {
  --accent: #22c55e;
  --accent-2: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --accent-ring: rgba(34, 197, 94, 0.28);
}
body[data-theme="table-5"] {
  --accent: #14b8a6;
  --accent-2: #0d9488;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --accent-ring: rgba(20, 184, 166, 0.28);
}
body[data-theme="table-6"] {
  --accent: #0ea5e9;
  --accent-2: #0284c7;
  --accent-soft: rgba(14, 165, 233, 0.14);
  --accent-ring: rgba(14, 165, 233, 0.28);
}
body[data-theme="table-7"] {
  --accent: #6366f1;
  --accent-2: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-ring: rgba(99, 102, 241, 0.28);
}
body[data-theme="table-8"] {
  --accent: #8b5cf6;
  --accent-2: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-ring: rgba(139, 92, 246, 0.28);
}
body[data-theme="table-9"] {
  --accent: #d946ef;
  --accent-2: #c026d3;
  --accent-soft: rgba(217, 70, 239, 0.14);
  --accent-ring: rgba(217, 70, 239, 0.28);
}
body[data-theme="table-10"] {
  --accent: #ec4899;
  --accent-2: #db2777;
  --accent-soft: rgba(236, 72, 153, 0.14);
  --accent-ring: rgba(236, 72, 153, 0.28);
}
body[data-theme="table-11"] {
  --accent: #a855f7;
  --accent-2: #9333ea;
  --accent-soft: rgba(168, 85, 247, 0.14);
  --accent-ring: rgba(168, 85, 247, 0.28);
}
body[data-theme="table-12"] {
  --accent: #84cc16;
  --accent-2: #65a30d;
  --accent-soft: rgba(132, 204, 22, 0.14);
  --accent-ring: rgba(132, 204, 22, 0.28);
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 3px;
}
.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.main-content {
  width: 100%;
}
.ad-left,
.ad-right {
  display: none;
  min-height: 600px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed #cbd5e1;
}
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}
.page-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  margin-bottom: 0.6rem;
  letter-spacing: 0.015em;
  line-height: 1.2;
}
.intro {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 65ch;
  margin: 0.5rem auto 0;
}
.game {
  background: var(--card);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  box-shadow: 0 14px 30px var(--shadow);
  border: 2px solid var(--tileBorder);
  margin-bottom: 3.5rem;
}
.problem-card {
  text-align: center;
  margin-bottom: 2rem;
}
.problem {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
}
.problem-stack {
  display: inline-block;
  text-align: right;
  min-width: 220px;
}
.operand-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1.05;
  font-weight: 600;
}
.operand-top {
  padding-right: 0.25rem;
}
.operand-bottom .operator {
  color: var(--muted);
}
.problem-rule {
  height: 4px;
  background: var(--tileBorder);
  margin-top: 0.6rem;
  border-radius: 999px;
}
.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}
.answer-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
}
#answer-input {
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.75rem;
  width: min(320px, 80%);
  text-align: center;
  border-radius: 16px;
  border: 3px solid var(--accent);
  background: var(--card);
  box-shadow: 0 6px 16px var(--accent-soft);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
#answer-input:focus,
#answer-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
@media (max-width: 600px) {
  #answer-input {
    font-size: 3rem;
    padding: 0.5rem 0.6rem;
  }
}
.feedback {
  margin-top: 0.75rem;
  min-height: 2.1rem;
  color: var(--accent-2);
  font-size: 1.05rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
}
.feedback.is-correct {
  color: var(--success);
  background: rgba(21, 128, 61, 0.12);
}
.feedback.is-incorrect {
  color: var(--error);
  background: rgba(220, 38, 38, 0.12);
}
.submit {
  display: block;
  margin: 0.85rem auto 0;
  width: min(320px, 92%);
  padding: 0.75rem 2.4rem;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 8px 18px var(--accent-ring);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.submit:hover,
.submit:focus {
  background: var(--accent-2);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px var(--accent-ring);
}
.submit:active {
  transform: translateY(1px);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0 1.25rem;
}
.stat {
  background: var(--tile);
  border-radius: 14px;
  padding: 0.8rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  border: 1px solid var(--tileBorder);
  transition: box-shadow 150ms ease, border-color 150ms ease;
}
.stat-text {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
}
.stat-text .label {
  font-size: 1.1rem;
}
.stat-text [data-streak],
.stat-text [data-best-streak] {
  font-size: 1.5rem;
}
.stat.is-highlight {
  animation: statGlow 750ms ease-out;
}
@keyframes statGlow {
  0% {
    box-shadow: 0 0 0 var(--accent-ring);
    border-color: var(--tileBorder);
    transform: scale(1);
  }
  35% {
    box-shadow: 0 0 26px var(--accent-ring);
    border-color: var(--accent);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 var(--accent-ring);
    border-color: var(--tileBorder);
    transform: scale(1);
  }
}
.stat-reset {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95rem;
}
.stat-reset:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 4px;
}
.table-chooser {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 3.5rem;
}
.table-chooser-title {
  margin: 0;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
}
.home-link {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
  align-self: center;
  border: 2px solid var(--accent-2);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.home-link:hover,
.home-link:focus {
  background: var(--accent-2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px var(--accent-ring);
}
.table-pager {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 2.25rem;
}
.table-pager.align-right {
  justify-content: flex-end;
}
.pager-link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}
.table-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.table-nav a {
  background: var(--tile);
  color: var(--text);
  padding: 0.95rem 0.65rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 1.05rem;
  text-align: center;
  font-weight: 700;
  border: 2px solid var(--tileBorder);
  box-shadow: 0 6px 14px var(--shadow2);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.table-nav a:hover,
.table-nav a:focus {
  transform: translateY(-3px);
  border-color: var(--accent-2);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.16);
  background: var(--tileHover);
}
.table-nav a:active {
  transform: translateY(1px);
}
.table-nav a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 10px 18px var(--accent-ring);
}
.table-nav a[aria-current="page"]:hover,
.table-nav a[aria-current="page"]:focus {
  transform: translateY(-2px);
}
.about-practice {
  max-width: 720px;
  margin: 0 auto;
}
.about-practice h2 {
  margin-top: 3.5rem;
  letter-spacing: -0.02em;
}
.about-practice-content h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
}
.about-practice-content p {
  margin: 0 0 0.75rem;
  color: #475569;
  line-height: 1.6;
}
.table-chart {
  max-width: 720px;
  margin: 2.5rem auto 3.5rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  padding: 1.25rem 1rem;
}
.table-chart h2 {
  margin: 0 0 0.75rem;
  text-align: center;
  font-size: 1.2rem;
}
.chart-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
@media (min-width: 520px) {
  .chart-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .chart-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.chart-grid li {
  background: #ffffff;
  border: 2px solid var(--accent-soft);
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  display: block;
  text-align: center;
  font-weight: 700;
}
.chart-grid li span {
  color: #334155;
  font-weight: 700;
}
.chart-grid li strong {
  color: var(--accent-2);
  display: inline;
  margin-left: 0.35rem;
}
.facts-list {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.25rem;
  color: #475569;
  line-height: 1.6;
}
.facts-list li {
  margin-bottom: 0.5rem;
}
@media (min-width: 640px) {
  .table-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 820px) {
  .table-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stat {
    box-shadow: 0 8px 18px var(--shadow2);
  }
}
@media (min-width: 1020px) {
  .table-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .table-pager {
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .table-nav a,
  .home-link,
  .stat {
    transition: none;
    transform: none;
  }
  .stat.is-highlight {
    animation: none;
  }
}
.site-footer {
  margin-top: 3rem;
  padding: 2rem 0 1rem;
  text-align: center;
  color: #4b5563;
}
.footer-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.footer-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.footer-links a:hover,
.footer-links a:focus {
  text-decoration: underline;
}
.footer-meta {
  margin: 0;
  font-size: 0.95rem;
}
