:root {
  --ink: #1c1917;
  --muted: #57534e;
  --paper: #f6f1e8;
  --surface: #fffdf9;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --coral: #c2410c;
  --mint: #ecfdf5;
  --peach: #fff7ed;
  --line: rgba(28, 25, 23, 0.08);
  --shadow: 0 18px 40px rgba(28, 25, 23, 0.08);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 118, 110, 0.16), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(194, 65, 12, 0.14), transparent 32%),
    radial-gradient(circle at 70% 92%, rgba(15, 118, 110, 0.1), transparent 28%),
    var(--paper);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero {
  text-align: center;
  margin-bottom: 8px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.op-wrap {
  position: relative;
  display: inline-flex;
}

.op-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--teal-dark);
  border-bottom: 2px solid var(--teal-dark);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

#op,
#h1 {
  font-size: 25px;
}

#op {
  appearance: none;
  margin: 0;
  padding: 10px 42px 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  color: var(--teal-dark);
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

#op:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

#options {
  width: 100%;
  text-align: center;
  margin: 28px 0 22px;
}

#options h2 {
  max-width: 28ch;
  margin: 18px auto 0;
  color: var(--muted);
  font-family: "Nunito", sans-serif;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 700;
  line-height: 1.4;
}

.assoc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.assoc-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d6d3d1;
  transition: background 0.2s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.2);
  transition: transform 0.2s ease;
}

.assoc-toggle input:checked + .toggle-ui {
  background: var(--teal);
}

.assoc-toggle input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.assoc-toggle input:focus-visible + .toggle-ui {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

#marg {
  margin: 0;
}

#cards {
  width: 100%;
  margin: 0;
}

#container2,
#container1 {
  float: none;
  width: auto;
  overflow: visible;
  position: static;
  right: auto;
  border: 0;
}

#container2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  background: transparent;
}

#container1 {
  display: contents;
  background: transparent;
}

.card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: center;
  float: none;
  width: auto;
  min-height: min(52vh, 420px);
  position: relative;
  left: auto;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#card1,
#card2 {
  left: auto;
}

#card1 {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 28%),
    var(--mint);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(15, 118, 110, 0.12);
}

#card2 {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 28%),
    var(--peach);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(194, 65, 12, 0.12);
}

.fact {
  border-radius: 999px;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10.5%;
  max-width: 50%;
  text-overflow: clip;
  vertical-align: top;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.fact:hover {
  transform: scale(1.08) rotate(0deg) !important;
  filter: saturate(1.15);
}

.right {
  background-color: #86efac;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.18);
}

.wrong {
  background-color: #f87171;
  color: #f87171 !important;
}

#formdiv {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  clear: both;
  min-height: 84px;
  padding-top: 28px;
  text-align: center;
}

#formdiv input,
#formdiv .form {
  font-size: 150%;
}

#formdiv input[type="number"] {
  width: min(220px, 100%);
  padding: 12px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  color: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  text-align: center;
}

#formdiv input[type="number"]:focus {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

#formdiv input[type="submit"] {
  padding: 12px 22px;
  border: 0;
  border-radius: 18px;
  background: var(--teal);
  color: #fff;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.25);
}

#formdiv input[type="submit"]:hover {
  background: var(--teal-dark);
}

#messages {
  position: sticky;
  bottom: 18px;
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

#messages:empty {
  display: none;
}

#messages h1 {
  display: inline-flex;
  margin: 0;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 12px 30px rgba(28, 25, 23, 0.22);
}

.more-practice {
  margin: 36px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.more-practice a {
  color: var(--teal-dark);
  font-weight: 800;
}

.more-practice a:hover {
  color: var(--coral);
}

@media (max-width: 760px) {
  .page {
    width: min(1120px, calc(100% - 20px));
    padding-top: 20px;
  }

  #container2 {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 280px;
  }

  .more-practice {
    white-space: normal;
  }
}
