:root {
  --rfw-bg: #0a0a0a;
  --rfw-panel: #0f172a;
  --rfw-panel-2: #111827;
  --rfw-text: #e2e8f0;
  --rfw-muted: #94a3b8;
  --rfw-accent: #3b82f6;
  --rfw-accent-2: #60a5fa;
  --rfw-border: #1e3a5f;
  --rfw-good: #4ade80;
  --rfw-bad: #f87171;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #0a0a0a; color: var(--rfw-text); }
body {
  min-height: 100vh;
  background-color: #0a0a0a;
  background-image: linear-gradient(rgba(10, 10, 10, 0.75), rgba(10, 10, 10, 0.85)), url('/images/background.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.rfw-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px 32px;
}

.rfw-header {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.back-link {
  display: inline-block;
  width: fit-content;
  color: #60a5fa;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 0;
  margin-bottom: 8px;
}
.back-link:hover { text-decoration: underline; }


.eyebrow {
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--rfw-accent-2);
  font-weight: 800;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(2rem, 8vw, 3.2rem); }
.rfw-header p { color: var(--rfw-muted); margin-bottom: 0; }

.game-grid { display: grid; gap: 14px; }

.game-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 15px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--rfw-border);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--rfw-panel), var(--rfw-panel-2));
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transition: transform .15s ease, border-color .15s ease;
}

a.game-card:active { transform: scale(.985); }
a.game-card:focus-visible { outline: 3px solid var(--rfw-accent); outline-offset: 3px; }

.game-icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: rgba(77,179,255,.10);
  font-size: 1.7rem;
}

.game-card h2 { margin-bottom: 5px; font-size: 1.2rem; }
.game-card p { margin-bottom: 8px; color: var(--rfw-muted); line-height: 1.4; }
.game-meta { color: var(--rfw-accent-2); font-size: .76rem; font-weight: 800; letter-spacing: .03em; }
.play-arrow { white-space: nowrap; color: var(--rfw-accent-2); font-weight: 900; }
.coming-soon { opacity: .72; }

.game-topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-right: 56px;
}
.game-topbar .title { font-weight: 900; }
.game-topbar .stats { color: var(--rfw-muted); font-size: .9rem; text-align: right; }

.game-panel {
  border: 1px solid var(--rfw-border);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--rfw-panel), var(--rfw-panel-2));
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
}

.word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
  min-height: 70px;
  margin: 18px 0;
  padding: 4px 0;
}
.word-group {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 5px;
  white-space: nowrap;
  justify-content: center;
}
.letter-slot {
  width: 30px;
  min-width: 30px;
  border-bottom: 3px solid var(--rfw-accent);
  padding: 4px 2px 7px;
  text-align: center;
  font-size: clamp(1.35rem, 5vw, 2.2rem);
  font-weight: 900;
  line-height: 1;
}
.letter-slot.space { border-bottom: 0; width: 12px; min-width: 12px; }
.letter-slot {
  min-width: 25px;
  border-bottom: 3px solid var(--rfw-accent);
  padding: 4px 4px 7px;
  text-align: center;
  font-size: clamp(1.35rem, 7vw, 2.2rem);
  font-weight: 900;
}
.letter-slot.space { border-bottom: 0; min-width: 12px; }

.hangman-status {
  text-align: center;
  color: var(--rfw-muted);
  margin-bottom: 16px;
}

.keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 6px;
  box-sizing: border-box;
}
.key-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 100%;
}
.key-row.row-2,
.key-row.row-3 {
  width: 100%;
}
.key {
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  max-width: 42px;
  min-height: 54px;
  border: 1px solid var(--rfw-border);
  border-radius: 10px;
  background: #1e293b;
  color: var(--rfw-text);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
  line-height: 1;
}
.key:active { transform: scale(.96); }
.key:disabled { cursor: default; opacity: .36; }
.key.correct { background: rgba(114,213,114,.22); border-color: rgba(114,213,114,.55); }
.key.wrong { background: rgba(255,119,119,.18); border-color: rgba(255,119,119,.45); }

.engine-message {
  min-height: 28px;
  margin: 14px 0 0;
  text-align: center;
  font-weight: 800;
}
.engine-message.good { color: var(--rfw-good); }
.engine-message.bad { color: var(--rfw-bad); }

.results {
  text-align: center;
  padding: 10px 0 4px;
}
.results h2 { font-size: 1.8rem; }
.result-number { font-size: 2.5rem; font-weight: 900; margin: 6px 0 16px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.result-cell { background: rgba(255,255,255,.05); border-radius: 12px; padding: 12px 6px; }
.result-cell strong { display: block; font-size: 1.15rem; }
.result-cell span { color: var(--rfw-muted); font-size: .72rem; }
.primary-btn {
  width: 100%; min-height: 52px;
  border: 2px solid #60a5fa; border-radius: 12px;
  background: #1d4ed8;
  color: #fff; font-weight: 800; font-size: 1rem;
  cursor: pointer;
}
.secondary-btn {
  width: 100%; min-height: 48px; margin-top: 9px;
  border: 2px solid #1e3a5f; border-radius: 12px;
  background: #0f172a; color: #93c5fd; font-weight: 700; cursor: pointer;
}

@media (max-width: 560px) {
  .game-card { grid-template-columns: auto 1fr; }
  .play-arrow { grid-column: 2; }
  .key {
    width: 32px;
    min-width: 32px;
    min-height: 52px;
    font-size: 1.12rem;
  }
}
/* end mobile game-card */

/* keyboard note - main rules above */


/* RFW site hamburger (games pages) */
.menu-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  background: rgba(15,15,15,0.9);
  border: 1px solid #333;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 10000;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.side-menu {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: #111;
  border-left: 1px solid #222;
  z-index: 9999;
  transition: right 0.3s ease;
  padding: 90px 24px 40px;
  overflow-y: auto;
}
.side-menu.open { right: 0; }
.side-menu a {
  display: block;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 14px 0;
  border-bottom: 1px solid #222;
  font-weight: 600;
}
.side-menu a:hover { color: #60a5fa; }
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.menu-overlay.show { opacity: 1; visibility: visible; }


/* Tic-Tac-Toe win pulse */
@keyframes rfw-win-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59,130,246,0.6); }
  40% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(59,130,246,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
.cell.win {
  animation: rfw-win-pulse 0.55s ease-out 2;
  background: rgba(59, 130, 246, 0.22) !important;
  border-color: #60a5fa !important;
  color: #fff !important;
}
