:root {
  --main-bg: #f4f4f4;
  --main-fg: #222;
  --box-bg: #fff;
  --border: #e4e4e4;
  --link: #2367c8;
  --link-hover: #014ef0;
  --accent: #e7f0ff;
  --select-arrow: url("data:image/svg+xml;charset=UTF-8,<svg width='10' height='5' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M0 0L5 5L10 0H0Z' fill='%232367c8'/></svg>");
}

body {
  font-family: "Segoe UI", "Roboto", Arial, sans-serif;
  background: var(--main-bg);
  color: var(--main-fg);
  margin: 0;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
  overflow-x: hidden;
}

body.dark {
  --main-bg: #17181c;
  --main-fg: #f4f4f4;
  --box-bg: #23242b;
  --border: #292a2f;
  --link: #71c6ff;
  --link-hover: #ffe6a6;
  --accent: #71c6ff22;
  --select-arrow: url("data:image/svg+xml;charset=UTF-8,<svg width='10' height='5' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M0 0L5 5L10 0H0Z' fill='%2371c6ff'/></svg>");
}

a {
  color: var(--link);
  text-decoration: underline;
  transition: color 0.2s;
}
a:hover {
  color: var(--link-hover);
}

.container {
  max-width: 800px;
  margin: 32px auto;
  background: var(--box-bg);
  border-radius: 16px;
  box-shadow: 0 4px 32px 0 rgba(0, 0, 0, 0.08);
  padding: 32px 24px;
  border: 1px solid var(--border);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  position: relative;
  width: 100%;
}

#menu-overlay {
  display: none;
}
nav.controls.open + #menu-overlay,
#menu-overlay.active {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.1); /* O più scuro se vuoi */
  cursor: pointer;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

nav.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  position: static;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--main-fg);
  margin-left: 10px;
  transition: color 0.2s;
}
.hamburger:focus-visible {
  outline: 2px solid var(--link);
}

/* Bottoni moderni/pill */
.control-btn,
.language-switcher,
.darkmode-toggle {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: var(--box-bg);
  color: var(--main-fg);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 1rem;
  margin-left: 10px;
  box-shadow: none;
}

.control-btn:hover,
.control-btn:focus-visible,
.language-switcher:hover,
.language-switcher:focus-visible,
.darkmode-toggle:hover,
.darkmode-toggle:focus-visible {
  background: var(--accent);
  color: #191919;
  outline: 2px solid var(--link);
}

/* Select custom */
.language-switcher,
.language-switcher:focus,
.language-switcher:hover,
.language-switcher:active {
  min-width: 120px;
  padding-right: 36px;
  appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 8px;
  background-color: var(--box-bg) !important;
  color: var(--main-fg) !important;
  border: none;
  box-shadow: none;
}

/* Icona tema */
.darkmode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.darkmode-toggle i {
  font-size: 1.2em;
  vertical-align: middle;
  pointer-events: none;
}
body.dark .darkmode-toggle .fa-sun {
  color: #ffe261 !important;
}
body.dark .darkmode-toggle .fa-moon {
  color: #191919 !important;
}

/* Solo su mobile/hamburger: label "Tema" visibile */
.theme-label {
  display: none;
  margin-left: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  justify-content: center;
}

/* Policy content */
section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
section:last-child {
  border-bottom: none;
}

h2 {
  display: flex;
  align-items: center;
  font-size: 1.3rem;
  margin: 0 0 10px 0;
  gap: 10px;
  font-weight: 600;
}
h2 i {
  font-size: 1.2em;
}

ul {
  padding-left: 1.4em;
  margin-top: 4px;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}

/* FULLSCREEN HAMBURGER MENU MOBILE */
@media (max-width: 800px) {
  .header-main {
    flex: 1;
    min-width: 0;
  }
  .header-title {
    font-size: 1.05rem;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hamburger {
    display: block;
    z-index: 102;
  }
  nav.controls {
    display: none;
  }
  nav.controls.open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: var(--main-bg);
    z-index: 101;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    animation: fadeInMenu 0.18s;
  }
  @keyframes fadeInMenu {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  body.menu-open {
    overflow: hidden;
    touch-action: none;
  }
  /* Bottoni e select grandi e simmetrici */
  nav.controls.open .control-btn,
  nav.controls.open .language-switcher,
  nav.controls.open .darkmode-toggle {
    width: 70vw;
    min-width: 220px;
    max-width: 95vw;
    justify-content: center;
    display: inline;
    margin-left: 0;
    margin-right: 0;
    font-size: 1.08rem;
    padding: 14px 0;
    border-radius: 999px;
    box-sizing: border-box;
    text-align: center;
  }
  nav.controls.open .darkmode-toggle i {
    margin: 0 auto;
    font-size: 1.15em;
    pointer-events: none;
  }
  nav.controls.open .darkmode-toggle {
    display: inline;
    justify-content: center;
  }
  nav.controls.open .darkmode-toggle .theme-label {
    display: inline;
    margin-left: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    justify-content: center;
  }
  nav.controls.open .language-switcher {
    appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 16px 8px;
  }
}

/* Migliora tocco su mobile */
@media (hover: none) and (pointer: coarse) {
  .control-btn,
  .language-switcher,
  .darkmode-toggle {
    min-height: 48px;
  }
}
