:root {
  --red: #d42040;
  --blue: #0d6efd;
  --dark: #1a1f2e;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #dde3ee;
  --text: #1c2533;
  --muted: #627086;
  --primary: #1f6feb;
  --primary-dark: #1348a8;
  --danger-bg: #fff0f0;
  --danger-text: #ae1b1b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  color: var(--text);
  background: var(--bg);
}

header {
  width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.user-link {
  color: inherit;
  text-decoration: none;
}

.user-link:hover {
  color: #0d4eb8;
  text-decoration: none;
}

.user-link:focus,
.user-link:active,
.user-link:visited {
  text-decoration: none;
}

.nav-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-right: 6px;
}

.nav-logo {
  width: 74px;
  height: auto;
  display: block;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
}

.social-btn:hover {
  transform: scale(1.15);
  opacity: 0.85;
}

.social-btn svg {
  width: 36px;
  height: 36px;
}

/* TikTok icon black on non-home pages */
.social-btn[title="TikTok"] svg path {
  fill: #000000 !important;
}

.logged-badge {
  font-size: 12px;
  color: #28a745;
  margin-right: 4px;
}

.user-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu-btn {
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  position: relative;
}

.nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: #0b5ed7;
  color: #fff;
  transform: scale(1.08);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.nav-notify-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d42040;
  border: 2px solid #fff;
}

.user-menu-panel {
  position: absolute;
  top: 52px;
  right: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 6px;
  display: none;
  z-index: 1200;
}

.user-menu-panel.open {
  display: block;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-family: "Oswald", sans-serif;
  font-size: 13px;
  color: #1a1f2e;
  text-transform: none;
  letter-spacing: 0.2px;
}

.user-menu-item.is-sub-item {
  padding-left: 16px;
}

.user-menu-item.is-sub-item .menu-label {
  position: relative;
  padding-left: 9px;
}

.user-menu-item.is-sub-item .menu-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #9cb0d3;
}

.user-menu-item:hover,
.user-menu-item.is-active {
  background: #f5f8ff;
  color: var(--blue);
  text-decoration: none;
}

.user-menu-sep {
  height: 1px;
  background: #edf1f6;
  margin: 5px 0;
}

.user-menu-section {
  padding: 2px 0;
}

.user-menu-section-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 6px 10px 4px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 8px;
}

.user-menu-section-toggle:hover {
  background: #f7f9fd;
}

.user-menu-section-title {
  padding: 0;
  font-family: "Oswald", sans-serif;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #657186;
  text-align: left;
}

.user-menu-section-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #8695ac;
  border-bottom: 2px solid #8695ac;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.user-menu-section-body {
  display: none;
  padding: 0 0 4px;
}

.user-menu-section.is-open .user-menu-section-body {
  display: block;
}

.user-menu-section.is-open .user-menu-section-chevron {
  transform: rotate(225deg);
}

.menu-section-home {
  color: #333;
}

.menu-section-user {
  color: #666;
  font-weight: 700;
}

.user-menu-section-title.menu-section-home {
  color: #333;
}

.user-menu-section-title.menu-section-user {
  color: #666;
  font-weight: 700;
}

.user-menu-section-title.menu-section-show {
  color: #0d6efd;
}

.user-menu-section-title.menu-section-games {
  color: #ef8b17;
}

.user-menu-section-title.menu-section-leaderboards {
  color: #1b8f3a;
}

.user-menu-section-title.menu-section-partecipante {
  color: #7b3ff2;
}

.user-menu-section-title.menu-section-mod {
  color: #7d1f1f;
}

.menu-section-arena {
  color: #0d6efd;
}

.menu-section-talk {
  color: #2da7ff;
}

.menu-section-format {
  color: #6b4fd6;
}

.menu-section-nerdinsisland {
  color: #1b7a5a;
}

.menu-section-clip {
  color: #7b3ff2;
}

.menu-subgroup {
  font-weight: 700;
  color: #7b3ff2;
  cursor: default;
  pointer-events: none;
}

.menu-sub-item {
  color: #666;
  padding-left: 20px;
  pointer-events: auto;
}

.menu-group {
  font-weight: 700;
}

.menu-group-user {
  color: #1b8f3a;
}

.menu-group-show {
  color: #0d6efd;
}

.menu-group-talk {
  color: #2da7ff;
}

.menu-group-episodes {
  color: #7b3ff2;
}

.menu-group-quiz {
  color: #ef8b17;
}

.menu-group-admin {
  color: #7d1f1f;
}

.menu-separator {
  color: #9aa6ba;
  margin: 0 4px;
}

.menu-label {
  color: #2f3747;
}

.user-menu-item.is-admin-link {
  color: #7d1f1f;
}

.user-menu-item.is-admin-link .menu-label,
.user-menu-item.is-admin-link .menu-separator {
  color: #2f3747;
}

.user-menu-item.is-admin-link:hover,
.user-menu-item.is-admin-link.is-active {
  background: #fff2f2;
  color: #7d1f1f;
}

.user-menu-item.is-vote-link {
  color: #c62828;
  font-weight: 700;
}

.user-menu-item.is-vote-link .menu-label {
  color: inherit;
}

.user-menu-item.is-vote-link:hover,
.user-menu-item.is-vote-link.is-active {
  background: #fff0f0;
  color: #b71c1c;
}

.user-menu-item.is-challenge-link {
  color: #c62828;
  font-weight: 700;
}

.user-menu-item.is-challenge-link .menu-label {
  color: inherit;
}

.user-menu-item.is-challenge-link:hover,
.user-menu-item.is-challenge-link.is-active {
  background: #fff0f0;
  color: #b71c1c;
}

.user-menu-sep-section {
  margin-top: 8px;
  margin-bottom: 6px;
  background: #e8c9c9;
}

.page-wrap {
  max-width: 1160px;
  margin: 18px auto;
  padding: 0 16px 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.game-leaderboard-table-wrap {
  overflow-x: auto;
}

.game-leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.game-leaderboard-table th,
.game-leaderboard-table td {
  border: 1px solid #d8e2f0;
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.game-leaderboard-table thead th {
  background: #eef4ff;
  color: #183761;
  text-transform: uppercase;
  font-family: "Oswald", sans-serif;
  font-size: 13px;
  letter-spacing: 0.8px;
}

.game-leaderboard-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.game-leaderboard-table tbody tr:nth-child(even) {
  background: #f7fbff;
}

.game-leaderboard-table tbody tr:hover {
  background: #edf5ff;
}

.game-leaderboard-table .col-rank {
  width: 52px;
}

.game-leaderboard-table .col-name {
  width: 180px;
}

.game-leaderboard-table .cell-name {
  text-transform: uppercase;
}

.game-leaderboard-table .cell-score {
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  padding: 9px 8px;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
}

.clean-list li {
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  border-color: #435064;
  color: #d4def2;
}

.btn-secondary:hover {
  background: #243349;
  text-decoration: none;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.form-grid input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  padding: 10px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrap input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .eye-slash {
  display: none;
}

.password-toggle.is-visible .eye-slash {
  display: block;
}

.password-toggle.is-visible path:not(.eye-slash) {
  display: none;
}

.error-box {
  background: var(--danger-bg);
  border: 1px solid #f4caca;
  color: var(--danger-text);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
}

.site-footer {
  border-top: 1px solid #0b3f8d;
  background: linear-gradient(180deg, #2e79e6 0%, #0b3f8d 100%);
}

.site-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 16px 22px;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.footer-contact {
  font-family: "Oswald", sans-serif;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 6px;
}

.footer-contact a {
  color: #fff;
}

.footer-quote {
  max-width: 980px;
  margin: 0 auto;
}

.footer-quote-text {
  font-size: 50px;
  color: #FFF;
  font-weight: 600;
  line-height: 1.3;
}

.footer-quote-meta {
  margin-top: -5px;
  font-size: 30px;
  color: #ccc;
}

.footer-quote-empty {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 880px) {
  .nav-bar {
    padding: 10px 16px;
  }

  .social-btn {
    width: 36px;
    height: 36px;
  }

  .social-btn svg {
    width: 28px;
    height: 28px;
  }

  .nav-logo {
    width: 58px;
  }

  .footer-quote-text {
    font-size: 28px;
    line-height: 1.35;
  }

  .footer-quote-meta {
    font-size: 16px;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .footer-quote-text {
    font-size: 20px;
  }

  .footer-quote-meta {
    font-size: 14px;
  }
}

/* ── Challenge badge in main menu ── */
.menu-challenge-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  margin-left: 5px;
  background: #d42040;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  vertical-align: middle;
  line-height: 1;
}

.user-menu-btn .menu-challenge-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  margin-left: 0;
}
