/* Games page — extends landing visual system */

/* Keep footer at the bottom when hub content is short */
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100svh;
}
#main {
  flex: 1 0 auto;
}
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

.games-hero {
  min-height: unset !important;
  padding-top: calc(var(--header-h) + 1.35rem) !important;
  padding-bottom: 0 !important;
}
.games-hero .hero-rail,
.games-hero .hero-inner {
  padding-bottom: 0;
}
.games-hero .hero-title {
  max-width: none;
  margin: 0;
  text-transform: none;
}
.games-lead {
  margin: 0.55rem 0 0;
  max-width: 36rem;
  font-family: var(--font-body);
  font-size: clamp(0.98rem, 1.7vw, 1.12rem);
  line-height: 1.45;
  color: var(--ink-soft);
}

.games-stack {
  gap: 0.85rem;
  padding-top: 0.55rem !important;
}

/* ── Hub cards ── */
.games-hub {
  width: 100%;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
  align-items: stretch;
}
.game-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.1rem;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  padding: 1.25rem 1.2rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(51, 51, 51, 0.09);
  border-color: #d5dde6;
}
.game-card:focus-within {
  border-color: #c9d4df;
}
.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1 1 auto;
}
.game-card-title {
  margin: 0;
  font-family: var(--font-sub);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.3;
}
.game-card-desc {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
  flex: 1 1 auto;
}
.game-card-meta {
  margin: 0.35rem 0 0;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--sage);
}
.game-card-play {
  align-self: flex-start;
  min-height: 44px;
  gap: 0.15rem;
}
.game-card-play:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.game-card-play:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Game stage ── */
.games-stage {
  width: 100%;
}
.back-to-games {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0 0 0.65rem;
  padding: 0.25rem 0.15rem;
  border: none;
  background: transparent;
  font-family: var(--font-sub);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--ease), transform 0.15s ease;
}
.back-to-games:hover {
  color: var(--accent);
}
.back-to-games:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.game-panel {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.game-screen-title {
  margin-bottom: 0.45rem !important;
}
.game-screen-lead {
  margin: 0 0 0.35rem;
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.game-screen-meta {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--sage);
}
.game-how,
.game-screen-how {
  margin: 0 0 0.75rem;
  max-width: 40rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.game-panel.is-playing .game-screen-lead,
.game-panel.is-playing .game-screen-how {
  display: none;
}
.game-start {
  margin-top: 0.35rem;
}
.game-start-meta {
  margin: 0 0 0.25rem;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--sage);
}
.quiz-progress {
  height: 4px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.quiz-progress > span {
  display: block;
  height: 100%;
  background: var(--sage);
  transition: width 0.25s ease;
}
.quiz-score-live {
  font-weight: 700;
  color: var(--ink);
}
.quiz-feedback {
  margin-top: 0.95rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fafbfc;
}
.quiz-feedback-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.quiz-feedback-title.is-ok { color: #4f7d5c; }
.quiz-feedback-title.is-bad { color: #a85b4f; }
.quiz-feedback-sub,
.quiz-feedback-answer,
.quiz-feedback-explain {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.quiz-next-row {
  margin-top: 0.85rem;
}
.game-option {
  position: relative;
}
.game-option-mark {
  margin-left: auto;
  font-family: var(--font-sub);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 1rem;
  text-align: center;
}
.game-option.is-correct .game-option-mark { color: #4f7d5c; }
.game-option.is-wrong .game-option-mark { color: #a85b4f; }
.quiz-result-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
}
.level-result-points {
  margin: 0.35rem 0 0;
  font-family: var(--font-sub);
  font-size: 0.9rem;
  color: var(--muted);
}
.rt-session-done {
  margin-top: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(165deg, #fff 0%, #f4f8fc 100%);
}
.rt-done-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-sub);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.rt-done-msg {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.game-eyebrow {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}
.game-filters {
  margin: 1rem 0 0;
}
.filter-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-sub);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.filter-chip {
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fafbfc;
  font-family: var(--font-sub);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform 0.18s ease;
}
.filter-chip:hover {
  color: var(--ink);
  border-color: #c9d4df;
}
.filter-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.filter-chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.filter-chip:active {
  transform: scale(0.98);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
}
.rt-main-actions {
  margin-top: 1rem;
  justify-content: flex-start;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn.ghost:hover {
  background: #eef4fa;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topic-result {
  margin-top: 1.35rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(160deg, #fbfcfd 0%, #f3f7fb 100%);
  animation: gameIn 0.35s ease;
}
.topic-result-label {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage);
}
.topic-result-text {
  margin: 0 0 1rem;
  font-family: var(--font-display, "DM Serif Display", serif);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  line-height: 1.35;
  color: var(--ink);
}
.topic-block h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-sub);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
.topic-block ul {
  margin: 0 0 0.95rem;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}
.topic-block li + li { margin-top: 0.25rem; }

.idiom-card,
.level-card,
.idiom-result,
.level-result {
  margin-top: 1.15rem;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  animation: gameIn 0.35s ease;
}
.idiom-meta,
.level-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.85rem;
  font-family: var(--font-sub);
  font-size: 0.82rem;
  color: var(--muted);
}
.idiom-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 4.5rem;
  font-weight: 700;
  color: var(--ink);
}
.idiom-timer-bar {
  height: 4px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.idiom-timer-bar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--sage);
  transform-origin: left center;
  transition: width 0.2s linear;
}
.idiom-prompt,
.level-prompt {
  margin: 0 0 1rem;
  font-family: var(--font-display, "DM Serif Display", serif);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.3;
  color: var(--ink);
}
.game-options {
  display: grid;
  gap: 0.55rem;
}
.game-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fafbfc;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform 0.15s ease;
}
.game-option:hover:not(:disabled) {
  background: #eef4fa;
  border-color: #c9d4df;
}
.game-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.game-option:active:not(:disabled) {
  transform: scale(0.99);
}
.game-option-key {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #e8eef4;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.game-option.is-correct {
  border-color: #6f9e7c;
  background: #eef7f1;
}
.game-option.is-wrong {
  border-color: #c9847a;
  background: #fbf0ee;
}
.game-option:disabled {
  cursor: default;
  opacity: 0.95;
}

.idiom-feedback,
.level-feedback {
  margin-top: 0.85rem;
  font-family: var(--font-sub);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.related-idioms {
  margin-top: 1.1rem;
}
.related-idioms h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-sub);
  font-size: 0.95rem;
}
.related-item {
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}
.related-item strong {
  display: block;
  font-family: var(--font-sub);
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.related-item span,
.related-item em {
  display: block;
  font-style: normal;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.level-result-card {
  text-align: center;
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(165deg, #fff 0%, #f4f8fc 100%);
  margin-top: 1rem;
}
.level-result-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
}
.level-result-score {
  margin: 0;
  font-family: var(--font-display, "DM Serif Display", serif);
  font-size: clamp(2.2rem, 5vw, 3rem);
  line-height: 1.1;
  color: var(--ink);
}
.level-result-verdict {
  margin: 0.75rem auto 0;
  max-width: 28ch;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.level-result-cta {
  margin-top: 1.15rem;
}

.idiom-score-line {
  margin: 0 0 0.5rem;
  font-family: var(--font-display, "DM Serif Display", serif);
  font-size: 1.65rem;
  color: var(--ink);
}
.idiom-score-msg {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ── Random Topic generator ── */
.rt-panel .rt-body {
  max-width: 40rem;
}
.rt-controls {
  margin-top: 0.35rem;
}
.rt-result {
  margin-top: 1.5rem;
}
.rt-card {
  padding: 1.2rem 1.25rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(165deg, #ffffff 0%, #f4f8fc 100%);
}
.rt-card.rt-card-in {
  animation: gameIn 0.32s ease;
}
.rt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.rt-meta {
  margin: 0;
  font-family: var(--font-sub);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}
.rt-copy {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.rt-copy:hover {
  color: var(--ink);
  border-color: #c9d4df;
  background: #eef4fa;
}
.rt-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.rt-topic {
  margin: 0 0 1rem;
  font-family: var(--font-display, "DM Serif Display", serif);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 400;
  line-height: 1.28;
  color: var(--ink);
}
.topic-block h3,
.topic-block h4 {
  margin: 0 0 0.45rem;
  font-family: var(--font-sub);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
.topic-block ul,
.topic-block ol {
  margin: 0 0 0.95rem;
  padding-left: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}
.topic-block li + li { margin-top: 0.28rem; }
.rt-follow {
  margin: 0 0 0.95rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.rt-session {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}
.rt-timer {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fafbfc;
}
.rt-timer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.rt-timer-label {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.rt-timer-clock {
  font-family: var(--font-sub);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
  max-width: 70%;
}
.rt-timer-track {
  height: 10px;
  border-radius: 999px;
  background: #e6edf4;
  overflow: hidden;
}
.rt-timer-track > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), #7aa88a);
  transform-origin: left center;
  transition: width 0.2s linear;
}
.rt-timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.rt-timer-controls .btn {
  min-height: 44px;
  min-width: 5.5rem;
}
.rt-after {
  justify-content: flex-start;
}

/* ── Spider-Man Who Said It ── */
.sm-wrap { margin-top: 0.75rem; }
.sm-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 0.75rem;
  font-family: var(--font-sub);
  font-size: 0.85rem;
  color: var(--muted);
}
.sm-board-wrap { position: relative; }
.sm-board {
  position: relative;
  z-index: 2;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(165deg, #fff 0%, #f4f8fc 100%);
}
.sm-web {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
.sm-heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}
.sm-heads h3 {
  margin: 0;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}
.sm-rows {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  min-height: 64px;
  align-items: stretch;
}
.sm-quote,
.sm-card {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fafbfc;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
  position: relative;
  z-index: 4;
}
.sm-quote { gap: 0.65rem; }
.sm-card {
  justify-content: center;
  font-family: var(--font-sub);
  font-weight: 700;
  text-align: center;
}
.sm-quote:hover:not(:disabled),
.sm-card:hover:not(:disabled) {
  border-color: #c9d4df;
  background: #eef4fa;
}
.sm-quote:focus-visible,
.sm-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sm-quote.is-selected,
.sm-card.is-selected {
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(120, 146, 132, 0.25);
  background: #eef4f1;
}
.sm-quote.is-bad,
.sm-card.is-bad {
  border-color: #c9847a !important;
  background: #fbf0ee !important;
}
.sm-quote.is-ok,
.sm-card.is-ok {
  border-color: #6f9e7c !important;
  background: #eef7f1 !important;
}
.sm-quote.is-matched,
.sm-card.is-used {
  border-color: #6f9e7c;
  background: #f3faf5;
  cursor: default;
  opacity: 0.95;
}
.sm-num {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  font-weight: 700;
  pointer-events: none;
}
.sm-quote-text {
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: none;
}
.sm-actions { margin-top: 0.85rem; }

@keyframes gameIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .games-hero {
    padding-top: calc(var(--header-h) + 1rem) !important;
  }
  .games-lead {
    font-size: 0.95rem;
  }
  .games-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .game-card {
    padding: 1.1rem 1rem;
  }
  .game-card:hover {
    transform: none;
  }
  .game-card-play {
    width: 100%;
    justify-content: center;
  }
  .filter-chip { min-height: 44px; }
  .rt-main-actions .btn {
    width: 100%;
  }
  .idiom-card,
  .level-card,
  .topic-result,
  .rt-card { padding: 1rem; }
  .rt-timer-controls .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }
  .rt-timer-clock {
    font-size: 0.98rem;
    max-width: 65%;
  }
  .sm-heads,
  .sm-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
  .sm-heads h3:last-child { margin-top: 0.35rem; }
  .sm-quote-text { font-size: 0.86rem; }
}

@media (hover: none) {
  .game-card:hover {
    transform: none;
    box-shadow: var(--shadow);
    border-color: var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-result,
  .rt-card.rt-card-in,
  .idiom-card,
  .level-card,
  .idiom-result,
  .level-result,
  .filter-chip,
  .game-option,
  .game-card,
  .rt-timer-track > span {
    animation: none;
    transition: none;
  }
}
