:root {
  --ink: #172033;
  --muted: #5f6b7c;
  --line: #dfe7f2;
  --purple: #6757f5;
  --math: #4078ff;
  --purple-dark: #4b3ee3;
  --blue: #4078ff;
  --soft-blue: #deecff;
  --soft-yellow: #fff1cb;
  --soft-green: #e4f9ee;
  --soft-pink: #ffe1ee;
  --soft-purple: #eee8ff;
  --shadow: 0 18px 45px rgba(34, 50, 84, 0.11);
  --shadow-soft: 0 10px 25px rgba(34, 50, 84, 0.08);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 191, 77, 0.22), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(103, 87, 245, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f4f8ff 45%, #fff9f1 100%);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.container { width: min(1120px, calc(100% - 44px)); margin: 0 auto; }
.hidden { display: none !important; }

.puzzle-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 231, 242, 0.9);
}
.puzzle-header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: fit-content; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.92rem; font-weight: 900;
  background: linear-gradient(135deg, #4078ff, #6757f5 58%, #44b454);
  box-shadow: 0 12px 22px rgba(64, 120, 255, 0.22);
}
.logo { display: block; font-size: 1.55rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; color: var(--ink); }
.tagline { display: block; margin-top: 7px; color: #718096; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.18em; }
.site-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.site-nav a {
  padding: 8px 12px; border-radius: 999px; color: #435067;
  font-size: 0.87rem; font-weight: 800; border: 1px solid transparent;
}
.site-nav a:hover, .site-nav a.active { color: #fff; background: var(--purple); }
.menu-toggle {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line);
  border-radius: 14px; background: #fff; cursor: pointer; font-size: 1.2rem;
}

.brain-subnav-card {
  width: min(1120px, calc(100% - 44px));
  margin: 14px auto 0;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}
.brain-subnav-card a {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #435067;
  font-weight: 900;
  font-size: 0.9rem;
}
.brain-subnav-card a:hover, .brain-subnav-card a.active {
  color: #fff;
  background: var(--purple);
  border-color: var(--purple);
}

.brain-hero {
  padding: 68px 0 28px;
  text-align: center;
}
.brain-hero-inner { max-width: 850px; }
.eyebrow {
  display: inline-flex;
  width: fit-content;
  color: var(--purple);
  background: rgba(103, 87, 245, 0.08);
  border: 1px solid rgba(103, 87, 245, 0.12);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brain-hero h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.07em;
}
.brain-hero p:not(.eyebrow) {
  max-width: 690px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
}

.brain-play-section {
  padding: 28px 0 54px;
  border-top: 1px solid rgba(223, 231, 242, 0.75);
  border-bottom: 1px solid rgba(223, 231, 242, 0.75);
  background: rgba(255, 255, 255, 0.42);
}
.brain-play-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 22px;
  align-items: start;
}
.brain-control-card,
.mathriddles-share-card {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}
.brain-control-card {
  padding: 24px;
  position: sticky;
  top: 116px;
}
.control-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  background: linear-gradient(135deg, #deecff, #eee8ff);
  font-size: 1.85rem;
  box-shadow: 0 9px 18px rgba(34, 50, 84, 0.08);
}
.brain-control-card h2 {
  margin: 16px 0 14px;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.mode-description { margin: 0 0 14px; color: var(--muted); font-size: 0.94rem; }
.primary-btn, .secondary-btn, .nav-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  border: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.primary-btn:hover, .secondary-btn:hover, .nav-btn:hover:not(:disabled) { transform: translateY(-2px); }
.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #4078ff, #6757f5);
  box-shadow: 0 13px 24px rgba(64, 120, 255, 0.2);
}
.secondary-btn {
  color: var(--purple-dark);
  background: #fff;
  border: 1px solid rgba(103, 87, 245, 0.18);
}
.full-btn { width: 100%; }
.how-to-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--soft-yellow), #fffaf0);
  border: 1px solid rgba(255, 210, 119, 0.45);
}
.how-to-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.how-to-card ul { margin: 0; padding-left: 18px; color: #5b6372; font-size: 0.92rem; }
.how-to-card li + li { margin-top: 5px; }

.brain-game-wrap { position: relative; }
.mathriddles-share-card {
  padding: 26px;
  background: linear-gradient(135deg, #fff, #f7fbff);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.small-label {
  margin: 0 0 5px;
  color: var(--purple);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-heading h3 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: -0.05em;
}
.riddle-card {
  min-height: 380px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 30px;
  border-radius: 28px;
  background: linear-gradient(135deg, #eef5ff, #f5f1ff);
  border: 1px solid rgba(34, 50, 84, 0.08);
}
.riddle-icon {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(34, 50, 84, 0.07);
  font-size: 2.2rem;
  margin-bottom: 18px;
}
.riddle-question {
  max-width: 760px;
  margin: 0 auto 20px;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.045em;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.answer-box {
  display: none;
  width: min(100%, 660px);
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  background: #fff;
  color: #15945e;
  border: 1px solid rgba(68, 180, 84, 0.22);
  font-size: 1.08rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(34, 50, 84, 0.06);
}
.nav-row.modern-nav {
  width: min(100%, 660px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  margin-top: 22px;
  align-items: center;
}
.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.modern-shuffle { min-width: 130px; }

.share-wrap { max-width: 1120px; margin: 26px auto 34px; padding: 0 22px; text-align: center; }
.share-panel-icons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.share-icon-btn, .share-panel-icons button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 14px;
  color: #435067;
  font-weight: 900;
  cursor: pointer;
}
.share-icon-btn:hover, .share-panel-icons button:hover { color: #fff; background: var(--purple); border-color: var(--purple); }
.share-feedback { min-height: 22px; margin-top: 10px; color: var(--muted); }
.puzzle-site-footer { padding: 32px 0; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.62); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.site-footer h3 { margin: 0; font-size: 1rem; font-weight: 900; }
.site-footer p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { color: #435067; font-size: 0.9rem; font-weight: 800; }
.footer-nav a:hover { color: var(--purple); }

@media (max-width: 980px) {
  .brain-play-grid { grid-template-columns: 1fr; }
  .brain-control-card { position: static; }
}
@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-nav {
    position: absolute;
    left: 22px;
    right: 22px;
    top: 76px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { text-align: center; }
}
@media (max-width: 680px) {
  .container, .brain-subnav-card { width: min(100% - 28px, 1120px); }
  .puzzle-header-inner { min-height: 74px; }
  .brand-badge { width: 40px; height: 40px; }
  .logo { font-size: 1.28rem; }
  .tagline { font-size: 0.58rem; }
  .brain-subnav-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .brain-subnav-card a { width: 100%; text-align: center; }
  .brain-hero { padding: 44px 0 24px; }
  .brain-hero h1 { font-size: clamp(2.25rem, 13vw, 3.5rem); }
  .mathriddles-share-card, .brain-control-card { padding: 20px; border-radius: 24px; }
  .riddle-card { min-height: 330px; padding: 22px; }
  .riddle-question { font-size: clamp(1.2rem, 6vw, 1.65rem); }
  .action-row, .nav-row.modern-nav { grid-template-columns: 1fr; display: grid; }
  .answer-btn, .nav-btn { width: 100%; }
  .section-heading { justify-content: center; text-align: center; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}


/* Difficulty selector */
.difficulty-panel {
  margin: 18px 0 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff, #f7fbff);
  border: 1px solid rgba(103, 87, 245, 0.14);
  box-shadow: 0 8px 18px rgba(34, 50, 84, 0.05);
}
.difficulty-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.difficulty-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
}
.difficulty-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #435067;
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.difficulty-btn[data-difficulty="easy"] { flex: 0.95 1 0; }
.difficulty-btn[data-difficulty="medium"] { flex: 1.1 1 0; }
.difficulty-btn[data-difficulty="hard"] { flex: 0.95 1 0; }
.difficulty-btn[data-difficulty="challenge"] {
  flex: 1.35 1 0;
  font-size: 0.72rem;
  padding: 0 7px;
}
.difficulty-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.difficulty-btn.active {
  color: #fff;
  border-color: var(--purple);
  background: linear-gradient(135deg, #4078ff, #6757f5);
}
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(64, 120, 255, 0.10);
  color: var(--purple-dark);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@media (max-width: 680px) {
  .difficulty-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .difficulty-btn {
    width: 100%;
  }
}
