:root {
	--bg-main: #fff7f0;
	--bg-panel: #fff1eb;         /* cieplejsze, bardziej różowawe */
	--bg-panel-border: 2px solid #ffdacc;
	--bg-panel-color: #5c3a2e;
	--bg-accent: #ffe9a7;
	--border-accent: #f6c177;
	--text-main: #3b324d;
	--text-label: #ab4cab;
	--button-bg: #e0f2ff;
	--button-hover: #bae6fd;
	--button-correct: #bbf7d0;
	--button-wrong: #fecaca;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Fredoka', sans-serif;
}

.app-wrapper {
  max-width: 800px;
  margin: 2em auto;
  padding: 1.6em;
  border-radius: 20px;
  box-shadow: 0 0 16px rgba(0,0,0,0.1);
  background-color: var(--bg-main);
  position: relative; /* jeśli potrzebujesz kontekstu dla zagłębionych fixedów */
}

h1 {
  text-align: center;
  font-size: 2em;
  color: #5b6dfb;
  text-shadow: 1px 1px #e0e7ff;
  margin-bottom: 0.5em;
}

#game {
  background: #ffffffcc;
  padding: 1em 1.5em;
  border-radius: 10px;
  border: 2px dashed #d0d0d0;
}

.question {
  font-size: 1.3em;
  font-weight: bold;
  color: #2e3440;
  margin-bottom: 0.4em;
}

.example {
  font-style: italic;
  color: #7c7c7c;
  margin-bottom: 1em;
}

.label {
  font-weight: bold;
  margin-bottom: 0.3em;
  font-size: 0.9em;
  color: #7f6fa5;                /* chłodna lawenda */
}

.word-value {
  font-size: 1.2em;
  font-weight: bold;
  background-color: #fff5cc;
  color: #4a372a;
  padding: 0.4em 0.8em;
  border-radius: 10px;
  display: inline-block;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  margin-bottom: 0.6em;
}

.example-value {
  font-style: italic;
  color: #6b7280;
  font-size: 1em;
  padding: 0.4em 0;
  margin-bottom: 1em;
  border: none;
  background: none;
}

.answers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7em;
}

.answers button {
	background: var(--button-bg);
	border: 2px solid #a5b4fc;
	border-radius: 16px;
	font-weight: bold;
	padding: 1em 1.2em;
	font-size: 1.1em;
	color: #374557;
	transition: background 0.2s ease, transform 0.2s ease;
	cursor: pointer;
	min-width: 120px;      /* minimalna szerokość */
	width: fit-content;
	justify-self: center;  /* wyśrodkowanie w siatce */
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
	text-align: center;
}

.answers button:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

.answers button.correct {
  background-color: var(--button-correct);
  border-color: #22c55e;
  color: #065f46;
  animation: flash-correct 0.5s ease;
}

.answers button.incorrect {
  background-color: var(--button-wrong);
  border-color: #f87171;
  color: #7f1d1d;
  animation: shake 0.3s ease;
}

.score {
  margin-top: 1.2em;
  font-weight: bold;
  text-align: center;
  color: #4a4a4a;
}

/* Scoreboard pinned at top */
.scoreboard {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 24px;
  padding: 12px 0;
  margin: 0 0 10px;
  width: 100%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 950;
}

.score-wrapper {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.score-value {
  font-size: 1.6em;
  font-weight: bold;
  min-width: 60px;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 12px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
  color: #2c3e50;
}

.score-label {
  margin-top: 6px;
  font-size: 1em;
  font-weight: 500;
  color: #5d6d7e;
}

#settingsBtn {
  position: fixed;
  top: 80px;
  right: 1em;
  font-size: 2em;
  background: none;
  border: none;
  color: #7c5cff;
  cursor: pointer;
  transition: color 0.3s ease;
  z-index: 1100;
}

#settingsBtn:hover {
  color: #5c47c6;
}

.burger {
  font-weight: bold;
  letter-spacing: 0.05em;
}


#settingsPanel {
  background: var(--bg-panel);
  border: var(--bg-panel-border);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  padding: 1.2em 1.5em;
  color: #4d3757;
  position: fixed;
  top: 0;
  right: -2200px; /* ukryty poza ekranem */
  top: 5em; /* przesunięcie panelu niżej, np. 4.5em */
  transition: right 0.3s ease;
  z-index: 1000;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

#settingsPanel.visible {
  right: 0; /* wysunięty na ekran */
}

#settingsPanel label {
  font-size: 1em;
  color: var(--text-label);
  font-weight: bold;
  margin-bottom: 0.3em;
}

#difficultySlider {
  -webkit-appearance: none;
  width: 100%;
  height: 1.2em;
  background: linear-gradient(90deg, #fde68a, #fcd34d);
  border-radius: 1em;
  outline: none;
  margin-top: 0.6em;
  transition: background 0.3s ease;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
}

#difficultySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: background 0.3s ease;
}

#difficultySlider::-moz-range-thumb {
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#difficultyLabel {
  display: inline-block;
  margin-top: -0.4em;
  font-size: 0.95em;
  color: #5a5a5a;
}

#categorySelect {
  background-color: #fff8f8;
  border: 2px solid #efb0d6;
  border-radius: 10px;
  padding: 0.5em;
  color: #57305d;
  font-size: 1em;
  transition: box-shadow 0.2s ease;
}

#categorySelect:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(222, 190, 130, 0.3);
}

select.disabled {
  opacity: 0.6;          /* stonowany wygląd */
  pointer-events: none;  /* wyłącza interakcję */
}

/* opcjonalnie styl samego <select disabled> */
select:disabled {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

.device-toggle {
  display: flex;
  gap: 0.6em;
}

.device-toggle button {
  flex: 1;
  padding: 0.45em 0.8em;
  font-size: 0.95em;
  font-weight: bold;
  border: 1px solid #c4b998;
  background-color: #fffefb;
  color: #4a4128;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: inset 0 -1px 2px rgba(0,0,0,0.04);
}

.device-toggle button:hover {
  background-color: #fff1d6;
}

.device-toggle button.active {
  background-color: #fcd34d;
  border-color: #f59e0b;
  color: #5e4b20;
}

#feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  font-weight: bold;
  padding: 0.4em 1em;
  border-radius: 12px;
  background-color: #e9d5ff;
  color: #6b21a8;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  animation: none;
}

#feedback.error {
  background-color: #ffe4e6;
  color: #881337;
  animation: shakeFade 0.6s ease;
}

@keyframes flash-correct {
  0%   { background-color: #a5d6a7; }
  50%  { background-color: #c8e6c9; }
  100% { background-color: #a5d6a7; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes shakeFade {
  0%   { transform: translate(-50%, -50%) translateX(0); opacity: 1; }
  20%  { transform: translate(-50%, -50%) translateX(-6px); }
  40%  { transform: translate(-50%, -50%) translateX(6px); }
  60%  { transform: translate(-50%, -50%) translateX(-4px); }
  80%  { transform: translate(-50%, -50%) translateX(4px); }
  100% { transform: translate(-50%, -60%) translateX(0); opacity: 0; }
}

@keyframes popUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}

@keyframes slideFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

body[data-device="mobile"] {
  font-size: 1.0em;
  padding: 0.6em;
}

body[data-device="mobile"] #game {
  padding: 0.8em 1em;
}

body[data-device="mobile"] .answers button {
  font-size: 1.0em;
  padding: 1.5em 1.2em;
  min-width: 140px;
  border-radius: 14px;
}

body[data-device="mobile"] h1 {
  font-size: 1.4em;
}

body[data-device="mobile"] #settingsPanel {
  font-size: 1em;
  padding: 0.8em 1em;
}

body[data-device="mobile"] .device-toggle button {
  padding: 0.4em;
  font-size: 0.9em;
}

body[data-device="mobile"] #settingsPanel label {
  font-size: 1.1em;
}

#timerSection input[type="number"],
#timerInputMobile {
  font-size: 1em;
  padding: 0.4em;
  border: 1px solid #c4b998;
  border-radius: 8px;
  background-color: #fffefb;
  color: #4a4128;
  box-sizing: border-box;
  margin-bottom: 0.6em;
}

#timerInputMobile {
  width: 100%;
}

#timerMinutes,
#timerSeconds {
  width: 5em;              /* odpowiada ok. 60px przy font-size: 1rem */
  padding: 0.25em 0.4em;   /* proporcjonalny odstęp */
  font-size: 1rem;
  text-align: right;
  box-sizing: border-box;
}


.timer-inputs {
  display: flex;
  gap: 0.6em;
  margin-bottom: 0.6em;
}

#timerSection button {
  font-weight: bold;
  font-size: 1.1em;
  padding: 0.2em;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  width: 100%;
  margin-bottom: 0.6em;
}

#startTimerBtn {
  background-color: #ffe9a7;
  border: 2px solid #f6c177;
  color: #4a372a;
}

#stopTimerBtn {
  background-color: #fecaca;
  border-color: #f87171;
  color: #7f1d1d;
}


.hidden {
  display: none !important;
}

#timerInputMobile {
  display: none;
}

#countdownTimer {
  text-align: center;
  font-size: 1.6em;
  font-weight: bold;
  color: #4a4128;
  margin: 1em 0;
  background-color: #fef3c7;
  border: 2px dashed #facc15;
  padding: 0.4em 0.8em;
  border-radius: 12px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.05);
}

#summaryModal {
  position: fixed;
  top: 10%;
  inset-inline: 0;
  margin-inline: auto;
  max-width: 500px;
  width: calc(100% - 5em);
  z-index: 2000;
  max-width: 100%;
  animation: slideFadeIn 0.3s ease;
  background: #fff4fc;
  border: 2px solid #ecb8e5;
  padding: 1.6em;
  border-radius: 18px;
  text-align: center;
  font-size: 1.1em;
  color: #3a3048;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

#summaryModal h2 {
  margin-bottom: 1em;
  font-size: 1.3em;
  color: #5e4b20;
}

#summaryModal p {
  margin: 0.4em 0;
}

#summaryModal button#closeSummaryBtn {
  position: absolute;
  top: 0.6em;
  right: 0.6em;
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: #999;
  transition: color 0.2s ease;
}

#summaryModal button#closeSummaryBtn:hover {
  color: #444;
}

.summary-heading {
  font-size: 1.5em;
  color: #e853a0;
  margin-bottom: 0.8em;
}

.summary-line {
  margin: 0.5em 0;
  font-size: 1.05em;
}

body.modal-blur::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  backdrop-filter: blur(4px);
  background-color: rgba(0,0,0,0.15);
  z-index: 1000;
}

#directionSwitcher {
  cursor: pointer;
}

#backButton {
  position: fixed;
  top: 80px;
  left: 1em;
  font-size: 2em;
  background: none;
  border: none;
  color: #7c5cff;
  cursor: pointer;
  transition: color 0.3s ease;
  z-index: 1100;
}

#backButton:hover {
  color: #5c47c6;
}

#infoButton {
  position: fixed;
  bottom: 1em;
  left: 1em;
  font-size: 1.6em;
  background: none;
  border: none;
  color: #7c5cff;
  cursor: pointer;
  z-index: 1500;
  transition: color 0.3s ease;
}
#infoButton:hover {
  color: #5c47c6;
}

#infoOverlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 247, 240, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
  cursor: pointer;
}
#infoOverlay.hidden {
  display: none;
}

.infoContent {
  max-width: 600px;
  background: #fffefb;
  border: 2px solid var(--bg-panel-border, #f6e7b4);
  border-radius: 18px;
  padding: 2em;
  color: var(--text-main);
  font-size: 1.1em;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  text-align: left;
  cursor: default;
}
.infoContent h3 {
  margin-top: 0;
  color: var(--text-label);
  font-size: 1.5em;
  margin-bottom: 0.6em;
}
.tapHint {
  margin-top: 1em;
  font-style: italic;
  font-size: 0.95em;
  color: #888;
  text-align: center;
}

#soundToggleBtn {
  font-size: 1.3em;
  background: none;
  border: none;
  cursor: pointer;
  color: #7c5cff;
  transition: color 0.3s ease;
  align-self: flex-start;
}
#soundToggleBtn:hover {
  color: #5c47c6;
}

/* Animation helper classes */
.animate-pop      { animation: scorePop   0.4s  ease; }
.animate-flash    { animation: scoreFlash  0.6s  ease; }

/* Keyframes */
@keyframes scorePop {
  0%   { transform: scale(1); background-color: #fff; }
  30%  { transform: scale(1.25); background-color: #d4edda; }
  100% { transform: scale(1); background-color: #fff; }
}
@keyframes scoreFlash {
  0%,100% { background-color: #fff; }
  50%     { background-color: #ffe0e0; }
}

@media (max-width: 480px) {
  body  { font-size: 15px; }
  h2    { font-size: 1.2em; }

  .score-wrapper { flex-wrap: nowrap; }
  .score-value { font-size: 1em; min-width: 20px; }
  .score-label { font-size: 0.8em; }
}