
  /*Carrega font de Creative commons*/
  @font-face {
    font-family: 'CCSymbols';
    src: url('fonts/CCSymbols.woff2') format('woff2'),
        url('fonts/CCSymbols.woff') format('woff');
    font-display: swap;
    unicode-range: U+00A9, U+229C, U+1F10D-1F10F, U+1F16D-1F16F;
  }

  :root {
    --bg-color: #f4f6f8;
    --text-color: #333;
    --header-bg: #1e3a8a;
    --sidebar-bg: #2563eb;
    --link-bg: #3b82f6;
    --link-hover: #60a5fa;
    --section-bg: white;
    --footer-bg: #1e3a8a;
  }

  body.dark-mode {
    --bg-color: #1e1e2e;
    --text-color: #e0e0e0;
    --header-bg: #111827;
    --sidebar-bg: #1e293b;
    --link-bg: #334155;
    --link-hover: #475569;
    --section-bg: #2d2d44;
    --footer-bg: #111827;
  }

  body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: clamp(10px, 2.5vw, 18px);
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    transition: background 0.3s, color 0.3s;
  }

  @media screen and (max-width: 768px) and (orientation: landscape) {
    body {
      font-size: 8px;
    }
  }

  header {
    background: var(--header-bg);
    color: white;
    padding: 0.5rem 2rem;
    text-align: center;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: height 0.3s ease, background 0.3s ease; /* Transición suave */
  }
  header.scrolled {
    background: rgba(30, 58, 138, 0.85);  /*menos opaco*/
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    height: 40px; /* altura reducida al hacer scroll */
  }
  header h1 {
    font-size: 1.2rem;
    margin: 0;
  }
  header img {
    height: 60px;
    margin-left: 2dvh;
  }
  .sidebar {
    font-size: clamp(12px, 2.5vw, 16px);
    width: 250px;
    background: var(--sidebar-bg);
    padding-top: 5rem;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;

    top: 60px; /* para dejar espacio al header */
    height: calc(100vh - 60px); /* ajusta la altura disponible */
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0;
  }
  .sidebar a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 0.75rem 1rem;
    background: var(--link-bg);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    transition: background 0.3s, transform 0.2s;
  }
  .sidebar a:hover,
  .sidebar a.active {
    background: var(--link-hover);
    transform: translateX(5px);
  }
  main {
    margin-left: 250px;
    padding: 6rem 2rem 2rem 2rem;
    /*max-width: 900px;*/
    flex: 1;
  }
  section {
    background: var(--section-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
    scroll-margin-top: 70px; /* Ajusta aquest valor segons l'alçada del teu header */
  }
  footer {
    text-align: center;
    padding: 1rem;
    background: var(--footer-bg);
    color: white;
    margin-left: 250px;
  }
  @keyframes fadeInUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    border: none;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    padding: 0;
  }
  .theme-toggle::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    margin: 2px;
    transition: transform 0.3s ease;
  }
  body.dark-mode .theme-toggle {
    background: #666;
  }
  body.dark-mode .theme-toggle::before {
    transform: translateX(24px);
    background: #fff;
  }
  .hgi-sun-01 {
      transform: translateX(-24px);
  }

  /*menu hamburguesa*/
  .hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: -1rem;
    font-size: 1.8rem;
    background: transparent;
    color: white;
    border: none;
    z-index: 1002;
    cursor: pointer;
  }
  #menu-icon {
    display: inline-block;
    will-change: transform;
    transition: transform 0.5s ease, opacity 0.5s ease; /* Transición suave para la rotación */
  }
  .hamburger.open #menu-icon {
    transform: rotate(90deg); /* Gira el icono a 45 grados para hacer la X */
    -webkit-transform: rotate(90deg);
  }

  /* Responsive */
  @media (max-width: 768px) {
    .sidebar {
      position: fixed;
      left: -250px;
      top: 0;
      height: 100%;
      transition: left 0.3s ease;
      z-index: 1001;

      top: 60px; /* para dejar espacio al header */
      height: calc(100vh - 60px); /* ajusta la altura disponible */
      overflow-y: auto;
      padding-top: 0;      
    }
    .sidebar.open {
      left: 0;
    }
    .hamburger {
      display: block;
    }
    main {
      margin-left: 0;
      padding: 6rem 1rem 2rem 1rem;
    }
    footer {
      margin-left: 0;
    }
    header h1 {
      font-size: 1rem;
    }
    header img {
      height: 40px;
    }
    body {
      flex-direction: column;
    }
  }
  /*fin menu hamburguesa*/

  .ataque {
    background: white;
    border-left: 6px solid #007BFF;
    margin: 10px auto;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  }
  body.dark-mode .ataque {
    background: rgb(57, 80, 114);
  }
  .ataque h2 {
    margin-top: 0;
    color: #007BFF;
  }

  .alert {
    background: #f9dcce;
    border-left: 6px solid #f39c12;
  }
  body.dark-mode .alert {
    background: #c29473;
  }
  .tips {
    background: #d2f8e1;
    border-left: 6px solid #27ae60;
  }
  body.dark-mode .tips {
    background: #84b196;
    border-left: 6px solid #27ae60;
  }

  table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1em;
  }
  th, td {
    border: 1px solid #ccc;
    padding: 0.5em;
    text-align: left;
  }
  th {
    background-color: #e0e0ff;
  }

  .imatge-dreta {
    float: right;
    margin-left: 15px;
    margin-bottom: 10px;
  }
  
  .imatge-esquerra {
    float: left;
    margin-right: 15px;
    margin-bottom: 10px;
  }

   h2 {
    color: #1f3c88;
    font-size: 22px;
    margin-bottom: 10px;
  }

  h1 {
    font-size: 28px;
    color: #b834c4;
    margin: 0;
  }