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

body {
  font-family: 'Quicksand', sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f0f0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: manipulation;
  width: 100vw;
  overflow-x: hidden;
}

body.dark-mode {
  background-color: #23272f !important;
  color: #f5f6fa !important;
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: #f5f6fa !important;
}
body.dark-mode .container {
  background-color: #2d3436 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
}
body.dark-mode .settings-option,
body.dark-mode .theme-option {
  background: none !important;
  color: #f5f6fa !important;
}
body.dark-mode .settings-label {
  color: #f5f6fa !important;
}
body.dark-mode input,
body.dark-mode select {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border: 1px solid #444 !important;
}
body.dark-mode .menu-btn,
body.dark-mode .level-btn,
body.dark-mode .stats-btn {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
body.dark-mode .menu-btn:hover,
body.dark-mode .level-btn:hover,
body.dark-mode .stats-btn:hover {
  background-color: #444 !important;
}
body.dark-mode .question {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
}
body.dark-mode .stat {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
  text-shadow: none !important;
}
body.dark-mode .option-btn {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
  text-shadow: none !important;
}
body.dark-mode .option-btn:hover {
  background-color: #444 !important;
}
body.dark-mode .stats-item,
body.dark-mode .stats-summary {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
}
body.dark-mode .high-score-row {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
}
body.dark-mode .high-scores-header {
  background-color: #23272f !important;
  color: #f5f6fa !important;
  border-bottom: 2px solid #444 !important;
}
body.dark-mode .selection-screen {
  background-color: #23272f !important;
  color: #f5f6fa !important;
}
body.dark-mode .selection-btn {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
}
body.dark-mode .selection-btn:hover {
  background-color: #444 !important;
}
body.dark-mode .special-hint {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-left: 4px solid #2980b9 !important;
}
body.dark-mode .hint-container {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
}
body.dark-mode .steps-container {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
}
body.dark-mode .result-content {
  background: #23272f !important;
  color: #f5f6fa !important;
}
body.dark-mode .result-title,
body.dark-mode .result-stats {
  color: #f5f6fa !important;
}
body.dark-mode .badge-text {
  color: #f5f6fa !important;
}
body.dark-mode .tab-btn,
body.dark-mode .tab-btn.active {
  background-color: #353b48 !important;
  color: #f5f6fa !important;
  border-color: #444 !important;
}
body.dark-mode .tab-btn:hover,
body.dark-mode .tab-btn.active:hover {
  background-color: #444 !important;
}
body.dark-mode .tab-btn-header,
body.dark-mode .tab-btn-desc {
  color: #f5f6fa !important;
}
body.dark-mode .modal {
  background-color: rgba(0,0,0,0.88) !important;
}
body.dark-mode .modal-content {
  background-color: #23272f !important;
  color: #f5f6fa !important;
}
body.dark-mode .modal-content h1,
body.dark-mode .modal-content h2,
body.dark-mode .modal-content h3,
body.dark-mode .modal-content h4,
body.dark-mode .modal-content h5,
body.dark-mode .modal-content h6 {
  color: #f5f6fa !important;
}
body.dark-mode h2 {
  color: #f5f6fa !important;
  text-shadow: none !important;
}

body.blocky-theme.dark-mode {
  background-color: #23272f !important;
  background-image: none !important;
}

body.dark-mode .stats-item-header .operation {
  color: #f5f6fa !important;
}

body.dark-mode .stats-item-details {
  color: #f5f6fa !important;
}

.container {
  width: 100%;
  max-width: 500px;
  text-align: center;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 4px solid #555555;
  box-shadow: inset 0 0 0 2px #000000;
  border-radius: 10px;
  margin: 20px 0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.82);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 4px solid #555555;
  box-shadow: inset 0 0 0 2px #000000;
}

.close-modal {
  background-color: var(--button-color, #3498db);
  color: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 1.3rem;
  position: absolute;
  top: 15px;
  right: 15px;
  box-shadow: 0 4px 8px var(--shadow-color, rgba(0,0,0,0.15));
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.close-modal:hover {
  filter: brightness(0.9);
  transform: scale(1.08);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555555;
  background: none;
  border: none;
  padding: 5px 10px;
  transition: color 0.3s;
}

.close:hover {
  color: #e74c3c;
}

@media (max-width: 480px) {
  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .container {
      width: 100vw;
      margin: 0;
      border-radius: 0;
      padding: 10px;
      box-sizing: border-box;
  }

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

  .question {
      font-size: 1.8rem;
      width: 95%;
      padding: 15px;
  }

  .option-btn {
      font-size: 1.2rem;
      padding: 12px;
  }

  .level-btn, .stats-btn {
      width: 95%;
      padding: 12px 20px;
      font-size: 1.1rem;
  }

  .stats {
      flex-direction: column;
      gap: 10px;
  }

  .stat {
      width: 100%;
  }

  .hero-image {
      width: 120px;
      height: 120px;
  }

  .modal-content {
      width: 95%;
      padding: 15px;
  }

  .tabs-container {
      flex-direction: column;
      align-items: center;
      gap: 10px;
  }

  .tab-btn {
      width: 100%;
      margin: 5px 0;
      padding: 12px;
      font-size: 1.1rem;
      flex-direction: row;
  }

  .tab-btn-icon {
      font-size: 1.6rem;
      height: 30px;
      min-width: 30px;
  }

  .tab-btn-header {
      font-size: 1.2rem;
      margin-bottom: 3px;
  }

  .tab-btn-desc {
      font-size: 0.75rem;
  }

  .tab-content {
      padding: 10px;
  }

  .level-selection {
      flex-direction: column;
      gap: 15px;
  }

  .level-btn, .stats-btn {
      width: 95%;
      padding: 12px 20px;
      font-size: 1.1rem;
  }

  .selection-screen {
      width: 95%;
      padding: 15px;
  }

  .selection-btn {
      padding: 10px;
      min-height: 70px;
      margin-bottom: 6px;
  }

  .selection-icon {
      font-size: 1.4rem;
      width: 35px;
      height: 35px;
      min-width: 35px;
      margin-right: 10px;
  }

  .selection-header {
      font-size: 1.2rem;
      line-height: 1.2;
      margin-bottom: 3px;
      min-height: 22px;
  }

  .selection-desc {
      font-size: 0.85rem;
      line-height: 1.2;
      min-height: 16px;
  }
}

@media (min-width: 769px) {
  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .container {
    margin: 0;
  }
}

h1 {
  color: #2d3436;
  font-size: 2.2rem;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.hero-image {
  width: 150px;
  height: 150px;
  margin: 10px auto;
  position: relative;
}

.level-btn, .stats-btn {
  background-color: #5b9a68;
  color: white;
  border: 2px solid #2d4c34;
  box-shadow: inset 0 0 0 2px #7bc092;
  text-shadow: 2px 2px #2d4c34;
  border-radius: 10px;
  padding: 12px 20px;
  margin: 10px 0;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
  width: 80%;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.level-btn:hover, .level-btn:active, .stats-btn:hover, .stats-btn:active {
  background-color: #7bc092;
  transform: scale(1.05);
}

.game-area {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 20px;
}

.stat {
  background-color: #5b9a68;
  color: white;
  padding: 10px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #7bc092;
  border: 2px solid #2d4c34;
  font-weight: bold;
}

.question {
  font-size: 2.5rem;
  margin: 20px 0;
  color: #2d3436;
  background-color: #ffffff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  width: 80%;
  border: 2px solid #555555;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
  margin-top: 20px;
}

.option-btn {
  background-color: #5b699a;
  color: white;
  border: 2px solid #2d344c;
  box-shadow: inset 0 0 0 2px #7b8ac0;
  text-shadow: 2px 2px #2d344c;
  border-radius: 10px;
  padding: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback {
  font-size: 1.5rem;
  margin: 20px 0;
  height: 40px;
}

.correct {
  color: #27ae60;
}

.incorrect {
  color: #e74c3c;
}

.hearts {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.menu-btn {
  background-color: #9a5b5b;
  color: white;
  border: 2px solid #4c2d2d;
  box-shadow: inset 0 0 0 2px #c07b7b;
  text-shadow: 2px 2px #4c2d2d;
  border-radius: 10px;
  padding: 10px 20px;
  margin-top: 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.menu-btn:hover, .menu-btn:active {
  background-color: #c07b7b;
  transform: scale(1.05);
}

.result-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.result-title {
  font-size: 2rem;
  margin: 20px 0;
  color: #2d3436;
}

.result-stats {
  font-size: 1.2rem;
  margin: 10px 0;
  color: #2d3436;
}

.badge {
  width: 200px;
  height: 200px;
  margin: 20px auto;
  position: relative;
}

.badge img {
  width: 100%;
  height: auto;
}

.badge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hearts {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.heart {
  width: 40px;
  height: 40px;
  position: relative;
}

.heart svg {
  width: 100%;
  height: 100%;
}

.heart path:first-child {
  fill: #5b9a68;
}

.heart path:last-child {
  fill: #ffffff;
}

.heart.broken path:first-child {
  fill: #8f8f8f;
}

.hint-container {
    text-align: center;
    margin: 10px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.hint-text {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.steps-container {
    font-size: 1.1rem;
    margin: 10px 0;
    text-align: left;
    padding: 10px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #27ae60;
    margin-top: 15px;
}

.numbers-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.number-box {
    padding: 10px 15px;
    background-color: #f1c40f;
    border-radius: 5px;
    color: #333;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.operator {
    font-size: 1.2rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.result-box {
    padding: 10px 15px;
    background-color: #2ecc71;
    border-radius: 5px;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.special-hint {
    margin-top: 20px;
    padding: 15px;
    background-color: #e8f4f8;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.special-hint h3 {
    color: #2980b9;
    margin-bottom: 10px;
}

.special-hint p {
    margin: 5px 0;
    color: #2c3e50;
}

.hint-btn {
    background-color: #f39c12 !important;
    border: 2px solid #4c2d2d !important;
    box-shadow: inset 0 0 0 2px #c07b7b !important;
    text-shadow: 2px 2px #4c2d2d !important;
    border-radius: 10px !important;
    padding: 10px 20px !important;
    margin-top: 10px !important;
}

.level-selection {
    width: 100%;
    margin: 20px 0;
    animation: fadeIn 0.3s ease;
}

.level-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 80%;
    margin: 0 auto;
}

.level-selection h2 {
    color: #2d3436;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.tabs-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.tab-btn {
    background-color: rgba(52, 152, 219, 0.7);
    color: white;
    border: 3px solid #2980b9;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
}

.tab-btn-icon {
    font-size: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 60px;
    height: 60px;
}

.tab-btn-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
}

.tab-btn-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tab-btn-desc {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: normal;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover {
    background-color: rgba(123, 192, 146, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.tab-btn.active {
    background-color: rgba(123, 192, 146, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.25);
}

.tab-btn.active:hover {
  background-color: rgba(52, 152, 219, 0.8);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.tab-content {
    display: none;
    width: 100%;
}

.tab-content.active {
    display: block;
}

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

#main-menu {
    display: block;
    animation: fadeIn 0.3s ease;
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

.result-buttons .btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 1.1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.result-buttons .btn:hover {
    background: #2980b9;
}

.result-stats {
    text-align: center;
    font-size: 1.2rem;
    color: #2c3e50;
}

.result-stats p {
    margin: 5px 0;
}

.badge {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.badge svg {
    width: 100%;
    height: 100%;
}

#result-title {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0;
    text-align: center;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.stats-item {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stats-item:hover {
    transform: translateY(-2px);
}

.stats-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.stats-item-header .operation {
    font-size: 1.4rem;
    color: #2c3e50;
}

.stats-item-header .ratio {
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: #e9ecef;
}

.stats-item-header .ratio.low {
    background-color: #ff6b6b;
    color: white;
}

.stats-item-header .ratio.medium {
    background-color: #ffd93d;
}

.stats-item-header .ratio.high {
    background-color: #51cf66;
    color: white;
}

.stats-item-details {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 1.1rem;
}

.stats-item-recent {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

.recent-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 0.2s;
}

.recent-dot:hover {
    transform: scale(1.2);
}

.recent-dot.correct {
    background-color: #51cf66;
}

.recent-dot.incorrect {
    background-color: #ff6b6b;
}

.stats-btn {
    background-color: #f39c12;
    color: white;
    border: 2px solid #4c2d2d;
    box-shadow: inset 0 0 0 2px #c07b7b;
    text-shadow: 2px 2px #4c2d2d;
    padding: 15px 30px;
    margin: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 80%;
    max-width: 300px;
    border-radius: 10px;
    display: inline-block;
    text-align: center;
}

.result-screen .stats-btn:hover {
    background-color: #fdba4d;
    transform: scale(1.05);
}

/* Style dla przycisku statystyk w modalnym oknie */
#stats-modal .stats-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #5b9a68;
    color: white;
    border: 2px solid #2d4c34;
    box-shadow: inset 0 0 0 2px #7bc092;
    text-shadow: 2px 2px #2d4c34;
    border-radius: 10px;
    padding: 12px 20px;
    margin: 10px 0;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 80%;
    max-width: 300px;
}

#stats-modal .modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    border: 4px solid #555555;
    box-shadow: inset 0 0 0 2px #000000;
    width: 90%;
    max-width: 500px;
    margin: 40px auto;
    overflow-y: auto;
    position: relative;
}

#stats-modal h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
}

.stats-summary {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 12px;
    font-size: 1.1rem;
    color: #2c3e50;
}

.stats-summary strong {
    color: #3498db;
}

@media (max-width: 768px) {
    .stats-container {
        padding: 10px;
        max-height: 80vh;
        max-width: 100%;
    }

    .stats-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
        margin: 10px 0;
    }

    .stats-item-main {
        width: 100%;
        margin-bottom: 10px;
    }

    .stats-item-header {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    .stats-item-details {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    .stats-item-recent {
        justify-content: center;
        margin-top: 10px;
    }

    .stats-summary {
        padding: 10px;
        margin-bottom: 15px;
    }

    .stats-summary p {
        margin: 5px 0;
        font-size: 0.9rem;
    }
}

.selection-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  text-align: center;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
  position: relative;
  z-index: 50;
}

.selection-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 10px 0;
}

.selection-buttons button:last-child {
  margin-bottom: 0;
}

.selection-btn {
  padding: 12px;
  margin-bottom: 8px;
  height: auto;
  min-height: 80px;
  display: flex;
  align-items: center;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  text-align: left;
  color: white;
}

.selection-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.selection-icon {
  font-size: 1.6rem;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
}

.selection-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 50px;
}

.selection-header {
  font-size: 1.4rem;
  line-height: 1.2;
  margin-bottom: 4px;
  color: white;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  min-height: 26px;
  display: flex;
  align-items: center;
}

.selection-desc {
  font-size: 0.95rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.9);
  min-height: 18px;
}

@media (max-width: 480px) {
  .selection-screen {
    width: 95%;
    padding: 15px;
  }

  .selection-btn {
    padding: 10px;
    min-height: 70px;
    margin-bottom: 6px;
  }

  .selection-icon {
    font-size: 1.4rem;
    width: 35px;
    height: 35px;
    min-width: 35px;
    margin-right: 10px;
  }

  .selection-header {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 3px;
    min-height: 22px;
  }

  .selection-desc {
    font-size: 0.85rem;
    line-height: 1.2;
    min-height: 16px;
  }
}

.selection-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 10px 0;
}

.selection-btn .selection-content {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#multiplication-screen .selection-buttons,
#games-screen .selection-buttons {
  margin: 10px 0 15px 0;
}

.selection-screen .menu-btn {
  margin-top: 10px;
}

.result-screen .level-btn,
.result-screen .menu-btn {
    background-color: #5b9a68;
    color: white;
    border: 2px solid #2d4c34;
    box-shadow: inset 0 0 0 2px #7bc092;
    text-shadow: 2px 2px #2d4c34;
    padding: 15px 30px;
    margin: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 80%;
    max-width: 300px;
    border-radius: 10px;
    display: inline-block;
    text-align: center;
}

.result-screen .level-btn:hover,
.result-screen .menu-btn:hover {
    background-color: #7bc092;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .result-screen .stats-btn,
    .result-screen .level-btn,
    .result-screen .menu-btn {
        width: 100%;
        max-width: 100%;
    }
}

.achievement-unlocked-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2rem;
    color: #27ae60;
    animation: pulse 2s infinite;
}

.achievement-item {
    position: relative;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background-color: #e3fcef !important;
    border-left: 4px solid #27ae60 !important;
}

.achievement-item.locked {
    opacity: 0.7;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.achievement-notification {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background-color: #27ae60;
  color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.5s ease;
  font-size: 1.3rem;
  min-width: 300px;
}

.achievements-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.achievement-item {
  width: 100%;
  height: auto;
  min-height: 110px;
  background-color: #ecf0f1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px 10px 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  text-align: center;
  border: 2px solid #ddd;
}

.achievement-item.unlocked {
  background-color: #f1c40f;
  opacity: 1;
}

.achievement-item.locked {
  opacity: 0.7;
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 5px;
  transition: opacity 0.2s;
}

.achievement-item.locked .achievement-icon {
  opacity: 0.5;
}

.achievement-name {
  font-size: 0.8rem;
  text-align: center;
  font-weight: bold;
  transition: opacity 0.2s;
}

.achievement-item.locked .achievement-name {
  opacity: 0.5;
}

.achievement-lock {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 1rem;
}

.achievement-unlocked-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #27ae60;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .achievement-item {
    width: 100vw;
    margin: 0 auto;
    padding: 10px 4vw;
    font-size: 1rem;
  }
  .achievements-container {
    gap: 10px;
  }
}

.modal-content .achievements-container {
  flex-direction: column;
  align-items: stretch;
}
.modal-content .achievement-item {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 12px 0;
}

#achievements-section .achievements-container {
  flex-direction: row;
  align-items: center;
}
#achievements-section .achievement-item {
  width: 100px;
  min-width: 80px;
  max-width: 120px;
  margin: 0 8px 8px 0;
}
