/*
 * Reference-informed Train + game identity layer.
 * Presentation only: game rules, progression, Premium gating and API contracts
 * remain owned by the existing runtime.
 */

/* -------------------------------------------------------------------------
   TRAIN: editorial chooser instead of a uniform dashboard
   ------------------------------------------------------------------------- */

.train-view {
  --train-rule: #2d363b;
}

.train-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: end;
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--train-rule);
}

.train-hero-copy {
  max-width: 720px;
}

.train-hero h1 {
  margin: 10px 0 16px;
  font-size: clamp(3rem, 6vw, 5.75rem);
  line-height: .92;
  letter-spacing: -.075em;
}

.train-hero h1 span {
  color: var(--accent);
}

.train-hero p {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1rem;
}

.train-hero-aside {
  display: grid;
  gap: 8px;
  min-width: 210px;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: .82rem;
}

.train-hero-aside > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.train-hero-aside strong {
  min-width: 1.2em;
  color: var(--text);
  font: 500 1.45rem var(--heading);
}

.train-hero-aside .text-link {
  width: max-content;
  margin-top: 7px;
}

.train-games-heading {
  align-items: end;
  margin: 34px 0 18px;
}

.train-games-heading .eyebrow {
  margin-bottom: 5px;
}

.train-games-heading h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  letter-spacing: -.045em;
}

.train-game-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.train-game-grid .game-card {
  isolation: isolate;
  min-height: 330px;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--game-color) 6%, transparent), transparent 46%),
    #171d22;
  overflow: hidden;
}

.train-game-grid .game-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--game-color);
  opacity: .72;
}

.train-game-grid .game-card-heading {
  margin-bottom: 12px;
  flex-wrap: nowrap;
}

.train-game-grid .game-card-heading > div {
  display: grid;
  gap: 2px;
}

.game-card-number {
  color: #738087;
  font: 500 .68rem var(--heading);
  letter-spacing: .12em;
}

.train-game-grid .daily-free-label {
  margin-left: auto;
}

.game-card-main {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 98px;
  gap: 10px;
  align-items: stretch;
}

.game-card-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.train-game-grid .game-card h3 {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 1.85vw, 1.8rem);
  letter-spacing: -.055em;
}

.train-game-grid .game-instruction {
  margin-top: 0;
  margin-bottom: 0;
  max-width: 34ch;
  min-height: 34px;
  color: #a5b1b5;
  font-size: .76rem;
  line-height: 1.45;
}

.game-card-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 98px;
  border-top: 1px solid color-mix(in srgb, var(--game-color) 24%, var(--train-rule));
  border-left: 0;
  padding: 14px 4px 0;
  color: var(--game-color);
  overflow: visible;
}

.game-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 10px;
  padding-top: 4px;
  border-top: 1px solid var(--train-rule);
}

.train-game-grid .game-level-seed {
  gap: 6px;
}

.train-game-grid .game-level-seed strong {
  font-size: 1.15rem;
}

.train-game-grid .best-note {
  margin: 0;
  max-width: 64%;
  text-align: right;
  font-size: .67rem;
}

.train-game-grid .game-card-actions {
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.train-game-grid .game-card-actions .secondary,
.train-game-grid .game-card-actions .quiet {
  min-height: 44px;
}

.train-game-grid .game-card-actions .secondary {
  border: 1px solid color-mix(in srgb, var(--game-color) 45%, #364047);
  background: color-mix(in srgb, var(--game-color) 17%, #20282e);
  color: var(--text);
}

/* -------------------------------------------------------------------------
   THE EIGHT TRAIN IDENTITIES
   ------------------------------------------------------------------------- */

.identity-memory {
  display: grid;
  grid-template-columns: repeat(4, 18px);
  gap: 5px;
}

.identity-memory i {
  width: 18px;
  height: 18px;
  border: 1px solid #435047;
  border-radius: 5px;
  background: #222a2a;
}

.identity-memory i.on {
  border-color: var(--game-color);
  background: var(--game-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--game-color) 25%, transparent);
}

.identity-math {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 4px 8px;
  align-items: baseline;
  padding-bottom: 3px;
  font: 500 1.8rem/1.12 var(--heading);
  letter-spacing: -.08em;
}

.identity-math span,
.identity-math b,
.identity-math i,
.identity-pattern span,
.identity-pattern b,
.identity-hunt span,
.route-sequence span,
.sort-signal b,
.sort-bin {
  line-height: 1.15;
}

.identity-math b {
  color: #8f9ba1;
  font-size: 1.4rem;
}

.identity-math i {
  grid-column: 1 / -1;
  justify-self: end;
  position: relative;
  min-width: 42px;
  color: var(--game-color);
  font: 500 1rem var(--heading);
  font-style: normal;
  letter-spacing: .02em;
}

.identity-math i em,
.identity-math i strong {
  font: inherit;
  font-style: normal;
}

.identity-math i strong {
  position: absolute;
  right: 0;
  opacity: 0;
}

.identity-pattern {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 5px;
}

.identity-pattern span,
.identity-pattern b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 35px;
  border: 1px solid color-mix(in srgb, var(--game-color) 40%, #3b444a);
  border-radius: 6px;
  background: color-mix(in srgb, var(--game-color) 8%, #1e252a);
  font: 500 1rem var(--heading);
}

.identity-pattern b {
  position: relative;
  color: #151a1d;
  background: var(--game-color);
}

.identity-pattern b em,
.identity-pattern b strong {
  font: inherit;
  font-style: normal;
}

.identity-pattern b strong {
  position: absolute;
  opacity: 0;
}

.identity-pattern i {
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--game-color) 32%, #384147);
}

.identity-hunt {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 30px);
  gap: 5px;
}

.identity-hunt span {
  display: grid;
  place-items: center;
  height: 30px;
  border: 1px solid #3a4a50;
  border-radius: 6px;
  color: #a8bbc0;
  font: 500 .75rem var(--heading);
}

.identity-hunt .target {
  color: #101719;
  border-color: var(--game-color);
  background: var(--game-color);
  /* Keep the narrow '1' optically centered in the smaller animated cell. */
  line-height: 1;
  padding-bottom: 2px;
}

.identity-switch {
  display: grid;
  grid-template-columns: 89px 16px 89px;
  align-items: center;
  gap: 11px;
  width: 216px;
}

.identity-switch .switch-rule {
  display: grid;
  align-content: center;
  gap: 3px;
  width: 89px;
  height: 44px;
  padding-inline: 8px;
  border: 1px solid color-mix(in srgb, var(--game-color) 42%, #3b444a);
  border-radius: 8px;
  background: color-mix(in srgb, var(--game-color) 7%, #1e252a);
  text-align: center;
}

.identity-switch .switch-rule small {
  color: #8c969d;
  font: 600 .5rem/1.3 var(--body);
  letter-spacing: .12em;
}

.identity-switch .switch-rule strong {
  color: #e0e5e7;
  font: 650 .68rem/1 var(--heading);
  letter-spacing: .03em;
}

.identity-switch > b {
  color: var(--game-color);
  font: 500 1rem/1.2 var(--heading);
  text-align: center;
}

.identity-route {
  display: grid;
  grid-template-columns: 108px 10px 108px;
  gap: 7px;
  align-items: end;
  width: 100%;
}

.route-preview {
  display: grid;
  gap: 6px;
  width: 108px;
}

.route-preview small {
  justify-self: center;
  color: #83908b;
  font: 600 .5rem/1.2 var(--body);
  letter-spacing: .12em;
  text-align: center;
}

.route-sequence {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 108px;
}

.identity-route .route-sequence span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--game-color) 45%, #3b4741);
  border-radius: 7px;
  background: #1d2524;
  font: 600 .78rem/1 var(--heading);
}

.route-transform {
  align-self: end;
  justify-self: center;
  width: 10px;
  height: 38px;
  color: color-mix(in srgb, var(--game-color) 70%, #8d9994);
  font: 650 .48rem/1 var(--body);
  letter-spacing: .08em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
}

.route-recalled {
  opacity: .42;
}

.identity-word {
  display: grid;
  gap: 2px;
  width: 100%;
  font-family: var(--heading);
}

.identity-word > span {
  font-size: 1.28rem;
  line-height: 1;
  letter-spacing: -.055em;
}

.identity-word > span:first-child::first-letter,
.identity-word > span:nth-child(2)::first-letter {
  color: var(--game-color);
}

.identity-word i {
  margin-top: 12px;
  color: #8f9aa0;
  font: 600 .6rem var(--body);
  letter-spacing: .12em;
}

.identity-sort {
  display: grid;
  grid-template-columns: 38px 119px 30px;
  grid-template-rows: repeat(2, 38px);
  align-items: center;
  gap: 7px 9px;
  width: 205px;
}

.sort-signal {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  gap: 1px;
  width: 38px;
  height: 38px;
  color: var(--game-color);
  border: 1px solid color-mix(in srgb, var(--game-color) 45%, #3c4651);
  border-radius: 9px;
  font-size: 1.05rem;
  line-height: 1;
  overflow: hidden;
}

.sort-signal em {
  font-style: normal;
  line-height: .9;
}

.sort-signal b {
  display: block;
  color: #d9e1e4;
  font: 600 .62rem/1 var(--heading);
}

.identity-sort .sort-lane {
  height: 1px;
  background: linear-gradient(90deg, var(--game-color), transparent);
}

.sort-bin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #48535d;
  border-radius: 6px;
  color: #aab5bd;
  font: 600 .75rem var(--heading);
}

.identity-sort .sort-signal-a,
.identity-sort .sort-lane:first-of-type,
.identity-sort .sort-bin-a { grid-row: 1; }
.identity-sort .sort-signal-b,
.identity-sort .sort-lane:last-of-type,
.identity-sort .sort-bin-b { grid-row: 2; }
.identity-sort .sort-signal-a,
.identity-sort .sort-signal-b { grid-column: 1; }
.identity-sort .sort-lane { grid-column: 2; }
.identity-sort .sort-bin-a,
.identity-sort .sort-bin-b { grid-column: 3; }

/* Give each card a different compositional gesture without becoming eight apps. */
.train-game-grid [data-game="memory"] .game-card-stage { background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--game-color) 11%, transparent), transparent 58%); }
.train-game-grid [data-game="math"] .game-card-stage { align-content: center; }
.train-game-grid [data-game="pattern"] .game-card-stage { place-items: center stretch; }
.train-game-grid [data-game="hunt"] .game-card-stage { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--game-color) 5%, transparent), transparent); }
.train-game-grid [data-game="switch"] .game-card-stage { background: transparent; }
/* Center the final three previews as complete compositions, without touching
   their individual elements, art or hover transitions. */
.train-game-grid [data-game="route"] .game-card-stage,
.train-game-grid [data-game="word"] .game-card-stage,
.train-game-grid [data-game="sort"] .game-card-stage { place-items: center; }
.train-game-grid [data-game="route"] .identity-route { width: max-content; max-width: 100%; }
.train-game-grid [data-game="word"] .identity-word { width: max-content; max-width: 100%; text-align: center; }

/* -------------------------------------------------------------------------
   PLAY: same shell, different task identity
   ------------------------------------------------------------------------- */

body[data-view="play"] .game-panel[data-game] {
  background: transparent;
}

body[data-view="play"] .game-panel[data-game] .game-meta {
  border-bottom-color: color-mix(in srgb, var(--game-color) 22%, var(--play-rule));
}

body[data-view="play"] .game-panel[data-game] .play-zone {
  position: relative;
  isolation: isolate;
}

body[data-view="play"] .game-panel[data-game] .play-zone::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 50% auto auto 50%;
  width: min(430px, 86vw);
  height: min(310px, 52vh);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .65;
}

body[data-view="play"] .game-panel[data-game="memory"] .play-zone::before,
body[data-view="play"] .game-panel[data-game="memory"] .play-zone::after {
  display: none;
}

body[data-view="play"] .game-panel[data-game="math"] .play-zone::before {
  background:
    linear-gradient(color-mix(in srgb, var(--game-color) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--game-color) 8%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle, #000 0 48%, transparent 78%);
}

body[data-view="play"] .game-panel[data-game="math"] .formula {
  padding: 20px 30px;
  border-bottom: 2px solid color-mix(in srgb, var(--game-color) 55%, transparent);
}

body[data-view="play"] .game-panel[data-game="pattern"] .sequence {
  position: relative;
  gap: 16px;
}

body[data-view="play"] .game-panel[data-game="pattern"] .sequence::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 4%;
  right: 4%;
  height: 1px;
  background: color-mix(in srgb, var(--game-color) 30%, #343942);
}

body[data-view="play"] .game-panel[data-game="pattern"] .sequence span {
  border-color: color-mix(in srgb, var(--game-color) 30%, #4b455b);
  background: #171d24;
  box-shadow: 0 0 0 6px #0e1215;
}

body[data-view="play"] .game-panel[data-game="pattern"] .sequence .unknown {
  color: #15171f;
  background: var(--game-color);
  border-color: var(--game-color);
}

body[data-view="play"] .game-panel[data-game="hunt"] .play-zone::before {
  width: min(500px, 92vw);
  height: min(360px, 58vh);
  border-radius: 24px;
  background:
    linear-gradient(color-mix(in srgb, var(--game-color) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--game-color) 6%, transparent) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(90deg, transparent, #000 20% 80%, transparent);
}

body[data-view="play"] .game-panel[data-game="hunt"] .hunt-grid {
  transform: rotate(-1deg);
}

body[data-view="play"] .game-panel[data-game="switch"] .rule-tag {
  color: #11171a;
  border: 0;
  background: var(--game-color);
  letter-spacing: .16em;
}

body[data-view="play"] .game-panel[data-game="switch"] .play-zone::before {
  background: linear-gradient(135deg, transparent 0 48%, color-mix(in srgb, var(--game-color) 9%, transparent) 49% 51%, transparent 52%);
}

body[data-view="play"] .game-panel[data-game="route"] .route-display {
  position: relative;
  max-width: 620px;
  padding: 22px 28px;
  border-block: 1px solid color-mix(in srgb, var(--game-color) 26%, #39433f);
  color: var(--game-color);
  letter-spacing: .16em;
}

body[data-view="play"] .game-panel[data-game="route"] .play-zone::before {
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--game-color) 35%, transparent), transparent);
}

body[data-view="play"] .game-panel[data-game="word"] .word-display {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(var(--word-count, 2), minmax(0, 1fr));
  align-items: center;
  gap: 12px;
  padding: 22px 26px;
  border-left: 3px solid var(--game-color);
  background: color-mix(in srgb, var(--game-color) 5%, #151a20);
  text-align: center;
  font-size: clamp(2rem, 4.1vw, 3.9rem);
  line-height: 1;
  letter-spacing: -.055em;
}

body[data-view="play"] .game-panel[data-game="word"] .word-token {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-view="play"] .game-panel[data-game="word"] .word-token + .word-token {
  border-left: 1px solid color-mix(in srgb, var(--game-color) 28%, #3c414a);
  padding-left: 12px;
}

body[data-view="play"] .game-panel[data-game="word"] .word-count-3,
body[data-view="play"] .game-panel[data-game="word"] .word-count-4 {
  font-size: clamp(1.5rem, 3.2vw, 2.65rem);
}

body[data-view="play"] .game-panel[data-game="word"] .answers {
  max-width: 680px;
}

@media (max-width: 620px) {
  body[data-view="play"] .game-panel[data-game="word"] .word-display {
    gap: 7px;
    padding: 18px 12px;
    font-size: clamp(1.45rem, 7vw, 2.25rem);
  }

  body[data-view="play"] .game-panel[data-game="word"] .word-token + .word-token {
    padding-left: 7px;
  }

  body[data-view="play"] .game-panel[data-game="word"] .word-count-3,
  body[data-view="play"] .game-panel[data-game="word"] .word-count-4 {
    font-size: clamp(1.05rem, 4.8vw, 1.55rem);
  }
}

body[data-view="play"] .game-panel[data-game="sort"] .rule-stimulus {
  border: 1px solid color-mix(in srgb, var(--game-color) 28%, #3b4650);
  border-radius: 28px;
  background: color-mix(in srgb, var(--game-color) 6%, #161c22);
}

body[data-view="play"] .game-panel[data-game="sort"] .play-zone::before {
  background: repeating-linear-gradient(90deg, transparent 0 82px, color-mix(in srgb, var(--game-color) 7%, transparent) 83px 84px);
  mask-image: linear-gradient(90deg, transparent, #000 18% 82%, transparent);
}

/* -------------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .train-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .train-game-grid .game-card {
    min-height: 0;
  }

  .game-card-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 96px;
  }
}

@media (max-width: 700px) {
  .train-game-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .train-hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 28px 0 24px;
  }

  .train-hero h1 {
    font-size: clamp(3rem, 15vw, 4.25rem);
    line-height: .94;
  }

  .train-hero-aside {
    grid-template-columns: auto auto;
    min-width: 0;
    padding: 15px 0 0;
    border-top: 1px solid var(--train-rule);
  }

  .train-hero-aside .text-link {
    grid-column: 1 / -1;
  }

  .train-games-heading {
    align-items: start;
    gap: 6px;
  }

  .train-games-heading > span {
    display: none;
  }

  .train-game-grid {
    gap: 12px;
  }

  .train-game-grid .game-card {
    padding: 18px 17px 17px;
    border-radius: 17px;
  }

  .game-card-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 100px;
    gap: 10px;
  }

  .train-game-grid .game-card h3 {
    max-width: none;
    font-size: 1.55rem;
  }

  .train-game-grid .game-card p {
    max-width: none;
  }

  .train-game-grid .game-instruction {
    font-size: .78rem;
    line-height: 1.42;
  }

  .game-card-stage {
    min-height: 100px;
    padding: 8px 0 0;
  }

  .game-card-meta {
    margin-top: 14px;
  }

  .train-game-grid .best-note {
    max-width: 58%;
    font-size: .7rem;
  }

  .train-game-grid .game-card-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .train-game-grid .game-card-actions .quiet {
    width: auto;
    padding-inline: 10px;
  }

  .identity-memory {
    grid-template-columns: repeat(4, 15px);
    gap: 5px;
  }

  .identity-memory i {
    width: 15px;
    height: 15px;
    border-radius: 3px;
  }

  .identity-math {
    font-size: 1.5rem;
    gap: 3px 5px;
  }

  .identity-math b {
    font-size: 1rem;
  }

  .identity-pattern {
    gap: 3px;
  }

  .identity-pattern span,
  .identity-pattern b {
    width: 23px;
    height: 30px;
    font-size: .72rem;
  }

  .identity-hunt {
    grid-template-columns: repeat(3, 25px);
    gap: 4px;
  }

  .identity-hunt span {
    height: 25px;
    font-size: .58rem;
  }

  .identity-switch {
    grid-template-columns: 89px 16px 89px;
    gap: 11px;
  }

  .identity-word > span {
    font-size: 1rem;
  }

  .identity-word i {
    font-size: .46rem;
  }

  .identity-sort {
    grid-template-columns: 38px 119px 30px;
    grid-template-rows: repeat(2,38px);
    gap: 7px 9px;
  }

  .sort-signal {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: .95rem;
  }

  .sort-bin {
    width: 30px;
    height: 30px;
    font-size: .6rem;
  }
}

@media (max-width: 360px) {
  .game-card-main {
    grid-template-columns: 1fr;
  }

  .game-card-stage {
    padding-inline: 0;
  }

  .train-game-grid .game-card-actions {
    grid-template-columns: 1fr;
  }

  .train-game-grid .game-card-actions .quiet {
    width: 100%;
  }
}

@keyframes train-memory-flash {
  0%, 100% { opacity: 1; transform: scale(1); }
  45% { opacity: .35; transform: scale(.82); }
  68% { opacity: 1; transform: scale(1.08); }
}

@keyframes train-pattern-link {
  0% { transform: scaleX(.15); opacity: .25; }
  70%, 100% { transform: scaleX(1); opacity: 1; }
}

@keyframes train-scan {
  0% { transform: translate(-50%, -50%) rotate(-24deg) translateX(-38px); opacity: 0; }
  35% { opacity: .85; }
  100% { transform: translate(-50%, -50%) rotate(-24deg) translateX(38px); opacity: 0; }
}

@keyframes train-route-step {
  0%, 100% { transform: translateY(0); background: #1d2524; }
  45% { transform: translateY(-6px); background: color-mix(in srgb, var(--game-color) 22%, #1d2524); }
}

@keyframes train-hunt-target {
  0%, 100% {
    color: #a8bbc0;
    border-color: #3a4a50;
    background: transparent;
    transform: scale(1);
  }
  45%, 70% {
    color: #101719;
    border-color: var(--game-color);
    background: var(--game-color);
    transform: scale(1.12);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .train-game-grid .game-card {
    transition: transform 180ms ease-out, box-shadow 180ms ease-out, border-color 180ms ease-out;
  }

  .train-game-grid .game-card:is(:hover, :focus-within) {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--game-color) 36%, #384147);
    box-shadow: 0 18px 40px rgba(0,0,0,.24);
  }

  .train-game-grid .arc-game-glyph svg {
    transition: transform 180ms ease-out;
  }

  .train-game-grid .game-card:is(:hover, :focus-within) .arc-game-glyph svg {
    transform: scale(1.1);
  }

  .train-game-grid [data-game="memory"]:is(:hover, :focus-within) .identity-memory i.on {
    animation: train-memory-flash 620ms ease-out both;
  }
  .train-game-grid [data-game="memory"]:is(:hover, :focus-within) .identity-memory i.on:nth-child(6) { animation-delay: 70ms; }
  .train-game-grid [data-game="memory"]:is(:hover, :focus-within) .identity-memory i.on:nth-child(7) { animation-delay: 140ms; }
  .train-game-grid [data-game="memory"]:is(:hover, :focus-within) .identity-memory i.on:nth-child(10) { animation-delay: 210ms; }
  .train-game-grid [data-game="memory"]:is(:hover, :focus-within) .identity-memory i.on:nth-child(15) { animation-delay: 280ms; }

  .train-game-grid [data-game="math"]:is(:hover, :focus-within) .identity-math span:first-child {
    transform: translateY(-4px);
  }
  .train-game-grid [data-game="math"]:is(:hover, :focus-within) .identity-math span:nth-of-type(2) {
    transform: translateY(4px);
  }
  .identity-math span,
  .identity-math i,
  .identity-math i em,
  .identity-math i strong {
    transition: transform 180ms ease-out, color 180ms ease-out, opacity 180ms ease-out;
  }
  .train-game-grid [data-game="math"]:is(:hover, :focus-within) .identity-math i {
    transform: translateX(-8px);
    color: #f4f7f5;
  }

  .train-game-grid [data-game="math"]:is(:hover, :focus-within) .identity-math i em {
    opacity: 0;
  }

  .train-game-grid [data-game="math"]:is(:hover, :focus-within) .identity-math i strong {
    opacity: 1;
    transform: scale(1.08);
  }

  .train-game-grid [data-game="pattern"]:is(:hover, :focus-within) .identity-pattern i {
    transform-origin: left center;
    animation: train-pattern-link 420ms ease-out both;
  }
  .train-game-grid [data-game="pattern"]:is(:hover, :focus-within) .identity-pattern b {
    transform: scale(1.08);
  }
  .identity-pattern b,
  .identity-pattern b em,
  .identity-pattern b strong { transition: transform 180ms ease-out, opacity 180ms ease-out; }

  .train-game-grid [data-game="pattern"]:is(:hover, :focus-within) .identity-pattern b em {
    opacity: 0;
  }

  .train-game-grid [data-game="pattern"]:is(:hover, :focus-within) .identity-pattern b strong {
    opacity: 1;
  }

  .identity-hunt .target { transition: transform 180ms ease-out, box-shadow 180ms ease-out; }
  .train-game-grid [data-game="hunt"]:is(:hover, :focus-within) .identity-hunt .target {
    transform: scale(1.12);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--game-color) 12%, transparent);
  }

  .train-game-grid [data-game="hunt"]:is(:hover, :focus-within) .hunt-step-2,
  .train-game-grid [data-game="hunt"]:is(:hover, :focus-within) .hunt-step-3 {
    animation: train-hunt-target 720ms ease-out both;
  }

  .train-game-grid [data-game="hunt"]:is(:hover, :focus-within) .hunt-step-2 { animation-delay: 130ms; }
  .train-game-grid [data-game="hunt"]:is(:hover, :focus-within) .hunt-step-3 { animation-delay: 260ms; }

  .identity-switch .switch-rule,
  .identity-switch > b { transition: transform 200ms ease-out, border-color 200ms ease-out, background 200ms ease-out; }
  .train-game-grid [data-game="switch"]:is(:hover, :focus-within) .switch-rule-color {
    transform: translateX(127px);
  }
  .train-game-grid [data-game="switch"]:is(:hover, :focus-within) .switch-rule-shape {
    transform: translateX(-127px);
  }
  .train-game-grid [data-game="switch"]:is(:hover, :focus-within) .identity-switch > b {
    transform: rotate(180deg);
  }

  .route-sequence span,
  .route-recalled { transition: opacity 200ms ease-out, border-color 200ms ease-out, background 200ms ease-out; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-source { opacity: .38; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-recalled { opacity: 1; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-source span { animation: none; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-answer span {
    animation: train-route-step 560ms ease-out both;
  }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-answer span:nth-child(2) { animation-delay: 70ms; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-answer span:nth-child(3) { animation-delay: 140ms; }
  .train-game-grid [data-game="route"]:is(:hover, :focus-within) .route-answer span:nth-child(4) { animation-delay: 210ms; }

  .identity-word > span { transition: letter-spacing 220ms ease-out, transform 220ms ease-out; }
  .train-game-grid [data-game="word"]:is(:hover, :focus-within) .identity-word > span:first-child {
    letter-spacing: .04em;
    transform: translateX(5px);
  }
  .train-game-grid [data-game="word"]:is(:hover, :focus-within) .identity-word > span:nth-child(2) {
    letter-spacing: .04em;
    transform: translateX(-5px);
  }

  .sort-signal,
  .sort-bin { transition: transform 200ms ease-out, border-color 200ms ease-out, background 200ms ease-out; }
  .train-game-grid [data-game="sort"]:is(:hover, :focus-within) .sort-signal { transform: translateX(8px) scale(.94); }
  .train-game-grid [data-game="sort"]:is(:hover, :focus-within) .sort-bin {
    transform: translateX(-3px);
    border-color: var(--game-color);
    background: color-mix(in srgb, var(--game-color) 12%, #20282f);
  }
}

.plus-reduced-motion .train-game-grid .game-card,
.plus-reduced-motion .train-game-grid .game-card:is(:hover, :focus-within),
.plus-reduced-motion .train-game-grid .game-card:is(:hover, :focus-within) * {
  animation: none !important;
  transform: none !important;
  transition-duration: .001ms !important;
}

/* -------------------------------------------------------------------------
   DE-BOXING PASS: the game card remains a meaningful launch target. Internal
   content should not be segmented into more boxes once the outer card exists.
   ------------------------------------------------------------------------- */

.train-hero {
  border: 0;
  padding-bottom: 26px;
}

.train-game-grid .game-card::before {
  left: 18px;
  right: auto;
  width: 38px;
  height: 3px;
  border-radius: 999px;
}

.game-card-stage,
.game-card-meta {
  border: 0;
}

.game-card-stage {
  padding-top: 4px;
}

.game-card-meta {
  margin-top: 6px;
  padding-top: 2px;
}
