/* =========================================================
   findmydegree.lk — main stylesheet
   Ported from legacy/php/css/style.css
   ========================================================= */

/* Google Fonts loaded via template <link> tag */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #0d0d0d;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Default link styling ----
   Green accent across the site. Specific containers (.navbar, .footer,
   .footer-links, .footer-social, .auth-links, .cta-btn, .btn-next, etc.)
   override this via higher-specificity class rules. We deliberately do NOT
   set a global a:visited colour here — its pseudo-class specificity (1,1)
   would override class-only button rules like .cta-btn (1,0). */
a { color: #2ECD73; text-decoration: none; }
a:hover { color: #34d87b; }
/* Note: we intentionally do NOT add text-decoration:underline on hover here.
   Block-level <a> wrappers (.stat-card, .forum-thread-link, etc.) would
   propagate the underline across every inline child. Inline content links
   that want a hover underline (e.g. .footer a, .auth-links a) declare it
   explicitly in their own rules below. */

/* Result-page links (university/degree names in /results/) — keep them
   white to match the surrounding plain-text cells; only highlight on hover. */
a.result-link { color: #ffffff; text-decoration: none; }
a.result-link:hover { color: #2ECD73; text-decoration: underline; }

/* ---- Layout ---- */

#container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1;
}

/* ---- Header ---- */

.header {
  background-color: #0d0d0d;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e1e1e;
}

.header .logo img {
  height: 48px;
}

.header .logo a {
  text-decoration: none;
}

/* Logo row */
.header .logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* BestWeb.LK header badge — competition over, markup commented out in base.html; kept for next year.
.header .logo .header-badge img {
  height: 44px;
  width: 44px;
  display: block;
}
*/

/* ---- Navbar ---- */
.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
}

.navbar a {
  color: #cccccc;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.navbar a:hover {
  color: #2ECD73;
}

/* ---- Highlighted "Rankings" nav item — draws the eye at first glance ---- */
.navbar a.nav-rankings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2ECD73;
  font-weight: 700;
  background: rgba(46, 205, 115, 0.10);
  border: 1px solid rgba(46, 205, 115, 0.45);
  border-radius: 999px;
  padding: 5px 13px;
  animation: rankPulse 2.4s ease-in-out infinite;
}
.navbar a.nav-rankings:hover {
  color: #06250f;
  background: #2ECD73;
  border-color: #2ECD73;
}
.nav-badge {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #06250f;
  background: #2ECD73;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.5;
}
.navbar a.nav-rankings:hover .nav-badge {
  color: #2ECD73;
  background: #06250f;
}
@keyframes rankPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 205, 115, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(46, 205, 115, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
  .navbar a.nav-rankings { animation: none; }
}

/* ---- Highlighted "Login" nav item — gold pill CTA (matches site theme) ---- */
.navbar a.nav-login {
  display: inline-flex;
  align-items: center;
  color: #c8a84b;
  font-weight: 700;
  background: rgba(200, 168, 75, 0.12);
  border: 1px solid rgba(200, 168, 75, 0.55);
  border-radius: 999px;
  padding: 5px 16px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.navbar a.nav-login:hover {
  color: #1a1400;
  background: #c8a84b;
  border-color: #c8a84b;
}

/* ---- "More" dropdown (hover on desktop) ---- */
.nav-more { position: relative; display: inline-flex; align-items: center; }
.nav-more-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #cccccc;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
}
.nav-more:hover .nav-more-toggle,
.nav-more:focus-within .nav-more-toggle { color: #2ECD73; }
.nav-more-caret { font-size: 0.65rem; transition: transform 0.2s; }
.nav-more:hover .nav-more-caret,
.nav-more:focus-within .nav-more-caret { transform: rotate(180deg); }

.nav-more-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.nav-more:hover .nav-more-menu,
.nav-more:focus-within .nav-more-menu { display: flex; }
.nav-more-menu a {
  padding: 10px 12px;
  border-radius: 6px;
  white-space: nowrap;
  color: #cccccc;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.nav-more-menu a:hover { background: rgba(46, 205, 115, 0.10); color: #2ECD73; }

/* ---- Hamburger button (hidden on desktop) ---- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #cccccc;
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* Animate to X when open */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: #888;
  border-top: 1px solid #1e1e1e;
}

.footer a { color: #2ECD73; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.footer-links {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: #666;
}

.footer-links a { color: #888; text-decoration: none; }
.footer-links a:hover { color: #2ECD73; }
.footer-links a.footer-feedback { color: #2ECD73; font-weight: 600; }
.footer-links a.footer-feedback:hover { color: #34d87b; text-decoration: underline; }

.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}
.footer-social a { color: #555; text-decoration: none; transition: color 0.2s; line-height: 1; }
.footer-social a:hover { color: #2ECD73; text-decoration: none; }

/* BestWeb.LK / TopWeb.LK footer badge — competition over, markup commented out in base.html; kept for next year.
   Vendor snippet declares 150x150 in markup (kept verbatim for their compliance scan); scale it down visually here.
.footer-badge img { width: 100px; height: 100px; }
*/

/* ---- Hero / main section ---- */

.main {
  padding: 32px 0 20px;
  text-align: center;
}

.main .image img {
  max-width: 220px;
  margin-bottom: 16px;
}

.main .slogan h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}

.main .slogan h1.hilite {
  color: #2ECD73;
}

.main .description {
  margin-top: 12px;
  padding: 0 10%;
}

.main .description h4 {
  font-size: 0.9rem;
  font-weight: 400;
  color: #cccccc;
  line-height: 1.6;
}

/* ---- Notice banner ---- */

.notice {
  margin: 12px 0;
  padding: 10px 16px;
  background-color: rgba(31, 173, 24, 0.3);
  color: #ffffff;
  border: 2px solid #156915;
  border-radius: 10px;
  font-size: 0.85rem;
  text-align: center;
}

/* ---- Section + Window ---- */

.section {
  margin-top: 24px;
  padding-bottom: 32px;
}

.window {
  background-color: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.windowTitle {
  text-align: center;
  margin-bottom: 24px;
}

.windowTitle h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #2ECD73;
  text-transform: uppercase;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 16px;
  text-align: center;
}

.form-group h4 {
  font-size: 0.85rem;
  color: #aaaaaa;
  margin-bottom: 6px;
}

select.old-select, select.subject-select, select.grade-select {
  background-color: #2a2a2a;
  color: #ffffff;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 8px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  min-width: 180px;
  cursor: pointer;
}

select.old-select:focus, select.subject-select:focus, select.grade-select:focus {
  outline: none;
  border-color: #2ECD73;
}

select option {
  background-color: #1a1a1a;
}

.subjects-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}

/* Subjects-only layout (no grade column) */
.subjects-grid.subjects-only {
  max-width: 480px;
}

.subject-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  align-items: center;
}

/* ---- Subject autocomplete ---- */

.autocomplete-wrap {
  position: relative;
  width: 100%;
}

.subject-text-input {
  width: 100%;
  background-color: #2a2a2a;
  color: #ffffff;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 8px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.subject-text-input:focus {
  border-color: #2ECD73;
}

.subject-text-input::placeholder {
  color: #666;
}

.ac-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.ac-list li {
  padding: 9px 14px;
  font-size: 0.88rem;
  color: #dddddd;
  cursor: pointer;
  transition: background-color 0.12s;
}

.ac-list li:hover {
  background-color: rgba(46, 205, 115, 0.12);
  color: #2ECD73;
}

.ac-list li strong {
  color: #2ECD73;
  font-weight: 700;
}

/* ---- Radio buttons ---- */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  max-width: 360px;
  margin: 12px auto;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #cccccc;
}

.radio-group input[type="radio"] {
  accent-color: #2ECD73;
  width: 16px;
  height: 16px;
}

/* ---- Z-score input ---- */

input.zscore {
  background-color: #2a2a2a;
  color: #ffffff;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 8px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  width: 160px;
  text-align: center;
}

input.zscore:focus {
  outline: none;
  border-color: #2ECD73;
}

input.zscore:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---- Submit button ---- */

#gooey-button, .btn-next {
  background: linear-gradient(135deg, #2ECD73 0%, #4cc47a 45%, #c8a84b 100%);
  color: #0d0d0d;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 4px 14px rgba(130,185,95,0.22);
  transition: transform .12s, box-shadow .15s;
  transition: background-color 0.2s ease;
  letter-spacing: 0.5px;
}

#gooey-button:hover, .btn-next:hover {
  color: #ffffff;
  text-decoration: none;
  background: linear-gradient(135deg, #34d87b 0%, #54cc80 45%, #d4b456 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200,168,75,0.35);
}

/* ---- Errors ---- */

.error-list {
  background-color: rgba(200, 40, 40, 0.2);
  border: 1px solid #c82828;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  list-style: none;
  text-align: center;
}

.error-list li {
  font-size: 0.85rem;
  color: #ff8080;
  margin-bottom: 4px;
}

/* ---- Progress indicator ---- */

.progress {
  text-align: center;
  margin-top: 16px;
}

.progress-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.progress-step {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #3a3a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
}

.progress-step.active {
  border-color: #c8a84b;
  color: #c8a84b;
  background-color: rgba(200, 168, 75, 0.12);
}

.progress-step.done {
  border-color: #c8a84b;
  background-color: #c8a84b;
  color: #0d0d0d;
}

.progress-line {
  flex: 1;
  max-width: 48px;
  height: 2px;
  background-color: #3a3a3a;
}

.progress-line.done {
  background-color: #c8a84b;
}

/* ---- Footer ---- */

.footer {
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
  color: #666666;
  border-top: 1px solid #1a1a1a;
}

.footer a {
  color: #2ECD73;
  text-decoration: none;
}

/* ---- About page ---- */

.about-content {
  line-height: 1.8;
}

.about-content h2 {
  color: #2ECD73;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.about-content p {
  color: #cccccc;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {

  /* -- Hamburger visible, navbar collapses -- */
  .hamburger { display: flex; }

  .navbar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #111111;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    border-bottom: 1px solid #2a2a2a;
    z-index: 100;
    padding: 8px 0;
  }

  .navbar.open { display: flex; }

  .navbar a {
    width: 100%;
    padding: 12px 24px;
    font-size: 0.95rem;
    border-bottom: 1px solid #1a1a1a;
  }

  .navbar a:last-child { border-bottom: none; }

  /* Keep the Rankings / Login pills as pills (not full-width rows) in the drawer. */
  .navbar a.nav-rankings,
  .navbar a.nav-login {
    width: auto;
    margin: 8px 24px;
    padding: 8px 14px;
    border-bottom: none;
  }

  /* "More" dropdown becomes an inline section in the mobile drawer (no hover
     on touch), with its items always visible and indented. */
  .nav-more { width: 100%; flex-direction: column; align-items: stretch; }
  .nav-more-toggle {
    width: 100%;
    padding: 12px 24px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #777;
    border-bottom: 1px solid #1a1a1a;
    cursor: default;
  }
  .nav-more-caret { display: none; }
  .nav-more-menu {
    position: static;
    display: flex;
    min-width: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    gap: 0;
  }
  .nav-more-menu a {
    width: 100%;
    padding: 12px 24px 12px 40px;
    border-radius: 0;
    border-bottom: 1px solid #1a1a1a;
  }
  .nav-more-menu a:last-child { border-bottom: none; }

  /* Make header position:relative so dropdown is anchored to it */
  .header { position: relative; }

  /* -- Container full width -- */
  #container { padding: 0 12px; }

  /* -- Slogan -- */
  .main .slogan h1 { font-size: 1.3rem; }
  .main .image img { max-width: 160px; }
  .main .description h4 { font-size: 0.82rem; }

  /* -- Cards -- */
  .window { padding: 16px 12px; }
  .window.window-centered { max-width: 100%; }

  /* -- Subjects -- */
  .subjects-grid, .subjects-grid.subjects-only { max-width: 100%; }
  .subject-row { grid-template-columns: 1fr 100px; gap: 8px; }

  /* -- Progress -- */
  .progress-step { width: 26px; height: 26px; font-size: 0.7rem; }
  .progress-line  { max-width: 32px; }

  /* -- Form elements -- */
  .old-select, .subject-text-input { font-size: 0.85rem; }

  /* -- Section + Window centring -- */
  .section { padding-bottom: 20px; }
  .windowTitle h3 { font-size: 0.95rem; }
}

/* ---- Centered selection window ---- */
.window.window-centered {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Description (now placed below the selection card) ---- */
.section > .description {
  margin: 18px auto 0;
  max-width: 640px;
  text-align: center;
  padding: 0 10%;
}
.section > .description h4 {
  font-size: 0.9rem;
  font-weight: 400;
  color: #cccccc;
  line-height: 1.6;
}

/* ---- Toast (top-right, dismissible) ---- */
.toast {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  padding: 12px 14px 12px 16px;
  background-color: rgba(31, 173, 24, 0.95);
  color: #ffffff;
  border: 1px solid #156915;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.25s ease-out;
}
.toast .toast-msg {
  flex: 1;
  line-height: 1.4;
}
.toast .toast-close {
  flex-shrink: 0;
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.85;
}
.toast .toast-close:hover {
  opacity: 1;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (max-width: 600px) {
  .toast {
    top: 80px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* ---- About page content ---- */
.about-content h2 {
  color: #2ECD73;
  font-size: 1rem;
  margin: 20px 0 6px;
}
.about-content p {
  color: #cccccc;
  font-size: 0.9rem;
  line-height: 1.7;
}
.about-content h2:first-child { margin-top: 0; }

/* ---- Team grid ---- */
.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  padding: 8px 0;
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 150px;
}

.team-card img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #2ECD73;
  margin-bottom: 10px;
}

.team-role {
  font-size: 0.72rem;
  font-weight: 600;
  color: #2ECD73;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.team-name {
  font-size: 0.85rem;
  color: #ffffff;
  font-weight: 500;
}

.team-email {
  font-size: 0.72rem;
  color: #888;
  margin-top: 3px;
  word-break: break-all;
}

@media (max-width: 600px) {
  .navbar { gap: 14px; }
  .navbar a { font-size: 0.8rem; }
  .team-grid { gap: 20px; }
  .team-card { width: 120px; }
  .team-card img { width: 80px; height: 80px; }
}


/* ============================================================
   Ad slots (manual AdSense units — templates/partials/_ad_unit.html)
   Every slot reserves its height up front so nothing jumps when an ad
   loads (CLS). Below-the-fold slots collapse if AdSense returns no ad;
   the top banner never collapses (it would shift the whole page).
   ============================================================ */

/* Small "ADVERTISEMENT" label above in-flow units (not the side rails) */
.fmd-ad--top::before,
.fmd-ad--banner::before,
.fmd-ad--in-content::before,
.fmd-ad--in-feed::before,
.fmd-ad--multiplex::before {
  content: "ADVERTISEMENT";
  display: block;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #555;
  margin-bottom: 4px;
}

.fmd-ad--banner     { min-height: 250px; margin: 20px auto; max-width: 728px; padding: 0 12px; }
.fmd-ad--in-content { min-height: 250px; margin: 18px 14px; }
.fmd-ad--in-feed    { min-height: 110px; margin: 8px 0; }
.fmd-ad--multiplex  { min-height: 320px; margin: 20px 0; }
.fmd-ad--rail       { min-height: 600px; }

@media (max-width: 640px) {
  .fmd-ad--banner,
  .fmd-ad--in-content { min-height: 120px; }
}

/* ---- Top banner (under the nav, every content page) -------------
   Exact-size unit: 320x100 on phones, 468x60 on small tablets,
   728x90 from 768px up. The wrapper's min-height (ad + 16px label)
   holds the space even when AdSense collapses an unfilled <ins> to
   0x0 via inline style, so the page below never moves. */
.fmd-ad--top {
  text-align: center;
  margin: 10px auto 4px;
  padding: 0 12px;
  min-height: 116px;
}
.fmd-ad--top .fmd-ad-fixed { width: 320px; height: 100px; }
@media (min-width: 500px) {
  .fmd-ad--top { min-height: 76px; }
  .fmd-ad--top .fmd-ad-fixed { width: 468px; height: 60px; }
}
@media (min-width: 768px) {
  .fmd-ad--top { min-height: 106px; }
  .fmd-ad--top .fmd-ad-fixed { width: 728px; height: 90px; }
}
.fmd-ad--top .fmd-ad-placeholder { display: inline-flex; min-height: 0; padding: 0; }

/* In-feed ad row inside results tables */
.fmd-ad-tr td { padding: 0; }

/* Dev-only placeholder shown when a slot ID isn't configured yet (DEBUG) */
.fmd-ad-placeholder {
  border: 2px dashed #3a3a3a;
  border-radius: 8px;
  color: #666;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: inherit;
  height: 100%;
  padding: 18px;
  box-sizing: border-box;
}
.fmd-ad-placeholder small { color: #4a4a4a; font-weight: 400; letter-spacing: normal; }

/* ---- Desktop side rails ----------------------------------------
   Fixed skyscrapers in the empty gutters beside the 960px #container.
   ≥1640px: 300px-wide rails; 1340–1639px: 160px (covers 1366x768
   laptops, the most common desktop size); below that: hidden, and
   base.html removes them from the DOM before AdSense fills them. */
.fmd-rail {
  display: none;
  position: fixed;
  top: 110px;
  width: 300px;
  z-index: 40;
}
.fmd-rail .fmd-ad { height: 600px; }
.fmd-rail--left  { left:  calc(50% - 480px - 320px); }
.fmd-rail--right { right: calc(50% - 480px - 320px); }

@media (min-width: 1640px) {
  .fmd-rail { display: block; }
}
@media (min-width: 1340px) and (max-width: 1639.98px) {
  .fmd-rail { display: block; width: 160px; }
  .fmd-rail--left  { left:  calc(50% - 480px - 175px); }
  .fmd-rail--right { right: calc(50% - 480px - 175px); }
}

/* When AdSense returns no ad it stamps data-ad-status="unfilled" on the
   <ins>. Collapse the slot then — no empty reserved box. The top banner
   is exempt: collapsing it after load would shift the whole page.
   (:has() is supported in all evergreen browsers.) */
.fmd-ad:not(.fmd-ad--top):has(> ins[data-ad-status="unfilled"]) {
  display: none;
}
