/* === VDS Dark Theme Variables === */
:root {
  --vds-bg-desktop: #000000;
  --vds-bg-window: #ffffff;
  --vds-text-primary: #ffffff;
  --vds-text-secondary: #cccccc;
  --vds-icon-shadow: rgba(255, 255, 255, 0.3);
  --vds-taskbar-bg: #1f1f1f;
  --vds-start-bg: #3a3a3a;
  --vds-menu-bg: rgba(40, 40, 40, 0.98);
}

html, body {
      margin: 0 !important;
      padding: 0 !important;
      font-family: sans-serif;
    }

    /* Overflow hidden solo per homepage VDS (non per pagine Jekyll) */
    body.vds-homepage {
      height: 100%;
      overflow: hidden;
      background: #000000 !important;
    }

    body.vds-homepage html {
      height: 100%;
      overflow: hidden;
    }
    #desktop {
      width: 100%;
      height: 100%;
      background-color: var(--vds-bg-desktop);
      position: relative;
      transition: background-color 0.3s ease;
      overflow: visible;
    }
    .icon {
      width: 64px;
      text-align: center;
      color: var(--vds-text-primary);
      font-size: 12px;
      margin: 8px;
      cursor: pointer;
      position: absolute;
      opacity: 0;
      transform: translateY(-20px);
      animation: iconFadeIn 0.6s ease forwards;
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease, color 0.3s ease;
      z-index: 60;
      text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    }
    .icon img {
      width: 48px;
      height: 48px;
      transition: transform 0.3s ease;
    }

    /* Animazione sequenziale per ogni icona */
    .icon:nth-child(1) { animation-delay: 0.2s; }
    .icon:nth-child(2) { animation-delay: 0.35s; }
    .icon:nth-child(3) { animation-delay: 0.5s; }
    .icon:nth-child(4) { animation-delay: 0.65s; }
    .icon:nth-child(5) { animation-delay: 0.8s; }
    .icon:nth-child(6) { animation-delay: 0.95s; }
    .icon:nth-child(7) { animation-delay: 1.1s; }
    .icon:nth-child(8) { animation-delay: 1.25s; }

    @keyframes iconFadeIn {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Effetti hover dinamici */
    .icon:hover {
      transform: scale(1.15) translateY(-8px);
      filter: brightness(1.3) drop-shadow(0 8px 12px rgba(255, 255, 255, 0.3));
    }

    .icon:hover img {
      animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes iconBounce {
      0%, 100% { transform: translateY(0) rotate(0deg); }
      25% { transform: translateY(-8px) rotate(-5deg); }
      75% { transform: translateY(-4px) rotate(5deg); }
    }

    /* === Icon Groups === */
    .icon-group {
      position: absolute;
      background: rgba(30, 30, 30, 0.95);
      border: 2px solid #555;
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
      z-index: 60;
      min-width: 180px;
      max-width: 600px;
      opacity: 0;
      transform: translateY(-20px);
      animation: iconGroupFadeIn 0.6s ease forwards;
      animation-delay: 0.3s;
    }

    @keyframes iconGroupFadeIn {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .icon-group-tab {
      background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
      color: #ecf0f1;
      padding: 8px 12px;
      border-radius: 6px 6px 0 0;
      cursor: move;
      display: flex;
      justify-content: space-between;
      align-items: center;
      user-select: none;
      font-weight: 600;
      font-size: 13px;
      letter-spacing: 0.5px;
      border-bottom: 1px solid #555;
    }

    .icon-group-label {
      flex: 1;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .icon-group-minimize {
      background: rgba(255, 255, 255, 0.1);
      color: #ecf0f1;
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 3px;
      width: 24px;
      height: 24px;
      font-size: 16px;
      line-height: 20px;
      cursor: pointer;
      transition: all 0.2s ease;
      font-weight: bold;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .icon-group-minimize:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: scale(1.1);
    }

    .icon-group-content {
      padding: 12px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
      gap: 8px;
      grid-auto-rows: minmax(90px, auto);
      min-height: 110px;
    }

    .icon-group-content .icon {
      position: relative;
      margin: 0;
      opacity: 1;
      transform: none;
      animation: none;
      width: auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    .icon-group.minimized {
      max-width: 200px;
    }

    .icon-group.minimized .icon-group-content {
      display: none;
    }

    /* === Mobile Column Tabs === */
    /* Hidden by default - shown only on mobile via media query */
    .mobile-group-tabs {
      display: none;
    }

    /* Responsive: Mobile only (< 768px) */
    @media (max-width: 768px) {
      /* Show mobile tab navigation bar */
      .mobile-group-tabs {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: rgba(30, 30, 30, 0.98);
        border-bottom: 2px solid #555;
        padding: 8px;
        z-index: 80;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
      }

      .mobile-group-tab {
        display: inline-block;
        background: rgba(44, 62, 80, 0.8);
        color: #ecf0f1;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        padding: 8px 14px;
        margin-right: 8px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
      }

      .mobile-group-tab:hover {
        background: rgba(52, 73, 94, 0.9);
        transform: translateY(-2px);
      }

      .mobile-group-tab.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-color: #667eea;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
      }

      /* Add padding-top to desktop for tab bar */
      #desktop {
        padding-top: 50px;
      }

      /* Icon groups: hide all by default, show only active column */
      .icon-group {
        display: none !important;
        min-width: 150px;
        max-width: calc(100vw - 130px);
        /* Position in main area (right of standalone column) */
        /* Margini simmetrici: 10px a sinistra delle standalone icons + 90px larghezza colonna = 100px left */
        /* 20px margine destro per simmetria con sinistra */
        left: 100px !important;
        right: 20px !important;
        width: calc(100vw - 130px) !important;
      }

      /* Show groups in active column */
      /* Le posizioni verticali sono gestite via JavaScript in switchMobileColumn() */
      .icon-group.mobile-active {
        display: block !important;
      }

      .icon-group-content {
        padding: 8px;
        gap: 6px;
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
      }

      .icon-group-tab {
        padding: 6px 10px;
        font-size: 12px;
      }
    }

    #taskbar {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 40px;
      background-color: var(--vds-taskbar-bg);
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: var(--vds-text-primary);
      padding: 0 10px;
      z-index: 2000;
      transition: background-color 0.3s ease, color 0.3s ease;
    }

    .taskbar-left {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .taskbar-vds-home-btn {
      display: none;
      background: rgba(52, 152, 219, 0.2);
      border: 1px solid rgba(52, 152, 219, 0.4);
      border-radius: 4px;
      color: #ecf0f1;
      text-decoration: none;
      font-size: 18px;
      padding: 6px 10px;
      transition: all 0.2s ease;
      cursor: pointer;
      line-height: 1;
    }

    .taskbar-vds-home-btn:hover {
      background: rgba(52, 152, 219, 0.4);
      border-color: rgba(52, 152, 219, 0.6);
      transform: translateY(-1px);
    }

    .taskbar-vds-home-btn .home-icon {
      font-size: 18px;
      line-height: 1;
      display: block;
    }

    #start {
      background-color: var(--vds-start-bg);
      padding: 5px 10px;
      border-radius: 4px;
      margin-right: 10px;
      cursor: pointer;
      position: relative;
      transition: background-color 0.3s ease;
    }
    #start-menu {
      display: none;
      position: absolute;
      bottom: 40px;
      left: 0;
      background: var(--vds-menu-bg);
      color: var(--vds-text-primary);
      padding: 6px;
      border: 1px solid var(--border-color, #555);
      border-radius: 8px 8px 0 0;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
      min-width: 220px;
      max-width: 90vw;
      max-height: calc(100vh - 80px);
      overflow-y: auto;
      overflow-x: hidden;
      z-index: 1000;
      grid-template-columns: 1fr;
      backdrop-filter: blur(10px);
      transition: background-color 0.3s ease, color 0.3s ease;
    }

    /* Scrollbar styling - stile GNU */
    #start-menu::-webkit-scrollbar {
      width: 8px;
    }

    #start-menu::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.2);
      border-radius: 4px;
    }

    #start-menu::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.3);
      border-radius: 4px;
    }

    #start-menu::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.5);
    }

    .start-item {
      padding: 6px 10px;
      cursor: pointer;
      white-space: nowrap;
      border-radius: 4px;
      transition: all 0.2s ease;
      margin: 1px 2px;
      font-size: 15px;
    }

    .start-item:hover {
      background: rgba(255, 255, 255, 0.15);
      transform: translateX(4px);
    }

    .start-header {
      padding: 5px 10px;
      font-weight: 600;
      font-size: 11px;
      color: #4a9eff;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      background: linear-gradient(90deg, rgba(0, 120, 215, 0.15) 0%, transparent 100%);
      border-left: 3px solid #0078d7;
      margin: 3px 2px 2px 2px;
      border-radius: 2px;
      cursor: default;
      white-space: nowrap;
    }

    .start-separator {
      margin: 4px 6px;
      border: none;
      height: 1px;
      background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    }

    /* Layout a 2 colonne per schermi con altezza media-bassa */
    @media (max-height: 850px) {
      #start-menu {
        grid-template-columns: 1fr 1fr;
        column-gap: 4px;
        min-width: 380px;
        padding: 5px;
      }

      #start-menu hr {
        grid-column: 1 / -1;
      }

      .start-header {
        grid-column: 1 / -1;
        font-size: 10px;
        padding: 4px 10px;
      }

      .start-item {
        padding: 5px 10px;
        font-size: 14px;
      }
    }

    /* Layout a 3 colonne per schermi con altezza limitata */
    @media (max-height: 700px) {
      #start-menu {
        grid-template-columns: 1fr 1fr 1fr;
        min-width: 520px;
        column-gap: 4px;
      }

      .start-header {
        font-size: 9px;
        padding: 4px 8px;
        letter-spacing: 0.5px;
      }

      .start-item {
        padding: 4px 8px;
        font-size: 11px;
      }

      .start-separator {
        margin: 3px 4px;
      }
    }

    /* Layout a 3 colonne compatto per schermi molto bassi */
    @media (max-height: 550px) {
      #start-menu {
        padding: 4px;
        column-gap: 3px;
        min-width: 480px;
      }

      .start-header {
        font-size: 8px;
        padding: 3px 6px;
      }

      .start-item {
        padding: 3px 6px;
        font-size: 10px;
      }

      .start-separator {
        margin: 2px 3px;
      }
    }

    .window {
      position: absolute;
      top: 10%;
      left: 5%;
      width: 90%;
      height: 70%;
      background: white;
      border: 2px solid #000;
      display: none;
      box-shadow: 3px 3px 8px rgba(0,0,0,0.5);
      z-index: 500;
      flex-direction: column;
      overflow: auto;
    }
    .window-header {
      background: #0078d7;
      color: white;
      padding: 5px;
      cursor: move;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .window-controls button {
      background: transparent;
      color: white;
      border: none;
      font-size: 16px;
      cursor: pointer;
      margin-left: 5px;
    }
    .window-controls button:hover {
      background: rgba(255,255,255,0.2);
    }
    .window.maximized {
      z-index: 1500;
      top: 0 !important;
      left: 0 !important;
      width: 100vw !important;
      height: calc(100vh - 40px) !important;
    }
    .window-content {
      padding: 10px;
      flex: 1;
    }
    #shutdown-screen {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: black;
      color: white;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      z-index: 9999;
    }
    ul.directory {
      list-style: none;
      padding-left: 20px;
    }
    ul.directory li::before {
      content: "\1F4C1 ";
    }
    
    @media (max-width: 768px) {
      .icon {
        width: 60px;
        font-size: 12px;
      }
      .icon img {
        width: 40px;
        height: 40px;
      }
      .window {
        width: 95%;
        height: 75%;
        top: 12%;
        left: 2.5%;
        z-index: 500;
      }
      .window.maximized {
        z-index: 1500;
      }
    }

.resizer {
  position: absolute;
  background: transparent;
  z-index: 10;
}

.resizer.right {
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
}

.resizer.left {
  top: 0;
  left: 0;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
}

.resizer.bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}

.resizer.top {
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}

.resizer.top-left,
.resizer.top-right,
.resizer.bottom-left,
.resizer.bottom-right {
  width: 10px;
  height: 10px;
}

.resizer.top-left {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.resizer.top-right {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.resizer.bottom-left {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.resizer.bottom-right {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

#game-canvas {
  border: 1px solid #ccc;
  background-color: #f5f5f5;
}

#boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: black;
  color: #00ff00;
  font-family: monospace;
  font-size: 14px;
  padding: 20px;
  overflow: auto;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

#boot-text {
  white-space: pre-line;
}

/* === Wormhole Transition Effect === */
@keyframes wormholeExit {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    clip-path: circle(150% at 50% 50%);
  }
  30% {
    transform: scale(1.05) rotate(90deg);
    opacity: 0.9;
  }
  60% {
    transform: scale(0.6) rotate(360deg);
    opacity: 0.7;
    clip-path: circle(60% at 50% 50%);
  }
  85% {
    transform: scale(0.2) rotate(540deg);
    opacity: 0.3;
    clip-path: circle(20% at 50% 50%);
  }
  100% {
    transform: scale(0) rotate(720deg);
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
  }
}

@keyframes wormholeGlow {
  0%, 100% {
    box-shadow:
      inset 0 0 0 rgba(255, 255, 255, 0),
      0 0 0 rgba(135, 206, 235, 0);
  }
  50% {
    box-shadow:
      inset 0 0 80px rgba(255, 255, 255, 0.3),
      0 0 100px rgba(135, 206, 235, 0.6);
  }
}

#boot-screen.wormhole-exit {
  animation:
    wormholeExit 1.8s cubic-bezier(0.6, 0.04, 0.98, 0.335) forwards,
    wormholeGlow 1.8s ease-in-out forwards;
  transform-origin: center center;
  /* Riduci z-index durante la transizione per non coprire la taskbar */
  z-index: 1000;
}

/* === Fade Transition (Mobile) === */
@keyframes simpleFadeExit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes simpleFadeEntry {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

#boot-screen.fade-exit {
  animation: simpleFadeExit 0.8s ease-out forwards;
  z-index: 1000;
}

#desktop.fade-entry {
  animation: simpleFadeEntry 0.6s ease-in forwards;
}

/* Desktop emerge dal wormhole */
@keyframes desktopWormholeEntry {
  0% {
    transform: scale(0) rotate(-720deg);
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
  }
  40% {
    transform: scale(0.4) rotate(-360deg);
    opacity: 0.5;
    clip-path: circle(30% at 50% 50%);
  }
  70% {
    transform: scale(0.9) rotate(-90deg);
    opacity: 0.9;
    clip-path: circle(80% at 50% 50%);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    clip-path: circle(150% at 50% 50%);
  }
}

#desktop.wormhole-entry {
  animation: desktopWormholeEntry 1.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transform-origin: center center;
}

/* Remove clip-path after desktop wormhole animation completes */
#desktop {
  clip-path: none;
}

/* === Page Transitions === */
/* Wormhole transition (riutilizza animazioni esistenti) */
body.page-transition-wormhole {
  animation:
    wormholeExit 1.8s cubic-bezier(0.6, 0.04, 0.98, 0.335) forwards,
    wormholeGlow 1.8s ease-in-out forwards;
  transform-origin: center center;
}

/* Slide Left */
@keyframes slideLeftExit {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-100%);
    opacity: 0;
  }
}

body.page-transition-slide-left {
  animation: slideLeftExit 800ms cubic-bezier(0.6, 0, 0.8, 0.2) forwards;
}

/* Slide Right */
@keyframes slideRightExit {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

body.page-transition-slide-right {
  animation: slideRightExit 800ms cubic-bezier(0.6, 0, 0.8, 0.2) forwards;
}

/* Fade + Zoom */
@keyframes fadeZoomExit {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

body.page-transition-fade-zoom {
  animation: fadeZoomExit 700ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Flip 3D */
@keyframes flip3DExit {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
  }
  100% {
    transform: rotateY(90deg);
    opacity: 0;
  }
}

body.page-transition-flip-3d {
  animation: flip3DExit 900ms cubic-bezier(0.7, 0, 1, 0.5) forwards;
  transform-origin: center center;
  perspective: 1000px;
}

/* Iris - circolare tipo cinema vintage */
@keyframes irisExit {
  0% {
    clip-path: circle(150% at 50% 50%);
    opacity: 1;
  }
  100% {
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
  }
}

body.page-transition-iris {
  animation: irisExit 1000ms cubic-bezier(0.5, 0, 0.5, 1) forwards;
}

/* Dissolve - effetto pixelato */
@keyframes dissolveExit {
  0% {
    opacity: 1;
    filter: blur(0px) brightness(1);
  }
  50% {
    filter: blur(5px) brightness(0.7);
  }
  100% {
    opacity: 0;
    filter: blur(20px) brightness(0.3);
  }
}

body.page-transition-dissolve {
  animation: dissolveExit 800ms ease-in-out forwards;
}

.icon:active {
  opacity: 0.8;
}

/* === Pergamene Dinamiche === */
.scroll-parchment {
  position: absolute;
  width: 350px;
  min-height: 200px;
  background: linear-gradient(135deg, #f4e8d0 0%, #e8d7b8 100%);
  border: 2px solid #8b7355;
  border-radius: 8px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 60px rgba(139, 115, 85, 0.1),
    0 0 0 1px rgba(139, 115, 85, 0.3);
  padding: 25px 20px;
  /* z-index: 70 - Maggiore delle icone (60) per far prevalere le pergamene
   * Il sistema di collision detection cerca sempre posizioni senza sovrapposizioni,
   * ma se necessario le pergamene prevalgono visivamente */
  z-index: 70;
  font-family: 'Georgia', serif;
  color: #3c2f1f;
  opacity: 0;
  transform: translateY(-50px) scale(0.8) rotate(-2deg);
  pointer-events: all;
  cursor: default;
  backdrop-filter: blur(2px);
  animation: parchmentAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.scroll-parchment::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 2px,
      rgba(139, 115, 85, 0.03) 4px
    );
  pointer-events: none;
  border-radius: 10px;
  z-index: -1;
}

.scroll-parchment-header {
  font-size: 20px;
  font-weight: bold;
  color: #5a3e2b;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #8b7355;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
  letter-spacing: 0.5px;
}

.scroll-parchment-content {
  font-size: 14px;
  line-height: 1.6;
  color: #4a3728;
  text-align: justify;
  margin-bottom: 15px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.scroll-parchment-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  font-size: 13px;
  font-style: italic;
  color: #6b5744;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(139, 115, 85, 0.3);
}

.scroll-parchment-link {
  color: #8b4513;
  text-decoration: none;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 3px;
  transition: all 0.3s ease;
  display: inline-block;
  background: rgba(139, 115, 85, 0.1);
}

.scroll-parchment-link:hover {
  background: rgba(139, 115, 85, 0.2);
  transform: translateX(3px);
  text-shadow: 0 0 5px rgba(139, 69, 19, 0.5);
}

/* Stili specifici per tipo di link */
.scroll-parchment-link-more {
  background: rgba(0, 120, 215, 0.15);
  color: #0056a3;
}

.scroll-parchment-link-more:hover {
  background: rgba(0, 120, 215, 0.25);
  text-shadow: 0 0 5px rgba(0, 86, 163, 0.5);
}

.scroll-parchment-link-github {
  background: rgba(51, 51, 51, 0.15);
  color: #333;
}

.scroll-parchment-link-github:hover {
  background: rgba(51, 51, 51, 0.25);
  text-shadow: 0 0 5px rgba(51, 51, 51, 0.5);
}

.scroll-parchment-link-slideshow {
  background: rgba(139, 0, 139, 0.15);
  color: #8b008b;
}

.scroll-parchment-link-slideshow:hover {
  background: rgba(139, 0, 139, 0.25);
  text-shadow: 0 0 5px rgba(139, 0, 139, 0.5);
}

.scroll-parchment-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: #8b7355;
  color: #f4e8d0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 22px;
  text-align: center;
  opacity: 0.7;
  transition: all 0.3s ease;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.scroll-parchment-close:hover {
  opacity: 1;
  transform: rotate(90deg) scale(1.1);
  background: #6b5744;
}

/* Animazioni */
@keyframes parchmentAppear {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.8) rotate(-5deg);
  }
  60% {
    opacity: 1;
    transform: translateY(10px) scale(1.02) rotate(1deg);
  }
  80% {
    transform: translateY(-5px) scale(0.98) rotate(-0.5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes parchmentDisappear {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    clip-path: circle(150% at 50% 50%);
  }
  30% {
    transform: scale(1.05) rotate(90deg);
    opacity: 0.9;
    clip-path: circle(120% at 50% 50%);
  }
  60% {
    transform: scale(0.6) rotate(360deg);
    opacity: 0.7;
    clip-path: circle(60% at 50% 50%);
  }
  85% {
    transform: scale(0.2) rotate(540deg);
    opacity: 0.3;
    clip-path: circle(20% at 50% 50%);
  }
  100% {
    transform: scale(0) rotate(720deg);
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
  }
}

/* Glow effect per pergamena wormhole */
@keyframes parchmentWormholeGlow {
  0%, 100% {
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.5),
      inset 0 0 60px rgba(139, 115, 85, 0.1),
      0 0 0 1px rgba(139, 115, 85, 0.3);
  }
  50% {
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.5),
      inset 0 0 80px rgba(139, 115, 85, 0.3),
      0 0 100px rgba(232, 215, 184, 0.6);
  }
}

.scroll-parchment.disappearing {
  animation:
    parchmentDisappear 0.8s cubic-bezier(0.6, 0.04, 0.98, 0.335) forwards,
    parchmentWormholeGlow 0.8s ease-in-out forwards;
  transform-origin: center center;
}

/* Ensure clip-path is removed after parchment disappears */
.scroll-parchment:not(.disappearing) {
  clip-path: none;
}

/* Effetto fluttuazione leggera */
.scroll-parchment.floating {
  animation: parchmentAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             parchmentFloat 6s ease-in-out infinite 1s;
}

@keyframes parchmentFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .scroll-parchment {
    width: 60%; /* Calcolo preciso: 60% dello schermo disponibile */
    max-width: 250px; /* Massimo 250px per layout armonico */
    padding: 16px 12px; /* Padding ridotto per compattezza */
    min-height: 170px; /* Altezza minima ottimizzata */
  }

  .scroll-parchment-header {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .scroll-parchment-content {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
  }

  .scroll-parchment-footer {
    font-size: 12px;
    margin-top: 10px;
    padding-top: 8px;
  }

  .scroll-parchment-close {
    width: 30px;
    height: 30px;
    font-size: 18px;
    line-height: 28px;
    top: 8px;
    right: 8px;
  }
}

/* === Slideshow Narrativo === */
.slideshow-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.slideshow-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}

.slideshow-header h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.slideshow-subtitle {
  font-size: 1.2rem;
  color: #666;
  font-style: italic;
}

.slideshow-player {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  max-width: 900px;
  margin: 0 auto;
}

.slideshow-image-container {
  position: relative;
  width: 100%;
  background: #000;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#slide-image {
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: contain;
  display: block;
}

.slideshow-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

#slide-progress-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0078d7, #00bcf2);
  transition: width 0s linear;
}

.slideshow-caption-container {
  padding: 2rem;
  min-height: 120px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

#slide-caption {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
  margin: 0;
  text-align: justify;
}

.slideshow-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background: #fff;
}

.slideshow-controls button {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slideshow-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.slideshow-controls button:active {
  transform: translateY(0);
}

.slideshow-controls button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

#play-pause-slide {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

#play-pause-slide:hover {
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.slideshow-counter {
  text-align: center;
  padding: 1rem;
  font-size: 0.95rem;
  color: #666;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  font-weight: 600;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .slideshow-header h1 {
    font-size: 1.8rem;
  }

  .slideshow-subtitle {
    font-size: 1rem;
  }

  .slideshow-image-container {
    min-height: 300px;
  }

  #slide-image {
    max-height: 400px;
  }

  .slideshow-caption-container {
    padding: 1.5rem;
    min-height: 100px;
  }

  #slide-caption {
    font-size: 1rem;
    line-height: 1.6;
  }

  .slideshow-controls {
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 1rem;
  }

  .slideshow-controls button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  /* Nascondi testo dei pulsanti su mobile, lascia solo icone */
  #prev-slide span:not([aria-hidden]),
  #next-slide span:not([aria-hidden]) {
    display: none;
  }

  #play-pause-text {
    display: none;
  }

  .slideshow-counter {
    font-size: 0.85rem;
    padding: 0.8rem;
  }
}

/* Animazione fade per cambio slide */
@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#slide-image {
  animation: slideFadeIn 0.4s ease-in-out;
}

/* === Taskbar Clock & Social Sharing === */
.taskbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social-sharing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.taskbar-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--vds-text-primary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
}

.taskbar-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.taskbar-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.15);
}

.share-icon {
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
}

.taskbar-clock {
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 12px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--vds-text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 60px;
  text-align: center;
}

/* Mobile responsive - Dimensioni GRANDI uniformi desktop/mobile */
@media (max-width: 768px) {
  #taskbar {
    height: 68px;
    padding: 0 12px;
  }

  .taskbar-vds-home-btn {
    padding: 12px 16px;
    font-size: 24px;
  }

  .taskbar-vds-home-btn .home-icon {
    font-size: 24px;
  }

  #start {
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
  }

  .social-sharing {
    gap: 12px;
    padding: 0 10px;
  }

  .taskbar-btn {
    min-width: 48px;
    height: 44px;
    padding: 10px 14px;
    font-size: 20px;
  }

  .share-icon {
    font-size: 20px;
  }

  .taskbar-clock {
    font-size: 20px;
    padding: 12px 18px;
    min-width: 90px;
    letter-spacing: 1.8px;
    font-weight: 700;
  }

  /* Hide some social buttons on very small screens */
  @media (max-width: 480px) {
    #share-facebook,
    #share-linkedin {
      display: none;
    }
  }
}

/* === Notification Animations === */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
