@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&display=swap');

:root {
  --accent: #ff6600;
  --accent-soft: #ff9933;
  --accent-glow: rgba(255, 102, 0, 0.22);
  --action-orange: #e85d04;
  --action-orange-soft: #ff7a1a;
  --text-main: #333333;
  --text-muted: #6b6b6b;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --panel-shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
  --header-height: 112px;
  --wordle-cell-size: 54px;
  --wordle-grid-gap: 8px;
  --wordle-key-size: 40px;
  --wordle-key-gap: 4px;
  --wordle-center-keys: 7;
}

html {
  scroll-padding-top: calc(var(--header-height) + 18px);
}

body {
  font-family: 'Roboto Slab', Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 153, 51, 0.18), transparent 32%),
    linear-gradient(to bottom, #ffffff, #e9e9e9);
  color: var(--text-main);
  text-align: center;
  margin: 0;
  padding: 0;
  padding-top: calc(var(--header-height) + 18px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.appHeader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 102, 0, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.appHeaderInner {
  width: 100%;
  max-width: none;
  min-height: var(--header-height);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(12px, 2vw, 22px);
  box-sizing: border-box;
  padding-left: 12px;
  padding-right: 12px;
}

.appHeader--home .appHeaderInner {
  justify-content: center;
}

.headerBrand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  flex: 1;
}

.appHeader--home .headerBrand {
  align-items: center;
  text-align: center;
}

.headerEyebrow {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.headerModeLabel {
  display: block;
  margin-top: 4px;
  color: #777777;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pageTitle {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);

  color: var(--accent);

  text-shadow:
    0 0 6px var(--accent-soft),
    0 0 12px var(--accent-glow);
}

.homeButton {
  width: clamp(50px, 5vw, 60px);
  height: clamp(50px, 5vw, 60px);
  flex: 0 0 auto;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
}

.homeButton svg {
  width: 28px;
  height: 28px;
  max-width: none;
  margin: 0;
  display: block;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

#contentWrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  box-sizing: border-box;
}

svg {
  width: 450px;
  height: 240px;
  max-width: 100%;
  background: var(--surface-solid);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  margin: 20px auto;
  display: block;
}

#note {
  fill: #000000;
  filter: none;
}

button {
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border 0.2s ease;
  padding: 12px 20px;
  font-weight: 600;
  color: #ffffff;
  background: #b3b3b3;
}

button:hover:not(.correct):not(.wrong):not(.selected) {
  transform: scale(1.03);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  background: #ffffff;
  color: #666666;
}

button:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255,102,0,0.6);
}

.menuButton.selected,
.symbolButton.selected,
.homeButton.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255,102,0,0.6);
  border-color: var(--accent);
}

#homeBtn.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

#answers {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

#answers .noteButton {
  min-width: 70px;
  padding: 10px 18px;
}

.buttonGroup {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.menuButton {
  width: 160px;
  height: 55px;
  font-size: 20px;
  color: #ffffff;
}

.buttonGroup .menuButton {
  width: 260px;
  height: 80px;
  font-size: 20px;
  padding: 10px;
  white-space: normal;
  text-align: center;
}

.buttonGroup .menuButton,
.buttonGroup .symbolButton {
  background: rgba(255, 255, 255, 0.86);
  border: 1.5px solid rgba(255, 102, 0, 0.18);
  color: var(--text-main);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
}

.buttonGroup .menuButton:hover:not(.selected),
.buttonGroup .symbolButton:hover:not(.selected) {
  background: rgba(255, 102, 0, 0.08);
  border-color: rgba(255, 102, 0, 0.34);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(255, 102, 0, 0.16);
}

.buttonGroup .menuButton.selected,
.buttonGroup .symbolButton.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(255, 102, 0, 0.28);
}

body.wordlePage .menuButton:not(.buttonGroup .menuButton),
body.gamePage .menuButton:not(.buttonGroup .menuButton),
body.figuresGamePage .menuButton:not(.buttonGroup .menuButton),
body.ritmoPage .menuButton:not(.buttonGroup .menuButton),
body.pentagrammaGamePage .menuButton:not(.buttonGroup .menuButton),
body.guantoPage .menuButton:not(.buttonGroup .menuButton) {
  background: linear-gradient(135deg, var(--action-orange), var(--action-orange-soft));
  border: 1.5px solid rgba(168, 63, 0, 0.22);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(232, 93, 4, 0.28);
}

body.wordlePage .menuButton:not(.buttonGroup .menuButton):hover,
body.gamePage .menuButton:not(.buttonGroup .menuButton):hover,
body.figuresGamePage .menuButton:not(.buttonGroup .menuButton):hover,
body.ritmoPage .menuButton:not(.buttonGroup .menuButton):hover,
body.pentagrammaGamePage .menuButton:not(.buttonGroup .menuButton):hover,
body.guantoPage .menuButton:not(.buttonGroup .menuButton):hover {
  background: linear-gradient(135deg, #d94f00, var(--action-orange));
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(232, 93, 4, 0.34);
}

.symbolButton {
  width: 120px;
  height: 120px;
  font-size: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

#warning {
  color: var(--accent);
  min-height: 24px;
  margin-top: 10px;
}

.warningText {
  color: var(--accent);
  min-height: 24px;
  margin-top: 12px;
}

.introSpacer {
  visibility: hidden;
}

.gameDisplay {
  width: 450px;
  height: 240px;
  max-width: 100%;
  background: var(--surface-solid);
  border-radius: 16px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--panel-shadow);
}

.figureImage {
  max-height: 180px;
  max-width: 100%;
}

.noteButton {
  font-size: 20px;
  padding: 12px 20px;
  margin: 5px;
  min-width: 70px;
  border-radius: 8px;
  background: #b3b3b3;
  color: #ff6600;
  border: 3px solid transparent;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.noteButton:hover:not(.correct):not(.wrong) {
  background: #ffffff;
  color: #ff6600;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.noteButton.correct {
  border-color: #66cc66 !important;
  box-shadow: 0 0 10px #66cc66 !important;
  color: #ff6600 !important;
  background: #b3b3b3 !important;
}

.noteButton.wrong {
  border-color: #cc3333 !important;
  box-shadow: 0 0 10px #cc3333 !important;
  color: #ff6600 !important;
  background: #b3b3b3 !important;
}

.noteButton:focus,
.noteButton:active {
  outline: none;
  box-shadow: none;
}

.hidden {
  display: none;
}

.headerModeLabel.hidden {
  display: block;
  visibility: hidden;
}

.actionRow {
  margin-top: 15px;
}

.messageText {
  margin-top: 15px;
  font-size: 18px;
  min-height: 28px;
  color: var(--text-main);
}

.questionBox {
  font-size: 1.5em;
  margin-bottom: 10px;
}

.gameIntro {
  max-width: 760px;
  margin: 14px auto 0;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.feedbackText {
  min-height: 28px;
  margin-top: 12px;
  color: var(--accent);
  font-size: 1.05rem;
}

.centeredButton {
  margin-top: 15px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#menu,
#game,
#config,
#quiz,
#endScreen {
  width: 100%;
}

#game:not(.hidden) {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 768px) {
  :root {
    --header-height: 96px;
    --wordle-cell-size: 42px;
    --wordle-grid-gap: 6px;
    --wordle-key-size: 36px;
    --wordle-key-gap: 4px;
  }

  html {
    scroll-padding-top: calc(var(--header-height) + 14px);
  }

  body {
    padding-top: calc(var(--header-height) + 14px);
  }

  #contentWrapper {
    width: 100%;
    padding: 16px 12px 28px;
  }

  .appHeaderInner {
    width: 100%;
    gap: 8px;
    padding-left: 10px;
    padding-right: 8px;
  }

  .homeButton {
    width: 52px;
    height: 52px;
  }

  .buttonGroup {
    gap: 12px;
  }

  .buttonGroup .menuButton,
  .menuButton {
    width: min(260px, 100%);
  }

  svg,
  .gameDisplay {
    height: auto;
    min-height: 220px;
  }
}

.learnCTA {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 28px auto 0;
}

.learnCTA .menuButton {
  width: auto;
  min-width: 240px;
  max-width: 320px;
  height: auto;
  min-height: 58px;
  padding: 14px 22px;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

/* ==================== GAME PAGES NO SCROLL ==================== */

body.wordlePage,
body.gamePage,
body.figuresGamePage,
body.ritmoPage,
body.pentagrammaGamePage,
body.guantoPage {
  height: 100vh;
  overflow: hidden;
}

body.wordlePage #contentWrapper,
body.gamePage #contentWrapper,
body.figuresGamePage #contentWrapper,
body.ritmoPage #contentWrapper,
body.pentagrammaGamePage #contentWrapper,
body.guantoPage #contentWrapper {
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  padding-top: 10px;
  padding-bottom: 10px;
}

body.wordlePage main,
body.gamePage main,
body.figuresGamePage main,
body.ritmoPage main,
body.pentagrammaGamePage main,
body.guantoPage main {
  overflow: hidden;
}

/* ==================== FLOATING SCROLL TOP ==================== */

button#scrollTopBtn{
  position: fixed;
  right: 20px;
  bottom: 20px;

  width: 48px;
  height: 48px;

  padding: 0;
  margin: 0;

  border: none;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);

  transition:
    opacity .22s ease,
    transform .22s ease,
    box-shadow .22s ease;

  background: linear-gradient(135deg, #ff6600, #ff9933);

  box-shadow:
    0 10px 22px rgba(255,102,0,0.22);
}

/* FRECCIA CENTRATA */

button#scrollTopBtn span{
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: white;

  font-size: 34px;
  font-weight: 700;
  line-height: 1;

  transform: translateY(-4px);
}

/* PAGINA STRUMENTI */

body.instrumentPage button#scrollTopBtn{
  background: linear-gradient(135deg, #00a6bd, #28d2c7);

  box-shadow:
    0 10px 22px rgba(0,166,189,0.22);
}

/* VISIBILE */

button#scrollTopBtn.show{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* HOVER */

button#scrollTopBtn:hover{
  transform: translateY(-3px);
}

/* MOBILE */

@media (max-width: 640px){

  button#scrollTopBtn{
    width: 44px;
    height: 44px;
    right: 14px;
    bottom: 14px;
  }

  button#scrollTopBtn span{
    font-size: 20px;
  }

}