
:root{
  --boy-rgb: 91,140,255;
  --girl-rgb: 255,111,177;
  --bg:#F4F8FF;
  --panel:#FFFFFF;
  --panel2:#F0F5FF;
  --text:#0B1020;
  --muted:#4A587A;
  --accent:#5B8CFF;
  --accent2:#7ED7C1;
  /* Gender accent (set by body.gender-*) */
  --gender:#5B8CFF;
  --gender-rgb: 91,140,255;
  --border:rgba(12,20,44,.12);
  --shadow:0 18px 50px rgba(12,20,44,.12);
  --radius:18px;
}

body.gender-girl{ --gender:#FF6FB1; --gender-rgb: 255,111,177; }
body.gender-boy{ --gender:#5B8CFF; --gender-rgb: 91,140,255; }
body.gender-any{ --gender:#5B8CFF; --gender-rgb: 91,140,255; }
body.dark{
  --bg:#0b1020;
  --panel:#111a33;
  --panel2:#0f1730;
  --text:#eaf0ff;
  --muted:#a9b5d6;
  --accent:#5B8CFF;
  --accent2:#7ED7C1;
  --border:rgba(255,255,255,.10);
  --shadow:0 18px 50px rgba(0,0,0,.45);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 20% 10%, rgba(var(--gender-rgb),.22), transparent 55%),
              radial-gradient(900px 600px at 80% 20%, rgba(126,215,193,.18), transparent 55%),
              radial-gradient(900px 600px at 50% 90%, rgba(var(--gender-rgb),.10), transparent 55%),
              var(--bg);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
a:hover{opacity:.9}

.topbar{
  position:sticky; top:0; z-index:50;
  backdrop-filter: blur(14px);
  background: rgba(255,255,255,.75);
  border-bottom:1px solid var(--border);
  padding:0; /* v3.9: inner container handles padding */
}
body.dark .topbar{
  background: linear-gradient(to bottom, rgba(11,16,32,.85), rgba(11,16,32,.55));
}
.brand{display:flex; gap:12px; align-items:center}
.logo{width:44px;height:44px;border-radius:12px;border:1px solid var(--border); background:rgba(255,255,255,.06)}
.brand-name{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px;color:var(--muted);margin-top:2px}

.toplinks{display:flex; gap:16px; font-size:16px; font-weight:600; color:var(--muted)}
.toplinks a{padding:8px 10px;border-radius:12px}
.toplinks a:hover{background:rgba(255,255,255,.06); color:var(--text)}

.wrap{max-width:1100px;margin:0 auto;padding:22px 18px 40px}

/* Some pages use .shell/.card (kept for compatibility)
   Treat them as aliases of the main layout primitives. */
.shell{max-width:1100px;margin:0 auto;padding:22px 18px 40px}

.card{
  margin-top:18px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(240,245,255,.92));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}
body.dark .card{
  background: linear-gradient(180deg, rgba(17,26,51,.75), rgba(15,23,48,.72));
}

.hero{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:18px;
  align-items:start;
}
.hero-left, .hero-right{
  /* Light mode: clean bright cards */
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(240,245,255,.92));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
}
body.dark .hero-left,
body.dark .hero-right{
  background: linear-gradient(180deg, rgba(17,26,51,.82), rgba(15,23,48,.78));
}
.hero-left{padding:22px}
.hero-right{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:12px;
  align-items:stretch;
  justify-content:flex-start;
  justify-self:end;
  width:fit-content;
  max-width:420px;
}

h1{margin:0 0 10px; font-size:40px; line-height:1.1}
.accent{color:var(--gender)}
.lead{margin:0 0 14px; color:var(--muted); font-size:16px}

.controls{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:12px 0 16px}
.segmented{
  display:flex; background:rgba(255,255,255,.06); border:1px solid var(--border);
  border-radius:16px; padding:4px;
}
.segbtn{
  border:0; background:transparent; color:var(--muted);
  padding:10px 12px; border-radius:12px; cursor:pointer; font-weight:700;
}
.segbtn.active{background:rgba(var(--gender-rgb),.18); color:var(--text); border:1px solid rgba(var(--gender-rgb),.32)}
.checkbox{display:flex; align-items:center; gap:10px; color:var(--muted); user-select:none}
.checkbox input{transform: scale(1.1)}

.namecard{
  background: rgba(255,255,255,.70);
  border:1px solid var(--border);
  border-radius: 18px;
  padding:14px;
}
body.dark .namecard{ background: rgba(255,255,255,.05); }

.preview{padding:6px 8px 12px;
}
.preview-line{
  font-size:28px;
  font-weight:900;
  letter-spacing:.2px;
  padding:10px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(12,20,44,.10);
}
body.dark .preview-line{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}
.preview-chips{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
.chip{
  padding:10px 12px;
  border-radius:999px;
  background:rgba(var(--gender-rgb),.14);
  border:1px solid rgba(var(--gender-rgb),.22);
  font-weight:850;
}
body.dark .chip{ background:rgba(0,0,0,.18); border:1px solid rgba(255,255,255,.12); }
.row{display:grid; grid-template-columns: 1fr auto; gap:12px; align-items:center; padding:10px 8px}
.row + .row{border-top:1px solid rgba(255,255,255,.08)}
.row-last{grid-template-columns: 1fr auto; padding-bottom:14px}
.label{font-size:12px;color:var(--muted); margin-bottom:6px}
.value{font-size:26px; font-weight:850; letter-spacing:.2px}

.nameinput{
  font-size:22px;
  font-weight:900;
  letter-spacing:.2px;
  padding:12px 12px;
}
.lockcol{display:flex; align-items:center; justify-content:flex-end}
.lock{
  width:46px;height:42px;border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
  cursor:pointer; font-size:18px;
}
.lock[aria-pressed="true"]{background:rgba(126,215,193,.18); border-color:rgba(126,215,193,.35)}

.text{
  width:100%;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.86);
  color:var(--text);
  padding:12px 12px;
  outline:none;
}
body.dark .text{ background:rgba(0,0,0,.22); }
.text:focus{border-color:rgba(91,140,255,.45); box-shadow:0 0 0 3px rgba(91,140,255,.18)}

.actions{display:flex; gap:10px; padding:10px 6px 6px}
.btn{
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:12px 14px;
  border-radius:16px;
  cursor:pointer;
  font-weight:800;
}
.btn:hover{transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn.primary{background:rgba(var(--gender-rgb),.22); border-color:rgba(var(--gender-rgb),.40)}
.btn.ghost{background:transparent}
.btn.mini{padding:10px 12px;border-radius:14px}
.botwrap{
  position:relative;
  display:inline-block;
  width:fit-content;
  max-width:360px;
  padding:8px;
}

/* Gender glow behind BabyBot (blue by default, pink on Girl) */
.botwrap::before{
  content:"";
  position:absolute;
  left:50%;
  top:58%;
  width:340px;
  height:340px;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle,
    rgba(var(--gender-rgb), .42) 0%,
    rgba(var(--gender-rgb), .16) 42%,
    rgba(0,0,0,0) 72%);
  filter: blur(18px);
  opacity: .95;
  z-index:0;
  pointer-events:none;
}

.bot{
  position:relative;
  z-index:1;
  width:320px;
  max-width:100%;
  height:auto;
  object-fit:contain;
  /* Softer shadow + a subtle colored lift (replaces the dark fade) */
  filter:
    drop-shadow(0 14px 28px rgba(0,0,0,.25))
    drop-shadow(0 0 42px rgba(var(--gender-rgb), .22));
}
.bubble{
  z-index:2;
  position:absolute;
  left:10px;
  top:10px;
  right:auto;
  width:fit-content;
  max-width:260px;
}
.bubble-inner{
  max-width: 260px;
  background: rgba(255,255,255,.94);
  border:1px solid rgba(11,16,32,.12);
  border-radius:18px;
  padding:12px 12px;
  box-shadow:0 14px 40px rgba(0,0,0,.35);
}
#bubbleText{color:#0b1020; font-weight:700; line-height:1.35}
.typing{display:none; gap:6px; margin-bottom:8px}
.typing span{
  width:8px;height:8px;border-radius:999px;
  background: rgba(11,16,32,.28);
  display:inline-block;
  animation: bounce 1.1s infinite;
}
.typing span:nth-child(2){animation-delay:.15s}
.typing span:nth-child(3){animation-delay:.3s}
@keyframes bounce{0%,100%{transform: translateY(0)}50%{transform: translateY(-6px)}}


/* Inline favorites card inside the hero (above BabyBot) */
.favorites-inline{
  margin-top:0;
  padding:14px;
}
.favorites-inline h2{font-size:18px; margin-bottom:0}
.favorites-inline .panel-head{margin-bottom:8px}
.hero-right .favorites-inline .favlist{grid-template-columns: repeat(2, 1fr); gap:10px}
@media (max-width: 940px){
  .hero-right{width:auto; max-width:unset}
  .hero-right .favorites-inline .favlist{grid-template-columns: 1fr 1fr}
}
@media (max-width: 520px){
  .hero-right .favorites-inline .favlist{grid-template-columns: 1fr}
}

.panel{
  margin-top:18px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(240,245,255,.92));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}
body.dark .panel{
  background: linear-gradient(180deg, rgba(17,26,51,.75), rgba(15,23,48,.72));
}
.panel-head{display:flex; align-items:center; justify-content:space-between; gap:12px}
h2{margin:0 0 10px; font-size:22px}
.muted{color:var(--muted); margin-top:8px}

.favlist{display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin-top:12px}
.fav{
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  border-radius:18px;
padding:12px;
  display:flex; flex-direction:column; gap:10px;
}
.fav strong{font-size:18px}
.fav .sub{font-size:12px;color:var(--muted)}
.fav .fav-actions{display:flex; gap:8px; margin-top:auto}
.empty{margin-top:14px; color:var(--muted); border:1px dashed rgba(255,255,255,.18); border-radius:18px; padding:14px}

.linksgrid{display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; margin-top:12px}
.cardlink{
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  border-radius:18px;
  padding:14px;
  font-weight:850;
}
.cardlink:hover{background:rgba(255,255,255,.08)}

.footer {
  padding: 40px 20px 60px;
  margin-top: 60px;margin-top:18px; text-align:center; color:var(--muted)}
.footrow{display:flex; gap:10px; justify-content:center; align-items:center; flex-wrap:wrap}
.dot{opacity:.6}

.toast{
  position:fixed;
  left:50%;
  bottom:20px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.14);
  padding:10px 12px;
  border-radius:14px;
  display:none;
  color:var(--text);
  box-shadow:0 18px 50px rgba(0,0,0,.55);
}

@media (max-width: 940px){
  .hero{grid-template-columns: 1fr}
  .bubble{left:10px; top:10px}
  h1{font-size:34px}
  .favlist{grid-template-columns: 1fr 1fr}
  .linksgrid{grid-template-columns: 1fr 1fr}
  .toplinks{display:none}
}
@media (max-width: 520px){
  .favlist{grid-template-columns: 1fr}
  .linksgrid{grid-template-columns: 1fr}
  .value{font-size:24px}
}


.top-actions{display:flex; align-items:center; gap:10px}
.iconbtn{
  border:1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  width:40px; height:40px;
  border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.iconbtn:hover{transform: translateY(-1px)}


/* Select */
.select{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  outline:none;
}
.select:focus{
  box-shadow: 0 0 0 4px rgba(91,140,255,0.18);
}


/* Browse page */
.names-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.chip{
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding:10px 12px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
}
.chip:hover{ transform: translateY(-1px); }
.toast{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%);
  background: rgba(0,0,0,.85);
  color:white;
  padding:10px 14px;
  border-radius:12px;
  font-weight:700;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(-2px); }
:root[data-theme="light"] .toast{ background: rgba(20, 32, 60, .92); }


/* Accent (Boy/Girl) */
:root{
  --accent-blue: #5B8CFF;
  --accent-pink: #FF5BAA;
  --accent: var(--accent-blue);
}
:root[data-accent="girl"]{ --accent: var(--accent-pink); }
:root[data-accent="boy"]{ --accent: var(--accent-blue); }

/* Ensure selects are readable in dark mode */
:root[data-theme="dark"] select,
:root[data-theme="dark"] option{
  background: var(--bg);
  color: var(--text);
}

/* Browse year dropdown sizing */
.yearselect{
  width: 240px;
  max-width: 240px;
}
@media (max-width: 520px){
  .yearselect{
    width: 100%;
    max-width: none;
  }
}

/* Use accent for primary buttons + active segmented button */
.btn.primary{ background: var(--accent) !important; border-color: transparent !important; }
.segbtn.active{ background: color-mix(in srgb, var(--accent) 22%, transparent) !important; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)) !important; }


/* Accent visibility without color-mix (broader browser support) */
.btn.primary{ background: var(--accent) !important; color:#fff !important; }
.segbtn.active{
  background: var(--accent) !important;
  color:#fff !important;
  border-color: var(--accent) !important;
}
/* Subtle accent glow on browse page */
:root[data-accent="boy"] .topbar{ box-shadow: 0 8px 30px rgba(91,140,255,.22); }
:root[data-accent="girl"] .topbar{ box-shadow: 0 8px 30px rgba(255,91,170,.22); }


/* Prevent background tiling/seams */
body{
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-position: top center !important;
}


/* Dark mode year dropdown should look exactly like light mode */
:root[data-theme="dark"] select.yearselect{
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #d0d7e2 !important;
}
:root[data-theme="dark"] select.yearselect option{
  background: #ffffff !important;
  color: #111111 !important;
}


/* Force native dropdown to render in light scheme (fixes unreadable option text in some browsers) */
:root[data-theme="dark"] select.yearselect{
  color-scheme: light;
}


/* If theme is applied via body.dark, mirror the yearselect light styling */
body.dark select.yearselect{
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid #d0d7e2 !important;
  color-scheme: light;
}


/* Numbered ranks on list pages */
.chip{
  display:flex;
  gap:10px;
  align-items:center;
}
.chip .rank{
  font-weight:800;
  opacity:.6;
  min-width:28px;
  text-align:right;
}
.chip .label{
  font-weight:700;
}

/* Brand logo (header) */
.brandlogo{
  width: 148px !important;
  height: auto !important;
  border-radius: 14px !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
/* Keep mobile header tidy */
@media (max-width: 520px){
  .brandlogo{ width: 120px !important; }
  .brand-sub{ display:none; }
}


/* --- Header wordmark + hamburger menu --- */
.brand-wordmark{
  height:30px;
  width:auto;
  display:block;
  line-height:1;
}
.brand .brand-name{ /* keep for pages that still use text */
  font-weight:800;
}
.top-actions{display:flex; gap:10px; align-items:center}

/* Hide inline links; use hamburger for all sizes */
.toplinks{display:none}

/* Hamburger button uses existing .iconbtn styles */
.nav-overlay{
  display:block;
  opacity:0;
  pointer-events:none;
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  z-index:60;
  transition: opacity .15s ease;
}
body.nav-open .nav-overlay,
.nav-open .nav-overlay{
  opacity:1;
  pointer-events:auto;
}


/* Menu panel */
.nav-open .toplinks{
  display:flex;
  position:fixed;
  top:72px;
  left:16px;
  right:16px;
  z-index:70;
  flex-direction:column;
  gap:10px;
  padding:14px;
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.18);
  max-height: calc(100vh - 92px);
  overflow:auto;
}
.nav-open .toplinks a{
  padding:10px 12px;
  border-radius:12px;
  background: rgba(255,255,255,.04);
}
body:not(.dark) .nav-open .toplinks a{ background: rgba(0,0,0,.03); }


/* Desktop: position dropdown near top-right (avoid header scrolling issues) */
@media (min-width: 860px){
  .nav-open .toplinks{
    position:fixed;
    top:72px;
    left:auto;
    right: max(18px, calc((100vw - 1100px)/2 + 18px));
    width:360px;
    max-height: calc(100vh - 92px);
    overflow:auto;
  }
}

/* --- v3.7: hamburger visibility + full logo header --- */
.logo-full{
  height:56px;
  width:auto;
  display:block;
}
.logo-text{
  font-weight:800;
  font-size:30px;
  line-height:1;
  letter-spacing:.2px;
  padding:6px 0;
  color: var(--text);
  text-shadow: 0 8px 22px rgba(0,0,0,.35);
}
.logo-text .logo-accent{
  color: var(--accent);
}

/* Remove the old square logo styling if any element still uses .logo */
.brand .logo{border-radius:12px}

/* Make hamburger always visible on gradients */
.menu-toggle{
  width:44px;
  height:44px;
  font-size:22px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
}
.menu-toggle:hover{
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.30);
}
.menu-toggle:active{ transform: translateY(1px); }
.menu-toggle:focus-visible{
  outline: 3px solid rgba(120,180,255,0.65);
  outline-offset: 3px;
}

/* Light mode contrast */
body:not(.dark) .menu-toggle{
  border:1px solid rgba(0,0,0,0.16);
  background: rgba(0,0,0,0.06);
  box-shadow: 0 10px 22px rgba(0,0,0,0.10);
}
body:not(.dark) .menu-toggle:hover{
  background: rgba(0,0,0,0.10);
  border-color: rgba(0,0,0,0.22);
}

@media (max-width: 600px){
  .logo-full{ height:44px; }
  .menu-toggle{ font-size:20px; }
}




/* --- v3.8: header/logo sizing + clickable hamburger menu --- */
.topbar{
  z-index: 120; /* ensure menu panel sits above overlay (stacking context fix) */
  align-items:flex-start;
}
.brand{
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.logo-full{
  height: 86px; /* bigger, more brand-forward */
}
.brand-sub{
  font-size: 13px;
  margin-top: 0;
}
/* Put the subtitle under the logo cleanly */
.brand > div{ padding-left: 2px; }

/* Overlay must stay below the menu panel but above page content */
.nav-overlay{
  z-index: 110;
}
.nav-open .toplinks{
  z-index: 130;
  top: 96px; /* account for larger logo */
}

/* Mobile tuning */
@media (max-width: 600px){
  .logo-full{ height: 64px; }
  .nav-open .toplinks{ top: 84px; }
}



/* v3.9 header tuning */
body.dark .topbar{
  background: rgba(12,18,38,.72);
}
.topbar-inner{
  max-width:1100px;
  margin:0 auto;
  padding:18px 18px; /* taller header */
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.brand{
  display:flex;
  align-items:center;
  gap:14px;
}
.brand-sub{
  font-size:14px; /* bigger, feels intentional */
  font-weight:600;
  letter-spacing:.2px;
  color:var(--muted);
  margin:0;
}
/* If you want a more "logo-y" feel later, we can swap this to a rounded font */
.logo-full{
  height:74px; /* brand-forward but not huge */
  width:auto;
  display:block;
}
@media (max-width: 600px){
  .topbar-inner{ padding:14px 14px; }
  .logo-full{ height:56px; }
  .brand-sub{ font-size:13px; }
}


/* v3.9 menu sizing + contrast */
.nav-open .toplinks{
  /* default is full-width; we tighten on desktop below */
  background: var(--panel);
}
.nav-open .toplinks a{
  color: var(--text);
}
body.dark .nav-open .toplinks a{
  color: var(--text);
}
@media (min-width: 900px){
  .nav-open .toplinks{
    left:auto;
    right: max(18px, calc((100vw - 1100px)/2 + 18px + 54px)); /* shift left under ☰ (theme button sits to the right) */
    width:340px;
    max-width: calc(100vw - 36px);
  }
}



/* --- v4.3: bubbly font to match BabyBot branding --- */
:root{
  --fontBrand: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
body{
  font-family: var(--fontBrand);
  letter-spacing: 0.1px;
}
h1, h2, h3, .title, .hero-title{
  font-family: var(--fontBrand);
  font-weight: 700;
  letter-spacing: 0.2px;
}
button, input, select, textarea{
  font-family: var(--fontBrand);
}
/* Make small UI labels feel a little softer */
.small, .muted, .brand-sub, .label{
  letter-spacing: 0.15px;
}



/* --- How-to section --- */
.howto-card{
  display:flex;
  gap:12px;
  align-items:flex-start;
}
.howto-num{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:34px;
  height:34px;
  border-radius:12px;
  font-weight:800;
  background: rgba(var(--gender-rgb), .14);
  border: 1px solid rgba(var(--gender-rgb), .25);
}
.howto-title{
  font-weight:800;
  margin-bottom:4px;
}
.howto-body .muted{
  font-size:14px;
}


/* Top 10 names block */
.top10-wrap{ margin-top:18px; padding-top:14px; border-top:1px solid rgba(255,255,255,.10);}
.top10-title{ margin:0 0 6px 0; font-size:18px;}
.top10-grid{ display:grid; gap:14px; grid-template-columns:1fr; margin-top:10px;}
.top10-col{ position:relative; overflow:hidden; background:rgba(0,0,0,.18); border:1px solid rgba(255,255,255,.10); border-radius:16px; padding:12px 12px 10px;}
.top10-head{ font-weight:700; margin-bottom:8px;}

/* Mobile fix: keep Top 20 Boys/Girls header aligned inside its card */
@media (max-width: 520px){
  .top10-col .top10-head{
    text-align: left;
    align-self: flex-start;
  }
}

.top10-list{ margin:0; padding-left:22px;}
.top10-list li{ margin:6px 0; display:flex; justify-content:space-between; gap:10px;}
.top10-list .nm{ font-weight:650;}
.top10-list .ct{ opacity:.85; font-variant-numeric:tabular-nums;}

/* Color-coded Top 10 columns */
.top10-col::before{
  content:'';
  position:absolute;
  inset:-2px;
  pointer-events:none;
  opacity:.85;
  background: radial-gradient(700px 220px at 18% 0%, rgba(255,255,255,.08), transparent 55%);
}
.top10-col:nth-child(1){
  border-color: rgba(var(--boy-rgb), .28);
  background: radial-gradient(520px 260px at 15% 0%, rgba(var(--boy-rgb), .22), transparent 60%),
              rgba(0,0,0,.16);
}
.top10-col:nth-child(2){
  border-color: rgba(var(--girl-rgb), .28);
  background: radial-gradient(520px 260px at 15% 0%, rgba(var(--girl-rgb), .22), transparent 60%),
              rgba(0,0,0,.16);
}
.top10-col:nth-child(1) .top10-head{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(var(--boy-rgb), .16);
  border: 1px solid rgba(var(--boy-rgb), .30);
}
.top10-col:nth-child(2) .top10-head{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(var(--girl-rgb), .16);
  border: 1px solid rgba(var(--girl-rgb), .30);
}
.top10-list li{
  padding:6px 8px;
  border-radius:10px;
}
.top10-col:nth-child(1) .top10-list li:nth-child(odd){
  background: rgba(var(--boy-rgb), .08);
}
.top10-col:nth-child(2) .top10-list li:nth-child(odd){
  background: rgba(var(--girl-rgb), .08);
}
@media (min-width: 860px){
  .top10-grid{ grid-template-columns:1fr 1fr;}
}


/* --- Name Details Modal --- */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}
.modal-backdrop.open{ display: flex; }

.modal{
  width: min(560px, 100%);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  overflow: hidden;
}
body.dark .modal{
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
body.dark .modal-head{
  border-bottom-color: rgba(255,255,255,.08);
}
.modal-title{
  display:flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-title h3{
  margin: 0;
  font-size: 22px;
  letter-spacing: .2px;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.04);
}
body.dark .badge{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.badge.boy{ background: rgba(64,140,255,.16); border-color: rgba(64,140,255,.35); }
.badge.girl{ background: rgba(255,92,186,.16); border-color: rgba(255,92,186,.35); }
.badge.any{ background: rgba(120,120,120,.12); }
.modal-close{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
}
body.dark .modal-close{ border-color: rgba(255,255,255,.12); }
.modal-body{
  padding: 14px 16px 16px 16px;
}
.kpis{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
@media (max-width:520px){
  .kpis{ grid-template-columns: 1fr; }
}
.kpi{
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 14px;
  padding: 10px 12px;
}
body.dark .kpi{
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}
.kpi .label{
  font-size: 12px;
  opacity: .75;
  font-weight: 700;
  margin-bottom: 6px;
}
.kpi .value{
  font-size: 18px;
  font-weight: 900;
}
.modal-actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.modal-actions a{
  text-decoration: none;
  font-weight: 800;
}
.modal-actions .mini{
  font-size: 12px;
  opacity: .75;
}
.details-btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.03);
  cursor: pointer;
  font-weight: 800;
}
body.dark .details-btn{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.details-btn:hover{ transform: translateY(-1px); }


/* --- Center BabyBot in right column --- */
.hero-right{
  align-items: center;
}
.bot-wrap{
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.bot-bubble{
  margin-left: auto;
  margin-right: auto;
}


body.dark .details-btn{ color: rgba(255,255,255,.95); }

/* Top lists: rank badges + two-column mode */
.rank-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:22px;
  padding:0 8px;
  border-radius: 999px;
  font-size:12px;
  font-weight:900;
  background: rgba(0,0,0,.06);
  border: 1px solid var(--border);
  margin-right:10px;
}
body.dark .rank-badge{ background: rgba(255,255,255,.08); }

.top10-grid.top10-single{
  grid-template-columns: 1fr;
}

.top10-two-col{
  columns: 2;
  column-gap: 18px;
}
.top10-two-col li{
  break-inside: avoid;
  display:flex;
  align-items:center;
}


.nav-open .nav-overlay{ display:block; opacity:1; pointer-events:auto; }


/* Name page chart + card polish */
.chart-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
#rankChart{
  width: 100%;
  height: auto;
  display: block;
}


/* Browse results width */
.namegrid{max-width:1100px;margin:0 auto;}

/* Browse width */
.browse-wrap{max-width:1100px;margin:0 auto;}

/* Generator remove buttons */
.lockcol{display:flex; gap:8px; align-items:center; justify-content:flex-end;}
button.remove{
  width:42px;height:42px;border-radius:14px;
  border:1px solid var(--border);
  background: var(--panel);
  font-weight:900;
  cursor:pointer;
}
button.remove[aria-pressed="true"]{
  background: rgba(255,80,80,.12);
  border-color: rgba(255,80,80,.35);
}

.chip{ text-decoration:none; }

/* ============================= */
/* Mobile layout fixes (Top 20 + Trend cards) */
/* ============================= */
@media (max-width: 768px){

  /* Ensure any Top 20 list that uses CSS columns collapses to one column */
  .top10-two-col{
    columns: 1;
    column-gap: 0;
  }

  /* If any grid layouts exist for Top 20 / trends, force single column */
  .top10-grid,
  .trends-grid,
  .trends-row,
  .trend-grid,
  .trendgrid,
  .trends-cards,
  .trends-cards-grid{
    grid-template-columns: 1fr !important;
  }

  /* Prevent right-side clipping caused by long flex/grid children */
  .top10-col,
  .trend-card,
  .trend,
  .trenditem{
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

}

/* ============================= */
/* Trend cards alignment (Fastest rising / Hidden gems / Falling) */
/* ============================= */
.trends-grid,
.trends-row,
.trends-cards,
.trends-cards-grid,
.trend-grid,
.trendgrid{
  display:grid;
  gap:14px;
  align-items:stretch;
}

/* Desktop/tablet: 3-up when there is room */
@media (min-width: 860px){
  .trends-grid,
  .trends-row,
  .trends-cards,
  .trends-cards-grid,
  .trend-grid,
  .trendgrid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Mobile: stack + prevent overflow */
@media (max-width: 859px){
  .trends-grid,
  .trends-row,
  .trends-cards,
  .trends-cards-grid,
  .trend-grid,
  .trendgrid{
    grid-template-columns: 1fr !important;
  }
}

.trend-card,
.trend,
.trenditem{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  align-self:stretch;
}

/* Ensure inner content doesn't push cards wider */
.trend-card *,
.trend *,
.trenditem *{
  min-width:0;
}

/* Optional: make headings consistent */
.trend-card h3,
.trend h3,
.trenditem h3{
  margin-top:0;
}

/* ============================= */
/* Hidden Gems header badge (200–500) alignment fix */
/* Keeps the badge from overflowing/pushing the middle column */
/* ============================= */
.trend-card .panel-head,
.trend-card .trend-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.trend-card .panel-head > *:first-child,
.trend-card .trend-head > *:first-child{
  min-width:0;
}

/* Common badge classes used across the site */
.trend-card .panel-head .badge,
.trend-card .panel-head .chip,
.trend-card .panel-head .range,
.trend-card .trend-head .badge,
.trend-card .trend-head .chip,
.trend-card .trend-head .range{
  position: static !important;
  inset: auto !important;
  transform: none !important;
  margin-left: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* If the badge is absolutely positioned without a specific class, this catches it */
.trend-card .panel-head [style*="position:absolute"],
.trend-card .trend-head [style*="position:absolute"]{
  position: static !important;
  inset: auto !important;
  transform: none !important;
  margin-left: auto;
  white-space: nowrap;
}

/* Ensure nothing can widen the card */
.trend-card{
  overflow: hidden;
}

/* KPI trend header fixes */
/* ============================= */
/* KPI trend cards: fix Hidden Gems badge + color arrows */
/* Targets the Fastest rising / Hidden gems / Falling cards */
/* ============================= */
.kpi{
  overflow: hidden; /* prevent badge bleed on small screens */
}

.kpi > div:first-child{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:nowrap;
}

.kpi > div:first-child > div{
  min-width:0;
}

/* Keep the badge inside the card and aligned */
.kpi > div:first-child .badge{
  margin-left:auto;
  align-self:flex-start;
  white-space:nowrap;
  flex: 0 0 auto;
}

/* Arrow badges: green for up, red for down */
.kpi > div:first-child .badge.boy{
  background: rgba(34, 197, 94, .22) !important;
  border-color: rgba(34, 197, 94, .40) !important;
  color: rgba(34, 197, 94, 1) !important;
}
.kpi > div:first-child .badge.girl{
  background: rgba(239, 68, 68, .22) !important;
  border-color: rgba(239, 68, 68, .40) !important;
  color: rgba(239, 68, 68, 1) !important;
}

/* Keep Hidden Gems range badge neutral */
.kpi > div:first-child .badge.any{
  background: rgba(255,255,255,.08);
}

/* ============================= */
/* KPI header: prevent badge overlap on narrow widths */
/* ============================= */
.kpi > div:first-child{
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 6px;
}

.kpi > div:first-child > div{
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
  overflow-wrap: anywhere;
}

/* If the badge can't fit beside the title, drop it to the next line (still right-aligned) */
@media (max-width: 520px){
  .kpi > div:first-child .badge.any{
    margin-left: 0;
    width: fit-content;
  }
}

/* ============================= */
/* Trend delta pills inside name cards: green up / red down */
/* ============================= */
.namecard .badge.boy{
  background: rgba(34, 197, 94, .22) !important;
  border-color: rgba(34, 197, 94, .40) !important;
  color: rgba(34, 197, 94, 1) !important;
}
.namecard .badge.girl{
  background: rgba(239, 68, 68, .22) !important;
  border-color: rgba(239, 68, 68, .40) !important;
  color: rgba(239, 68, 68, 1) !important;
}
.namecard .badge.any{
  background: rgba(255,255,255,.08);
}

/* Keep badge text from wrapping weirdly */
.namecard .badge{
  white-space: nowrap;
}

/* ============================= */
/* KPI cards (Fastest rising / Hidden gems / Falling) mobile fit + polish */
/* ============================= */

/* Ensure KPI wrapper behaves as grid even if inline styles exist */
.kpis{ display:grid; }

/* Mobile: stack KPI columns to prevent overflow/right shift */
@media (max-width: 820px){
  .kpis{
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* KPI header: allow title to wrap and keep badge inside */
.kpi > div:first-child{
  flex-wrap: wrap;
}
.kpi > div:first-child > div{
  min-width: 0;
}

/* Make KPI header badge tighter so it doesn't look floaty */
.kpi .badge{
  padding: 8px 10px;
  border-radius: 999px;
}

/* ============================= */
/* Trend delta pills inside name cards: green up / red down */
/* (JS uses .badge.boy for up, .badge.girl for down) */
/* ============================= */
.namecard .meta .badge.boy{
  background: rgba(34, 197, 94, .22) !important;
  border-color: rgba(34, 197, 94, .38) !important;
  color: rgba(34, 197, 94, 1) !important;
}
.namecard .meta .badge.girl{
  background: rgba(239, 68, 68, .22) !important;
  border-color: rgba(239, 68, 68, .38) !important;
  color: rgba(239, 68, 68, 1) !important;
}
.namecard .meta .badge.any{
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.14) !important;
}

/* ============================= */
/* Trending page: color rank-change pills */
/* In trending.js, delta>0 uses .badge.boy, delta<0 uses .badge.girl */
/* Scope to #results so it doesn't affect other pages' boy/girl accents */
/* ============================= */
#results .badge.boy{
  background: rgba(34, 197, 94, .22) !important;
  border-color: rgba(34, 197, 94, .40) !important;
  color: rgba(34, 197, 94, 1) !important;
}
#results .badge.girl{
  background: rgba(239, 68, 68, .22) !important;
  border-color: rgba(239, 68, 68, .40) !important;
  color: rgba(239, 68, 68, 1) !important;
}
#results .badge.any{
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.14) !important;
  color: var(--text) !important;
}

/* ============================= */
/* FINAL Trending arrow color fix */
/* Forces arrow + text + SVG to proper green/red */
/* ============================= */

#results .badge.boy,
#results .badge.boy *,
#results .badge.boy svg{
  background: rgba(34,197,94,.22) !important;
  border-color: rgba(34,197,94,.45) !important;
  color: #16a34a !important;
  fill: #16a34a !important;
}

#results .badge.girl,
#results .badge.girl *,
#results .badge.girl svg{
  background: rgba(239,68,68,.22) !important;
  border-color: rgba(239,68,68,.45) !important;
  color: #dc2626 !important;
  fill: #dc2626 !important;
}

/* ============================= */
/* Name pages polish (hero, chart, table, buttons) */
/* ============================= */

/* Make the name feel like a "hero" */
.name-title,
.namepage h1,
main .panel h1.name{
  font-size: 46px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: .4px;
  margin: 0;
  display: inline-block;
  position: relative;
}

/* Subtle gender glow behind the name */
.name-title::after,
.namepage h1::after,
main .panel h1.name::after{
  content:"";
  position:absolute;
  inset:-10px -18px;
  background: radial-gradient(circle,
    rgba(var(--gender-rgb), .26) 0%,
    rgba(var(--gender-rgb), .12) 45%,
    transparent 72%);
  border-radius: 22px;
  filter: blur(18px);
  z-index:-1;
  pointer-events:none;
}

/* Make the chart card feel premium */
.chart-card{
  border-color: rgba(var(--gender-rgb), .22);
  box-shadow:
    0 14px 40px rgba(0,0,0,.08),
    0 0 0 1px rgba(var(--gender-rgb), .10) inset;
  overflow: hidden;
}
body.dark .chart-card{
  box-shadow:
    0 18px 60px rgba(0,0,0,.45),
    0 0 0 1px rgba(var(--gender-rgb), .12) inset;
}

/* Canvas a little crisper (JS draws the styling, this just frames it) */
#rankChart{
  border-radius: 14px;
}

/* The info table under the chart (covers most markup variants) */
.chart-card table,
.rank-table,
#rankTable,
.table-rank{
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-card th,
.rank-table th,
#rankTable th,
.table-rank th{
  text-align: left;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: .2px;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.chart-card td,
.rank-table td,
#rankTable td,
.table-rank td{
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}
.chart-card tr:nth-child(even) td,
.rank-table tr:nth-child(even) td,
#rankTable tr:nth-child(even) td,
.table-rank tr:nth-child(even) td{
  background: rgba(var(--gender-rgb), .05);
}
body.dark .chart-card tr:nth-child(even) td,
body.dark .rank-table tr:nth-child(even) td,
body.dark #rankTable tr:nth-child(even) td,
body.dark .table-rank tr:nth-child(even) td{
  background: rgba(255,255,255,.04);
}

/* Better mobile readability for table */
@media (max-width: 520px){
  .chart-card th,
  .chart-card td,
  .rank-table th,
  .rank-table td,
  #rankTable th,
  #rankTable td{
    padding: 10px 6px;
    font-size: 13px;
  }
}

/* Make Share stand out on name pages */
.share-btn,
a.share-btn,
button.share-btn,
.name-actions .share,
.name-actions .btn-share,
a[href*="share"] .btn,
a[href*="share"].btn{
  background: rgba(var(--gender-rgb), .95) !important;
  color: #fff !important;
  border: 1px solid rgba(var(--gender-rgb), .65) !important;
  box-shadow: 0 12px 30px rgba(var(--gender-rgb), .30);
}
.share-btn:hover,
.name-actions .btn-share:hover{
  transform: translateY(-1px);
}

/* Back button styling (works for <a> or <button>) */
.back-btn,
a.back-btn,
button.back-btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 900;
}
.back-btn:hover{ transform: translateY(-1px); }

/* Keep name page action row tidy */
.name-actions,
.page-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top: 12px;
}

/* ============================= */
/* Name page: KPI grid + trend table lively styling */
/* ============================= */

/* KPI cards (Year/Rank/Babies) on name pages */
.kpi-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 6px;
}
@media (max-width: 720px){
  .kpi-grid{ grid-template-columns: 1fr; }
}
.kpi-grid .kpi{
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--gender-rgb), .22);
  background: linear-gradient(180deg,
    rgba(var(--gender-rgb), .14),
    rgba(255,255,255,.04));
  box-shadow: 0 10px 30px rgba(var(--gender-rgb), .10);
}
body.dark .kpi-grid .kpi{
  background: linear-gradient(180deg,
    rgba(var(--gender-rgb), .16),
    rgba(255,255,255,.04));
}
.kpi-grid .kpi-label{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .2px;
  opacity: .75;
  margin-bottom: 6px;
}
.kpi-grid .kpi-value{
  font-size: 20px;
  font-weight: 950;
  letter-spacing: .2px;
  color: var(--text);
}
@media (max-width: 520px){
  .kpi-grid .kpi{ padding: 10px 12px; }
  .kpi-grid .kpi-value{ font-size: 20px; }
}

/* Trend table (Year/Rank/Babies/Category) */
#trendTable table,
.table table{
  width:100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow:hidden;
  background: rgba(255,255,255,.04);
}
#trendTable thead th,
.table thead th{
  text-align:left;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .2px;
  color: var(--muted);
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--gender-rgb), .07);
  white-space: nowrap;
}
#trendTable tbody td,
.table tbody td{
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#trendTable tbody tr:nth-child(even) td,
.table tbody tr:nth-child(even) td{
  background: rgba(var(--gender-rgb), .05);
}
body.dark #trendTable tbody tr:nth-child(even) td,
body.dark .table tbody tr:nth-child(even) td{
  background: rgba(255,255,255,.035);
}

/* Category pill */
.sexpill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  font-weight: 950;
  font-size: 12px;
}
.sexpill.boy{
  border-color: rgba(91,140,255,.45);
  background: rgba(91,140,255,.16);
  color: #dbe7ff;
}
.sexpill.girl{
  border-color: rgba(255,91,170,.45);
  background: rgba(255,91,170,.16);
  color: #ffe0f0;
}

/* Share button emoji spacing (sharebtn on name page) */
.sharebtn{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

/* ============================= */
/* Browse page mobile width fix */
/* Prevent segmented buttons from forcing horizontal overflow */
/* ============================= */
@media (max-width: 700px){

  /* Browse controls should stack on mobile */
  .browse .controls,
  body.browse .controls,
  .controls.browse-controls{
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .browse .controls .field,
  body.browse .controls .field,
  .controls.browse-controls .field{
    min-width: 0 !important;
    width: 100% !important;
  }

  .browse .controls select,
  .browse .controls input,
  body.browse .controls select,
  body.browse .controls input,
  .controls.browse-controls select,
  .controls.browse-controls input{
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Segmented buttons must never exceed the panel width */
  .browse .seg,
  body.browse .seg,
  .seg.browse-seg{
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
  }

  .browse .seg .segbtn,
  body.browse .seg .segbtn,
  .seg.browse-seg .segbtn{
    flex: 1 1 30% !important;
    min-width: 86px !important;
    text-align: center !important;
  }
}

/* Safety net: never allow horizontal scroll from controls */
body{ overflow-x: hidden; }
.wrap, .panel{ overflow-x: hidden; }


/* Name chart legend (Boy/Girl) */
.chart-legend{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:flex-start;
  margin-bottom:10px;
  padding-left:2px;
  font-weight:900;
  color: var(--muted);
  font-size:12px;
}
.chart-legend .item{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
}
body.dark .chart-legend .item{ background: rgba(255,255,255,.04); }
.chart-legend .dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
}
.chart-legend .item.boy .dot{ background: rgba(var(--boy-rgb), .95); }
.chart-legend .item.girl .dot{ background: rgba(var(--girl-rgb), .95); }

/* Footer */

.site-footer{
  margin-top:48px;
  padding:28px 16px 18px;
  border-top:1px solid rgba(255,255,255,.10);
  text-align:center;
}
.site-footer .wrap{
  max-width:1100px;
  margin:0 auto;
  padding:0 18px;
}
.site-footer .footer-tagline{
  margin:0 0 12px;
  color:var(--muted);
  font-weight:600;
}
.site-footer .footer-links{
  display:flex;
  justify-content:center;
  gap:16px;
  margin:0 0 14px;
  flex-wrap:wrap;
}
.site-footer .footer-links a{
  padding:8px 10px;
  border-radius:12px;
  color:var(--muted);
  font-weight:600;
}
.site-footer .footer-links a:hover{
  color:var(--text);
  background: rgba(255,255,255,.06);
}
.site-footer .footer-bottom{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.08);
  opacity:.75;
  font-size:13px;
}

body.light .site-footer{
  border-top:1px solid rgba(0,0,0,.10);
}
.site-footer .footer-inner{
  max-width:1100px;
  margin:0 auto;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
}
.site-footer .footer-left strong{
  display:block;
  font-size:18px;
  letter-spacing:.2px;
  margin-bottom:6px;
}
.site-footer .footer-left .muted{
  opacity:.78;
  max-width:520px;
}
.site-footer .footer-right{
  display:flex;
  gap:18px;
  align-items:center;
  flex-wrap:wrap;
}
.site-footer .footer-right a{
  text-decoration:none;
  opacity:.88;
}
.site-footer .footer-right a:hover{
  opacity:1;
  text-decoration:underline;
}
.site-footer 
body.light .site-footer .footer-bottom{
  border-top:1px solid rgba(0,0,0,.08);
}

@media (max-width: 640px){
  .site-footer .footer-inner{
    flex-direction:column;
    align-items:center;
    text-align:center;
  }
  .site-footer .footer-right{
    justify-content:center;
  }
  .site-footer .footer-left .muted{
    max-width:unset;
  }
}
