* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
}

body {
  background: #121213;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
}

.game-container {
  max-width: 550px;
  width: 100%;
  background: #121213;
  color: #d7dadc;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid #3a3a3c;
}

.title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-left: 0.5rem;
}

.header-controls {
  display: flex;
  gap: 1rem;
  margin-right: 0.5rem;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #d7dadc;
  padding: 0.5rem;
}

.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  padding: 10px;
  aspect-ratio: 5 / 6;
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.tile {
  background: #121213;
  border: 2px solid #3a3a3c;
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  transition: transform 0.2s;
  transform-style: preserve-3d;
}

.tile.flip {
  animation: flip 0.4s ease forwards;
}

@keyframes flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.tile.correct { background: #6aaa64; border-color: #6aaa64; }
.tile.present { background: #c9b458; border-color: #c9b458; }
.tile.absent { background: #3a3a3c; border-color: #3a3a3c; }

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 0 4px;
}

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

.key {
  background: #818384;
  border: none;
  color: #fff;
  font-weight: bold;
  font-size: 1.25rem;
  height: 58px;
  border-radius: 4px;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 28px;
  max-width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 2px 0 #5a5a5c;
  touch-action: manipulation;
}

.key.enter, .key.delete {
  flex: 1.5 1 auto;
  max-width: 80px;
  font-size: 1rem;
}

.key.correct { background: #6aaa64; }
.key.present { background: #c9b458; }
.key.absent { background: #3a3a3c; }

.message {
  text-align: center;
  font-size: 1.1rem;
  min-height: 2.2rem;
  color: #f0f0f0;
  padding: 0.5rem;
}

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show { display: flex; }

.modal-content {
  background: #1a1a1b;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  color: #d7dadc;
  position: relative;
  border: 1px solid #3a3a3c;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 12px; right: 18px;
  font-size: 2rem;
  cursor: pointer;
  color: #aaa;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
  margin: 20px 0;
  font-size: 1.8rem;
  font-weight: bold;
}

.stats-grid div span { font-size: 2rem; display: block; }
.stats-grid div { font-size: 0.9rem; color: #aaa; }

.share-button {
  background: #6aaa64;
  border: none;
  color: white;
  font-size: 1.3rem;
  padding: 12px 20px;
  border-radius: 40px;
  width: 100%;
  cursor: pointer;
  font-weight: bold;
}

.example-word {
  display: flex;
  gap: 6px;
  margin: 10px 0;
}

.example-tile {
  width: 40px;
  height: 40px;
  border: 2px solid #3a3a3c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 4px;
}

.example-tile.correct { background: #6aaa64; border-color: #6aaa64; }
.example-tile.present { background: #c9b458; border-color: #c9b458; }
.example-tile.absent { background: #3a3a3c; border-color: #3a3a3c; }

@media (max-width: 450px) {
  .key { font-size: 1rem; height: 48px; }
  .key.enter, .key.delete { font-size: 0.8rem; }
  .title { font-size: 1.5rem; }
  .icon-btn { font-size: 1.6rem; }
  .example-tile { width: 35px; height: 35px; font-size: 1.3rem; }
}
