    /* --- RESET & BOX SIZING --- */
    *, *::before, *::after { box-sizing: border-box; }

    :root {
      --bg-color: #0d1117;
      --term-bg: #161b22;
      --text-main: #c9d1d9;
      --text-muted: #8b949e;
      --accent-red: #ff7b72;
      --accent-blue: #58a6ff;
      --accent-green: #3fb950;
      --accent-purple: #d2a8ff;
      --border: #30363d;
      --font-mono: 'Fira Code', 'Consolas', monospace;
    }

    html, body { width: 100%; overflow-x: hidden; scroll-behavior: smooth; }

    body {
      background: var(--bg-color);
      color: var(--text-main);
      font-family: var(--font-mono);
      margin: 0;
      padding: 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      min-height: 100vh;
    }

    .seo-content {
      position: absolute;
      width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0, 0, 0, 0);
      white-space: nowrap; border: 0;
    }

    .lang-switch-container {
      position: absolute;
      top: 20px;
      right: 20px;
      display: flex;
      gap: 10px;
      z-index: 1000;
    }

    .lang-btn {
      background: var(--term-bg);
      color: var(--text-muted);
      border: 1px solid var(--border);
      padding: 6px 12px;
      border-radius: 4px;
      cursor: pointer;
      font-family: var(--font-mono);
      font-size: 0.85em;
      transition: all 0.3s ease;
    }

    .lang-btn:hover { border-color: var(--accent-blue); color: var(--text-main); }
    .lang-btn.active { border-color: var(--accent-blue); color: var(--accent-blue); font-weight: bold; background: #21262d; }

    .terminal-wrapper {
      width: 100%;
      max-width: 900px;
      margin-top: 40px;
      box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    }

    .terminal-header {
      background: var(--term-bg);
      border: 1px solid var(--border);
      border-bottom: none;
      padding: 10px 15px;
      border-radius: 6px 6px 0 0;
      display: flex;
      justify-content: space-between;
      color: var(--text-muted);
      font-size: 0.85em;
      font-weight: bold;
      user-select: none;
    }

    .terminal-body {
      background: #010409; 
      border: 1px solid var(--border);
      padding: 20px;
      min-height: 550px;
      border-radius: 0 0 6px 6px;
      font-size: 0.95em;
      line-height: 1.6;
      overflow-x: hidden;
      word-wrap: break-word;
    }

    .prompt { color: var(--accent-red); font-weight: bold; }
    .out-success { color: var(--accent-green); }
    .out-warn { color: #d29922; }
    .out-info { color: var(--accent-blue); }
    .out-keyword { color: var(--accent-purple); }
    
    .cursor {
      display: inline-block;
      width: 9px; height: 1.1em;
      background: var(--accent-red);
      animation: blink 1s steps(2, start) infinite;
      vertical-align: text-bottom;
    }
    @keyframes blink { to { background: transparent; } }

    .nav-container {
      margin-top: 30px;
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: center;
      width: 100%;
    }

    .btn {
      background: var(--term-bg);
      color: var(--text-main);
      border: 1px solid var(--border);
      padding: 12px 24px;
      text-decoration: none;
      font-size: 0.95em;
      border-radius: 6px;
      transition: all 0.2s ease-in-out;
      font-weight: 500;
      text-align: center;
      cursor: pointer;
    }
    .btn:hover { border-color: var(--text-main); background: #21262d; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

    .btn-challenge {
      margin-top: 15px;
      border: 1px solid rgba(255, 123, 114, 0.4);
      color: var(--accent-red);
      background: rgba(255, 123, 114, 0.05);
      font-weight: bold;
    }

    .quote-footer {
      margin-top: 50px;
      color: var(--text-muted);
      font-size: 0.9em;
      text-align: center;
      max-width: 650px;
      font-style: italic;
    }

    .modal-overlay {
      display: none;
      position: fixed;
      top: 0; left: 0; width: 100%; height: 100%;
      background: rgba(0, 0, 0, 0.85);
      backdrop-filter: blur(5px);
      z-index: 9999;
      justify-content: center;
      align-items: center;
      padding: 10px;
    }

    .modal-window {
      background: var(--bg-color);
      border: 1px solid var(--border);
      width: 100%; max-width: 800px; 
      max-height: 95vh;
      display: flex; flex-direction: column;
      border-radius: 8px;
    }

    .modal-header {
      padding: 15px;
      background: var(--term-bg);
      border-bottom: 1px solid var(--border);
      display: flex; justify-content: space-between; align-items: center;
      color: var(--text-main); font-weight: bold;
    }

    .modal-tabs {
      display: flex;
      background: #0d1117;
      border-bottom: 1px solid var(--border);
      overflow-x: auto;
    }

    .tab {
      padding: 12px 18px;
      cursor: pointer;
      color: var(--text-muted);
      border-right: 1px solid var(--border);
      font-size: 0.85em;
      white-space: nowrap;
    }
    .tab.active { color: var(--accent-red); border-bottom: 2px solid var(--accent-red); }

    .modal-body { padding: 20px; overflow-y: auto; }
    .challenge-box { display: none; }
    .challenge-box.active { display: block; }

    .code-display {
      background: #050505;
      border: 1px solid var(--border);
      border-left: 3px solid var(--accent-red);
      padding: 15px;
      margin: 15px 0;
      font-family: var(--font-mono);
      font-size: 0.9em;
      white-space: pre-wrap;
    }

    .input-group { display: flex; gap: 10px; margin-top: 20px; }
    .ctf-input { flex-grow: 1; background: #010409; border: 1px solid var(--border); color: #fff; padding: 12px; border-radius: 4px; }
    .btn-submit { background: var(--term-bg); border: 1px solid var(--border); color: var(--text-main); cursor: pointer; padding: 0 25px; border-radius: 4px; font-weight: bold; }
    .explanation-text { display: none; margin-top: 15px; background: rgba(88, 166, 255, 0.08); padding: 15px; border-radius: 6px; border-left: 2px solid var(--accent-blue); }

  .btn-challenge-chess {
    margin-top: 15px;
    border: 1px solid rgba(210, 168, 255, 0.4); /* Viola semitrasparente */
    color: var(--accent-purple);
    background: rgba(210, 168, 255, 0.05); /* Sfondo viola leggerissimo */
    font-weight: bold;
  }

  .btn-challenge-chess:hover {
    border-color: var(--accent-purple);
    background: rgba(210, 168, 255, 0.1);
    box-shadow: 0 0 15px rgba(210, 168, 255, 0.2); /* Effetto luce viola */
    transform: translateY(-2px);
  }

    /* Stile per i pallini nella testata del terminale */
  .dots { 
    display: flex; 
    gap: 8px; 
    align-items: center;
  }

  .dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
  }

  .red { background: #ff5f56; }
  .amber { background: #ffbd2e; }
  .green { background: #27c93f; }

  /* Aggiornamento header per ospitare pallini e testo */
  .terminal-header {
    background: var(--term-bg);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 10px 15px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between; /* Spinge il testo a destra o mantiene spazio */
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: bold;
    user-select: none;
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 15px; /* Spazio tra i pallini e la scritta root */
  }

  .dim { color: #484f58; opacity: 0.7; }

  /* Titolo Scacchi Glitch (Nascosto di base) */
  #chess-glitch-title {
    display: none;
    font-size: 5rem;
    font-weight: 900;
    color: var(--accent-purple);
    margin: 20px 0;
    letter-spacing: -2px;
    line-height: 1;
    position: relative;
    text-shadow: 3px 3px 0px rgba(0,0,0,0.5);
    z-index: 10;
  }

  #chess-glitch-title.active {
    display: block;
    animation: chess-glitch-anim 0.2s ease;
  }

  .main-footer {
  margin-top: 60px; /* Spazio dal contenuto precedente */
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85em;
  width: 100%;
  opacity: 0.6; /* Un po' più spento per non distrarre dal terminale */
  transition: opacity 0.3s ease;
}

  .main-footer:hover {
    opacity: 1; /* Si illumina quando ci passi sopra */
  }

  .main-footer p::before {
    content: "$ ";
    color: var(--accent-red);
  }

  /* Restyling Avanzato Explain Logic */
  .btn-explain {
    display: block;
    width: 100%; /* Occupa tutta la larghezza per essere facile da cliccare */
    margin-top: 20px;
    background: rgba(88, 166, 255, 0.05);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  .btn-explain:hover {
    background: rgba(88, 166, 255, 0.15);
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
    transform: scale(1.01);
    color: #fff;
  }

  /* Effetto linea di scansione che passa quando fai hover */
  .btn-explain::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    transition: all 0.5s;
  }

  .btn-explain:hover::after {
    left: 120%;
  }

  /* Contenitore della spiegazione (il testo che appare) */
  .explanation-text {
    display: none;
    margin-top: 10px;
    background: #0d1117;
    padding: 15px;
    border-radius: 4px;
    border-left: 3px solid var(--accent-blue);
    font-size: 0.9em;
    color: var(--text-main);
    line-height: 1.5;
    animation: fadeIn 0.4s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes chess-glitch-anim {
    0% { transform: translate(2px, 2px); opacity: 0.8; }
    50% { transform: translate(-2px, -2px); opacity: 1; }
    100% { transform: translate(0); }
  }

    @media (max-width: 600px) {
      .input-group { flex-direction: column; }
      .btn-submit { width: 100%; padding: 12px; }
      .btn { width: 100%; margin-bottom: 5px; }
    }
