:root {
  --bg-1: #d7f8e7;
  --bg-2: #bde0fe;
  --bg-3: #fff1cc;
  --accent-1: #2a9d8f;
  --accent-2: #2d6cdf;
  --accent-3: #f4a261;
  --text-main: #22313f;
  --card-bg: #fffaf4;
  --pill-bg: #ffffff;
}

body.subject-matematica {
  --bg-1: #c6a6ff;
  --bg-2: #9fd2ff;
  --bg-3: #ffd891;
  --accent-1: #7b43ff;
  --accent-2: #2f7dff;
  --accent-3: #ffb347;
  --text-main: #261a44;
  --card-bg: #fff7ef;
}

body.subject-geografia {
  --bg-1: #aaf2c8;
  --bg-2: #9fcdff;
  --bg-3: #ffe29f;
  --accent-1: #1f9d5d;
  --accent-2: #2b67d8;
  --accent-3: #f0b63f;
  --text-main: #1a3442;
  --card-bg: #fffaf0;
}

body.subject-storia {
  --bg-1: #ffd6ad;
  --bg-2: #cfc3ff;
  --bg-3: #ffdcb8;
  --accent-1: #8b4e2e;
  --accent-2: #6a45d1;
  --accent-3: #df9d45;
  --text-main: #362319;
  --card-bg: #fff7ee;
}

body.subject-scienze {
  --bg-1: #a9f4e2;
  --bg-2: #9fceff;
  --bg-3: #ffe3a3;
  --accent-1: #159883;
  --accent-2: #2863d6;
  --accent-3: #f2b23f;
  --text-main: #16323d;
  --card-bg: #fffaf1;
}

body.subject-italiano {
  --bg-1: #ffc0cf;
  --bg-2: #b9cbff;
  --bg-3: #ffe5ad;
  --accent-1: #cc3550;
  --accent-2: #3d67d8;
  --accent-3: #f2b950;
  --text-main: #3a2532;
  --card-bg: #fff9f2;
}

body.subject-civica {
  --bg-1: #aef3dd;
  --bg-2: #a6d3ff;
  --bg-3: #ffe8ad;
  --accent-1: #1f9f8f;
  --accent-2: #2a67d8;
  --accent-3: #ff9f3d;
  --text-main: #183a44;
  --card-bg: #fffaf1;
}

body.subject-problemi {
  --bg-1: #ffd48e;
  --bg-2: #ffb2a3;
  --bg-3: #adf5c8;
  --accent-1: #ff7b54;
  --accent-2: #2a9d8f;
  --accent-3: #f9c74f;
  --text-main: #2e2a2a;
  --card-bg: #fff8f0;
}

body.subject-inglese {
  --bg-1: #b8e6ff;
  --bg-2: #c9d0ff;
  --bg-3: #ffe3a8;
  --accent-1: #1f7fe0;
  --accent-2: #17a388;
  --text-main: #20344d;
  --card-bg: #fff9f1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  color: var(--text-main);
}

.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  opacity: 0.2;
  animation: drift linear infinite;
}

@keyframes drift {
  0% {
    transform: translateY(100vh) rotate(0deg);
  }
  100% {
    transform: translateY(-20vh) rotate(380deg);
  }
}

.wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 122px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 940px;
  margin-bottom: 10px;
}

.nav-icons {
  display: flex;
  gap: 10px;
}

.breadcrumbs {
  width: 100%;
  max-width: 940px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.breadcrumbs a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumbs [aria-current='page'] {
  color: #fff;
  opacity: 0.95;
}

.back-btn {
  background: linear-gradient(135deg, #ffffff, #f5f8ff);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50px;
  padding: 10px 20px;
  min-height: 44px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent-1);
  text-decoration: none;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16), 0 10px 18px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  transition: transform 0.15s;
}

.back-btn:hover {
  transform: translateY(-2px);
}

header {
  text-align: center;
  margin-bottom: 14px;
  animation: popIn 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes popIn {
  0% {
    transform: scale(0.6) rotate(-8deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 1.2px;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2), 8px 8px 24px rgba(0, 0, 0, 0.13);
}

.subtitle {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25);
  margin-top: 4px;
}

.header-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.icon-btn {
  background: linear-gradient(135deg, #ffffff, #f6faff);
  border: none;
  border-radius: 50px;
  padding: 10px 18px;
  min-height: 44px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.14), 0 10px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-2);
  transition: transform 0.15s;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.screen {
  display: none;
  width: 100%;
  max-width: 940px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#contenuto-principale {
  width: 100%;
}

.card {
  background: linear-gradient(165deg, #fffefb 0%, var(--card-bg) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  padding: 28px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 0 0 4px rgba(255, 255, 255, 0.22);
  width: 100%;
  animation: slideUp 0.45s ease;
  position: relative;
  overflow: hidden;
}

.levels-wrap {
  width: 100%;
  background: linear-gradient(165deg, #fffefb 0%, var(--card-bg) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  padding: 28px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 0 0 4px rgba(255, 255, 255, 0.22);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: -90px;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--accent-1);
  opacity: 0.16;
}

.card::after {
  content: '';
  position: absolute;
  bottom: -70px;
  left: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--accent-2);
  opacity: 0.12;
}

.card > * {
  position: relative;
  z-index: 1;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.section-label {
  font-family: 'Fredoka One', cursive;
  color: var(--accent-1);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  margin-bottom: 12px;
  text-align: center;
}

.class-selector-label,
.levels-title {
  font-family: 'Fredoka One', cursive;
  color: var(--accent-2);
  font-size: 1rem;
  margin: 4px 0 12px;
  text-align: center;
}

.intro-note {
  background: linear-gradient(135deg, #ffffff, #eef6ff);
  border: 2px dashed rgba(42, 157, 143, 0.45);
  border-radius: 16px;
  padding: 12px 14px;
  color: #3c566f;
  font-weight: 800;
  line-height: 1.5;
  margin: 0 0 14px;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.seo-static {
  width: 100%;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid rgba(45, 108, 223, 0.2);
  background: linear-gradient(140deg, #ffffff, #f5fbff);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.06);
  position: relative;
}

.seo-static::before {
  content: 'Per genitori e insegnanti';
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(45, 108, 223, 0.12);
  color: #2d6cdf;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.2px;
}

.seo-static h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.seo-static p {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #35506b;
  margin: 0 0 8px;
}

.seo-static ul {
  margin: 0 0 8px 18px;
  color: #35506b;
  font-size: 0.88rem;
  line-height: 1.4;
  font-weight: 700;
}

.seo-static li + li {
  margin-top: 4px;
}

.seo-faq::before {
  content: 'Domande frequenti';
}

.seo-faq-item {
  border-top: 1px solid rgba(45, 108, 223, 0.16);
  padding: 8px 0;
}

.seo-faq-item summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent-2);
  line-height: 1.3;
}

.seo-faq-item summary:hover {
  text-decoration: underline;
}

.seo-faq-item p {
  margin: 6px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #35506b;
}

.related-subjects {
  width: 100%;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid rgba(45, 108, 223, 0.18);
  background: linear-gradient(140deg, #ffffff, #f7fbff);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
}

.related-subjects h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--accent-2);
  margin: 0 0 8px;
}

.related-subjects ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-subjects li {
  margin: 0;
}

.related-subjects a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(45, 108, 223, 0.1);
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease;
}

.related-subjects a:hover,
.related-subjects a:focus {
  background: rgba(45, 108, 223, 0.2);
  text-decoration: underline;
}

.class-selector-label {
  margin-top: 4px;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.class-btn {
  background: linear-gradient(145deg, #ffffff, #f4fbff);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 12px 10px;
  font-weight: 900;
  color: #46586a;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14), 0 12px 18px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-height: 44px;
}

.class-btn:nth-child(1) { background: linear-gradient(145deg, #dff4ff, #b8e5ff); color: #17496a; }
.class-btn:nth-child(2) { background: linear-gradient(145deg, #e3ffe9, #bff5ce); color: #215a34; }
.class-btn:nth-child(3) { background: linear-gradient(145deg, #f2e8ff, #ddc6ff); color: #4b2c78; }
.class-btn:nth-child(4) { background: linear-gradient(145deg, #ffe8ef, #ffc7d8); color: #7a2845; }

.class-btn .a-icon {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 3px;
}

.class-btn .a-title {
  display: block;
  font-size: 0.92rem;
  line-height: 1.15;
}

.class-btn .a-sub {
  display: block;
  font-size: 0.82rem;
  color: #2d4256;
  margin-top: 2px;
}

.class-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.14), 0 14px 20px rgba(0, 0, 0, 0.11);
}

.class-btn.selected {
  border-color: var(--accent-1);
  border-width: 4px;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.15), 0 0 0 4px rgba(42, 157, 143, 0.25), 0 16px 24px rgba(42, 157, 143, 0.25);
  filter: brightness(0.95) saturate(1.1);
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.area-grid:empty {
  min-height: 260px;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.level-card {
  width: 100%;
  text-align: left;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14), 0 12px 18px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(145deg, #fff, #f4fbff);
  color: #38556e;
}

.level-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.level-info {
  min-width: 0;
}

.level-name {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}

.level-classes,
.level-topics {
  display: block;
  font-size: 0.85rem;
  color: #2d4256;
  margin-top: 2px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 74px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #264f91;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.play-window-panel {
  width: 100%;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 2px solid rgba(45, 108, 223, 0.18);
  background: linear-gradient(135deg, #fff, #f4f8ff);
  box-shadow: 0 10px 24px rgba(45, 108, 223, 0.1);
}

.play-window-kicker {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2d6cdf;
}

.play-window-status {
  margin: 0 0 10px;
  color: #42586d;
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.45;
}

.play-window-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.play-window-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1f3f73;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 900;
}

.play-window-btn {
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #2d6cdf, #4d8dff);
  color: #fff;
  font-size: 0.96rem;
  line-height: 1.2;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(45, 108, 223, 0.24);
}

.play-window-note {
  margin: 10px 0 0;
  color: #5d7082;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
}

.area-more-btn {
  border: 2px dashed rgba(46, 78, 112, 0.45);
  background: #f8fcff;
  color: #2a4e74;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 900;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
  margin: -4px 0 12px;
}

.area-more-btn:hover {
  border-color: #2d6cdf;
  color: #2d6cdf;
}

.area-btn {
  background: linear-gradient(145deg, #ffffff, #f4fbff);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 12px;
  font-weight: 900;
  color: #566;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14), 0 12px 18px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-height: 44px;
}

.area-btn:nth-child(1) { background: linear-gradient(145deg, #fff8d6, #ffe890); color: #6a5600; }
.area-btn:nth-child(2) { background: linear-gradient(145deg, #dff4ff, #b8e5ff); color: #17496a; }
.area-btn:nth-child(3) { background: linear-gradient(145deg, #e3ffe9, #bff5ce); color: #215a34; }
.area-btn:nth-child(4) { background: linear-gradient(145deg, #f2e8ff, #ddc6ff); color: #4b2c78; }
.area-btn:nth-child(5) { background: linear-gradient(145deg, #ffe8ef, #ffc7d8); color: #7a2845; }
.area-btn:nth-child(6) { background: linear-gradient(145deg, #ffeed8, #ffd2a0); color: #7a4b18; }
.area-btn:nth-child(7) { background: linear-gradient(145deg, #e7f0ff, #bfd5ff); color: #264f91; }
.area-btn:nth-child(8) { background: linear-gradient(145deg, #eafff4, #c3f5de); color: #236045; }
.area-btn:nth-child(9) { background: linear-gradient(145deg, #fff0e8, #ffd2bd); color: #7c3f21; }
.area-btn:nth-child(10) { background: linear-gradient(145deg, #f7f0ff, #dacbff); color: #4f3a85; }
.area-btn:nth-child(11) { background: linear-gradient(145deg, #e8fbff, #c2f0ff); color: #206173; }
.area-btn:nth-child(12) { background: linear-gradient(145deg, #fff7e8, #ffe1b6); color: #6e4f1d; }
.area-btn:nth-child(13) { background: linear-gradient(145deg, #e8fffb, #c4f9ef); color: #1f6154; }
.area-btn:nth-child(14) { background: linear-gradient(145deg, #ffe8f5, #ffcbe8); color: #7c2f5b; }
.area-btn:nth-child(15) { background: linear-gradient(145deg, #eaf0ff, #cfdcff); color: #304f85; }
.area-btn:nth-child(16) { background: linear-gradient(145deg, #f0ffe8, #d8f6c1); color: #436124; }
.area-btn:nth-child(17) { background: linear-gradient(145deg, #fff0ec, #ffd3c8); color: #7a3323; }
.area-btn:nth-child(18) { background: linear-gradient(145deg, #eff8ff, #cce8ff); color: #225477; }
.area-btn:nth-child(19) { background: linear-gradient(145deg, #f2ecff, #dacdff); color: #4e387d; }
.area-btn:nth-child(20) { background: linear-gradient(145deg, #e9fff8, #c9f4e5); color: #225d4a; }
.area-btn:nth-child(21) { background: linear-gradient(145deg, #fff5ea, #ffe1bc); color: #744f1f; }

.area-btn .a-icon {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.area-btn .a-title {
  display: block;
  font-size: 0.95rem;
}

.area-btn .a-sub {
  display: block;
  font-size: 0.82rem;
  color: #2d4256;
  margin-top: 3px;
}

.area-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.14), 0 14px 20px rgba(0, 0, 0, 0.11);
}

.area-btn.selected {
  border-color: var(--accent-1);
  border-width: 4px;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.15), 0 0 0 4px rgba(42, 157, 143, 0.25), 0 16px 24px rgba(42, 157, 143, 0.25);
  filter: brightness(0.95) saturate(1.1);
}

.start-btn {
  display: block;
  margin: 18px auto 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-1) 78%, #000 22%), color-mix(in srgb, var(--accent-2) 78%, #000 22%));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 44px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.42rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 7px 0 #1f6d63, 0 12px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}

.start-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 9px 0 #1f6d63, 0 16px 22px rgba(0, 0, 0, 0.2);
}

.start-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #1f6d63;
}

.score-bar {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
}

.score-pill {
  background: var(--pill-bg);
  border-radius: 50px;
  padding: 7px 16px;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 5px;
  border: 3px solid transparent;
}

.score-pill.points {
  border-color: var(--accent-1);
  color: var(--text-main);
}

.score-pill.qn {
  border-color: var(--accent-2);
  color: var(--text-main);
}

.progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(70, 93, 114, 0.34);
  border: 2px solid rgba(70, 93, 114, 0.78);
}

.dot.current {
  background: #ffd166;
  border-color: #d39f1a;
  transform: scale(1.4);
}

.dot.ok {
  background: #58c9b9;
  border-color: #1f8a78;
}

.dot.ko {
  background: #ff6b6b;
  border-color: #cc4444;
}

.q-card {
  background: linear-gradient(165deg, #ffffff, #f8fbff);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 26px 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.q-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 24px 18px;
  overflow: visible;
}

.q-card::before {
  content: '';
  position: absolute;
  top: -36px;
  right: -26px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(42, 157, 143, 0.12);
}

.mascot-q {
  position: static;
  align-self: flex-start;
  flex-shrink: 0;
  width: 88px;
  height: 128px;
  background: center / contain no-repeat;
  background-image: url('assets/mascotte/cervellino-neutral.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-neutral.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-neutral.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-neutral.png') type("image/png") 1x
  );
  opacity: 0.98;
  pointer-events: none;
  transition: transform 0.2s ease, filter 0.2s ease;
  text-indent: -9999px;
  overflow: hidden;
  margin-top: 2px;
}

.mascot-q[data-state="neutral"] {
  background-image: url('assets/mascotte/cervellino-neutral.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-neutral.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-neutral.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-neutral.png') type("image/png") 1x
  );
}

.mascot-q[data-state="happy"] {
  background-image: url('assets/mascotte/cervellino-happy.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-happy.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-happy.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-happy.png') type("image/png") 1x
  );
  transform: scale(1.08) rotate(-6deg);
  transform-origin: bottom center;
}

.mascot-q[data-state="sad"] {
  background-image: url('assets/mascotte/cervellino-sad.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-sad.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-sad.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-sad.png') type("image/png") 1x
  );
  filter: saturate(0.9);
}

.mascot-q[data-state="celebrate"] {
  background-image: url('assets/mascotte/cervellino-celebrate.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-celebrate.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-celebrate.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-celebrate.png') type("image/png") 1x
  );
  transform: scale(1.12);
  transform-origin: bottom center;
}

.q-content {
  flex: 1;
  min-width: 0;
}

@media (min-width: 600px) {
  .mascot-q {
    width: 96px;
    height: 138px;
  }
}

.q-meta {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--accent-1);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-left: 0;
}

.q-text {
  font-size: 1.14rem;
  font-weight: 800;
  line-height: 1.45;
  color: #3f4b53;
  margin-bottom: 16px;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

body.subject-civica .answer-btn {
  font-family: 'Fredoka One', cursive;
}

body.subject-problemi .intro-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

body.subject-problemi .intro-pill {
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
  color: #555;
  text-align: center;
  border: 2px dashed rgba(255, 123, 84, 0.35);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

body.subject-problemi .answer-btn {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
}

.answer-btn {
  border: none;
  border-radius: 16px;
  padding: 14px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  line-height: 1.3;
  min-height: 66px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  position: relative;
}

.answer-btn:nth-child(1) {
  background: linear-gradient(135deg, #2b66d9, #6ea0ff);
  box-shadow: 0 6px 0 #1f4ca1;
}

.answer-btn:nth-child(2) {
  background: linear-gradient(135deg, #2a9d8f, #5fd0bf);
  box-shadow: 0 6px 0 #1f766c;
}

.answer-btn:nth-child(3) {
  background: linear-gradient(135deg, #f2b950, #ffd58f);
  color: #614525;
  box-shadow: 0 6px 0 #ba8527;
}

.answer-btn:nth-child(4) {
  background: linear-gradient(135deg, #e76f51, #ff9d86);
  box-shadow: 0 6px 0 #b44d35;
}

.answer-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
}

.answer-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

.answer-btn:disabled {
  cursor: default;
}

.answer-btn.correct {
  outline: 4px solid #2fbf71;
  box-shadow: 0 0 0 4px #2fbf71, inset 0 0 0 100px rgba(47, 191, 113, 0.18);
  transform: scale(1.03);
}

.answer-btn.correct::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.2rem;
  font-weight: 900;
  color: #145a32;
}

.answer-btn.wrong {
  filter: grayscale(0.9) brightness(0.85);
  opacity: 0.6;
}

.answer-btn.wrong::after {
  content: '✕';
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.2rem;
  font-weight: 900;
  color: #7a1c1c;
}

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}

.bonus-btn {
  border: none;
  border-radius: 18px;
  padding: 14px 12px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16);
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.bonus-btn.easy {
  background: linear-gradient(135deg, #2a9d8f, #58c9b9);
}

.bonus-btn.medium {
  background: linear-gradient(135deg, #ff9f1c, #ffbf69);
}

.bonus-btn.hard {
  background: linear-gradient(135deg, #9d4edd, #c77dff);
}

.bonus-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.18);
}

.bonus-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.skip-btn {
  border: none;
  background: linear-gradient(135deg, #ffffff, #f5f5f5);
  color: #777;
  border-radius: 50px;
  padding: 12px 22px;
  min-height: 44px;
  font-weight: 800;
  cursor: pointer;
  border: 2px solid #eee;
  display: block;
  margin: 8px auto 0;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.bonus-note {
  text-align: center;
  font-size: 0.9rem;
  color: #7a7a7a;
  font-weight: 700;
}

.full-width {
  width: 100%;
}

.bonus-base-note {
  text-align: center;
  font-weight: 800;
  color: #566372;
  line-height: 1.5;
}

.center-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.result-btns-spaced {
  margin-top: 12px;
}

.result-card {
  text-align: center;
  animation: resultBoom 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.mascot-result {
  width: 130px;
  height: 188px;
  margin: 0 auto 4px;
  background: center / contain no-repeat;
  animation: mascotResultIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.mascot-result[data-state="neutral"] {
  background-image: url('assets/mascotte/cervellino-neutral.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-neutral.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-neutral.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-neutral.png') type("image/png") 1x
  );
}

.mascot-result[data-state="happy"] {
  background-image: url('assets/mascotte/cervellino-happy.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-happy.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-happy.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-happy.png') type("image/png") 1x
  );
}

.mascot-result[data-state="sad"] {
  background-image: url('assets/mascotte/cervellino-sad.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-sad.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-sad.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-sad.png') type("image/png") 1x
  );
}

.mascot-result[data-state="celebrate"] {
  background-image: url('assets/mascotte/cervellino-celebrate.png');
  background-image: image-set(
    url('assets/mascotte/cervellino-celebrate.avif') type("image/avif") 1x,
    url('assets/mascotte/cervellino-celebrate.webp') type("image/webp") 1x,
    url('assets/mascotte/cervellino-celebrate.png') type("image/png") 1x
  );
  animation:
    mascotResultIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both,
    mascotResultCelebrate 0.6s ease 1s 2;
}

.result-emoji {
  font-size: 4.2rem;
  animation: emojiWiggle 0.5s ease 0.7s 2;
}

.result-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.1rem;
  margin: 10px 0 8px;
}

.result-msg {
  font-size: 1rem;
  color: #666;
  font-weight: 700;
  margin-bottom: 18px;
}


.score-final {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.score-extra {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.score-item {
  background: linear-gradient(160deg, #ffffff, #f9fcff);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
}

.score-item .num {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--accent-1);
}

.score-item .lbl {
  font-size: 0.88rem;
  font-weight: 800;
  color: #808080;
}

.result-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-replay {
  background: linear-gradient(135deg, var(--accent-2), #2f68d8);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 30px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 5px 0 #2258b8;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-home {
  background: linear-gradient(135deg, #ffffff, #f6faff);
  color: var(--accent-1);
  border: 3px solid var(--accent-1);
  border-radius: 50px;
  padding: 12px 28px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.13);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-replay:hover,
.btn-home:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn-replay:active,
.btn-home:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.lb-card {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 9px 26px rgba(0, 0, 0, 0.14);
  width: 100%;
}

.lb-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 6px;
}

.lb-sub {
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
}

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

.lb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lb-table th {
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: #5f6b7a;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 2px solid #ececec;
}

.lb-table td {
  padding: 10px 8px;
  font-weight: 800;
  font-size: 0.92rem;
  border-bottom: 1px solid #f1f1f1;
  color: #444;
}

.lb-empty {
  text-align: center;
  padding: 30px 0;
  color: #667487;
  font-size: 1.05rem;
  font-weight: 800;
}

.btn-clear {
  background: none;
  border: 2px solid #eee;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #6b7684;
  cursor: pointer;
  margin: 16px auto 0;
  display: block;
}

.btn-clear:hover {
  color: #e63946;
  border-color: #e63946;
}

.feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: 'Fredoka One', cursive;
  font-size: 3.5rem;
  z-index: 100;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.feedback.show {
  animation: fbPop 1.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.feedback.ok {
  color: #2fbf71;
  text-shadow: 3px 3px 0 #208950;
}

.feedback.ko {
  color: #ff6b6b;
  text-shadow: 3px 3px 0 #cc3f3f;
}

@keyframes fbPop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -58%) scale(1.3);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -65%) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -75%) scale(1);
    opacity: 0;
  }
}

@keyframes resultBoom {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes mascotResultIn {
  0% {
    transform: scale(0.4) rotate(8deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.1) rotate(-3deg);
    opacity: 1;
  }
  80% {
    transform: scale(0.96) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes mascotResultCelebrate {
  0%, 100% {
    transform: scale(1) rotate(0);
  }
  25% {
    transform: scale(1.08) rotate(-5deg);
  }
  75% {
    transform: scale(1.08) rotate(5deg);
  }
}

@keyframes emojiWiggle {
  0%, 100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-15deg) scale(1.15);
  }
  75% {
    transform: rotate(15deg) scale(1.15);
  }
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 8px;
  z-index: 210;
}

.footer-link {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 800;
  color: #5f6b7a;
  border: none;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

.footer-link:focus-visible {
  outline: 3px solid var(--accent-1);
  outline-offset: 2px;
  border-radius: 10px;
}

.footer-link:hover {
  color: var(--accent-1);
}

.footer-version {
  cursor: default;
  color: inherit;
  opacity: 0.95;
}

.footer-support-cta {
  flex: 0 0 auto;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #FF3D00;
  color: #fff !important;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.15s;
}

.footer-support-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f4f4f4;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #999;
  cursor: pointer;
}

.modal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.7rem;
  margin-bottom: 4px;
}

.modal-body {
  font-size: 0.93rem;
  line-height: 1.7;
  color: #555;
}

.modal-body h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.08rem;
  margin: 14px 0 6px;
  color: var(--accent-1);
}

.modal-body a {
  color: var(--accent-1);
  font-weight: 800;
  text-decoration: none;
}

.modal-body a:hover {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  background: #fff;
  color: #000;
  min-height: 44px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  z-index: 9999;
  text-decoration: none;
  border: 3px solid #000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 8px;
}

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

:focus-visible {
  outline: 3px solid #0050ef;
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 5px rgba(0, 80, 239, 0.2);
}

@media (max-width: 600px) {
  .answers-grid,
  .bonus-grid,
  .score-final,
  .score-extra,
  .class-grid,
  .area-grid {
    grid-template-columns: 1fr;
  }

  .play-window-actions {
    align-items: stretch;
  }

  .play-window-timer,
  .play-window-btn {
    width: 100%;
  }

  body.subject-problemi .intro-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .q-card-main {
    gap: 10px;
  }

  .q-card-main .mascot-q {
    width: 72px;
    height: 104px;
  }
}

@media (max-width: 640px) {
  .mascot-result {
    width: 108px;
    height: 156px;
  }
}

@media (hover: none) {
  .back-btn:hover,
  .icon-btn:hover,
  .class-btn:hover,
  .area-btn:hover,
  .start-btn:hover,
  .answer-btn:hover:not(:disabled),
  .bonus-btn:hover,
  .btn-replay:hover,
  .btn-home:hover,
  .btn-clear:hover,
  .footer-support-cta:hover {
    transform: none;
    filter: none;
  }
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   FASE 2 — Restyle Wada Sanzo. SOLO modalita standard.
   Guardia html:not([data-palette="okabe-ito"]) su ogni regola.
   I blocchi body.subject-* originali restano intatti come fallback Okabe.
   ========================================================================= */

/* --- Titolo / sottotitolo / breadcrumb: scuri su sfondo crema --- */
html:not([data-palette="okabe-ito"]) .title {
  color: var(--accent-1);
  text-shadow: 0 2px 0 rgba(255,255,255,.45), 0 4px 12px rgba(44,42,40,.12);
}
html:not([data-palette="okabe-ito"]) .subtitle {
  color: var(--ws-hays-russet);
  text-shadow: none;
}
html:not([data-palette="okabe-ito"]) .breadcrumbs {
  color: var(--ws-slate-black);
  text-shadow: none;
}
html:not([data-palette="okabe-ito"]) .breadcrumbs a {
  color: var(--accent-1);
}
html:not([data-palette="okabe-ito"]) .breadcrumbs [aria-current='page'] {
  color: var(--ws-hays-russet);
  opacity: 1;
}

/* --- Override body.subject-* (sfondo + token accento, scoped) ---
   Lascia intatti i blocchi .subject-* originali: Okabe li usa ancora. */
html:not([data-palette="okabe-ito"]) body.subject-matematica {
  --accent-1: var(--subj-math-a);
  --accent-2: var(--subj-math-b);
  --accent-3: var(--subj-math-dec);
  --bg-1: #ede7f6;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-italiano {
  --accent-1: var(--subj-ita-a);
  --accent-2: var(--subj-ita-b);
  --accent-3: var(--subj-ita-dec);
  --bg-1: #fbe7ea;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-geografia {
  --accent-1: var(--subj-geo-a);
  --accent-2: var(--subj-geo-b);
  --accent-3: var(--subj-geo-dec);
  --bg-1: #e6f3e9;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-storia {
  --accent-1: var(--subj-sto-a);
  --accent-2: var(--subj-sto-b);
  --accent-3: var(--subj-sto-dec);
  --bg-1: #f3e8da;
  --bg-2: var(--ws-cartridge-buff);
  --bg-3: var(--ws-ivory);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-scienze {
  --accent-1: var(--subj-sci-a);
  --accent-2: var(--subj-sci-b);
  --accent-3: var(--subj-sci-dec);
  --bg-1: #e0f2f0;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-inglese {
  --accent-1: var(--subj-eng-a);
  --accent-2: var(--subj-eng-b);
  --accent-3: var(--subj-eng-dec);
  --bg-1: #e4eef7;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-problemi {
  --accent-1: var(--subj-prob-a);
  --accent-2: var(--subj-prob-b);
  --accent-3: var(--subj-prob-dec);
  --bg-1: #fbeadd;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) body.subject-civica {
  --accent-1: var(--subj-civ-a);
  --accent-2: var(--subj-civ-b);
  --accent-3: var(--subj-civ-dec);
  --bg-1: #e2f0ea;
  --bg-2: var(--ws-olive-buff);
  --bg-3: var(--ws-cartridge-buff);
  --card-bg: var(--ws-ivory);
  --text-main: var(--ws-slate-black);
}

/* --- Bottoni risposta: 4 toni Wada armonici (tutti i quiz) ---
   Fallback hex prima di color-mix per browser meno recenti. */
html:not([data-palette="okabe-ito"]) .answer-btn:nth-child(1) {
  background: linear-gradient(135deg, #2e6fa6, #4e8fc4);
  box-shadow: 0 6px 0 #1e4c78;
  color: #fff;
}
html:not([data-palette="okabe-ito"]) .answer-btn:nth-child(2) {
  background: linear-gradient(135deg, #2e8455, #4da870);
  box-shadow: 0 6px 0 #1f5c3a;
  color: #fff;
}
html:not([data-palette="okabe-ito"]) .answer-btn:nth-child(3) {
  background: linear-gradient(135deg, #c8881a, #e0a526);
  box-shadow: 0 6px 0 #8f6010;
  color: var(--ws-slate-black);
}
html:not([data-palette="okabe-ito"]) .answer-btn:nth-child(4) {
  background: linear-gradient(135deg, #c4452f, #d9673e);
  box-shadow: 0 6px 0 #8a2f1f;
  color: #fff;
}

/* --- Class btn: 4 toni Wada ciclici --- */
html:not([data-palette="okabe-ito"]) .class-btn:nth-child(4n+1) {
  background: linear-gradient(145deg, #e0f2f0, #c5e8e4);
  color: #1a5a54;
}
html:not([data-palette="okabe-ito"]) .class-btn:nth-child(4n+2) {
  background: linear-gradient(145deg, #e4eef7, #cfdcef);
  color: #1e4a6e;
}
html:not([data-palette="okabe-ito"]) .class-btn:nth-child(4n+3) {
  background: linear-gradient(145deg, #ede7f6, #dac8f0);
  color: #4a2878;
}
html:not([data-palette="okabe-ito"]) .class-btn:nth-child(4n) {
  background: linear-gradient(145deg, #fbe7ea, #f5c8d0);
  color: #762840;
}

/* --- Area btn: 5 toni Wada ciclici (rimpiazza 21 gradienti hardcoded) --- */
html:not([data-palette="okabe-ito"]) .area-btn:nth-child(5n+1) {
  background: linear-gradient(145deg, #fdf4d0, #f5e497);
  color: #6a5400;
}
html:not([data-palette="okabe-ito"]) .area-btn:nth-child(5n+2) {
  background: linear-gradient(145deg, #e4eef7, #cfdcef);
  color: #1e4a6e;
}
html:not([data-palette="okabe-ito"]) .area-btn:nth-child(5n+3) {
  background: linear-gradient(145deg, #e6f3e9, #cce6d2);
  color: #1e5a34;
}
html:not([data-palette="okabe-ito"]) .area-btn:nth-child(5n+4) {
  background: linear-gradient(145deg, #fbe7ea, #f5c8d0);
  color: #762840;
}
html:not([data-palette="okabe-ito"]) .area-btn:nth-child(5n) {
  background: linear-gradient(145deg, #f3e8da, #e5d1ba);
  color: #6b4220;
}

/* a-sub eredita colore parent a opacita ridotta */
html:not([data-palette="okabe-ito"]) .area-btn .a-sub,
html:not([data-palette="okabe-ito"]) .class-btn .a-sub {
  color: inherit;
  opacity: .7;
}

/* --- Dot progress: colori Wada --- */
html:not([data-palette="okabe-ito"]) .dot.current {
  background: var(--ws-maize);
  border-color: var(--ws-yellow-ocher);
}
html:not([data-palette="okabe-ito"]) .dot.ok {
  background: var(--ws-cossack-green);
  border-color: #1f5c3a;
}
html:not([data-palette="okabe-ito"]) .dot.ko {
  background: var(--ws-jasper-red);
  border-color: #8a2f1f;
}

/* --- Feedback testo quiz --- */
html:not([data-palette="okabe-ito"]) .feedback.ok {
  color: var(--ws-cossack-green);
  text-shadow: 3px 3px 0 #1f5c3a;
}
html:not([data-palette="okabe-ito"]) .feedback.ko {
  color: var(--ws-jasper-red);
  text-shadow: 3px 3px 0 #8a2f1f;
}

/* --- Start btn: ombra tematizzata (color-mix con fallback) --- */
html:not([data-palette="okabe-ito"]) .start-btn {
  box-shadow: 0 7px 0 color-mix(in srgb, var(--accent-1) 60%, #000),
              0 12px 18px rgba(44,42,40,.18);
}
html:not([data-palette="okabe-ito"]) .start-btn:hover {
  box-shadow: 0 9px 0 color-mix(in srgb, var(--accent-1) 60%, #000),
              0 16px 22px rgba(44,42,40,.2);
}
html:not([data-palette="okabe-ito"]) .start-btn:active {
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent-1) 60%, #000);
}

/* --- Btn replay: ombra tematizzata --- */
html:not([data-palette="okabe-ito"]) .btn-replay {
  box-shadow: 0 5px 0 color-mix(in srgb, var(--accent-2) 65%, #000);
}

/* --- Fix contrasto: titolo Problemi su sfondo pesca (#d9743f su #fbeadd = 2.74:1 FAIL).
   Usa variante scura #a04f20 che porta a 4.91:1 (AA per testo normale). --- */
html:not([data-palette="okabe-ito"]) body.subject-problemi .title {
  color: #a04f20;
}
