html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: sans-serif;
  background: #fff;
  margin: 0; padding: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center;
}

header {
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  width: 100vw;
  max-width: 100%;
  height: 60px;
  box-sizing: border-box;
  overflow: hidden;
  /* border-bottom: 1px solid #e0e7ef; */
}
header .left,
header .right { display: flex; align-items: center; gap: 30px; }

header button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 18px;
  cursor: pointer;
  color: #0065ad;
  font-weight: bold;
}
header button i { font-size: 1.5rem; color: inherit; }




/* Spiel pausieren Pause-Button ausblenden */
button#pause-btn {
	display:none;
}



h1 {
  margin-top: 36px;
  color: #2C3E50;
  letter-spacing: .03em;
  font-size: 2.1em;
}
.main-controls {
  text-align: center;
  margin: 16px 0 0 0;
}
#timer {
  margin: 0 10px;
  font-size: 1.1rem;
  min-width: 90px;
  display: inline-block;
}

#game-container {
  /* box-shadow: 0 4px 14px rgba(0,0,0,0.10); */
  /* border-radius: 18px; */
  /* background: #fff; */
  /* padding: 24px 32px 22px 32px; */
  margin: 32px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 100%;
}
#wordlist {
  min-width: unset;
  max-width: 90%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
#wordlist li {
  font-size: 1.15em;
  color: #34495e;
  margin: 6px 0;
  transition: color 0.2s;
  padding-left: 8px;
  position: relative;
  display: flex;
  align-items: baseline;
}
#wordlist li.found {
  color: #aaa;
  text-decoration: line-through;
}
#wordlist li::before {
  content: "🟦";
  opacity: 0.25;
  margin-right: 4px;
  font-size: 0.9em;
  vertical-align: middle;
}
#wordlist li.found::before {
  content: "✅";
  opacity: 1;
  margin-right: 8px;
  color: #27ae60;
}

/* --- Grid --- */
#grid {
  max-width: 100vw;
  width: 100%;
  overflow-x: auto;
  display: grid;
  grid-template-columns: repeat(10, 3.2em); /* oder dynamisch via JS */
  grid-template-rows: repeat(10, 3.2em);
  gap: 3px;
  border-radius: 12px;
  user-select: none;
  touch-action: none;
}
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: bold;
  background: #0065ad1a;
  color: #2d415a;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  /* box-shadow: 0 1px 2px rgba(0,0,0,0.07); */
  position: relative;
}

.cell.selected {
  background: #74b9ff;
  color: #fff;
}
.cell.found {
  background: #20bf6b;
  color: #fff;
  font-weight: bold;
  animation: foundPulse 0.7s;
}
@keyframes foundPulse {
  0% { box-shadow: 0 0 0 0 #20bf6b55; }
  70% { box-shadow: 0 0 0 15px #20bf6b00; }
  100% { box-shadow: 0 0 0 0 #20bf6b00; }
}

/* --- Highscore-Liste --- */
#highscores {
  text-align:center;
  margin-top:3rem;
  padding:2rem 2rem 3rem 2rem;
  background-color:#0065ad;
  color:#fff;
  border-radius:12px;
  width: 100%;
  max-width: 100%;
}
.highscore-entry {
  font-size: 15px;
  margin: 3px 0;
}

/* --- Menüs / Popups --- */
.popup, .settings-popup, .menu-popup, #pausePopup, #confirmPopup {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: none;
  justify-content: center; align-items: center;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(5px);
  z-index: 2000;
}
.popup:not(.hidden),
.settings-popup:not(.hidden),
.menu-popup:not(.hidden),
#pausePopup:not(.hidden),
#confirmPopup:not(.hidden) {
  display: flex;
}

#menuPopup nav div, #helpPopup nav div, #settingsPopup nav div, #postGamePopup nav div {
    padding: 20px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
}
#menuPopup nav {
	width: 100%;
	max-width: 100%;
}
#menuPopup nav div:hover, #helpPopup nav div:hover, #settingsPopup nav div:hover, #postGamePopup nav div:hover {
  background: #f0f0f0;
}

.popup-content {
  width: 85%; max-width: 380px;
  background: #fff;
  padding: 50px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  text-align: center;
  position: relative;
  display:flex; flex-direction:column; align-items:center;justify-content:center;
}
.popup .close,
.settings-popup .close,
.menu-popup .close {
  position: absolute;
  top: 10px; right: 14px;
  font-size: 1.8rem;
  cursor: pointer;
  color: #666;
}
.btn, .main-btn, .saveHighscoreBtn {
  background: #0065ad;
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1.5rem;
}
.btn.primary { background: #0065ad; }
.btn:not(.primary) { background: #777; }

.btn-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* --- Erfolgsmeldung --- */
#success {
  background: linear-gradient(90deg, #20bf6b 30%, #00b894 100%);
  color: #fff;
  border-radius: 8px;
  padding: 16px 24px;
  font-size: 1.2em;
  margin-top: 28px;
  display: none;
  box-shadow: 0 4px 18px #27ae6040;
  letter-spacing: .03em;
}

/* --- Konfetti --- */
canvas#confetti-canvas {
  pointer-events: none;
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 20;
}

/* --- Einstellungen --- */
#settingsPopup label {
  display: block;
  margin: 12px 0 4px 0;
}

/* --- Formular --- */
input, textarea { font-size: 16px; padding: 3px 6px; }
label           { margin-top: 12px; }

/* --- Mobile --- */
@media (max-width: 900px) {
  #game-container { flex-direction: column; align-items: center; gap: 28px; padding: 16px; }
  #grid {
    grid-template-columns: repeat(10, 2.5em);
    grid-template-rows: repeat(10, 2.5em);
  }
  #highscores { width: 98%; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.2em; }
  #grid {
    grid-template-columns: repeat(10, 2.0em);
    grid-template-rows: repeat(10, 2.0em);
  }
  #game-container { padding: 5px;}
  .popup-content { padding: 50px; }
}