:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8e7a5, #f4b183);
  color: #2e2e2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.game-shell {
  width: min(100%, 980px);
}

.game-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  color: #7a2e1b;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.language-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: #5b4a40;
}

.language-picker select {
  border: 1px solid #f0c781;
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
  color: #2e2e2e;
}

h3 {
  margin-top: 0;
  color: #7a2e1b;
}

.intro,
.message {
  margin: 0 0 16px;
  color: #5b4a40;
}

.level-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.level-btn {
  background: #f4ede2;
  color: #5b4a40;
}

.level-btn.active {
  background: #7a2e1b;
  color: white;
}

.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat {
  min-width: 110px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff7e6;
  box-shadow: inset 0 0 0 1px #f2c76d;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat span {
  font-size: 1.2rem;
  font-weight: 700;
  color: #7a2e1b;
}

.stat small {
  color: #6f584e;
}

.board-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(10, minmax(34px, 42px));
  gap: 6px;
  user-select: none;
}

.cell {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: #fff7e6;
  color: #2d2d2d;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #f0c781;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cell:hover {
  transform: translateY(-1px);
  background: #fff0b8;
}

.cell.selected {
  background: #ffb703;
  color: white;
}

.cell.found {
  background: #2a9d8f;
  color: white;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: #7a2e1b;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover {
  background: #a43f24;
  transform: translateY(-1px);
}

.word-panel {
  margin-top: 8px;
}

.word-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-list li {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f4ede2;
  color: #5b4a40;
  font-weight: 600;
}

.word-list li.found {
  background: #d8f3dc;
  color: #166534;
  text-decoration: line-through;
}

.details-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #f2c76d;
}

.dictionary-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #f2c76d;
}

.dictionary-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.dictionary-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

#loadMoreDictionaryBtn {
  padding: 8px 12px;
  border-radius: 999px;
  background: #7a2e1b;
  color: white;
  font-weight: 600;
}

.dictionary-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #5b4a40;
  font-weight: 600;
}

.dictionary-filter input,
.dictionary-filter select {
  border: 1px solid #f0c781;
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 180px;
}

.dictionary-stats {
  margin: 12px 0 8px;
  color: #6f584e;
}

.dictionary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.dictionary-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: white;
  box-shadow: inset 0 0 0 1px #f1e1c2;
  cursor: pointer;
}

.dictionary-list li:hover {
  background: #fff5d8;
}

.dictionary-list li strong {
  color: #7a2e1b;
}

.word-details {
  display: grid;
  gap: 10px;
}

.word-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: white;
  box-shadow: inset 0 0 0 1px #f1e1c2;
}

.word-item strong {
  color: #7a2e1b;
}

.word-item p {
  margin: 4px 0 0;
  color: #5b4a40;
}

@media (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .board {
    grid-template-columns: repeat(10, minmax(28px, 32px));
  }

  .cell {
    font-size: 0.9rem;
  }
}
