h1 {
  margin: 40px auto 30px;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  text-align: center;
}

.container {
  background: #394555;
  padding: 25px;
  margin: 40px auto;
  border-radius: 10px;
  width: calc(100% - 30px);
  max-width: 600px;
  box-shadow: 0 0 15px rgba(0,0,0,.3);
  border: 1px solid #3a3a5e;
}

h2 {
  margin: 0 0 10px;
  font-size: 17px;
  text-align: left;
}

p {
  line-height: 1.6;
}

.hidden {
  display: none;
}

.intro {
  margin: 0 0 18px;
  font-size: 14px;
  color: #cbd5e1;
}

select {
  padding: 10px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
}

button {
  width: 100%;
  padding: 12px;
  font-size: 17px;
  border: none;
  border-radius: 5px;
  background-color: #4caf50;
  color: #fff;
  cursor: pointer;
  margin-top: 10px;
}

button:hover {
  background-color: #45a049;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

button:disabled:hover {
  background-color: #4caf50;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.controls select {
  flex: 1;
  min-width: 120px;
}

.controls button {
  flex: 1;
  width: auto;
  min-width: 120px;
  margin-top: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.stat-item {
  background: #2d3a4a;
  padding: 10px 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

#message {
  min-height: 44px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.msg-good {
  color: #2ecc71;
}

.msg-bad {
  color: #ff8a80;
}

.msg-info {
  color: #cbd5e1;
}

#puzzle {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  margin-bottom: 20px;
  padding: 16px 12px;
  background: #2d3a4a;
  border-radius: 10px;
}

.word {
  display: inline-flex;
  gap: 3px;
}

.punct {
  align-self: flex-start;
  height: 30px;
  padding: 0 1px;
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
  color: #cbd5e1;
}

.cell {
  display: flex;
  flex-direction: column;
  width: 26px;
  height: 46px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-size: 16px;
  color: #fff;
  background: #394555;
  border: 1px solid #4a5a70;
  border-radius: 5px;
  transition: border-color .15s ease, background .15s ease;
}

.cell:hover {
  background: #44546a;
}

.cell:disabled:hover {
  background: #394555;
}

.cell .guess {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.cell .cipher {
  display: block;
  height: 16px;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: #cbd5e1;
  background: #1e252e;
}

.cell.same {
  border-color: #c9a84c;
  background: #4a5a70;
}

.cell.current {
  box-shadow: 0 0 0 2px #c9a84c;
}

.cell.given .guess {
  color: #7bdc9c;
}

.cell.wrong {
  border-color: #ff8a80;
}

.cell.wrong .guess {
  color: #ff8a80;
}

#keypad {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.key {
  margin-top: 0;
  padding: 10px 0;
  font-size: 16px;
  font-weight: 700;
  background: #2d3f52;
  border: 1px solid #4a5a70;
}

.key:hover {
  background: #3a5169;
}

.key:disabled:hover {
  background: #2d3f52;
}

.key.used {
  opacity: .4;
}

.key-clear {
  grid-column: span 2;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.actions button {
  margin-top: 0;
  padding: 11px 6px;
  font-size: 15px;
  background: #2d3f52;
}

.actions button:hover {
  background: #3a5169;
}

.actions button:disabled:hover {
  background: #2d3f52;
}

.panel {
  margin-top: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #2d3a4a;
  border-radius: 10px;
}

.panel p {
  margin: 0 0 6px;
  font-size: 16px;
}

#answerAuthor {
  font-size: 14px;
  color: #cbd5e1;
}

#freq {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.freq-btn {
  width: auto;
  margin: 0;
  padding: 6px 9px;
  font-size: 13px;
  background: #1e252e;
  border: 1px solid #4a5a70;
}

.freq-btn:hover {
  background: #2a343f;
}

.freq-btn.selected {
  background: #4a5a70;
  border-color: #c9a84c;
}

@media (max-width: 460px) {
  .container {
    padding: 15px;
  }

  #puzzle {
    gap: 12px 12px;
    padding: 12px 8px;
  }

  .cell {
    width: 22px;
    height: 44px;
  }

  .cell .guess {
    font-size: 18px;
  }
}
