/* Typing game page — everything is scoped to #game so the rest of the site is untouched. */
.wr-hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 24px 0 14px; padding: 14px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.wr-hearts { display: flex; gap: 4px; font-size: 26px; line-height: 1; color: var(--error); }
.wr-heart { transition: transform .2s, opacity .2s; }
.wr-heart.lost { opacity: .2; transform: scale(.7); filter: grayscale(1); }
.wr-stat { display: flex; flex-direction: column; }
.wr-stat span { font-size: 14px; color: var(--muted); }
.wr-stat strong { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* Game panel: dark scene with light text, whatever the site theme */
.wr-panel { --wr-text: #f1f2fc; --wr-muted: #aab1d8; --wr-gold: #ffd7a3; --wr-rose: #ff92a5; --pill: rgba(38,44,92,.6); --veil: rgba(38,44,92,.55);
  position: relative; height: clamp(440px, 64vh, 720px); overflow: hidden; border-radius: 20px; border: 1px solid var(--line); background: #2a2f60; color: var(--wr-text); box-shadow: 0 18px 40px -24px rgba(20,33,61,.45); }
.wr-panel[data-scene=autumn] { --pill: rgba(80,40,10,.62); --veil: rgba(80,40,10,.5); }
.wr-panel[data-scene=forest] { --pill: rgba(2,58,38,.68); --veil: rgba(2,58,38,.5); }
.wr-panel[data-scene=rainy] { --pill: rgba(40,55,70,.68); --veil: rgba(40,55,70,.5); }
.wr-panel[data-scene=stormy] { --pill: rgba(10,14,28,.72); --veil: rgba(10,14,28,.55); }
.wr-panel::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; z-index: 3; background: var(--wr-rose); box-shadow: 0 0 14px 3px rgba(255,146,165,.55); opacity: .8; }
.wr-panel.hit { animation: wr-hit .3s; }
@keyframes wr-hit { 0%, 100% { box-shadow: none; } 50% { box-shadow: inset 0 -40px 40px -20px rgba(255,146,165,.5); } }

/* scenes */
.wr-scene { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.wr-scene svg { width: 100%; height: 100%; display: none; }
.wr-panel[data-scene=lake] svg[data-s=lake], .wr-panel[data-scene=autumn] svg[data-s=autumn], .wr-panel[data-scene=forest] svg[data-s=forest],
.wr-panel[data-scene=rainy] svg[data-s=rainy], .wr-panel[data-scene=stormy] svg[data-s=stormy] { display: block; }
.wr-scene .cl { animation: wr-cl 70s ease-in-out infinite alternate; }
.wr-scene .cl2 { animation-duration: 100s; animation-direction: alternate-reverse; }
@keyframes wr-cl { to { transform: translateX(70px); } }
.wr-scene .lf { animation: wr-fall linear infinite; }
@keyframes wr-fall { from { transform: translate(var(--x), -20px) rotate(0); } to { transform: translate(calc(var(--x) + 70px), 520px) rotate(300deg); } }
.wr-scene .dr { animation: wr-drop linear infinite; }
@keyframes wr-drop { from { transform: translate(var(--x), -30px); } to { transform: translate(calc(var(--x) - var(--s)), 540px); } }
.wr-scene .rp { transform-box: fill-box; transform-origin: center; animation: wr-rip 1.8s ease-out infinite; }
@keyframes wr-rip { from { transform: scale(.2); opacity: .8; } to { transform: scale(1.5); opacity: 0; } }
.wr-scene .bolt, .wr-scene .fl { opacity: 0; animation-iteration-count: infinite; }
.wr-scene .bolt { animation-name: wr-bolt; } .wr-scene .fl { animation-name: wr-flash; }
@keyframes wr-bolt { 0%, 88%, 100% { opacity: 0; } 90% { opacity: 1; } 91% { opacity: .1; } 93% { opacity: .95; } 96% { opacity: 0; } }
@keyframes wr-flash { 0%, 88%, 100% { opacity: 0; } 90% { opacity: .4; } 91% { opacity: .05; } 93% { opacity: .35; } 96% { opacity: 0; } }
.wr-scene .sw { transform-box: fill-box; transform-origin: 50% 100%; animation: wr-sway 2.6s ease-in-out infinite alternate; }
@keyframes wr-sway { from { transform: rotate(-2deg); } to { transform: rotate(2.5deg); } }

/* falling words */
.wr-word { position: absolute; z-index: 2; top: 0; left: 0; padding: 4px 13px; border-radius: 999px; background: var(--pill); backdrop-filter: blur(3px); border: 1.5px solid rgba(225,228,255,.35); font-family: var(--mono); font-size: 18px; font-weight: 500; white-space: nowrap; will-change: transform; color: var(--wr-text); text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.wr-word.target { border-color: var(--wr-gold); box-shadow: 0 0 16px rgba(255,215,163,.5); }
.wr-word .done { color: var(--wr-gold); }
.wr-pop { position: absolute; z-index: 3; color: #b4e8d0; font-weight: 800; pointer-events: none; animation: wr-up .7s forwards; }
@keyframes wr-up { to { transform: translateY(-30px); opacity: 0; } }

/* overlays and buttons inside the panel */
.wr-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; overflow-y: auto; background: var(--veil); backdrop-filter: blur(4px); }
.wr-overlay h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.wr-overlay p { margin: 0; max-width: 420px; color: var(--wr-muted); }
.wr-options { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wr-choice { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; color: var(--wr-muted); }
.wr-btn { border: 0; cursor: pointer; padding: 11px 22px; border-radius: 999px; font-weight: 600; background: var(--wr-gold); color: #2a2f5e; }
.wr-btn:hover { filter: brightness(1.05); }
.wr-btn.ghost { padding: 8px 15px; background: transparent; color: var(--wr-text); border: 2px solid rgba(225,228,255,.35); }
.wr-btn.ghost.on { background: var(--wr-text); color: #232a4d; border-color: var(--wr-text); }
.wr-x { position: absolute; top: 10px; right: 10px; z-index: 6; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.35); background: rgba(255,255,255,.16); color: var(--wr-text); font-size: 16px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px); }
.wr-x:hover { background: rgba(255,255,255,.3); }
.wr-panel :focus-visible { outline: 2px solid var(--wr-gold); }
.hidden { display: none !important; }

/* typing bar under the panel */
.wr-bar { display: flex; gap: 10px; margin-top: 14px; }
.wr-input { flex: 1; min-width: 0; padding: 12px 18px; font-family: var(--mono); font-size: 20px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; outline: none; }
.wr-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wr-input.bad, .wr-input.bad:focus { border-color: var(--error); box-shadow: 0 0 0 3px rgba(214,51,108,.14); }
.wr-note { margin: 14px 0 0; }

@media (max-width: 700px) {
  .wr-hud { padding: 12px 14px; gap: 12px; margin-top: 18px; }
  .wr-stat strong { font-size: 20px; }
  .wr-hearts { font-size: 22px; }
  .wr-panel { height: min(62vh, 540px); border-radius: 16px; }
  .wr-word { font-size: 16px; }
  .wr-input { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .wr-panel *, .wr-panel { animation: none !important; transition: none !important; } }

/* "Practice game" shortcut on the Test page (right side of the heading) */
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.game-link { display: inline-flex; align-items: center; gap: 12px; margin-top: 4px; padding: 10px 16px 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; text-align: left; transition: border-color .15s, transform .15s, box-shadow .15s; }
.game-link:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 10px 22px -14px rgba(47,91,234,.55); }
.game-link-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.game-link-text { display: flex; flex-direction: column; line-height: 1.2; }
.game-link-text strong { font-size: 15px; font-weight: 600; }
.game-link-text small { font-size: 13px; color: var(--muted); }
.game-link-arrow { margin-left: 4px; color: var(--accent); font-size: 18px; transition: transform .15s; }
.game-link:hover .game-link-arrow { transform: translateX(3px); }
@media (max-width: 700px) { .game-link { width: 100%; margin: 0 0 18px; } .game-link-arrow { margin-left: auto; } }

/* ---- Game page fits the screen: no scrolling, wide, centred, minimal text ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.game-mode { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.game-mode .site-header { flex: none; width: min(1280px, calc(100% - 32px)); min-height: 60px; }
body.game-mode .container { flex: 1; min-height: 0; display: flex; flex-direction: column; width: min(1280px, calc(100% - 32px)); padding: 0 0 16px; }
body.game-mode #game.active-page { display: flex; flex-direction: column; flex: 1; min-height: 0; }
body.game-mode .wr-hud { flex: none; margin: 0 0 10px; padding: 8px 18px; gap: 12px; border-radius: 14px; }
body.game-mode .wr-hearts { font-size: 22px; }
body.game-mode .wr-stat { flex-direction: row; align-items: baseline; gap: 7px; }
body.game-mode .wr-stat span { font-size: 13px; }
body.game-mode .wr-stat strong { font-size: 20px; }
body.game-mode .wr-panel { flex: 1; height: auto; min-height: 200px; }
body.game-mode .wr-bar { flex: none; margin-top: 10px; }
body.game-mode .wr-input { padding: 10px 16px; }
@media (max-width: 700px) {
  body.game-mode .site-header, body.game-mode .container { width: calc(100% - 20px); }
  body.game-mode .wr-hud { padding: 6px 12px; gap: 6px 12px; }
  body.game-mode .wr-stat strong { font-size: 17px; }
  body.game-mode .wr-hearts { font-size: 19px; }
}
@media (max-height: 420px) { body.game-mode { height: auto; min-height: 100vh; overflow: auto; } body.game-mode .wr-panel { min-height: 240px; } }
