* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f6f7fb;
  margin: 0;
  padding: 12px;
  color: #1f2330;
}
.wrap { max-width: 420px; margin: 0 auto; text-align: center; }
.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
}
#newbtn {
  background: #4f46e5; color: white; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 14px;
}
#newbtn:hover { background: #4338ca; }
.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  margin: 0 auto 12px;
  max-width: 320px;
  aspect-ratio: 5 / 6;
}
.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  background: #fff;
  border: 2px solid #d3d6da;
  color: #1f2330;
  user-select: none;
}
.tile.filled { border-color: #878a8c; }
.tile.correct { background: #6aaa64; border-color: #6aaa64; color: #fff; }
.tile.present { background: #c9b458; border-color: #c9b458; color: #fff; }
.tile.absent  { background: #787c7e; border-color: #787c7e; color: #fff; }
.tile.shake { animation: shake 0.3s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.result {
  margin: 8px 0;
  padding: 10px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
}
.result.win { background: #d1fae5; color: #065f46; }
.result.lose { background: #fee2e2; color: #991b1b; }
.result.hidden { display: none; }
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.key {
  min-width: 36px;
  min-height: 48px;
  flex: 1 1 0;
  padding: 0 4px;
  border: 0;
  background: #d3d6da;
  border-radius: 5px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  color: #1f2330;
}
.key.wide { flex: 1.5 1 0; font-size: 12px; }
.key.correct { background: #6aaa64; color: #fff; }
.key.present { background: #c9b458; color: #fff; }
.key.absent  { background: #787c7e; color: #fff; }
.key:active { opacity: 0.8; }
@media (max-width: 380px) {
  .key { min-width: 28px; font-size: 12px; }
}
