/* Fünferlei: letter tiles, on-screen keyboard (QWERTZ with Ä, Ö, Ü), flip animation */

/* familiar word-game logic (green = right place, yellow = elsewhere, grey = not in the word),
   in our own shades: fresher green, warm amber, blue-grey from the site palette */
:root { --w-good: #3f9e6e; --w-mid: #e2a93b; --w-far: #7f8ea3; --w-key: #d5dee9; }
@media (prefers-color-scheme: dark) {
  :root { --w-good: #3a8f63; --w-mid: #cf9530; --w-far: #34445a; --w-key: #5d6f88; }
}
html.halloween { --w-good: #3a8f63; --w-mid: #cf9530; --w-far: #34445a; --w-key: #5d6f88; }

.modes { display: flex; gap: 6px; margin: 6px 0 4px; padding: 4px; background: var(--track); border-radius: 999px; }
.modes a {
  flex: 1; padding: 8px 10px; text-align: center; border-radius: 999px;
  font-weight: 700; color: var(--muted); text-decoration: none;
}
.modes a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---------- board ---------- */
.board { --size: min(60px, calc((100vw - 64px) / 5)); display: grid; gap: 6px; justify-content: center; margin: 10px 0 4px; }
.row { display: grid; grid-template-columns: repeat(5, var(--size)); gap: 6px; }
.tile {
  display: flex; align-items: center; justify-content: center;
  width: var(--size); height: var(--size);
  font: 800 calc(var(--size) * 0.5) / 1 "Outfit", sans-serif;
  text-transform: uppercase;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  user-select: none;
}
.tile.filled { border-color: var(--muted); animation: type 0.12s ease-out; }
.tile.good, .tile.mid, .tile.far { border-color: transparent; }
.tile.good { --c: var(--w-good); --t: #fff; }
.tile.mid { --c: var(--w-mid); --t: #fff; }
.tile.far { --c: var(--w-far); --t: #fff; }
.tile.good, .tile.mid, .tile.far { background: var(--c); color: var(--t); }

/* the row just played flips tile by tile; colours switch at half-turn (see app.js: --i = position) */
.row.reveal .tile { animation: flip 0.5s ease-in-out both; animation-delay: calc(var(--i) * 0.22s); }
.row.shake { animation: shake 0.4s; }
.row.win .tile { animation: jump 0.5s ease-out both; animation-delay: calc(1.2s + var(--i) * 0.08s); }
.row.reveal.win .tile {
  animation: flip 0.5s ease-in-out both, jump 0.5s ease-out both;
  animation-delay: calc(var(--i) * 0.22s), calc(1.2s + var(--i) * 0.08s);
}

@keyframes type { 50% { transform: scale(1.1); } }
@keyframes flip {
  0% { transform: rotateX(0); background: var(--card); color: var(--text); border-color: var(--muted); }
  49% { background: var(--card); color: var(--text); border-color: var(--muted); }
  50% { transform: rotateX(90deg); background: var(--c); color: var(--t); border-color: transparent; }
  100% { transform: rotateX(0); }
}
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes jump { 40% { transform: translateY(-16px); } 70% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) {
  .row.reveal .tile, .row.shake, .row.win .tile, .tile.filled { animation: none; }
}

/* ---------- keyboard ---------- */
.keyboard { display: grid; gap: 6px; margin: 12px -6px 0; user-select: none; }
.keyboard[hidden] { display: none; }
.krow { display: flex; gap: 4px; justify-content: center; }
.key {
  flex: 1 1 0; min-width: 0; height: 52px; padding: 0;
  font: 700 1.05rem "DM Sans", sans-serif;
  color: var(--text);
  background: var(--w-key);
  border: 0; border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.key.wide { flex-grow: 1.7; font-size: 0.8rem; }
.key:active { transform: translateY(1px); filter: brightness(0.92); }
.key.good { background: var(--w-good); color: #fff; }
.key.mid { background: var(--w-mid); color: #fff; }
.key.far { background: var(--w-far); color: #fff; }

/* ---------- result ---------- */
.result { margin-top: 12px; text-align: center; }
.result .word { font: 900 2rem "Outfit", sans-serif; letter-spacing: 0.12em; margin: 4px 0; }
.result .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.result .def { font-size: 0.9rem; }

/* how-to + stats */
.demo { display: flex; gap: 6px; margin: 8px 0 12px; --size: 40px; }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; }
.chip.good { background: var(--w-good); } .chip.mid { background: var(--w-mid); } .chip.far { background: var(--w-far); }
.dist { display: grid; gap: 4px; margin-top: 10px; }
.dist div { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font-weight: 700; }
.dist i {
  display: block; min-width: 24px; padding: 2px 8px; border-radius: 6px;
  background: var(--far); color: var(--text); font-style: normal; text-align: right;
}
.dist i.best { background: var(--w-good); color: #fff; }
