.home-learn {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  align-items: center;
  justify-content: space-between;
  background:
    radial-gradient(circle at 100% 0%, rgba(254, 243, 5, 0.45), transparent 42%),
    radial-gradient(circle at 0% 100%, rgba(216, 239, 235, 0.9), transparent 46%),
    var(--white);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
  padding: 1.7rem 1.5rem;
}

.home-learn .close-copy { max-width: 32rem; }

.home-learn h2 { color: var(--ink); }

.home-learn p {
  margin-top: 0.75rem;
  color: var(--muted);
}

.tools-hero {
  padding: 3.2rem 0 1.2rem;
}

.tools-hero .wrap {
  max-width: 720px;
}

.tools-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  max-width: 12ch;
}

.tools-lead {
  max-width: 38rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.14rem;
  line-height: 1.55;
}

.tools-grid {
  display: grid;
  gap: 1.1rem;
  padding: 1.4rem 0 2.5rem;
}

.tool-card {
  position: relative;
  display: grid;
  gap: 0.75rem;
  align-content: start;
  min-height: 100%;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.3rem 1.35rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--accent, var(--sea));
}

a.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(23, 32, 51, 0.12);
}

.tool-card[data-accent="abc"] { --accent: #1a7a72; --soft: #d8efeb; }
.tool-card[data-accent="mem"] { --accent: #2f6fed; --soft: #dce8ff; }
.tool-card[data-accent="words"] { --accent: #d97706; --soft: #ffe8c2; }
.tool-card[data-accent="soon"] { --accent: #8b95a5; --soft: #eef1f4; }

.tool-card.is-soon {
  background: #f7f8fa;
  box-shadow: none;
  border: 1px dashed rgba(23, 32, 51, 0.16);
  cursor: default;
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 1rem;
  background: var(--soft, var(--sea-soft));
  font-family: var(--arabic);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--ink);
}

.tool-card .badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--soft, var(--sea-soft));
  color: var(--accent, var(--sea-deep));
}

.tool-card.is-soon .badge {
  background: #e8ebf0;
  color: var(--muted);
}

.tool-card h2 {
  font-size: clamp(1.45rem, 2.5vw, 1.75rem);
  line-height: 1.15;
}

.tool-card p {
  color: var(--muted);
  line-height: 1.5;
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.tool-meta span {
  background: var(--paper);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink);
}

.tool-go {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-weight: 800;
  color: var(--accent, var(--sea-deep));
}

.tool-go::after {
  content: "→";
  transition: transform 0.15s ease;
}

a.tool-card:hover .tool-go::after { transform: translateX(3px); }

.tools-note {
  margin: 0 0 3.8rem;
  background: linear-gradient(135deg, var(--sky), var(--sea-soft));
  border-radius: 1.35rem;
  padding: 1.4rem 1.4rem 1.45rem;
}

.tools-note h2 {
  font-size: 1.45rem;
  margin-bottom: 0.45rem;
}

.tools-note p { color: var(--ink); max-width: 48rem; }

.game-shell {
  padding: 1.4rem 0 4rem;
  background:
    radial-gradient(circle at 90% 8%, rgba(254, 243, 5, 0.28), transparent 28%),
    radial-gradient(circle at 8% 20%, rgba(216, 239, 235, 0.55), transparent 30%),
    transparent;
}

.game-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1.15rem;
}

.game-top h1 {
  margin-top: 0.35rem;
  font-size: clamp(2rem, 4.5vw, 3rem);
}

.game-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--sea-deep);
}

.game-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 1.5rem;
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.1);
  padding: clamp(1.1rem, 3vw, 1.6rem);
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.stat [data-score],
.stat [data-streak],
.stat [data-moves],
.stat [data-pairs] {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--sea-deep);
}

.prompt-box {
  text-align: center;
  padding: clamp(1.5rem, 4vw, 2.2rem) 1rem;
  margin-bottom: 1.15rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(254, 243, 5, 0.35), transparent 55%),
    var(--sea-soft);
  border-radius: 1.25rem;
}

.prompt-label {
  margin-bottom: 0.55rem;
  color: var(--sea-deep);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-main {
  font-family: var(--display);
  font-size: clamp(2.2rem, 7vw, 3.8rem);
  color: var(--ink);
  line-height: 1.1;
}

.prompt-main.ar {
  font-family: var(--arabic);
  font-size: clamp(3.4rem, 11vw, 5.8rem);
  line-height: 1;
}

.prompt-sub {
  margin-top: 0.45rem;
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  font-weight: 700;
  color: var(--sea-deep);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.choice {
  min-height: 96px;
  border: 2px solid transparent;
  border-radius: 1.15rem;
  background: var(--white);
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.06);
  color: var(--ink);
  font-family: var(--arabic);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.choice:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(23, 32, 51, 0.1);
  border-color: rgba(26, 122, 114, 0.35);
}

.choice:active { transform: translateY(0); }

.choice.is-correct {
  border-color: var(--sea);
  background: #c9f2ea;
  box-shadow: 0 0 0 4px rgba(26, 122, 114, 0.15);
}

.choice.is-wrong {
  border-color: #e06b6b;
  background: #ffe4e4;
}

.choice:disabled { cursor: default; }

.game-feedback {
  min-height: 1.7rem;
  margin: 1.05rem 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.9rem;
}

.game-actions .btn { min-width: 10rem; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.memory-card {
  aspect-ratio: 1;
  border: 0;
  border-radius: 1.05rem;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  position: relative;
  perspective: 900px;
  padding: 0;
  transition: transform 0.15s ease;
}

.memory-card:hover:not(:disabled):not(.is-matched) { transform: scale(1.03); }

.memory-card .face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  backface-visibility: hidden;
  transition: transform 0.28s ease;
  box-shadow: 0 10px 22px rgba(23, 32, 51, 0.12);
}

.memory-card .back {
  background: linear-gradient(160deg, #24968c, #0f4f4a);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.memory-card .front {
  background: var(--yellow);
  color: var(--ink);
  transform: rotateY(180deg);
  font-family: var(--arabic);
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
}

.memory-card.is-flipped .back,
.memory-card.is-matched .back { transform: rotateY(180deg); }

.memory-card.is-flipped .front,
.memory-card.is-matched .front { transform: rotateY(0); }

.memory-card.is-matched {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.memory-card .front.is-name {
  font-family: var(--font);
  font-size: clamp(0.95rem, 2.8vw, 1.2rem);
  font-weight: 800;
}

.teacher-tip {
  margin-top: 1.15rem;
  padding: 0.85rem 1rem;
  border-radius: 0.95rem;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

@media (min-width: 800px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .memory-grid { gap: 0.9rem; }
  .game-panel { padding: 1.7rem; }
}

@media (max-width: 560px) {
  .memory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice { min-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card,
  .choice,
  .memory-card,
  .memory-card .face,
  .tool-go::after { transition: none; }

  a.tool-card:hover,
  .choice:hover,
  .memory-card:hover { transform: none; }
}
