/* Equation Guess — Playnesta-original stylesheet.
   The base tile / keyboard / alert rules derive from the MIT-licensed
   wordle-clone by WebDevSimplified (see LICENSE.txt and NOTICE.md); the
   eight-column board, the operator keypad and the shell are Playnesta-original. */
*, *::after, *::before {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background-color: hsl(240, 3%, 7%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: .6em;
  font-size: clamp(.5rem, 2.5vmin, 1.5rem);
  color: white;
  /* The playable is embedded at two fixed stages today (348x261 on a phone,
     894x670 on a desktop), so the board is sized from the iframe height instead
     of a fixed em: otherwise the keypad falls below the fold and the action bar
     covers the Enter key (measured on production 2026-10-06). */
  --cell: min(3.1em, max(12px, calc((100vh - 150px) / 6)));
  --key-h: min(2.6em, max(12px, calc(var(--cell) * .8)));
  --key-w: min(var(--cell), calc((100vw - 1.6em) / 10));
}

.pn-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2em;
  margin-bottom: .6em;
}

.pn-title {
  font-size: 1.4em;
  font-weight: bold;
  letter-spacing: .02em;
}

.pn-status {
  font-size: .8em;
  opacity: .75;
}

.guess-grid {
  display: grid;
  justify-content: center;
  align-content: center;
  flex-grow: 1;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(6, var(--cell));
  gap: .22em;
  margin-bottom: .6em;
}

.tile {
  font-size: min(1.9em, calc(var(--cell) * .62));
  color: white;
  border: .05em solid hsl(240, 2%, 23%);
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  transition: transform 250ms linear;
}

.tile[data-state="active"] {
  border-color: hsl(200, 1%, 34%);
}

.tile[data-state="wrong"] {
  border: none;
  background-color: hsl(240, 2%, 23%);
}

.tile[data-state="wrong-location"] {
  border: none;
  background-color: hsl(49, 51%, 47%);
}

.tile[data-state="correct"] {
  border: none;
  background-color: hsl(115, 29%, 43%);
}

.tile.shake {
  animation: shake 250ms ease-in-out;
}

.tile.dance {
  animation: dance 500ms ease-in-out;
}

.tile.flip {
  transform: rotateX(90deg);
}

@keyframes shake {
  10% { transform: translateX(-5%); }
  30% { transform: translateX(5%); }
  50% { transform: translateX(-7.5%); }
  70% { transform: translateX(7.5%); }
  90% { transform: translateX(-5%); }
  100% { transform: translateX(0); }
}

@keyframes dance {
  20% { transform: translateY(-50%); }
  40% { transform: translateY(5%); }
  60% { transform: translateY(-25%); }
  80% { transform: translateY(2.5%); }
  90% { transform: translateY(-5%); }
  100% { transform: translateY(0); }
}

.keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .22em;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: .22em;
  width: 100%;
}

.key {
  font-size: inherit;
  flex: 0 0 auto;
  width: var(--key-w);
  height: var(--key-h);
  border: none;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: hsl(
    var(--hue, 200),
    var(--saturation, 1%),
    calc(var(--lightness-offset, 0%) + var(--lightness, 51%))
  );
  color: white;
  fill: white;
  border-radius: .25em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.key.wide {
  width: min(calc(2 * var(--key-w) + .22em), calc((100vw - 1.6em) / 2));
}

.key > svg {
  width: 1.4em;
  height: 1.4em;
  pointer-events: none;
}

.key:hover, .key:focus {
  --lightness-offset: 10%;
}

.key.wrong {
  --lightness: 23%;
}

.key.wrong-location {
  --hue: 49;
  --saturation: 51%;
  --lightness: 47%;
}

.key.correct {
  --hue: 115;
  --saturation: 29%;
  --lightness: 43%;
}

.alert-container {
  position: fixed;
  top: 10vh;
  left: 50vw;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.alert {
  pointer-events: none;
  background-color: hsl(204, 7%, 85%);
  color: hsl(240, 3%, 7%);
  padding: .75em;
  border-radius: .25em;
  opacity: 1;
  transition: opacity 500ms ease-in-out;
  margin-bottom: .5em;
  max-width: 92vw;
  word-break: break-word;
  text-align: center;
}

.alert:last-child {
  margin-bottom: 0;
}

.alert.hide {
  opacity: 0;
}
