*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #121213;
  color: #d7dadc;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.container {
  max-width: 540px;
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  margin-bottom: 24px;
  border-bottom: 1px solid #3a3a3c;
  padding-bottom: 12px;
  width: 100%;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subtitle {
  color: #818384;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Grid */
.grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lock-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #3a3a3c;
  background: transparent;
  color: #6aaa64;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.lock-btn:hover {
  border-color: #6aaa64;
  background: #1e2e1e;
}

.lock-btn.lock-btn-locked {
  border-color: #c9b458;
  color: #c9b458;
}

.lock-btn.lock-btn-locked:hover {
  background: #2e2a1a;
}

.tile {
  width: 58px;
  height: 58px;
  border: 2px solid #3a3a3c;
  background: #121213;
  color: #d7dadc;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  caret-color: transparent;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.tile:focus {
  border-color: #565758;
}

div.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.tile.green {
  background: #6aaa64;
  border-color: #6aaa64;
  color: #fff;
}

.tile.yellow {
  background: #c9b458;
  border-color: #c9b458;
  color: #fff;
}

.tile.gray {
  background: #3a3a3c;
  border-color: #3a3a3c;
  color: #fff;
}

/* Controls */
.controls {
  margin-bottom: 20px;
}

.btn {
  background: #818384;
  color: #fff;
  border: none;
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:hover {
  background: #a0a1a2;
}

/* Keyboard */
.keyboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.keyboard-row {
  display: flex;
  gap: 4px;
}

.key {
  width: 36px;
  height: 42px;
  border-radius: 4px;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #818384;
  color: #fff;
}

.key.used-gray {
  background: #3a3a3c;
  color: #565758;
}

.key.used-yellow {
  background: #c9b458;
  color: #fff;
}

.key.used-green {
  background: #6aaa64;
  color: #fff;
}

/* Results */
.results {
  width: 100%;
  text-align: center;
}

.results h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  font-weight: 600;
}

#word-count {
  color: #6aaa64;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: #1a1a1b;
  border-radius: 6px;
}

.word-list .word {
  background: #3a3a3c;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Footer / Legend */
footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: #818384;
  text-align: center;
}

.legend {
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.75rem;
}

.empty-l { border: 1px solid #3a3a3c; }
.green-l { background: #6aaa64; color: #fff; }
.yellow-l { background: #c9b458; color: #fff; }
.gray-l { background: #3a3a3c; color: #fff; }

/* Scrollbar */
.word-list::-webkit-scrollbar {
  width: 8px;
}
.word-list::-webkit-scrollbar-track {
  background: #1a1a1b;
}
.word-list::-webkit-scrollbar-thumb {
  background: #3a3a3c;
  border-radius: 4px;
}

@media (max-width: 400px) {
  .tile {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }
}
