/* Fiver: lime. Rounded slab-letter tiles that flip one by one, and a soft
   gray keyboard that remembers what each letter showed. The hit/close
   colors are a shade darker than the usual so white letters stay readable. */

:root { --lime: #c5e063; --hit: #3e8e50; --close: #b98a14; --miss: #787c7e; }
.fiver { --game: var(--lime); min-height: calc(100dvh - 57px); gap: 14px; padding-top: 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }

.pnum { margin: 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.pnum b { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--lime); color: var(--ink); font-size: 12px; }

.board { flex: 1; display: grid; align-content: center; gap: 6px; width: min(330px, 100%); margin: 0 auto; }
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile {
  --bg: var(--paper); --fg: var(--ink); --line: var(--rule);
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px;
  border: 2px solid var(--line); background: var(--bg); color: var(--fg);
  font: 700 clamp(26px, 8vw, 34px)/1 var(--slab); text-transform: uppercase;
}
.tile.typed { --line: #8d8d8d; }
.tile.pop { animation: pop 0.1s var(--ease); }
.tile.hit { --bg: var(--hit); --line: var(--hit); --fg: #fff; }
.tile.close { --bg: var(--close); --line: var(--close); --fg: #fff; }
.tile.miss { --bg: var(--miss); --line: var(--miss); --fg: #fff; }

/* the new row turns over one tile at a time, showing its color halfway through */
.row.reveal .tile { animation: flip 0.5s ease-in-out backwards; animation-delay: calc(var(--i) * 300ms); }
@keyframes flip {
  0%, 49% { background: var(--paper); color: var(--ink); border-color: #8d8d8d; }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); background: var(--bg); color: var(--fg); border-color: var(--line); }
  100% { transform: rotateX(0); background: var(--bg); color: var(--fg); border-color: var(--line); }
}
@keyframes pop { 50% { transform: scale(1.08); } }
.row.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.row.win .tile { animation: hop 0.45s var(--ease); animation-delay: calc(var(--i) * 90ms); }
@keyframes hop { 40% { transform: translateY(-14px); } }

.keys { display: grid; gap: 8px; width: 100%; max-width: 500px; margin: 0 auto; user-select: none; }
.krow { display: flex; gap: 6px; justify-content: center; }
.krow:nth-child(2) { padding: 0 5%; }
.key {
  flex: 1; display: grid; place-items: center; height: 56px; padding: 0; min-width: 0;
  border: 0; border-radius: 6px; background: #e4e6e9; color: var(--ink); cursor: pointer;
  font: 700 15px var(--ui); text-transform: uppercase;
}
.key:hover { background: #d8dbdf; }
.key.wide { flex: 1.5; font-size: 12px; }
.key svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.key.hit { background: var(--hit); color: #fff; }
.key.close { background: var(--close); color: #fff; }
.key.miss { background: var(--miss); color: #fff; }

/* modals */
.answer { letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.d-sub a { color: var(--ink); text-underline-offset: 2px; }
.ex { display: flex; gap: 4px; margin: 14px 0 6px; }
.ex i {
  display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--rule); border-radius: 5px;
  font: 700 21px/1 var(--slab); font-style: normal; text-transform: uppercase;
}
.ex i.hit { background: var(--hit); border-color: var(--hit); color: #fff; }
.ex i.close { background: var(--close); border-color: var(--close); color: #fff; }
.ex i.miss { background: var(--miss); border-color: var(--miss); color: #fff; }
.hard { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: var(--wash); font-size: 14px; line-height: 1.4; cursor: pointer; }
.hard input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--hit); }
.hard b { display: block; font-size: 15px; }

@media (max-height: 640px) {
  .key { height: 48px; }
  .board { width: min(280px, 100%); }
}
@media (prefers-reduced-motion: reduce) {
  .row.reveal .tile, .tile.pop, .row.shake, .row.win .tile { animation: none; }
}
