/* ═══════════════════════════════════════════
   CRAZY NUMBERS — Clean Light Design
   ═══════════════════════════════════════════ */

/* ─── TOKENS ─── */
:root {
  --white: #ffffff;
  --off:   #f8f9fc;
  --bg:    #f1f4fb;
  --card:  #ffffff;
  --border: #e4e8f0;
  --border2: #d0d6e4;

  --navy:  #0f1729;
  --text:  #1e2740;
  --text2: #5a6480;
  --text3: #9098b5;
  --muted: #c4cad9;

  --blue:    #2563eb;
  --blue-lt: #eff4ff;
  --blue-md: #bfcfff;
  --indigo:  #4f46e5;
  --teal:    #0d9488;
  --teal-lt: #edfafa;
  --amber:   #d97706;
  --amber-lt:#fffbeb;
  --purple:  #7c3aed;
  --purple-lt:#f5f3ff;
  --rose:    #e11d48;
  --rose-lt: #fff1f2;
  --green:   #16a34a;
  --green-lt:#f0fdf4;
  --red:     #dc2626;

  --prime-c:    var(--amber);
  --prime-lt:   #fff7e6;
  --perfect-c:  var(--purple);
  --perfect-lt: var(--purple-lt);
  --fib-c:      var(--teal);
  --fib-lt:     var(--teal-lt);
  --pal-c:      var(--rose);
  --pal-lt:     var(--rose-lt);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(15,23,41,.06), 0 1px 2px rgba(15,23,41,.04);
  --shadow:    0 4px 16px rgba(15,23,41,.08), 0 2px 6px rgba(15,23,41,.04);
  --shadow-lg: 0 16px 48px rgba(15,23,41,.12), 0 4px 12px rgba(15,23,41,.06);
  --shadow-xl: 0 32px 80px rgba(15,23,41,.16);

  --transition: .2s cubic-bezier(.4,0,.2,1);
  --nav-h: 64px;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: 'Outfit', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--border); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }

/* ─── TYPOGRAPHY ─── */
h1,h2,h3,h4 { font-weight: 700; line-height: 1.2; color: var(--navy); }
h1 { font-size: clamp(2rem,5vw,3.2rem); }
h2 { font-size: clamp(1.4rem,3vw,2rem); }
h3 { font-size: 1.1rem; }

/* ─── LAYOUT ─── */
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.main-content { flex: 1; margin-top: var(--nav-h); }

/* ══════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.navbar.scrolled { box-shadow: var(--shadow); }

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Brand */
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-right: 8px;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.nav-brand:hover { opacity: .8; }
.brand-icon { font-size: 1.5rem; color: var(--blue); }
.brand-text strong { color: var(--blue); }

/* Nav menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-item { position: relative; }

.nav-link {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text2);
  transition: all var(--transition);
  white-space: nowrap;
  background: none;
  border: none;
}
.nav-link:hover { color: var(--navy); background: var(--off); }
.nav-item.active > .nav-link { color: var(--blue); font-weight: 600; }
.caret { font-size: .65rem; margin-left: 2px; opacity: .6; transition: transform var(--transition); }

/* Right side */
.nav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Nav search */
.nav-search-form {
  display: flex; align-items: center;
  background: var(--off);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.nav-search-form:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.nav-search-input {
  padding: 7px 12px;
  background: none; border: none; outline: none;
  font-size: .875rem; width: 130px;
  color: var(--text);
  -moz-appearance: textfield;
}
.nav-search-input::-webkit-outer-spin-button,
.nav-search-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.nav-search-input::placeholder { color: var(--text3); }
.nav-search-btn {
  padding: 7px 13px;
  background: var(--blue);
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  transition: background var(--transition);
}
.nav-search-btn:hover { background: var(--indigo); }

/* Flag icons sizing */
.fi { font-size: 1.1rem; border-radius: 2px; flex-shrink: 0; }
.lang-btn .fi { font-size: 1rem; }

/* Language switcher */
.lang-switcher {
  display: flex; gap: 3px;
}
.lang-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  border: 1.5px solid transparent;
  transition: all var(--transition);
  background: none;
}
.lang-btn .lang-code { color: var(--text3); font-size: .72rem; font-weight: 700; }
.lang-btn:hover { background: var(--off); border-color: var(--border); color: var(--navy); }
.lang-btn.active { background: var(--blue-lt); border-color: var(--blue-md); color: var(--blue); }
.lang-btn.active .lang-code { color: var(--blue); }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  padding: 8px;
  background: none; border: none;
  cursor: pointer;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--navy); border-radius: 2px;
  transition: all var(--transition);
}

/* ─── MEGA MENU — pure CSS :hover, zero JS needed ─── */
/*
  padding-top on .mega-menu creates a transparent hover bridge
  that fills the gap between nav-link and the visible card.
  CSS :hover on .nav-item persists over absolutely-positioned
  descendants → no gap death, no JS timers.
*/
.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-top: 8px;
  min-width: 700px;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility 0s linear .18s;
}

/* Ouvert via JS (.mega-open sur .nav-item.has-mega) */
.nav-item.has-mega.mega-open .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .18s ease, visibility 0s linear 0s;
}

.nav-item.has-mega.mega-open .caret { transform: rotate(180deg); }

.mega-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 24px;

  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.mega-col {
  padding: 0 20px;
  border-right: 1px solid var(--border);
}
.mega-col:first-child { padding-left: 0; }
.mega-col:last-child { border-right: none; padding-right: 0; }

.mega-col-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.mega-list { display: flex; flex-direction: column; gap: 2px; }
.mega-list li a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text2);
  transition: all var(--transition);
}
.mega-list li a:hover { background: var(--off); color: var(--navy); }
.mega-icon { font-size: 1rem; flex-shrink: 0; }

.mega-tip {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--off);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--text2);
  line-height: 1.5;
  border: 1px solid var(--border);
}

/* Range grid */
.mega-range-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; margin-bottom: 10px;
}
.mega-range-chip {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  background: var(--off);
  border: 1.5px solid var(--border);
  text-align: center;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}
.mega-range-chip:hover,
.mega-range-chip.active { background: var(--blue-lt); color: var(--blue); border-color: var(--blue-md); }

.mega-all-link {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--blue);
  margin-top: 6px;
  padding: 4px 0;
  transition: opacity var(--transition);
}
.mega-all-link:hover { opacity: .7; }

/* Tables grid in mega */
.mega-tables-grid {
  display: grid; grid-template-columns: repeat(5,1fr);
  gap: 5px;
}
.mega-table-btn {
  display: flex; align-items: center; justify-content: center;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text2);
  background: var(--off);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
}
.mega-table-btn:hover,
.mega-table-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

/* Featured numbers in mega */
.mega-featured-nums {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.mega-num-chip {
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-lt);
  border: 1px solid var(--blue-md);
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}
.mega-num-chip:hover { background: var(--blue); color: white; }

/* ══════════════════════════════════════════
   BUTTONS & FORM ELEMENTS
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--indigo); border-color: var(--indigo); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-outline { background: none; border-color: var(--border2); color: var(--text2); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-lt); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }

/* Tag / badge / chip */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  border: 1.5px solid;
}
.chip-prime    { color: var(--amber);  border-color: #fde68a; background: var(--prime-lt); }
.chip-perfect  { color: var(--purple); border-color: #ddd6fe; background: var(--perfect-lt); }
.chip-fib      { color: var(--teal);   border-color: #99f6e4; background: var(--fib-lt); }
.chip-pal      { color: var(--rose);   border-color: #fecdd3; background: var(--pal-lt); }
.chip-armstrong{ color: var(--green);  border-color: #bbf7d0; background: var(--green-lt); }
.chip-abundant { color: var(--blue);   border-color: var(--blue-md); background: var(--blue-lt); }
.chip-deficient{ color: var(--text2);  border-color: var(--border2); background: var(--off); }
.chip-happy    { color: var(--teal);   border-color: #99f6e4; background: var(--teal-lt); }
.chip-evil     { color: var(--red);    border-color: #fca5a5; background: #fef2f2; }
.chip-square   { color: var(--green);  border-color: #bbf7d0; background: var(--green-lt); }

/* Filter pills */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-pill:hover { border-color: var(--blue); color: var(--blue); }
.filter-pill.active { background: var(--blue); color: white; border-color: var(--blue); }

/* Range tabs */
.range-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.range-tab {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text3);
  background: var(--white);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}
.range-tab:hover { border-color: var(--blue-md); color: var(--blue); }
.range-tab.active { background: var(--navy); color: white; border-color: var(--navy); }

/* Toggle */
.toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-btn:hover { border-color: var(--blue-md); color: var(--blue); }
.toggle-btn.on { background: var(--blue-lt); border-color: var(--blue-md); color: var(--blue); }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-pad-lg { padding: 32px; }

.card-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   HOME PAGE
══════════════════════════════════════════ */

/* Hero */
.hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 80px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(37,99,235,.06), transparent),
    radial-gradient(ellipse 50% 50% at 90% 50%, rgba(79,70,229,.04), transparent);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: var(--blue-lt);
  border: 1px solid var(--blue-md);
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero h1 {
  font-size: clamp(2.4rem,6vw,4rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--navy);
}
.hero h1 em { color: var(--blue); font-style: normal; }
.hero h1 strong { color: var(--navy); }
.hero-sub {
  font-size: 1.05rem;
  color: var(--text2);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* Hero search */
.hero-search {
  display: flex;
  max-width: 460px;
  margin: 0 auto 56px;
  background: var(--white);
  border: 2px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.hero-search:focus-within {
  border-color: var(--blue);
  box-shadow: var(--shadow), 0 0 0 4px rgba(37,99,235,.1);
}
.hero-search input {
  flex: 1; padding: 14px 20px;
  background: none; border: none; outline: none;
  font-size: 1.05rem; font-weight: 500;
  color: var(--text);
  -moz-appearance: textfield;
}
.hero-search input::-webkit-outer-spin-button,
.hero-search input::-webkit-inner-spin-button { -webkit-appearance: none; }
.hero-search input::placeholder { color: var(--text3); font-weight: 400; }
.hero-search button {
  padding: 14px 24px;
  background: var(--blue);
  color: white; border: none;
  font-size: .95rem; font-weight: 700;
  transition: background var(--transition);
}
.hero-search button:hover { background: var(--indigo); }

/* Stats bar */
.stats-band {
  display: flex; justify-content: center; align-items: center;
  gap: 0; flex-wrap: wrap;
  background: var(--off);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.stat-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 36px;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-val { font-size: 1.8rem; font-weight: 900; color: var(--navy); line-height: 1; }
.stat-val .accent { color: var(--blue); }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text3); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }

/* Section */
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.section-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.section-sub { color: var(--text2); font-size: .9rem; margin-bottom: 28px; }

/* Category cards */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.cat-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: block;
  box-shadow: var(--shadow-sm);
}
.cat-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.cat-icon { font-size: 2rem; margin-bottom: 14px; display: block; }
.cat-name { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.cat-desc { font-size: .845rem; color: var(--text2); line-height: 1.5; }

/* Featured numbers */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.featured-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: block;
  box-shadow: var(--shadow-sm);
}
.featured-card:hover { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-3px); }
.featured-num { font-size: 2.2rem; font-weight: 900; color: var(--navy); line-height: 1; margin-bottom: 6px; font-family: 'DM Mono', monospace; }
.featured-name { font-size: .78rem; color: var(--text2); font-weight: 500; }
.featured-desc { font-size: .72rem; color: var(--text3); margin-top: 3px; line-height: 1.4; }

/* ══════════════════════════════════════════
   LISTING PAGE
══════════════════════════════════════════ */
.listing-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 32px 0 24px;
}
.listing-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.listing-desc { color: var(--text2); font-size: .9rem; margin-bottom: 20px; }

.listing-controls {
  display: flex; flex-direction: column; gap: 12px;
}

.num-grid-wrap { padding: 32px 0; }

.number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 7px;
}

.num-cell {
  aspect-ratio: 1;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.num-cell:hover {
  transform: scale(1.1); z-index: 2;
  box-shadow: var(--shadow);
  border-color: var(--blue);
}
.num-cell.is-prime    { border-color: #fde68a; background: #fffdf0; }
.num-cell.is-perfect  { border-color: #ddd6fe; background: #faf8ff; }
.num-cell.is-fib      { border-color: #99f6e4; background: #f0fdfb; }
.num-cell.is-pal      { border-color: #fecdd3; background: #fff8f8; }
.num-cell.is-armstrong{ border-color: #bbf7d0; background: #f2fdf5; }

.num-cell .n {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--navy);
  line-height: 1;
}
.num-cell .dots {
  display: flex; gap: 2px; margin-top: 4px;
}
.num-cell .dot { width: 5px; height: 5px; border-radius: 50%; }

.num-cell.dim { opacity: .2; pointer-events: none; }

/* Legend */
.grid-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--text2); font-weight: 500;
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ══════════════════════════════════════════
   NUMBER DETAIL PAGE
══════════════════════════════════════════ */

.prop-table { width: 100%; }
.prop-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.prop-row:last-child { border-bottom: none; }
.prop-label { color: var(--text2); }
.prop-value { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--navy); text-align: right; word-break: break-all; max-width: 55%; }
.prop-value a { color: var(--blue); }
.prop-value a:hover { text-decoration: underline; }

.repr-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.repr-row:last-child { border-bottom: none; }
.repr-base { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); min-width: 70px; }
.repr-val { font-family: 'DM Mono', monospace; font-size: .9rem; font-weight: 500; color: var(--blue); word-break: break-all; }
.repr-val .b1 { color: var(--navy); }
.repr-val .b0 { color: var(--muted); }

.factorization { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin: 12px 0 16px; line-height: 1.4; }
.factor { color: var(--blue); }
.pow { font-size: .6em; vertical-align: super; }
.op { color: var(--text3); margin: 0 5px; }

.divisors-wrap { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.divisor-pill {
  padding: 3px 10px;
  border-radius: 5px;
  font-family: 'DM Mono', monospace;
  font-size: .82rem;
  font-weight: 500;
  background: var(--off);
  border: 1px solid var(--border);
  color: var(--navy);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-block;
}
.divisor-pill:hover { background: var(--blue); color: white; border-color: var(--blue); }

.facts-list { list-style: none; }
.facts-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: .875rem; color: var(--text2); line-height: 1.6;
}
.facts-list li:last-child { border-bottom: none; }
.facts-bullet { color: var(--blue); font-size: .6rem; margin-top: 6px; flex-shrink: 0; }

.num-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
}
.num-nav-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .875rem; font-weight: 600;
  color: var(--text2); cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.num-nav-btn:hover { border-color: var(--blue); color: var(--blue); }
.num-nav-num { font-family: 'DM Mono', monospace; font-size: 1.1rem; color: var(--blue); font-weight: 700; }

/* ══════════════════════════════════════════
   TABLES PAGE
══════════════════════════════════════════ */
.tables-page { max-width: 980px; margin: 0 auto; padding: 40px 24px 80px; }
.tables-page .page-header { margin-bottom: 28px; }

.table-selector-bar {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.table-sel-row { display: flex; gap: 6px; flex-wrap: wrap; }
.table-sel-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  font-size: .95rem; font-weight: 700;
  background: var(--off); border: 1.5px solid var(--border);
  color: var(--text2); cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}
.table-sel-btn:hover { border-color: var(--blue-md); color: var(--blue); background: var(--blue-lt); }
.table-sel-btn.active { background: var(--navy); color: white; border-color: var(--navy); box-shadow: 0 3px 10px rgba(15,23,41,.25); }

.table-controls-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
  align-items: center;
}

.mult-table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: auto;
  box-shadow: var(--shadow-sm);
}
.mult-table { border-collapse: collapse; width: 100%; }
.mult-table th {
  background: var(--navy); color: white;
  padding: 10px 14px; text-align: center;
  font-family: 'DM Mono', monospace; font-size: .875rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,.1);
  min-width: 50px; position: sticky; top: 0; z-index: 2;
}
.mult-table td {
  padding: 9px 14px; text-align: center;
  border: 1px solid var(--border);
  font-family: 'DM Mono', monospace; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  color: var(--text);
}
.mult-table td:hover { background: var(--blue-lt); color: var(--blue); }
.mult-table tr td.hl-row { background: rgba(37,99,235,.06); }
.mult-table tr td.hl-col { background: rgba(16,185,129,.06); }
.mult-table tr td.hl-both { background: var(--blue); color: white !important; font-weight: 700; font-size: 1rem; }
.mult-table tbody tr:hover td { background: rgba(37,99,235,.04); }

/* Single table */
.single-table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.single-table-row {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center; padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.single-table-row:last-child { border-bottom: none; }
.single-table-row:hover { background: var(--off); }
.st-a { font-family: 'DM Mono', monospace; font-size: 1.1rem; font-weight: 700; color: var(--blue); }
.st-op { font-size: 1.2rem; color: var(--text3); text-align: center; }
.st-b { font-family: 'DM Mono', monospace; font-size: 1.1rem; font-weight: 700; color: var(--blue); text-align: center; }
.st-eq { font-size: 1.2rem; color: var(--text3); text-align: center; }
.st-r  { font-family: 'DM Mono', monospace; font-size: 1.4rem; font-weight: 800; color: var(--navy); text-align: right; cursor: pointer; }
.st-r:hover { color: var(--blue); }

/* ══════════════════════════════════════════
   EXERCISES PAGE
══════════════════════════════════════════ */
.exercises-page { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; }

.ex-scoreboard {
  display: grid; grid-template-columns: repeat(4,1fr) auto;
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.ex-score-cell {
  background: var(--white); padding: 16px 12px; text-align: center;
}
.ex-score-val { font-size: 1.8rem; font-weight: 900; line-height: 1; font-family: 'DM Mono', monospace; }
.ex-score-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-top: 3px; }
.ex-reset-cell {
  background: var(--white); padding: 12px 16px;
  display: flex; align-items: center; justify-content: center;
}
.ex-reset-btn {
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600;
  background: none; border: 1.5px solid var(--border);
  color: var(--text3); cursor: pointer;
  transition: all var(--transition);
}
.ex-reset-btn:hover { border-color: var(--red); color: var(--red); }

.ex-config-bar {
  display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.ex-config-group { }
.ex-config-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); margin-bottom: 6px; }
.ex-config-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.ex-cfg-btn {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  background: var(--white); border: 1.5px solid var(--border);
  color: var(--text2); cursor: pointer; transition: all var(--transition);
}
.ex-cfg-btn:hover { border-color: var(--blue-md); color: var(--blue); }
.ex-cfg-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

.exercise-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 56px 40px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ex-progress-bar {
  position: absolute; top: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--indigo));
  border-radius: 0 4px 4px 0;
  transition: width .5s ease;
}

.ex-question {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 10px;
  font-family: 'DM Mono', monospace;
}
.ex-question .qop { color: var(--text3); margin: 0 10px; font-weight: 400; }
.ex-question .qmark { color: var(--blue); }

.ex-hint { font-size: .875rem; color: var(--text3); font-style: italic; margin-bottom: 32px; }

.ex-typed-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

.ex-input {
  width: 160px; padding: 14px 16px;
  background: var(--off); border: 2px solid var(--border2);
  border-radius: var(--radius-lg); text-align: center;
  font-size: 2rem; font-weight: 700; color: var(--navy);
  font-family: 'DM Mono', monospace; outline: none;
  transition: all var(--transition);
  -moz-appearance: textfield;
}
.ex-input::-webkit-outer-spin-button,
.ex-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ex-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.ex-input.correct { border-color: var(--green); box-shadow: 0 0 0 4px rgba(22,163,74,.12); background: var(--green-lt); }
.ex-input.wrong   { border-color: var(--red); box-shadow: 0 0 0 4px rgba(220,38,38,.12); animation: shake .3s ease; }

@keyframes shake {
  0%,100%{ transform: translateX(0); }
  25%    { transform: translateX(-8px); }
  75%    { transform: translateX(8px); }
}

.ex-validate-btn {
  padding: 14px 24px;
  background: var(--blue); color: white;
  border: none; border-radius: var(--radius-lg);
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.ex-validate-btn:hover { background: var(--indigo); box-shadow: 0 4px 12px rgba(37,99,235,.3); }

.ex-mcq-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%; max-width: 360px; margin-top: 8px;
}
.ex-mcq-btn {
  padding: 18px 12px;
  border: 2px solid var(--border2); background: var(--off);
  border-radius: var(--radius-lg);
  font-size: 1.6rem; font-weight: 800;
  color: var(--navy); cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}
.ex-mcq-btn:hover { border-color: var(--blue); background: var(--blue-lt); color: var(--blue); transform: scale(1.04); }
.ex-mcq-btn.correct { border-color: var(--green); background: var(--green-lt); color: var(--green); }
.ex-mcq-btn.wrong   { border-color: var(--red); background: #fef2f2; color: var(--red); }
.ex-mcq-btn:disabled { cursor: default; }

.ex-feedback {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 8px 20px; border-radius: 20px;
  font-size: .875rem; font-weight: 700;
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
.ex-feedback.show { opacity: 1; }
.ex-feedback.correct { background: var(--green-lt); color: var(--green); border: 1px solid #bbf7d0; }
.ex-feedback.wrong   { background: #fef2f2; color: var(--red); border: 1px solid #fca5a5; }

.ex-next-btn {
  margin-top: 20px; padding: 11px 28px;
  background: var(--off); border: 1.5px solid var(--border2);
  border-radius: var(--radius); font-size: .9rem; font-weight: 700;
  color: var(--text2); cursor: pointer; transition: all var(--transition);
  display: none;
}
.ex-next-btn.show { display: inline-block; }
.ex-next-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ══════════════════════════════════════════
   PAGE HEADER SHARED
══════════════════════════════════════════ */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px 24px;
}
.page-header-inner { max-width: 1180px; margin: 0 auto; }
.page-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.page-title .accent { color: var(--blue); }
.page-subtitle { color: var(--text2); font-size: .9rem; margin-top: 4px; }
.breadcrumb {
  display: flex; gap: 6px; align-items: center;
  font-size: .8rem; color: var(--text3); margin-bottom: 12px;
}
.breadcrumb a { color: var(--blue); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--muted); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.7);
  padding: 56px 24px 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; gap: 48px; flex-wrap: wrap;
  padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-brand { flex: 1; min-width: 200px; }
.footer-logo { font-size: 1.4rem; font-weight: 800; color: white; margin-bottom: 8px; }
.footer-tagline { font-size: .875rem; color: rgba(255,255,255,.45); line-height: 1.6; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col { min-width: 140px; }
.footer-col-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.3); margin-bottom: 14px; }
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col ul li a { font-size: .875rem; color: rgba(255,255,255,.6); transition: color var(--transition); }
.footer-col ul li a:hover { color: white; }
.footer-bottom {
  max-width: 1180px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
  padding: 20px 0;
  font-size: .78rem; color: rgba(255,255,255,.3);
}
.footer-nodb { font-style: italic; }

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.text-muted { color: var(--text2); }
.text-blue { color: var(--blue); }
.mono { font-family: 'DM Mono', monospace; }
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .875rem; font-weight: 600; color: var(--text2);
  margin-bottom: 16px; transition: color var(--transition);
}
.back-link:hover { color: var(--blue); }

/* Spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-menu { display: none; }
  .nav-hamburger { display: flex; }
  .nav-right .nav-search-form { display: none; }
  .mega-inner { grid-template-columns: 1fr; }
  .mega-col { border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 16px; margin-bottom: 16px; }
  .mega-col:last-child { border-bottom: none; margin-bottom: 0; }
}
@media (max-width: 600px) {
  .stats-band { flex-direction: column; gap: 0; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); width: 100%; }
  .stat-item:last-child { border-bottom: none; }
  .hero { padding: 48px 16px 40px; }
  .ex-scoreboard { grid-template-columns: repeat(2,1fr) auto; }
  .exercise-card { padding: 40px 16px 32px; }
  .number-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .lang-code { display: none; }
}

/* ── MOBILE MENU OPEN STATE ─────────────────── */
@media (max-width: 900px) {
  .nav-menu.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    z-index: 199;
    gap: 4px;
    box-shadow: var(--shadow);
  }
}

/* ══════════════════════════════════════════════
   NUMBER DETAIL — New Design
══════════════════════════════════════════════ */
.nd-page { padding-bottom: 80px; }

/* Breadcrumb */
.nd-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem; color: var(--text3);
  background: var(--white);
  padding-top: 20px;
}
.nd-breadcrumb a { color: var(--blue); }
.nd-breadcrumb a:hover { text-decoration: underline; }
.nd-breadcrumb strong { color: var(--navy); }

/* ── HERO ── */
.nd-hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 20px 0 36px;
  margin-top: 0;
}
.nd-hero-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: start;
}

/* Big number */
.nd-numeral {
  font-size: clamp(5rem, 14vw, 9rem);
  font-weight: 900;
  font-family: 'DM Mono', monospace;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -.04em;
  position: relative;
}
.nd-numeral::after {
  content: '';
  display: block;
  width: 60%;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--indigo));
  border-radius: 3px;
  margin-top: 16px;
}

/* Name rows */
.nd-names {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 20px;
}
.nd-name-row {
  display: flex; align-items: center; gap: 10px;
}
.nd-flag { font-size: .95rem; flex-shrink: 0; }
.nd-name-val {
  font-size: .9rem; font-weight: 500; color: var(--text2);
  font-style: italic;
}

/* Language label ("en français", "in English"…) */
.nd-name-label {
  font-size: .72rem; font-weight: 600;
  text-transform: lowercase; letter-spacing: .01em;
  color: var(--text3);
  min-width: 110px;
}

/* Highlight the current page language */
.nd-name-row.nd-name-current .nd-name-val {
  font-weight: 800; font-style: normal;
  color: var(--navy); font-size: 1rem;
}
.nd-name-row.nd-name-current .nd-name-label {
  color: var(--blue); font-weight: 700;
}
.nd-name-row.nd-name-current .nd-flag {
  filter: drop-shadow(0 0 3px rgba(37,99,235,.4));
}
/* nd-name-val style is uniform — bold handled per lang in JS */

/* Right side */

/* Left column of hero — numeral + names */
.nd-hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.nd-hero-right {
  display: flex; flex-direction: column; gap: 20px;
  padding-top: 8px;
}

.nd-badges-wrap {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 28px;
}
.nd-badge-skeleton, .nd-quick-skeleton {
  height: 24px; width: 180px;
  background: var(--border);
  border-radius: 12px;
  animation: pulse .9s ease infinite alternate;
}
@keyframes pulse { from { opacity:.4 } to { opacity:.8 } }

/* Quick stats row */
.nd-quick-grid {
  display: flex; gap: 0;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.nd-qs {
  flex: 1; padding: 16px 12px; text-align: center;
  border-right: 1px solid var(--border);
}
.nd-qs:last-child { border-right: none; }
.nd-qs-val { font-size: 1.6rem; font-weight: 900; color: var(--navy); font-family: 'DM Mono', monospace; line-height: 1; }
.nd-qs-lbl { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-top: 4px; }

/* ── TABS ── */
.nd-tabs-bar {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  position: sticky; top: var(--nav-h); z-index: 50;
  /* No mask — was hiding the last tab */
}
.nd-tabs-bar .container { max-width: 1000px; }
.nd-tabs {
  display: flex; gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;       /* Firefox */
  scroll-behavior: smooth;
}
.nd-tabs::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.nd-tab {
  padding: 12px 16px;          /* tighter padding so all 7 tabs fit */
  font-size: .82rem; font-weight: 600;
  color: var(--text2);
  background: none; border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nd-tab:hover { color: var(--navy); }
.nd-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── PANELS ── */
.nd-content { padding: 36px 24px; max-width: 1000px; margin: 0 auto; }
.nd-panel { display: none; }
.nd-panel.active { display: block; }

/* ── PROPERTIES ── */
.nd-prop-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.nd-prop-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color .18s, box-shadow .18s;
}
.nd-prop-card:hover {
  border-color: var(--blue-md);
  box-shadow: var(--shadow);
}
.nd-pc-lbl {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text3); margin-bottom: 8px;
}
.nd-pc-val {
  font-size: 1.05rem; font-weight: 600; color: var(--navy);
  font-family: 'DM Mono', monospace;
  word-break: break-all;
}
.nd-pc-val a { color: var(--blue); }
.nd-pc-val a:hover { text-decoration: underline; }

/* ── REPRESENTATIONS ── */
.nd-repr-list { display: flex; flex-direction: column; gap: 0; }
.nd-repr-row {
  display: grid;
  grid-template-columns: 52px 180px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.nd-repr-row:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; border: 1px solid var(--border); border-bottom: none; }
.nd-repr-row:last-child  { border-radius: 0 0 var(--radius-lg) var(--radius-lg); border: 1px solid var(--border); }
.nd-repr-row:not(:first-child):not(:last-child) { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.nd-repr-row:hover { background: var(--off); }
.nd-rr-base {
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text3); text-align: center;
}
.nd-rr-label {
  font-size: .82rem; color: var(--text2); font-weight: 500;
}
.nd-rr-val {
  font-size: .95rem; color: var(--navy); font-weight: 500;
  word-break: break-all;
}
.nd-rr-val.mono { font-family: 'DM Mono', monospace; color: var(--blue); }

/* Binary bits */
.bit { font-family: 'DM Mono', monospace; font-size: .9rem; letter-spacing: .08em; }
.bit-1 { color: var(--blue); font-weight: 700; }
.bit-0 { color: var(--muted); }

/* ── DIVISORS ── */
.nd-divs-header {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.nd-divs-factorization {
  font-size: 2rem; font-weight: 700; color: var(--navy); margin-bottom: 12px;
}
.nd-divs-stats {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-size: .875rem; color: var(--text2);
}
.nd-divs-stats strong { color: var(--navy); }

/* ── FACTS TIMELINE ── */
.nd-facts-timeline {
  display: flex; flex-direction: column; gap: 0;
  max-width: 720px;
}
.nd-fact-item {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.nd-fact-item:last-child { border-bottom: none; }
.nd-fact-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: white;
  font-size: .8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nd-fact-text { font-size: .925rem; color: var(--text2); line-height: 1.7; padding-top: 5px; }

/* ── PREV/NEXT NAV ── */
.nd-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 32px 24px 0; max-width: 1000px; margin: 0 auto;
  border-top: 1px solid var(--border); margin-top: 20px;
}
.nd-nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: all .18s; text-decoration: none;
}
.nd-nav-btn:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.nd-nav-arrow { font-size: 1.1rem; color: var(--blue); }
.nd-nav-lbl { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); }
.nd-nav-num { font-size: 1.4rem; font-weight: 800; font-family: 'DM Mono', monospace; color: var(--navy); }
.nd-nav-all {
  padding: 10px 20px;
  background: var(--off); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .875rem; font-weight: 600;
  color: var(--text2); text-decoration: none; transition: all .18s;
}
.nd-nav-all:hover { border-color: var(--blue); color: var(--blue); }

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  .nd-hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .nd-numeral { font-size: clamp(4rem, 20vw, 6rem); }
  .nd-repr-row { grid-template-columns: 40px 1fr; }
  .nd-rr-label { display: none; }
  .nd-prop-cards { grid-template-columns: 1fr 1fr; }
  .nd-tab { padding: 12px 14px; font-size: .8rem; }
}

/* ══════════════════════════════════════════════
   MEANING CARD
══════════════════════════════════════════════ */
.nd-meaning-card {
  display: flex; align-items: flex-start; gap: 32px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl, 20px);
  padding: 36px 40px;
  max-width: 820px;
}
.nd-meaning-num {
  font-size: 4rem; font-weight: 900;
  font-family: 'DM Mono', monospace;
  color: var(--blue); opacity: .15;
  line-height: 1; flex-shrink: 0;
  min-width: 80px; text-align: center;
}
.nd-meaning-text {
  font-size: 1rem; line-height: 1.85;
  color: var(--text2); margin: 0;
  border-left: 3px solid var(--blue);
  padding-left: 24px;
  font-style: italic;
}

/* ══════════════════════════════════════════════
   SEQUENCES
══════════════════════════════════════════════ */
.nd-seq-section {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.nd-seq-title {
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text3); margin-bottom: 10px;
}
.nd-seq-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.nd-seq-pill {
  padding: 6px 14px;
  background: var(--off); border: 1.5px solid var(--border);
  border-radius: 999px; font-size: .82rem; font-weight: 600;
  color: var(--navy); text-decoration: none;
  transition: all .15s;
}
.nd-seq-pill:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light, #eff6ff); }
.nd-seq-none { color: var(--text3); font-size: .875rem; }

/* ══════════════════════════════════════════════
   NEIGHBORS
══════════════════════════════════════════════ */
.nd-neighbors-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 24px;
}
.nd-nb-cell {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 14px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); text-decoration: none;
  min-width: 80px; transition: all .18s;
}
.nd-nb-cell:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); }
.nd-nb-num { font-size: 1.3rem; font-weight: 800; font-family: 'DM Mono'; color: var(--navy); }
.nd-nb-name { font-size: .65rem; color: var(--text3); margin-top: 3px; text-align: center; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Current number highlight */
.nd-nb-cell.nd-nb-current { border-color: var(--blue); background: #eff6ff; }
.nd-nb-cell.nd-nb-current .nd-nb-num { color: var(--blue); }

/* Type colors */
.nd-nb-cell.nd-nb-prime   { border-color: #d97706; }
.nd-nb-cell.nd-nb-prime   .nd-nb-num { color: #d97706; }
.nd-nb-cell.nd-nb-fib     { border-color: #0d9488; }
.nd-nb-cell.nd-nb-fib     .nd-nb-num { color: #0d9488; }
.nd-nb-cell.nd-nb-perfect { border-color: #7c3aed; }
.nd-nb-cell.nd-nb-perfect .nd-nb-num { color: #7c3aed; }

/* Notable neighbors row */
.nd-nb-notable {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 4px; margin-bottom: 16px;
}
.nd-nb-notable-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px; border-radius: var(--radius-lg); text-decoration: none;
  border: 1.5px solid var(--border); transition: all .18s;
}
.nd-nb-notable-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.nd-nb-notable-lbl { font-size: .68rem; color: var(--text3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.nd-nb-notable-val { font-size: 1.5rem; font-weight: 900; font-family: 'DM Mono'; margin-top: 4px; }
.nd-nb-notable-item.nd-nb-prime  { background: #fffbeb; border-color: #d97706; }
.nd-nb-notable-item.nd-nb-prime  .nd-nb-notable-val { color: #d97706; }
.nd-nb-notable-item.nd-nb-fib    { background: #f0fdfa; border-color: #0d9488; }
.nd-nb-notable-item.nd-nb-fib    .nd-nb-notable-val { color: #0d9488; }
.nd-nb-notable-item.nd-nb-sq     { background: #f0f9ff; border-color: #0284c7; }
.nd-nb-notable-item.nd-nb-sq     .nd-nb-notable-val { color: #0284c7; }

/* Legend */
.nd-nb-legend {
  font-size: .78rem; color: var(--text3);
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  padding: 10px 0;
}
.nd-nb-l { font-size: 1rem; }
.nd-nb-l.nd-nb-current { color: var(--blue); }
.nd-nb-l.nd-nb-prime   { color: #d97706; }
.nd-nb-l.nd-nb-fib     { color: #0d9488; }
.nd-nb-l.nd-nb-perfect { color: #7c3aed; }

/* Responsive */
@media (max-width: 720px) {
  .nd-meaning-card { flex-direction: column; gap: 16px; padding: 24px; }
  .nd-meaning-num  { font-size: 2.5rem; opacity: .2; }
  .nd-nb-notable   { grid-template-columns: 1fr 1fr; }
  .nd-nb-cell      { min-width: 60px; padding: 8px 10px; }
}

/* ══════════════════════════════════════════════
   TOOLS TAB
══════════════════════════════════════════════ */
.nd-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.nd-tool-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow .18s, border-color .18s;
}
.nd-tool-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 16px rgba(37,99,235,.08);
}
.nd-tool-title {
  font-size: .8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text3); margin-bottom: 12px;
}
.nd-tool-input-row {
  display: flex; gap: 6px; align-items: center; margin-bottom: 10px;
}
.nd-tool-input {
  flex: 1; min-width: 0;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem; font-family: 'DM Mono', monospace;
  background: var(--off); color: var(--navy);
  transition: border-color .15s;
}
.nd-tool-input:focus { outline: none; border-color: var(--blue); background: var(--white); }
.nd-tool-op { font-size: .8rem; font-weight: 700; color: var(--text3); padding: 0 2px; flex-shrink: 0; }
.nd-tool-btn {
  padding: 7px 14px;
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius);
  font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: background .15s; flex-shrink: 0;
}
.nd-tool-btn:hover { background: #1d4ed8; }
.nd-tool-result {
  font-size: .85rem; line-height: 1.6;
  min-height: 24px; color: var(--text2);
  opacity: 0; transition: opacity .2s;
}
.nd-tool-result.has-result { opacity: 1; }
.tool-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; border-bottom: 1px solid var(--border);
  gap: 8px;
}
.tool-row:last-child { border-bottom: none; }
.tool-lbl { color: var(--text3); font-size: .8rem; }
.tool-row strong { font-family: 'DM Mono', monospace; color: var(--navy); }
.tool-row a { font-family: 'DM Mono'; color: var(--blue); font-weight: 700; }
.tool-row code { font-family: 'DM Mono'; background: var(--off); padding: 1px 5px; border-radius: 4px; font-size: .8rem; }
.tool-seq {
  font-family: 'DM Mono'; font-size: .75rem;
  color: var(--text3); margin-top: 6px;
  word-break: break-all; line-height: 1.5;
}
.tool-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.divisor-pill.sm { padding: 2px 7px; font-size: .75rem; }
.tool-fact-html { font-family: 'DM Mono'; font-size: .95rem; }

@media (max-width: 720px) {
  .nd-tools-grid { grid-template-columns: 1fr; }
}
/* ═══════════════════════════════════════════════════════
   PATCH — Share button + Mega menu Jeux
   À coller à la FIN de style.css
   ═══════════════════════════════════════════════════════ */

/* ── Bouton Partager ─────────────────────────────────── */
.nd-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 20px;
  margin-top: 12px;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  background: var(--off);
  color: var(--text2);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.nd-share-btn:hover {
  border-color: var(--blue-md);
  background: var(--blue-lt);
  color: var(--blue);
}
.nd-share-btn.copied {
  border-color: var(--green);
  background: var(--green-lt);
  color: var(--green);
}

/* ── Mega menu Jeux ──────────────────────────────────── */

/* Réduire la largeur min du dropdown pour un seul bloc */
.nav-item.has-mega:has(.mega-inner--games) .mega-menu {
  min-width: 0;
}
.mega-inner--games {
  grid-template-columns: 1fr;
  min-width: 300px;
  max-width: 340px;
}

/* Item jeu : grille icône | texte | badge */
.mega-game-item {
  list-style: none;
}
.mega-game-item > a {
  display: grid !important;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px !important;
  border-radius: var(--radius);
  transition: background .15s;
  text-decoration: none;
}
.mega-game-item > a:hover {
  background: var(--off);
}

/* Icône dans un carré */
.mega-game-item .mega-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.mega-game-item > a:hover .mega-icon {
  background: var(--blue-lt);
  border-color: var(--blue-md);
}

/* Bloc texte */
.mega-game-item > a > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.mega-game-item > a strong {
  display: block;
  font-size: .875rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}
.mega-game-desc {
  display: block;
  font-size: .72rem;
  color: var(--text2);
  line-height: 1.3;
  white-space: normal;
}

/* Badge NOUVEAU */
.mega-badge {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 7px;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  background: var(--indigo);
  color: #fff;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
