.floating-nav-wrapper {
  position: fixed;
  top: 50%;
  right: 0;
  /* Desktop/tablet: hide partially so icons stay visible */
  transform: translateY(-50%) translateX(calc(100% - 55px));
  z-index: 1050;
  transition: transform 0.3s ease;
  width: 300px;
}
.floating-nav-wrapper.open {
  transform: translateY(-50%) translateX(0);
}
.floating-nav {
  background: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.12);
  border-radius: 12px 0 0 12px;
  height: auto;
  padding: 1rem 0.5rem;
  overflow: hidden;
  transition: all 0.3s ease;
}
.floating-nav h6 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6c757d;
  margin-left: 1.2rem;
  transition: opacity 0.3s;
  opacity: 1;
}
.floating-nav .nav-link { transition: color 0.2s, background 0.2s; }
.floating-nav a.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  color: #333;
  transition: background 0.2s, color 0.2s;
}
.badge-style {
  font-size: 1rem;
  background-color: #2ecc71 !important;
  padding: 0.7em 1.2em;
}
.sep-line {
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #198754 0%, #0d6efd 100%);
  border-radius: 2px;
}
.floating-nav .nav-link.active {
  background-color: #2ecc71;
  color: white;
}
.floating-nav a.nav-link.subnav-link,
.floating-nav a.nav-link.subnav-link:hover,
.floating-nav a.nav-link.subnav-link.active {
  background: none !important;
  color: #333 !important;
}
.floating-nav a.nav-link.subnav-link:hover {
  color: #2ecc71 !important;
  background: none !important;
}
.floating-nav .nav-link.active:hover {
  color: #ffffff !important;
  background-color:#2ecc70e0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
}
.icon-circle-sm {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #f1f7f3;
  border: 1px solid #d7efe3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#r-filter-buttons .btn.active {
  background-color: #198754;
  color: #fff;
  border-color: #198754;
}

#type-filter-buttons .btn.active {
  background-color: #6c757d;
  color: #fff;
  border-color: #6c757d;
}

.method-tool-card {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.method-tool-card:hover {
  transform: translateY(-3px);
}

.model-view-page .background-section:not(.model-canvas-section) {
  min-height: 100vh;
  padding-top: 76px;
}

.model-view-page .background-section .row.min-vh-100 {
  min-height: calc(100vh - 76px) !important;
}

.model-view-page .transparent-card {
  height: calc(100vh - 96px) !important;
}

.model-guide {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(16, 24, 32, 0.72);
  backdrop-filter: blur(2px);
}

.model-guide[hidden] {
  display: none;
}

/* Modern model canvas */
.model-view-page .model-canvas-section {
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding-top: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, rgba(131, 118, 197, 0.16), transparent 34%),
    radial-gradient(circle at 84% 20%, rgba(88, 170, 112, 0.17), transparent 32%),
    radial-gradient(circle at 78% 86%, rgba(230, 160, 95, 0.14), transparent 34%),
    linear-gradient(145deg, #f8fafc 0%, #f1f6f3 48%, #f7f5fb 100%);
}

.model-view-page .model-canvas-section::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.42;
  background-image: radial-gradient(circle, rgba(75, 94, 104, 0.22) 1px, transparent 1.2px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}

.model-view-page .model-canvas-layout {
  z-index: 0;
  display: grid;
  width: 100%;
  height: 100%;
  padding: calc(76px + 1rem) 1rem 1rem;
  place-items: center;
}

.model-view-page .model-canvas-row,
.model-view-page .model-canvas-row > .col-12 {
  width: 100%;
  height: 100%;
  margin: 0;
  place-items: center;
}

.model-view-page .model-canvas-surface {
  position: relative;
  isolation: isolate;
  width: min(98vw, 1900px, calc(125.7svh - 2.52rem - 95.5px));
  height: auto;
  max-height: calc(100svh - 2rem - 76px);
  margin: auto;
  aspect-ratio: 1956 / 1556;
}

.model-view-page .model-canvas-section.is-model-zoomed .model-canvas-surface {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
}

.model-view-page .model-canvas-section.is-model-zoomed .model-canvas-layout {
  padding: 0;
}

.model-view-page .model-canvas-surface::after {
  position: absolute;
  inset: 16% 14% 8%;
  z-index: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(55, 76, 66, 0.16), transparent 68%);
  filter: blur(44px);
}

.model-view-page .model-canvas-object {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background: transparent !important;
  border: 0;
  object-fit: contain;
}

.model-zoom-controls {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1040;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 0.4rem;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(74, 96, 85, 0.16);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(36, 52, 61, 0.16);
  backdrop-filter: blur(14px) saturate(120%);
}

.model-zoom-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: #34454e;
  background: #fff;
  border: 1px solid rgba(74, 96, 85, 0.18);
  border-radius: 10px;
  transition: color 0.16s ease, background-color 0.16s ease,
    border-color 0.16s ease, transform 0.16s ease;
}

.model-zoom-button:not(:disabled):hover,
.model-zoom-button:not(:disabled):focus-visible {
  color: #fff;
  background: #58aa70;
  border-color: #58aa70;
  transform: translateY(-1px);
}

.model-zoom-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.model-zoom-reset {
  margin-left: 0.1rem;
}

.model-theme-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1040;
  display: grid;
  width: 50px;
  height: 50px;
  padding: 0;
  place-items: center;
  color: #34454e;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(74, 96, 85, 0.18);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(36, 52, 61, 0.16);
  backdrop-filter: blur(14px) saturate(120%);
  transition: color 0.2s ease, background-color 0.2s ease,
    border-color 0.2s ease, transform 0.2s ease;
}

.model-theme-toggle:hover,
.model-theme-toggle:focus-visible {
  color: #fff;
  background: #8376c5;
  border-color: #8376c5;
  transform: translateY(-2px);
}

.model-game-link {
  position: fixed;
  top: calc(76px + 0.85rem);
  right: 1.25rem;
  z-index: 1040;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  color: #24343d;
  font-weight: 800;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(74, 96, 85, 0.16);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(36, 52, 61, 0.14);
  backdrop-filter: blur(14px) saturate(120%);
  transition: color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.model-game-link:hover,
.model-game-link:focus-visible {
  color: #fff;
  background: #58aa70;
  transform: translateY(-1px);
}

html[data-model-theme="dark"] .model-view-page {
  color-scheme: dark;
  background: #0d1519;
}

html[data-model-theme="dark"] .model-view-page .model-canvas-section {
  background: #18252b;
}

html[data-model-theme="dark"] .model-view-page .model-canvas-section::before {
  opacity: 0.5;
  background-image: radial-gradient(circle, rgba(205, 220, 213, 0.2) 1px, transparent 1.2px);
}

html[data-model-theme="dark"] .model-view-page .model-canvas-surface::after {
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.26), transparent 68%);
}

html[data-model-theme="dark"] .model-view-page .model-canvas-object {
  background: transparent;
}

html[data-model-theme="dark"] .model-view-page .navbar {
  background: rgba(38, 53, 60, 0.94) !important;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

html[data-model-theme="dark"] .model-view-page .navbar .nav-link,
html[data-model-theme="dark"] .model-view-page .learning-model-switch,
html[data-model-theme="dark"] .model-view-page .learning-feedback-link {
  color: #d7e2dd;
}

html[data-model-theme="dark"] .model-zoom-controls,
html[data-model-theme="dark"] .model-theme-toggle,
html[data-model-theme="dark"] .cehub-help-btn {
  color: #dbe7e1;
  background: rgba(22, 34, 40, 0.92);
  border-color: rgba(190, 213, 202, 0.18);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
}

html[data-model-theme="dark"] .model-zoom-button {
  color: #dbe7e1;
  background: #1d2b31;
  border-color: rgba(190, 213, 202, 0.16);
}

html[data-model-theme="dark"] .model-guide-card {
  color: #e4ece8;
  background: rgba(22, 31, 36, 0.98);
}

html[data-model-theme="dark"] .model-guide-menu-note {
  color: #d7e2dd;
  background: #1c3127;
}

html[data-model-theme="dark"] .model-guide-feature {
  color: #d7e2dd;
  background: #1d2b31;
}

html[data-model-theme="dark"] .model-theme-toggle:hover,
html[data-model-theme="dark"] .model-theme-toggle:focus-visible {
  color: #172027;
  background: #f0c86e;
  border-color: #f0c86e;
}

html[data-model-theme="dark"] .model-game-link {
  color: #dbe7e1;
  background: rgba(22, 34, 40, 0.92);
  border-color: rgba(190, 213, 202, 0.18);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
}

html[data-model-theme="dark"] .model-game-link:hover,
html[data-model-theme="dark"] .model-game-link:focus-visible {
  color: #172027;
  background: #f0c86e;
}

html[data-model-theme="dark"] .model-view-page footer {
  color: #d7e2dd !important;
  background-color: #162228 !important;
  border-top: 1px solid rgba(190, 213, 202, 0.14);
}

html[data-model-theme="dark"] .model-view-page footer h4,
html[data-model-theme="dark"] .model-view-page footer h5 {
  color: #edf5f1;
}

html[data-model-theme="dark"] .model-view-page footer .text-secondary,
html[data-model-theme="dark"] .model-view-page footer .nav-link {
  color: #b8c7c0 !important;
}

html[data-model-theme="dark"] .model-view-page footer .link,
html[data-model-theme="dark"] .model-view-page footer a:hover,
html[data-model-theme="dark"] .model-view-page footer a:focus {
  color: #7bd889 !important;
}

html[data-model-theme="dark"] .model-view-page footer hr {
  border-color: rgba(190, 213, 202, 0.18);
  opacity: 1;
}

@media (max-width: 767.98px) {
  .model-view-page .model-canvas-layout {
    padding: calc(88px + 0.75rem) 0.75rem 0.75rem;
  }

  .model-view-page .model-canvas-surface {
    width: min(calc(100vw - 1.5rem), calc(125.7svh - 1.89rem - 110.6px));
    height: auto;
    max-height: calc(100svh - 1.5rem - 88px);
  }

  .model-view-page .model-canvas-section.is-model-zoomed .model-canvas-surface {
    width: 100%;
    height: 100%;
    max-height: none;
  }

  .model-zoom-controls {
    right: auto;
    bottom: 0.75rem;
    left: 0.75rem;
    grid-template-columns: repeat(3, 40px);
  }

  .model-zoom-button {
    width: 40px;
    height: 40px;
  }

  .model-theme-toggle {
    right: 0.75rem;
    bottom: 0.75rem;
    width: 46px;
    height: 46px;
  }

  .model-game-link {
    top: calc(88px + 0.6rem);
    right: 4rem;
    padding: 0.58rem 0.7rem;
    font-size: 0.85rem;
  }

}

.model-guide-open {
  overflow: hidden;
}

.model-guide-card {
  width: min(540px, 100%);
  max-height: calc(100svh - 2.5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  overflow-y: auto;
  color: #24313a;
  text-align: center;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.model-guide-card h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.model-guide-card p {
  margin-bottom: 0;
  line-height: 1.65;
}

.model-guide-kicker {
  color: #2ecc71;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.model-guide-menu-note {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  color: #34454f;
  text-align: left;
  background: #eef7f1;
  border-radius: 12px;
}

.model-guide-features {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.1rem;
  text-align: left;
}

.model-guide-feature {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  color: #34454f;
  font-size: 0.9rem;
  line-height: 1.4;
  background: #f5f7f8;
  border-radius: 10px;
}

.model-guide-feature > i,
.model-guide-feature-icons {
  color: #2ecc71;
  text-align: center;
}

.model-guide-feature-icons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.15rem;
  font-size: 0.65rem;
}

.model-guide-feature-icons .fa-expand {
  grid-column: 1 / -1;
}

.model-guide-menu-note i {
  flex: 0 0 auto;
  color: #2ecc71;
  font-size: 1.1rem;
}

.model-guide-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

#modelGuideDone {
  background-color: #2ecc71;
  border-color: #2ecc71;
}

#modelGuideDone:hover,
#modelGuideDone:focus {
  background-color: #29b866;
  border-color: #29b866;
}

.model-guide-demo {
  position: relative;
  width: 150px;
  height: 100px;
  margin: 0 auto 1rem;
}

.model-guide-strategy {
  position: absolute;
  top: 8px;
  left: 50%;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: #4d985d;
  border-radius: 50%;
  transform: translateX(-50%);
  animation: model-guide-glow 2.2s ease-in-out infinite;
}

.model-guide-mouse {
  position: absolute;
  right: 16px;
  bottom: 0;
  width: 27px;
  height: 42px;
  background: #fff;
  border: 3px solid #24313a;
  border-radius: 15px;
  animation: model-guide-mouse 2.2s ease-in-out infinite;
}

.model-guide-mouse span {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 8px;
  background: #24313a;
  border-radius: 2px;
  transform: translateX(-50%);
}

@keyframes model-guide-mouse {
  0%, 15% { transform: translate(0, 0); }
  55%, 80% { transform: translate(-42px, -28px); }
  100% { transform: translate(0, 0); }
}

@keyframes model-guide-glow {
  0%, 35%, 100% { box-shadow: 0 0 0 rgba(77, 152, 93, 0); }
  55%, 80% { box-shadow: 0 0 22px rgba(77, 152, 93, 0.9); }
}

@media (max-width: 480px) {
  .model-guide-actions {
    flex-direction: column-reverse;
  }

  .model-guide-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .model-guide-strategy,
  .model-guide-mouse {
    animation: none;
  }
}

@media (max-width: 767px) {
  .model-view-page .background-section:not(.model-canvas-section) {
    padding-top: 88px;
  }

  .model-view-page .background-section .row.min-vh-100 {
    min-height: calc(100vh - 88px) !important;
  }

  .model-view-page .transparent-card {
    width: 92% !important;
    height: calc(100vh - 112px) !important;
  }
}

/* Desktop/tablet: open on hover or when toggled */
@media (min-width: 992px) {
  .floating-nav-wrapper:hover,
  .floating-nav-wrapper.open {
    transform: translateY(-50%) translateX(0);
  }
}

/* Laptop screens: smaller font sizes only (992px - 1699px) */
/* This covers typical laptop resolutions like 1440x900, 1366x768, 1600x900, etc. */
/* Only font sizes are changed, padding and widths remain unchanged to avoid layout issues */
@media (min-width: 992px) and (max-width: 1699px) {
  .floating-nav a.nav-link {
    font-size: 0.85rem;
  }
  
  .floating-nav a.nav-link.nav-header {
    font-size: 0.9rem;
  }
  
  .floating-nav a.nav-link.subnav-link {
    font-size: 0.8rem;
  }
  
  .floating-nav a.nav-link.subnav-link.ms-3 {
    font-size: 0.75rem;
  }
  
  .floating-nav .nav-link i.fa-lg {
    font-size: 1rem !important;
  }
  
  .floating-nav .nav-link i.small {
    font-size: 0.7rem !important;
  }
  
  .floating-nav h6 {
    font-size: 0.7rem;
  }
}

@media (max-width: 992px) {
  .floating-nav-wrapper {
    width: 260px;
    /* On small screens, hide fully off-screen when closed */
    transform: translateY(-50%) translateX(100%);
  }
  .floating-nav-wrapper.open {
    transform: translateY(-50%) translateX(0);
  }
}
    /* Reusable modal UX: keep long content scrollable, spinner fade */
    #cehubModal .modal-body {
      max-height: calc(100vh - 220px);
      overflow: auto;
    }

    @media (max-width: 992px) {
      #cehubModal .modal-dialog {
        margin: .5rem;
      }

      #cehubModal .modal-body {
        max-height: calc(100vh - 180px);
      }
    }

    #cehubModalBody .cehub-modal-spinner {
      opacity: 1;
      transition: opacity .2s ease;
    }

    #cehubModalBody.loaded .cehub-modal-spinner {
      opacity: 0;
      pointer-events: none;
    }

    #cehubModalBody .cehub-scope .linear-detail-page {
      min-height: 0;
      padding-top: 0;
      background: transparent;
    }

    #cehubModalBody .cehub-scope .linear-detail-page > .container {
      padding-top: 0 !important;
      padding-bottom: 0 !important;
    }

    /* Questionmark button styling */
    .cehub-help-btn {
      position: fixed;
      top: 84px;
      left: 25px;
      z-index: 1051;
      background: #fff;
      color: #52a374;
      border: 1px solid #d1e7dd;
      border-radius: 50%;
      width: 48px;
      height: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      transition: background 0.2s, color 0.2s;
      cursor: pointer;
    }

    .cehub-help-btn:hover,
    .cehub-help-btn:focus {
      background: #e9f7ef;
      color: #2ecc71;
      outline: none;
    }

    @media (max-width: 576px) {
      .cehub-help-btn {
        top: 76px;
        left: auto;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
      }
    }
