@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

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

body {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: #ffffff;
  color: #333;
}

h1 {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #e84393;
  margin-bottom: 4px;
}

h1.teal {
  color: #1abc9c;
}

h1.purple {
  color: #9b59b6;
}

body:has(h1.purple) {
  --chapter-accent: #9b59b6;
  --chapter-accent-rgb: 155, 89, 182;
}

h1.red {
  color: #e74c3c;
}

h1.green {
  color: #27ae60;
}

h1.orange {
  color: #e67e22;
}

/* Chapter accent inferred from current interactive title color */
body:has(h1.orange) {
  --chapter-accent: #e67e22;
  --chapter-accent-rgb: 230, 126, 34;
}

body:has(h1.green) {
  --chapter-accent: #27ae60;
  --chapter-accent-rgb: 39, 174, 96;
}

body:has(h1.red) {
  --chapter-accent: #e74c3c;
  --chapter-accent-rgb: 231, 76, 60;
}

body:has(h1.teal) {
  --chapter-accent: #1abc9c;
  --chapter-accent-rgb: 26, 188, 156;
}

body:has(h1.gray) {
  --chapter-accent: #8a8a8a;
  --chapter-accent-rgb: 138, 138, 138;
}

/* Keep splash screen colors coherent with chapter color on mobile/desktop */
body:has(.all h1) #tap-btn {
  background: var(--chapter-accent, #1abc9c) !important;
}

body:has(.all h1) #tap-overlay .tutorial-box.centered .tutorial-label,
body:has(.all h1) #tap-overlay .tutorial-box.corner .tutorial-label {
  color: var(--chapter-accent, #1abc9c) !important;
}

body:has(.all h1) #tap-overlay .tutorial-box.centered .hand-cursor,
body:has(.all h1) #tap-overlay .tutorial-box.corner .hand-cursor {
  fill: var(--chapter-accent, #1abc9c) !important;
}

body:has(.all h1) #tap-overlay .spinner {
  border-color: rgba(var(--chapter-accent-rgb, 26, 188, 156), 0.18) !important;
  border-top-color: var(--chapter-accent, #1abc9c) !important;
}

.page {
  font-size: 14px;
  color: #999;
  display: inline;
  font-weight: 400;
  text-transform: none;
}

.all {
  padding: 60px 30px 2px;
}

.legenda {
  width: 100%;
  text-align: right;
  margin-top: -60px;
}

#animation_container {
  margin: 0 auto;
}

/* Top Bar - same as etudes */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
}

.buy-btn {
  background: #e84393;
  color: white;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 8px 16px;
  text-transform: uppercase;
  transition: background 0.2s;
}

.buy-btn:hover {
  background: #d63384;
}

.lang-toggle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-toggle a {
  color: #999;
  text-decoration: none;
  transition: color 0.2s;
}

.lang-toggle a:hover {
  color: #333;
}

.lang-toggle a.active {
  color: #333;
  font-weight: 600;
}

.global-menu-toggle {
  width: 46px;
  height: 46px;
  border: none;
  background: transparent;
  color: #000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  position: relative;
  z-index: 140;
  touch-action: manipulation;
}

.global-menu-toggle svg {
  width: 34px;
  height: 34px;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  fill: none;
}

.global-fs-menu {
  position: fixed;
  inset: 0;
  background: var(--chapter-bg-tint, rgba(255, 255, 255, 0.98));
  z-index: 260;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.global-fs-menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  background: #E84493;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 78%);
  z-index: 3;
  pointer-events: none;
}

.global-fs-menu.open {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.global-fs-menu-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  box-sizing: border-box;
  position: relative;
  z-index: 4;
}

.global-menu-close {
  width: 42px;
  height: 42px;
  border: none;
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.global-menu-close svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}

.global-fs-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.global-fs-link {
  font-family: Montserrat, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.2;
  padding: 3px 0;
  width: 100%;
  max-width: 340px;
}

.global-fs-link.active {
  color: #fff !important;
  text-align: center;
  width: calc(100% + 48px);
  max-width: none;
  margin-left: -24px;
  margin-right: -24px;
  padding: 8px 0;
}

.global-fs-link.active.chapter-green { background: #27ae60; }
.global-fs-link.active.chapter-red { background: #e74c3c; }
.global-fs-link.active.chapter-teal { background: #1abc9c; }
.global-fs-link.active.chapter-gray { background: #8a8a8a; }

.global-fs-link.chapter-green { color: #27ae60; }
.global-fs-link.chapter-orange { color: #E67E23; }
.global-fs-link.chapter-red { color: #e74c3c; }
.global-fs-link.chapter-teal { color: #1abc9c; }
.global-fs-link.chapter-gray { color: #8a8a8a; }

.global-fs-link.active.chapter-orange { background: #E67E23; }

.global-fs-link.global-home-link,
.global-fs-link.global-home-link.site-link {
  margin-top: 8px;
  color: #000;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: none;
}

.global-menu-lang-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Montserrat, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  z-index: 5;
}

.global-menu-lang-toggle a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.15s ease;
}

.global-menu-lang-toggle a.active {
  color: #fff;
}

.global-fs-group-divider {
  height: 12px;
  flex-shrink: 0;
}

.global-fs-divider {
  width: calc(100% + 68px);
  height: 7px;
  background: #0FA6D3;
  margin: 14px -24px 14px;
  transform: rotate(1.3deg);
  transform-origin: center;
  flex-shrink: 0;
}

.global-fs-man {
  position: absolute;
  left: -57px;
  bottom: -50px;
  width: min(180px, 45vw);
  height: auto;
  pointer-events: none;
  z-index: 3;
  opacity: 0.98;
}

/* Bottom Bar - unified with nav buttons */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0;
  row-gap: 0;
  box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.1);
}

.bottom-bar .back-to-book {
  position: fixed;
  left: 14px;
  bottom: -56px;
  width: 92px;
  height: 132px;
  z-index: 140;
  display: block;
  padding: 0;
  margin: 0;
  text-decoration: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  border-radius: 0;
  overflow: hidden;
  background-image: url('../../img/book/playwithsound_TommasoRosati-724x1024.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 -3px 16px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s ease, bottom 0.22s ease, box-shadow 0.22s ease;
}

.bottom-bar .back-to-book[href*="/it/suono-elettronico/"] {
  background-image: url('../../img/book/suono_elettronico_coverNEW.jpeg');
}

.bottom-bar .back-to-book:hover {
  transform: translateY(-8px);
  bottom: -50px;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.28);
}

.bottom-bar .back-to-book svg {
  display: none;
}

/* Navigation buttons in bottom bar */
.nav-buttons {
  display: none;
  gap: 0;
  align-items: stretch;
  height: 100%;
}

.nav-wheel-shell {
  display: none;
}

.nav-wheel-track {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.nav-wheel-arrow {
  display: none;
}

.nav-wheel-item {
  flex: 0 0 auto;
  transform-origin: center center;
  white-space: nowrap;
  will-change: transform, opacity;
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

/* Bottom navigation (two-band layout on desktop and mobile) */
.nav-mobile {
  display: flex;
  order: 1;
  width: calc(100% - 92px);
  margin-left: 92px;
  height: 38px;
  align-items: stretch;
  border-bottom: 1px solid #eee;
}

.nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 100%;
  padding: 0 12px;
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1;
  color: #555;
  text-decoration: none;
  background: #f5f5f5;
  transition: background 0.15s;
}

.nav-arrow:hover,
.nav-arrow:active {
  background: #e8e8e8;
}

.nav-select-wrap {
  flex: 1;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.nav-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 10px;
  pointer-events: none;
  font-size: 0.65rem;
  color: #888;
}

.nav-mobile select {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  text-align-last: center;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 24px;
  cursor: pointer;
  outline: none;
  color: #8a8a8a;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px;
  border: none;
  color: #FFFFFF;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-btn:hover {
  opacity: 0.7;
}

/* Default: white background, colored text */
.nav-btn.teal {
  background: #ffffff;
  color: #1abc9c;
}

.nav-btn.red {
  background: #ffffff;
  color: #e74c3c;
}

.nav-btn.green {
  background: #ffffff;
  color: #27ae60;
}

.nav-btn.gray {
  background: #8a8a8a;
  color: #ffffff;
  border: none;
}

/* Active: colored background, white text */
.nav-btn.active.teal {
  background: #1abc9c !important;
  color: #ffffff !important;
}

.nav-btn.active.red {
  background: #e74c3c !important;
  color: #ffffff !important;
}

.nav-btn.active.green {
  background: #27ae60 !important;
  color: #ffffff !important;
}

.nav-btn.active.gray {
  background: #8a8a8a !important;
  color: #ffffff !important;
  border: none;
}

.bottom-bar .site-link {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  order: 2;
  width: auto;
  height: 38px;
  margin-left: auto;
  padding: 0 18px 0 12px;
  color: black;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  padding: 0;
}

.bottom-bar:has(.nav-btn.active.gray) .nav-mobile select,
.bottom-bar:has(.nav-btn.active.gray) .nav-select-wrap::after {
  color: #8a8a8a;
}

.bottom-bar:has(.nav-btn.active.green) .nav-mobile select,
.bottom-bar:has(.nav-btn.active.green) .nav-select-wrap::after {
  color: #27ae60;
}

.bottom-bar:has(.nav-btn.active.red) .nav-mobile select,
.bottom-bar:has(.nav-btn.active.red) .nav-select-wrap::after {
  color: #e74c3c;
}

.bottom-bar:has(.nav-btn.active.teal) .nav-mobile select,
.bottom-bar:has(.nav-btn.active.teal) .nav-select-wrap::after {
  color: #1abc9c;
}

/* Orange chapter (Polar Pattern / Catena elettroacustica) */
h1.orange { color: #E67E23; }

body:has(h1.orange) {
  --chapter-accent: #E67E23;
  --chapter-accent-rgb: 230, 126, 35;
}

.nav-btn.orange {
  background: #ffffff;
  color: #E67E23;
}

.nav-btn.active.orange {
  background: #E67E23 !important;
  color: #ffffff !important;
}

.desktop-side-link.chapter-orange { color: #E67E23; }
.desktop-side-link.chapter-orange:hover,
.desktop-side-link.chapter-orange.active { background: #E67E23; color: #ffffff; }

.bottom-bar:has(.nav-btn.active.orange) .nav-mobile select,
.bottom-bar:has(.nav-btn.active.orange) .nav-select-wrap::after {
  color: #E67E23;
}

/* ─── Shared desktop side menu ────────────────────────────────────────────── */
:root {
  --sub-side-menu-open-w: 240px;
  --sub-side-menu-closed-w: 64px;
  --sub-side-menu-bg: #fcfffe;
}

.desktop-side-menu { display: none; }

@media (min-width: 901px) {
  body {
    --sub-side-menu-current-w: var(--sub-side-menu-open-w);
    padding-left: var(--sub-side-menu-current-w);
  }
  .desktop-side-menu {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sub-side-menu-open-w);
    background: var(--sub-side-menu-bg);
    z-index: 160; display: flex; flex-direction: column; align-items: stretch;
    padding: 10px 0 100px 8px; overflow-y: auto; overflow-x: hidden;
    border-right: 13px solid var(--chapter-accent, #1abc9c); box-sizing: border-box;
  }
  .desktop-side-menu::-webkit-scrollbar { width: 4px; }
  .desktop-side-menu::-webkit-scrollbar-track { background: transparent; }
  .desktop-side-menu::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }
  .desktop-side-menu::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.3); }
  .desktop-side-header {
    position: sticky; top: 0; z-index: 2; background: var(--sub-side-menu-bg);
    display: flex; align-items: flex-start; min-height: 42px; justify-content: flex-start;
    gap: 8px; margin: 0 0 6px 0; width: calc(100% - 8px);
  }
  .desktop-side-menu-toggle { display: none; }
  .desktop-side-menu-nav { margin-top: 8px; display: flex; flex-direction: column; gap: 0; }
  .desktop-side-buy {
    display: inline-flex; align-items: center; justify-content: center;
    width: auto; margin: 2px 0 10px 0; padding: 10px 18px; border-radius: 0;
    background: #e84393; color: #fff; text-decoration: none;
    font-family: Montserrat, sans-serif; font-size: .62rem; font-weight: 700;
    letter-spacing: .09em; text-transform: uppercase;
  }
  .desktop-side-buy:hover { background: #d63384; }
  .desktop-side-link {
    color: #333; text-decoration: none; font-family: Montserrat, sans-serif;
    font-size: .8rem; font-weight: 700; letter-spacing: .01em; text-transform: uppercase;
    white-space: nowrap; padding: 7px 10px 7px 18px;
    margin: 0 0 0 -8px; width: calc(100% + 8px); border-radius: 0;
    transition: background .18s ease, color .18s ease;
  }
  .desktop-side-divider { height: 15px; background: transparent; margin: 0 0 0 -8px; width: calc(100% + 8px); }
  .desktop-side-link.chapter-green  { color: #27ae60; }
  .desktop-side-link.chapter-red    { color: #e74c3c; }
  .desktop-side-link.chapter-teal   { color: #1abc9c; }
  .desktop-side-link.chapter-gray   { color: #19ACE2; }
  .desktop-side-link.chapter-green:hover,  .desktop-side-link.chapter-green.active  { background: #27ae60; color: #fff; }
  .desktop-side-link.chapter-red:hover,    .desktop-side-link.chapter-red.active    { background: #e74c3c; color: #fff; }
  .desktop-side-link.chapter-teal:hover,   .desktop-side-link.chapter-teal.active   { background: #1abc9c; color: #fff; }
  .desktop-side-link.chapter-gray:hover,   .desktop-side-link.chapter-gray.active   { background: #19ACE2; color: #fff; }
  .desktop-book-cover {
    position: fixed; left: 18px; bottom: -58px; width: 112px; height: 158px;
    z-index: 260; display: block; box-shadow: 0 -3px 16px rgba(0,0,0,.22); transition: transform .22s ease;
  }
  .desktop-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .desktop-book-cover:hover { transform: translateY(-4px); }
  .top-bar { left: var(--sub-side-menu-current-w); }
  .top-bar .buy-btn { display: none; }
  .top-bar .lang-toggle { display: none; }
  .desktop-page-lang {
    position: fixed; top: 12px; right: 14px; z-index: 280;
    background: #fff; display: inline-flex; align-items: center; gap: 10px;
    padding: 4px 10px; font-family: Montserrat, sans-serif; font-size: .72rem; font-weight: 500; letter-spacing: .08em;
  }
  .desktop-page-lang a { color: #9a9a9a; text-decoration: none; }
  .desktop-page-lang a.active { color: #6f6f6f; }
  .bottom-bar { display: block; background: transparent; box-shadow: none; padding: 0; pointer-events: none; height: 0; }
  .bottom-bar .nav-buttons, .bottom-bar .nav-mobile { display: none !important; }
  .bottom-bar .back-to-book { display: none !important; }
  .bottom-bar .site-link {
    position: fixed; right: 18px; bottom: 10px; width: auto; margin: 0; padding: 0;
    display: inline-flex; justify-content: flex-end; align-items: center; pointer-events: auto;
  }
}

@media (min-width: 901px) and (max-width: 1279px) {
  body { --sub-side-menu-current-w: var(--sub-side-menu-closed-w); }
  body.sub-side-menu-open { --sub-side-menu-current-w: var(--sub-side-menu-open-w); }
  .desktop-side-menu {
    width: var(--sub-side-menu-closed-w); overflow: hidden;
    transition: width .22s ease, background .22s ease;
    cursor: pointer; background: var(--chapter-accent, #1abc9c); border-right: none;
  }
  .desktop-side-header { background: var(--chapter-accent, #1abc9c); transition: background .22s ease; }
  body.sub-side-menu-open .desktop-side-header { background: var(--sub-side-menu-bg); }
  .desktop-side-menu-toggle {
    position: absolute; inset: 0; width: 100%; height: 42px; margin: 0; border: none;
    background: transparent; color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; z-index: 8; transform: none; padding: 0;
  }
  .desktop-side-menu-toggle svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; pointer-events: none; }
  .desktop-side-menu-nav { opacity: 0; transform: translateX(-8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
  .desktop-side-buy { opacity: 0; pointer-events: none; transform: translateX(-8px); transition: opacity .2s ease, transform .2s ease; margin: 0; }
  body.sub-side-menu-open .desktop-side-menu { width: var(--sub-side-menu-open-w); cursor: default; overflow-y: auto; overflow-x: hidden; background: var(--sub-side-menu-bg); border-right: 13px solid var(--chapter-accent, #1abc9c); }
  body.sub-side-menu-open .desktop-side-menu-nav { opacity: 1; transform: translateX(0); pointer-events: auto; }
  body.sub-side-menu-open .desktop-side-buy { opacity: 1; transform: translateX(0); pointer-events: auto; order: 1; }
  body.sub-side-menu-open .desktop-side-header { margin-bottom: 10px; align-items: center; justify-content: flex-start; }
  body.sub-side-menu-open .desktop-side-menu-toggle { position: static; width: 42px; height: 42px; inset: auto; z-index: 8; flex: 0 0 42px; order: 2; color: var(--chapter-accent, #1abc9c); }
  .top-bar { left: var(--sub-side-menu-current-w); }
}

@media (max-width: 900px) {
  .desktop-page-lang { display: none !important; }
  .desktop-side-menu  { display: none !important; }
  .desktop-book-cover { display: none !important; }
}

/* Fullscreen button */
#fullscreen-btn {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* Tablet / small desktop: use mobile bottom menu graphics */
@media only screen and (max-width: 900px) {
  .bottom-bar {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    row-gap: 0;
  }

  .nav-buttons {
    display: none;
  }

  .nav-mobile {
    display: flex;
    order: 1;
    width: calc(100% - 76px);
    margin-left: 76px;
    align-items: stretch;
    border-bottom: 1px solid #eee;
  }

  body:not(.shared-nav-ready) .bottom-bar .nav-buttons,
  body:not(.shared-nav-ready) .bottom-bar .nav-mobile,
  body:not(.shared-nav-ready) .bottom-bar .site-link {
    visibility: hidden;
  }

  .nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 10px 14px;
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1;
    color: #555;
    text-decoration: none;
    background: #f5f5f5;
    transition: background 0.15s;
  }

  .nav-arrow:hover,
  .nav-arrow:active {
    background: #e8e8e8;
  }

  .nav-select-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
  }

  .nav-select-wrap::after {
    content: '▾';
    position: absolute;
    right: 10px;
    pointer-events: none;
    font-size: 0.65rem;
    color: #888;
  }

  .nav-mobile select {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 24px 10px 24px;
    cursor: pointer;
    outline: none;
    color: #8a8a8a;
  }

  .bottom-bar:has(.nav-btn.active.gray) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.gray) .nav-select-wrap::after {
    color: #8a8a8a;
  }

  .bottom-bar:has(.nav-btn.active.green) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.green) .nav-select-wrap::after {
    color: #27ae60;
  }

  .bottom-bar:has(.nav-btn.active.red) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.red) .nav-select-wrap::after {
    color: #e74c3c;
  }

  .bottom-bar:has(.nav-btn.active.teal) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.teal) .nav-select-wrap::after {
    color: #1abc9c;
  }

  .bottom-bar .back-to-book {
    left: 0;
    bottom: -20px;
    width: 76px;
    height: 108px;
    border-radius: 0;
  }

  .bottom-bar .back-to-book:hover {
    transform: translateY(-4px);
    bottom: -16px;
  }

  .bottom-bar .site-link {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 3;
    width: calc(100% - 76px);
    margin-left: 76px;
    padding: 12px 0;
  }
}

@media only screen and (min-width: 901px) {
  body.has-book-wheel-nav .bottom-bar {
    justify-content: flex-start;
    --book-left-visual-offset: 46px;
  }

  body.has-book-wheel-nav .nav-buttons,
  body.has-book-wheel-nav .nav-mobile {
    display: none !important;
  }

  body.has-book-wheel-nav .nav-wheel-shell {
    display: flex;
    order: 1;
    width: calc(100% - 92px + var(--book-left-visual-offset));
    margin-left: calc(92px - var(--book-left-visual-offset));
    min-height: 40px;
    align-items: stretch;
    justify-content: center;
    border-bottom: 1px solid #eee;
    background: #fff;
  }

  body.has-book-wheel-nav .bottom-bar .site-link {
    width: auto;
    margin-left: auto;
  }

  body.has-book-wheel-nav .nav-wheel-track {
    position: static;
    padding: 0;
    flex: 0 0 auto;
    min-height: 40px;
    overflow: visible;
    gap: 0;
    justify-content: center;
    will-change: transform;
  }

  body.has-book-wheel-nav .nav-wheel-shell.wheel-anim-left .nav-wheel-track {
    animation: wheel-shift-left var(--wheel-anim-duration, 240ms) cubic-bezier(0.22, 0.9, 0.35, 1) forwards;
  }

  body.has-book-wheel-nav .nav-wheel-shell.wheel-anim-right .nav-wheel-track {
    animation: wheel-shift-right var(--wheel-anim-duration, 240ms) cubic-bezier(0.22, 0.9, 0.35, 1) forwards;
  }

  body.has-book-wheel-nav .nav-wheel-shell.wheel-anim-left .nav-wheel-item {
    animation: wheel-item-left var(--wheel-anim-duration, 240ms) cubic-bezier(0.22, 0.9, 0.35, 1) forwards;
  }

  body.has-book-wheel-nav .nav-wheel-shell.wheel-anim-right .nav-wheel-item {
    animation: wheel-item-right var(--wheel-anim-duration, 240ms) cubic-bezier(0.22, 0.9, 0.35, 1) forwards;
  }

  @keyframes wheel-shift-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(var(--wheel-shift-track, 50px) * -1)); }
  }

  @keyframes wheel-shift-right {
    0% { transform: translateX(0); }
    100% { transform: translateX(var(--wheel-shift-track, 50px)); }
  }

  @keyframes wheel-item-left {
    0% { transform: translateX(0) rotate(0deg); }
    100% { transform: translateX(calc(var(--wheel-shift-item, 30px) * -1)) rotate(calc(var(--wheel-tilt, 1.5deg) * -1)); }
  }

  @keyframes wheel-item-right {
    0% { transform: translateX(0) rotate(0deg); }
    100% { transform: translateX(var(--wheel-shift-item, 30px)) rotate(var(--wheel-tilt, 1.5deg)); }
  }

  body.has-book-wheel-nav .nav-wheel-arrow {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 40px;
    flex: 0 0 34px;
    padding: 0;
    color: #666;
    text-decoration: none;
    background: transparent;
    font-size: 1.95rem;
    font-weight: 300;
    line-height: 1;
    transition: all 0.15s ease;
    opacity: 1;
    pointer-events: auto;
  }

  body.has-book-wheel-nav .nav-wheel-prev {
    margin-right: 0;
    transform: translateX(-2px);
  }

  body.has-book-wheel-nav .nav-wheel-next {
    margin-left: 0;
  }

  body.has-book-wheel-nav .nav-wheel-arrow:hover,
  body.has-book-wheel-nav .nav-wheel-arrow:active {
    background: #4a4a4a;
    color: #fff;
  }

  body.has-book-wheel-nav .nav-wheel-arrow:active {
    transform: scale(0.96);
  }

  body.has-book-wheel-nav .nav-wheel-prev:active {
    transform: translateX(-2px) scale(0.96);
  }

  body.has-book-wheel-nav .nav-wheel-item {
    min-width: 88px;
    padding: 0 12px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    letter-spacing: 0.025em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    background: white;
    color: inherit;
    border-radius: 0;
    box-shadow: none !important;
    filter: none !important;
  }

  body.has-book-wheel-nav .nav-wheel-label {
    display: inline-block;
    line-height: 1;
    transform: translateY(0);
  }

  body.has-book-wheel-nav .nav-wheel-item:hover {
    color: white !important;
    opacity: 1 !important;
    filter: none !important;
  }

  body.has-book-wheel-nav .nav-wheel-item.green:hover {
    background: #27ae60;
  }

  body.has-book-wheel-nav .nav-wheel-item.red:hover {
    background: #e74c3c;
  }

  body.has-book-wheel-nav .nav-wheel-item.teal:hover {
    background: #1abc9c;
  }

  body.has-book-wheel-nav .nav-wheel-item.gray:hover {
    background: #8a8a8a;
  }

  body.has-book-wheel-nav .nav-wheel-item.gray {
    background: #8a8a8a;
    color: #ffffff;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='0']:hover {
    transform: none;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='1']:hover {
    transform: none;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='2']:hover {
    transform: none;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='3']:hover {
    transform: none;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='0'] {
    opacity: 1;
    transform: none;
    filter: none;
    z-index: 4;
    font-size: 0.66rem;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='1'] {
    opacity: 0.76;
    transform: none;
    filter: none;
    z-index: 3;
    font-size: 0.62rem;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='2'] {
    opacity: 0.46;
    transform: none;
    filter: none;
    z-index: 2;
    font-size: 0.58rem;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='3'] {
    opacity: 0.28;
    transform: none;
    filter: none;
    z-index: 1;
    font-size: 0.54rem;
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='1'] .nav-wheel-label {
    transform: translateY(0.5px);
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='2'] .nav-wheel-label {
    transform: translateY(1px);
  }

  body.has-book-wheel-nav .nav-wheel-item[data-wheel-offset='3'] .nav-wheel-label {
    transform: translateY(1.5px);
  }
}

@media (max-width: 900px) {
  body.has-fullscreen-menu .top-bar {
    z-index: 240;
  }

  body.has-fullscreen-menu .top-bar .lang-toggle {
    display: none;
  }

  body.has-fullscreen-menu .global-menu-toggle {
    display: inline-flex;
    pointer-events: auto;
  }

  body.has-fullscreen-menu .global-fs-menu {
    display: flex;
  }

  body.has-fullscreen-menu .bottom-bar {
    display: block;
    background: transparent;
    box-shadow: none;
    padding: 0;
    pointer-events: none;
  }

  body.has-fullscreen-menu .bottom-bar .back-to-book {
    pointer-events: auto;
  }

  body.has-fullscreen-menu .bottom-bar .nav-buttons,
  body.has-fullscreen-menu .bottom-bar .nav-mobile,
  body.has-fullscreen-menu .bottom-bar .site-link {
    display: none !important;
  }
}

/* Responsive */
@media only screen and (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }

  .legenda img {
    width: 110px;
  }

  .all {
    padding: 55px 15px 15px;
  }

  body {
    font-size: 12px;
  }

  .top-bar {
    padding: 10px 15px;
  }

  /* Two-row bottom bar on mobile */
  .bottom-bar {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    row-gap: 0;
  }

  /* Hide desktop button row, show dropdown row */
  .nav-buttons {
    display: none;
  }

  .nav-mobile {
    display: flex;
    order: 1;
    width: calc(100% - 76px);
    margin-left: 76px;
    align-items: stretch;
    border-bottom: 1px solid #eee;
  }

  .nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 10px 14px;
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1;
    color: #555;
    text-decoration: none;
    background: #f5f5f5;
    transition: background 0.15s;
  }

  .nav-arrow:hover,
  .nav-arrow:active {
    background: #e8e8e8;
  }

  .nav-select-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
  }

  .nav-select-wrap::after {
    content: '▾';
    position: absolute;
    right: 10px;
    pointer-events: none;
    font-size: 0.65rem;
    color: #888;
  }

  .nav-mobile select {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 24px 10px 24px;
    cursor: pointer;
    outline: none;
    color: #8a8a8a;
  }

  .bottom-bar:has(.nav-btn.active.gray) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.gray) .nav-select-wrap::after {
    color: #8a8a8a;
  }

  .bottom-bar:has(.nav-btn.active.green) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.green) .nav-select-wrap::after {
    color: #27ae60;
  }

  .bottom-bar:has(.nav-btn.active.red) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.red) .nav-select-wrap::after {
    color: #e74c3c;
  }

  .bottom-bar:has(.nav-btn.active.teal) .nav-mobile select,
  .bottom-bar:has(.nav-btn.active.teal) .nav-select-wrap::after {
    color: #1abc9c;
  }

  .bottom-bar .back-to-book {
    left: 0;
    bottom: -20px;
    width: 76px;
    height: 108px;
    border-radius: 0;
  }

  .bottom-bar .back-to-book:hover {
    transform: translateY(-4px);
    bottom: -16px;
  }

  .bottom-bar .site-link {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 3;
    width: calc(100% - 76px);
    margin-left: 76px;
    padding: 12px 0;
    font-size: 0.65rem;
  }

  /* Shift animation down slightly on mobile */
  #animation_container {
    margin-top: 20px !important;
  }
}

/* Legacy support for old menu class */
.menu {
  display: none;
}

.nav-menu {
  display: none;
}

