* {
  box-sizing: border-box;
}
html {
  color-scheme: dark;
  background: #07101d;
}
body {
  margin: 0;
  color: #edf5ff;
  font:
    16px/1.6 system-ui,
    sans-serif;
  background: radial-gradient(ellipse at top right, #204449, #07101d 70%);
  min-height: 100vh;
}
main {
  max-width: 760px;
  padding: 32px 20px 64px;
  margin: auto;
}
.brand,
a {
  color: #8ff0e9;
  text-decoration: none;
}
.brand {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
header {
  margin: 40px 0 24px;
}
h1 {
  font-size: clamp(36px, 8vw, 60px);
  line-height: 1.1;
  margin: 12px 0;
}
header p,
footer {
  color: #b4c5d8;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.13em;
  color: #8ff0e9;
}
h2 {
  font-size: 22px;
}
.panel {
  padding: 24px;
  border: 1px solid #54768680;
  border-radius: 20px;
  background: #0c1a2cee;
}
.row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
input {
  width: 100%;
  min-width: 0;
  background: #07101d;
  color: white;
  border: 1px solid #668393;
  border-radius: 9px;
  padding: 12px;
  font: inherit;
}
button {
  font: inherit;
  font-weight: 700;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #8ff0e9;
  color: #092629;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
}
button:hover {
  filter: brightness(1.1);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button.secondary {
  background: #1c3044;
  color: #d6e8f5;
  border-color: #54768680;
  margin-top: 14px;
}
:focus-visible {
  outline: 3px solid #f8d58c;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
#message {
  min-height: 1.6em;
  color: #f8d58c;
}
.answers {
  display: grid;
  gap: 10px;
}
.answers button {
  text-align: left;
}
.answers button.correct {
  background: #8ff0e9;
}
.answers button.wrong {
  background: #f7aeaa;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.card {
  padding: 0;
  aspect-ratio: 1;
  background: #243c53;
  color: #efffff;
  border: 1px solid #68889d;
  font-size: clamp(22px, 6vw, 38px);
}
.card.matched {
  background: #1a564f;
  opacity: 1;
}
#maze {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  aspect-ratio: 1;
  background: #162c3e;
  border: 4px solid #385469;
  border-radius: 6px;
  overflow: hidden;
}
.cell {
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: clamp(8px, 2vw, 16px);
}
.wall {
  background: #58758a;
}
.player {
  background: #8ff0e9;
  color: #092629;
}
.goal {
  background: #f8d58c;
  color: #092629;
}
.directions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.directions button {
  padding: 10px 16px;
}
footer {
  font-size: 12px;
  margin-top: 28px;
}
#scores {
  padding-left: 24px;
}
#scores li {
  padding: 7px 0;
  border-bottom: 1px solid #314457;
}
@media (max-width: 380px) {
  main {
    padding: 24px 12px;
  }
  .panel {
    padding: 16px;
  }
  .cards {
    gap: 7px;
  }
  .row {
    flex-wrap: wrap;
  }
  .row button {
    width: 100%;
  }
}

.leaderboard {
  margin-top: 20px;
}

select {
  display: block;
  max-width: 100%;
  font: inherit;
  padding: 10px;
  border: 1px solid #668393;
  border-radius: 9px;
  background: #07101d;
  color: #edf5ff;
  margin: 8px 0 20px;
}
.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Maze assistance keeps the player and goal visually distinct. */
.cell.visited:not(.player):not(.goal) {
  color: #8ff0e9;
  background: #254751;
}
.trail-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.trail-option input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.directions button {
  touch-action: none;
  user-select: none;
}

.cards[aria-busy="true"] {
  cursor: progress;
}
.cards[aria-busy="true"] .card {
  cursor: progress;
}
.card.pending {
  opacity: 1;
  background: #254751;
  outline: 3px dashed #8ff0e9;
  outline-offset: -5px;
}
