html, body {
  margin: 0 auto;
  padding: 0;
  font-family: 'Merriweather', serif;
  background-color: #f8fafc;
  height: 100%;
  overflow-x: hidden;
}

body {
  min-height: -webkit-fill-available;
  min-height: 100vh;
}

a {
  color: #062a4d;
}

#container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  min-height: -webkit-fill-available;
  min-height: 100vh;
  padding: 0 8px;
}

/* Logo */
.logo {
  text-align: center;
  margin-top: 8px;
  cursor: pointer;
  font-family: 'Merriweather', serif;
  font-weight: 900;
}

.logo_green, .logo_gold {
  font-size: clamp(20px, 5vw, 26px);
  color: #fff;
  width: clamp(38px, 10vw, 49px);
  height: clamp(28px, 7vw, 35px);
  border-radius: 4px;
  margin: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo_gold {
  background-color: #c69214;
}

.logo_green {
  background-color: #062a4d;
}

/* Nav bar */
.nav_bar {
  text-align: center;
  height: 33px;
  margin-top: 8px;
}

.btn {
  padding: 4px;
  font-size: clamp(14px, 4vw, 19px);
  background: transparent;
  border: 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: .3s;
  color: #475569;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover, .btn:active {
  color: #062a4d;
  border-bottom: 2px solid #062a4d;
}

/* Game area */
.game_area {
  margin-top: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 4px;
}

.row {
  display: flex;
  justify-content: center;
  margin: clamp(3px, 1vw, 5px);
  gap: clamp(3px, 1vw, 5px);
}

.row_block {
  font-size: clamp(22px, 7vw, 32px);
  font-weight: bold;
  border: 2px solid #e2e8f0;
  width: clamp(46px, 14vw, 60px);
  height: clamp(46px, 14vw, 60px);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  color: #0f172a;
}

/* Notification */
#notification {
  font-family: inherit;
  text-align: center;
  font-size: clamp(13px, 3.5vw, 16px);
  margin: 8px auto;
  min-height: 24px;
  color: #062a4d;
  font-weight: bold;
}

/* Keyboard */
#keyboard {
  text-align: center;
  margin-bottom: 10px;
  padding: 8px 4px;
}

#topKeys, #midKeys, #botKeys {
  display: flex;
  justify-content: center;
  width: 100%;
  gap: clamp(2px, 0.8vw, 4px);
  margin-bottom: clamp(3px, 0.8vw, 4px);
}

.keyboardKey_s, .keyboardKey_m, .keyboardKey_l {
  background-color: #e2e8f0;
  color: #0f172a;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: bold;
  height: clamp(42px, 11vw, 50px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: none;
  transition: transform 0.1s, background 0.15s;
}

.keyboardKey_s:active,
.keyboardKey_m:active,
.keyboardKey_l:active {
  transform: scale(0.95);
  background-color: #cbd5e1;
}

.keyboardKey_s {
  flex: 1;
  max-width: clamp(28px, 8vw, 45px);
}

.keyboardKey_m {
  flex: 1.2;
  max-width: clamp(32px, 9vw, 50px);
}

.keyboardKey_l {
  flex: 1.5;
  max-width: clamp(50px, 12vw, 65px);
  font-size: clamp(10px, 2.5vw, 12px);
}

/* Help modal */
.help-btn {
  margin-left: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  touch-action: manipulation;
}

.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.help-modal-content {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  max-width: 90%;
  width: 380px;
  color: #000;
  max-height: 80vh;
  overflow-y: auto;
}

.help-modal-content h2 {
  margin-top: 0;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
}

.example-row {
  display: flex;
  margin: 8px 0;
  align-items: center;
}

.example-text {
  margin-left: 10px;
  align-self: center;
  font-size: clamp(0.85rem, 3vw, 1rem);
}

.modal-play-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: #062a4d;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  touch-action: manipulation;
}

/* Block colors */
.blockGreen, .blockGrey, .blockGold {
  color: #fff !important;
  border: none !important;
  animation: flip 0.5s ease forwards;
}

.blockGreen {
  background-color: #059669;
}

.blockGrey {
  background-color: #94a3b8;
}

.blockGold {
  background-color: #c69214;
}

@keyframes flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

/* Mobile responsive */
@media (max-width: 400px) {
  #container { padding: 0 4px; }
  .row_block { width: 42px; height: 42px; font-size: 20px; }
  .keyboardKey_s { max-width: 26px; }
  .keyboardKey_m { max-width: 30px; }
  .keyboardKey_l { max-width: 46px; font-size: 9px; }
}

@media (max-width: 320px) {
  .row_block { width: 38px; height: 38px; font-size: 18px; }
  .keyboardKey_s, .keyboardKey_m, .keyboardKey_l { height: 38px; font-size: 10px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .game_area { margin-top: 5px; }
  .row { margin: 2px; }
  .row_block { width: 40px; height: 40px; font-size: 20px; }
  #keyboard { margin-bottom: 5px; padding: 4px; }
  .keyboardKey_s, .keyboardKey_m, .keyboardKey_l { height: 36px; }
  .logo { margin-top: 4px; }
  .nav_bar { height: 28px; margin-top: 4px; }
}
