* {
  box-sizing: border-box;
}

body {
  background-color: #34495e;
  color: #fff;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

h1 {
  margin: 20px 0 0;
}

.level-selector {
  align-items: center;
  display: flex;
  gap: 10px;
  margin: 12px 0 4px;
}

.level-selector span {
  font-weight: 700;
}

.level-selector select {
  background-color: #fff;
  border: 0;
  border-radius: 5px;
  color: #2c3e50;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  min-width: 140px;
  padding: 8px 12px;
}

.level-selector select:focus {
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.45);
  outline: 0;
}

.game-container {
  padding: 20px 30px;
  position: relative;
  margin: auto;
  height: 350px;
  width: 450px;
}

.figure-container {
  fill: transparent;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linecap: round;
}

.figure-part {
  display: none;
}

.wrong-letters-container {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  text-align: right;
}

.wrong-letters-container p {
  margin: 0 0 5px;
}

.chance-count {
  font-weight: 700;
}

.wrong-letter-list {
  min-height: 30px;
}

.wrong-letters-container span {
  font-size: 24px;
}

.word {
  display: flex;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.letter {
  border-bottom: 3px solid #2980b9;
  display: inline-flex;
  font-size: 30px;
  align-items: center;
  justify-content: center;
  margin: 0 3px;
  height: 50px;
  width: 20px;
}

.keyboard {
  display: grid;
  gap: 8px;
  margin: 0 auto 24px;
  max-width: 720px;
  padding: 0 16px;
  width: 100%;
}

.keyboard-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.keyboard-key {
  background-color: #fff;
  border: 0;
  border-radius: 5px;
  color: #2c3e50;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  height: 44px;
  min-width: 30px;
  padding: 0;
  text-transform: uppercase;
  width: 48px;
}

.keyboard-key:active {
  transform: scale(0.95);
}

.keyboard-key:focus {
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.45);
  outline: 0;
}

.keyboard-key.correct {
  background-color: #2ecc71;
  color: #fff;
}

.keyboard-key.wrong {
  background-color: #95a5a6;
  color: #ecf0f1;
}

.keyboard-key:disabled {
  cursor: default;
  opacity: 0.75;
}

.popup-container {
  background-color: rgba(0,0,0,0.3);
  position: fixed;
  inset: 0;
  display: none;
  /* display: flex; */
  align-items: center;
  justify-content: center;
}

.popup {
  background: #2980b9;
  border-radius: 5px;
  padding: 20px;
  box-shadow: 0 10px 10px 3px rgba(0,0,0,0.4);
  text-align: center;
}

.popup h2 {
  white-space: pre-line;
}

.answer-link {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.answer-link:focus {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.popup button {
  cursor: pointer;
  background-color: #fff;
  color: #2980b9;
  border: 0;
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 16px;
}

.popup button:active {
  transform: scale(0.95);
}

.popup button:focus {
  outline: 0;
}

@media (max-width: 520px) {
  body {
    padding: 0 10px;
  }

  .game-container {
    height: 320px;
    max-width: 100%;
    padding: 10px 16px;
    width: 100%;
  }

  .keyboard {
    gap: 7px;
    padding: 0;
  }

  .keyboard-row {
    gap: 4px;
  }

  .keyboard-key {
    flex: 1;
    font-size: 15px;
    height: 42px;
    min-width: 0;
    width: auto;
  }
}
