* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #0f1012;
  color: #fff;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.app {
  width: 100%;
  max-width: 540px;
  background: #1c1d22;
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 18px 18px 20px;
}

.topbar {
  display: grid;
  grid-template-columns: 100px 1fr 120px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
}

.nav-btn {
  appearance: none;
  border: none;
  text-decoration: none;
  background: #3a3b40;
  color: #fff;
  border-radius: 10px;
  min-height: 38px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

canvas {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin-bottom: 18px;
  background: transparent;
}

.word {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 48px;
  margin-bottom: 10px;
}

.word-letter {
  width: 28px;
  height: 40px;
  border-bottom: 3px solid #fff;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
}

.wrong-wrap {
  min-height: 42px;
  text-align: center;
  margin-bottom: 8px;
}

.wrong-label {
  display: block;
  color: #ff5d5d;
  font-size: 14px;
  margin-bottom: 4px;
}

.wrong {
  color: #ffb0b0;
  font-size: 16px;
  min-height: 18px;
}

.message {
  min-height: 28px;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.keyboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.key {
  appearance: none;
  border: none;
  border-radius: 8px;
  min-width: 44px;
  height: 46px;
  padding: 0 10px;
  background: #8a8a8a;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.key:disabled {
  opacity: 0.75;
  cursor: default;
}

.key:not(.correct):not(.wrong):hover {
  background: #a0a0a0;
}

.key.correct {
  background: #349623; /* žalia */
  color: #fff;
}

.key.wrong {
  background: #cd3131; /* raudona */
  color: #fff;
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .app {
    padding: 14px 12px 16px;
    border-radius: 20px;
  }

  .topbar {
    grid-template-columns: 78px 1fr 96px;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .nav-btn {
    min-height: 34px;
    font-size: 12px;
    padding: 8px 10px;
  }

  canvas {
    width: 190px;
    margin-bottom: 14px;
  }

  .word-letter {
    width: 24px;
    height: 34px;
    font-size: 24px;
  }

  .keyboard {
    gap: 6px;
  }

  .keyboard-row {
    gap: 5px;
  }

  .key {
    min-width: 36px;
    height: 42px;
    padding: 0 8px;
    font-size: 16px;
  }
}