/* Hülge pelu — values from the laisk-huljes.html prototype. Builds on
   leona.css (tokens, nav, page background). Desktop first here, like the
   prototype: the phone layout below 700px fills the screen instead. */

[hidden] { display: none !important; }

.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 28px 20px 60px;
}

/* ---------- Top bar ---------- */

.game-bar {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--plum);
  border: 3px solid var(--plum);
  border-radius: 999px;
  padding: 4px 14px;
  font: 700 15px var(--display);
  box-shadow: 3px 3px 0 var(--teal);
}
button.chip { cursor: pointer; }
.chip:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.chip--sky { background: var(--sky); }
.chip--cream { background: var(--cream); }

.chip--night { background: var(--cream); padding: 4px 8px 4px 14px; }
.chip--night[aria-pressed="true"] { background: var(--plum); color: var(--sun); }

.switch {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  border: 2.5px solid var(--plum);
  background: #D9DEE8;
}
.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--plum);
  transition: transform .15s ease;
}
.chip--night[aria-pressed="true"] .switch { background: var(--pink); }
.chip--night[aria-pressed="true"] .switch-knob { transform: translateX(20px); }

/* ---------- Heading ---------- */

.game-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.game-title {
  margin: 0;
  font: 700 clamp(40px, 7vw, 76px)/1 var(--display);
  color: var(--cream);
  text-shadow: 4px 4px 0 var(--magenta), 8px 8px 0 rgba(14, 124, 123, .75);
}

.game-lede {
  margin: 0;
  max-width: 46ch;
  font: 500 17px/1.5 var(--body);
  color: var(--cream-warm);
  text-wrap: pretty;
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 3 / 1;
  min-height: 0;
  background: var(--cream);
  border: 5px solid var(--plum);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 9px 9px 0 var(--magenta);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.stage-canvas { display: block; width: 100%; height: 100%; }

.stage-hint {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.stage-hint span {
  background: var(--sun);
  color: var(--plum);
  border: 3px solid var(--plum);
  border-radius: 999px;
  padding: 6px 16px;
  font: 600 15px var(--display);
  box-shadow: 3px 3px 0 var(--plum);
}

.over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4% 12px 0;
  pointer-events: none;
}

.over-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  color: var(--plum);
  border: 4px solid var(--plum);
  border-radius: 22px;
  padding: 12px 26px;
  box-shadow: 6px 6px 0 var(--teal);
  pointer-events: auto;
  cursor: auto;
  text-align: center;
}
.over-line { font: 700 22px/1.1 var(--display); }
.over-score { font-size: 15px; font-weight: 700; color: var(--purple-muted); }

.save-form { display: flex; gap: 8px; margin-top: 4px; }
.save-name {
  width: 150px;
  min-height: 40px;
  border: 3px solid var(--plum);
  border-radius: 14px;
  padding: 4px 12px;
  font: 700 16px var(--body);
  color: var(--plum);
  background: #FFFFFF;
  outline: none;
}
.save-name:focus-visible { box-shadow: 0 0 0 3px var(--pink); }
.save-msg { font-size: 14px; font-weight: 700; color: var(--teal); }

.over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn {
  min-height: 40px;
  color: var(--plum);
  border: 3px solid var(--plum);
  border-radius: 999px;
  padding: 4px 16px;
  font: 700 16px var(--display);
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--plum);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--plum); }
.btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn--pink { background: var(--pink); color: var(--cream); padding: 4px 18px; }
.btn--sun { background: var(--sun); }
.btn--sky { background: var(--sky); }
.btn--mint { background: var(--mint); }
.btn--square { border-radius: 14px; padding: 4px 14px; font-size: 15px; box-shadow: 2px 2px 0 var(--plum); }
.btn--small { font-size: 15px; box-shadow: 2px 2px 0 var(--plum); }

/* ---------- Touch controls ---------- */

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }

.big-btn {
  min-width: 150px;
  min-height: 56px;
  border: 4px solid var(--plum);
  border-radius: 999px;
  font: 700 20px var(--display);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--plum);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.big-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--plum); }
.big-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; }
.big-btn--pink { background: var(--pink); color: var(--cream); }
.big-btn--sun { background: var(--sun); color: var(--plum); }

.keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--cream-warm);
}
.keys span { border: 2px solid var(--cream-warm); border-radius: 999px; padding: 3px 12px; }

/* ---------- Leaderboard ---------- */

.board {
  width: calc(100% - 40px);
  max-width: 440px;
  margin: auto;
  padding: 20px;
  background: var(--cream);
  color: var(--plum);
  border: 4px solid var(--plum);
  border-radius: 24px;
  box-shadow: 7px 7px 0 var(--magenta);
  font-family: var(--body);
}
.board[open] { display: flex; flex-direction: column; gap: 12px; }
.board::backdrop { background: rgba(26, 11, 56, .72); }

.board-head { display: flex; align-items: center; gap: 10px; }
.board-title { margin: 0; font: 700 28px/1 var(--display); }
.board-head .btn { margin-left: auto; }
.board-msg { margin: 0; font-size: 16px; font-weight: 600; color: var(--purple-muted); }

.board-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.board-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 2.5px solid var(--plum);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: 700;
}
.board-rank { font-family: var(--display); color: var(--magenta); }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-family: var(--display); }
.board-list li.is-mine { background: var(--sun); }

/* ---------- Phone: the game fills the screen ---------- */

@media (max-width: 700px) {
  .game-page { height: 100vh; height: 100svh; min-height: 0; }
  .game { min-height: 0; gap: 14px; padding: 16px 14px 22px; }
  .stage { flex: 1 1 0; aspect-ratio: auto; }
  .keys { display: none; }
}
