/* Shared portal typography and navigation for the games collection. */
:root {
  --cg-brand-700: #0849a2;
  --cg-brand-100: #d6e9fe;
  --cg-ink: #111111;
  --cg-ink-soft: rgba(17,17,17,.72);
  --cg-sky: #f7fbff;
  --cg-white: #fff;
  --cg-border: rgba(8,73,162,.2);
  --portal-game-navy: var(--cg-ink);
  --portal-game-paper: var(--cg-white);
  --portal-game-muted: var(--cg-ink-soft);
}
body:is(.portal-game,.cg-games-hub) { color: var(--cg-ink); background: var(--cg-white); }
.cg-games-shell { width: min(85rem, calc(100% - clamp(2rem,4vw,5rem))); margin-inline: auto; }
.cg-games-header { background: var(--cg-white); border-bottom: 1px solid var(--cg-border); }
body.portal-game > :is(.cg-games-header,.cg-games-footer) { display: block !important; }
.cg-games-header > .cg-games-shell { display: flex; align-items: center; justify-content: space-between; gap: clamp(.75rem,2vw,2rem); min-height: 5.5rem; padding-block: .5rem; }
.cg-games-header__logo { display: block; flex: none; }
.cg-games-header__logo img { display: block; width: 4.25rem; height: 4rem; object-fit: contain; }
.cg-games-header nav,.cg-games-footer nav { display: flex; flex-wrap: wrap; gap: .25rem clamp(.25rem,1vw,1rem); align-items: center; }
.cg-games-header nav { justify-content: flex-end; }
.cg-games-header nav a,.cg-games-footer nav a { display: inline-flex; min-height: 2.75rem; align-items: center; padding: .65rem .85rem; color: var(--cg-brand-700); font: 800 clamp(.75rem,.72rem + .2vw,.95rem)/1.3 Montserrat,system-ui,sans-serif; text-decoration: none; }
.cg-games-header nav a:is(:hover,[aria-current]),.cg-games-header nav a:focus-visible { background: var(--cg-brand-100); }
.cg-games-header :focus-visible,.cg-games-footer :focus-visible { outline: 2px solid var(--cg-brand-700); outline-offset: 3px; }
.cg-games-footer { background: var(--cg-sky); border-top: 1px solid var(--cg-border); padding-block: clamp(2rem,4vw,3.5rem); margin-top: clamp(2.5rem,5vw,5rem); }
.cg-games-footer > .cg-games-shell { display: block; }
.cg-games-footer p { max-width: 52rem; color: var(--cg-ink-soft); margin: 0 0 1rem; font: 400 1rem/1.75 Montserrat,system-ui,sans-serif; }
.cg-games-footer p strong { color: var(--cg-brand-700); font-weight: 800; }
.cg-games-footer nav a { padding-left: 0; padding-right: 1.25rem; }
.cg-games-footer a:hover { text-decoration: underline; }
body.portal-game :is(.game-heading,.game-intro) { display: block !important; padding-block: clamp(1.75rem,3vw,3rem); margin: 0; }
.portal-game :is(.game-heading h1,.game-intro h1) { max-width: none; color: var(--cg-brand-700); line-height: 1.15; }
.portal-game :is(.game-heading__lead,.game-intro__lead) { max-width: 54rem; margin: 1.1rem 0 0; color: var(--cg-ink-soft); font-size: 1rem; line-height: 1.75; }
.portal-game :is(.game-heading__facts,.game-intro__eyebrow) { display: none; }
.portal-game :is(.game-manual,.game-notes) { color: var(--cg-ink); }
.portal-game .game-manual { display: block; }
.portal-game .game-manual > h2 { margin-bottom: 1rem; }
.portal-game :is(.game-manual,.game-notes) h2 { color: var(--cg-brand-700); }
.portal-game :is(.game-manual,.game-notes) p { color: var(--cg-ink-soft); }
.portal-game #ranking .leaderboard__header { display: block; }
.portal-game #ranking .leaderboard__header p { color: var(--cg-ink-soft); max-width: 54rem; }
.portal-game #ranking .leaderboard__mark { display: none; }
.portal-game #ranking td,.portal-game #ranking tbody tr:nth-child(-n+3) td { color: var(--cg-ink); }
.portal-game #ranking td:nth-child(3) { color: var(--cg-brand-700); }
.portal-game .game-overlay p { color: var(--cg-ink-soft); }
.portal-game .game-overlay h2 { color: var(--cg-brand-700); }
body.portal-game .mobile-game-nav { background: var(--cg-sky); }
.cg-games-challenge { display: block; padding: clamp(1.1rem,2vw,1.7rem); margin: 0 0 clamp(1.5rem,3vw,2.5rem); background: var(--cg-sky); border: 0; }
.cg-games-challenge h2 { margin: 0; color: var(--cg-brand-700); font: 400 clamp(1.1rem,1rem + .6vw,1.5rem)/1.3 'Archivo Black',sans-serif; text-transform: none; }
.cg-games-challenge p { color: var(--cg-ink-soft); font: 400 .95rem/1.75 Montserrat,system-ui,sans-serif; margin: .75rem 0; max-width: 58rem; }
.cg-games-challenge a { color: var(--cg-brand-700); font: 800 .9rem/1.5 Montserrat,system-ui,sans-serif; text-underline-offset: .25rem; }
.cg-games-challenge a:hover { text-decoration-thickness: 2px; }
.cg-games-breadcrumb { padding-block: 1rem 0; color: var(--cg-ink-soft); font: 400 .8rem/1.6 Montserrat,system-ui,sans-serif; }
.cg-games-breadcrumb ol { display: flex; flex-wrap: wrap; gap: .35rem .6rem; list-style: none; padding: 0; margin: 0; }
.cg-games-breadcrumb li + li::before { content: '/'; margin-right: .6rem; color: var(--cg-ink-soft); }
.cg-games-breadcrumb a { color: var(--cg-brand-700); text-underline-offset: .2rem; }
.cg-games-hub .cg-games-breadcrumb { background: var(--cg-sky); }
.cg-games-hub { --navy: var(--cg-ink); --blue: var(--cg-brand-700); --paper: var(--cg-white); --cream: var(--cg-white); --line: var(--cg-border); }
.cg-games-hub .wrap { width: min(85rem,calc(100% - clamp(2rem,4vw,5rem))); }
.cg-games-hub :is(h1,h2,h3) { color: var(--cg-brand-700); }
.cg-games-hub .chooser { height: auto; min-height: 0; padding-block: clamp(2.5rem,4vw,4.5rem); background: var(--cg-sky); }
.cg-games-hub .chooser > .wrap { display: block; height: auto; }
.cg-games-hub .intro { display: block; margin-bottom: clamp(1.5rem,3vw,2.5rem); }
.cg-games-hub .intro h1 { max-width: 24ch; line-height: 1.15; }
.cg-games-hub .intro > p { max-width: 58rem; margin: 1.1rem 0 0; font-size: 1rem; line-height: 1.75; color: var(--cg-ink-soft); }
.cg-games-hub .intro .intro-competition { color: var(--cg-brand-700); font-weight: 700; }
.cg-games-hub .choices { grid-template-rows: none; gap: clamp(.8rem,2vw,1.5rem); }
.cg-games-hub .choice { background: white; border: 1px solid var(--cg-border); transition: border-color .2s; }
.cg-games-hub .choice:hover { transform: none; box-shadow: none; border-color: var(--cg-brand-700); }
.cg-games-hub .choice > img { height: auto; flex: none; aspect-ratio: 16/9; object-fit: cover; }
.cg-games-hub .choice > span { padding: 1rem .75rem; }
.cg-games-hub .choice strong { color: var(--cg-brand-700); font-size: clamp(.85rem,.75rem + .45vw,1.2rem); }
.cg-games-hub .game { padding-block: clamp(2.5rem,5vw,5rem); background: white; }
.cg-games-hub .game:nth-of-type(even) { background: var(--cg-sky); }
.cg-games-hub .game-layout { gap: clamp(1.5rem,4vw,4rem); }
.cg-games-hub .game-image { box-shadow: none; background: var(--cg-brand-100); }
.cg-games-hub .game-image img { aspect-ratio: 16/10; }
.cg-games-hub .game-copy h2 { font-size: clamp(1.6rem,1.2rem + 1.3vw,2.7rem); line-height: 1.2; }
.cg-games-hub .description { color: var(--cg-ink-soft); font-size: 1rem; line-height: 1.8; }
.cg-games-hub .play { display: inline-flex; min-height: 2.75rem; padding: .85rem 1.25rem; color: white; background: var(--cg-brand-700); border: 1px solid var(--cg-brand-700); font-size: .9rem; font-weight: 800; }
.cg-games-hub .play:hover { color: var(--cg-brand-700); background: white; }
.cg-games-hub .ranking-heading { display: block; }
.cg-games-hub .ranking-heading > span { display: block; margin-top: .4rem; color: var(--cg-ink-soft); }
.cg-games-hub .ranking-content { color: var(--cg-ink); }
.cg-games-hub .cg-games-challenge { width: 100%; margin: 0; padding-block: clamp(2rem,4vw,3.5rem); border: 0; background: var(--cg-brand-100); }
.cg-games-hub .cg-games-challenge h2 { font-size: clamp(1.4rem,1rem + 1.3vw,2.25rem); }
.cg-games-hub .tip { display: block; }
.cg-games-hub .tip > a { display: inline-flex; margin: .75rem 0 0; }
@media(max-width:650px) {
  .cg-games-header > .cg-games-shell { gap: .5rem; min-height: 4.75rem; }
  .cg-games-header__logo img { width: 3.25rem; height: 3.5rem; }
  .cg-games-header nav { gap: 0; }
  .cg-games-header nav a { padding: .6rem .45rem; }
  .cg-games-hub .choices { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cg-games-hub .intro h1 { font-size: clamp(1.7rem,5.5vw,2.4rem); }
  .cg-games-hub .intro > p { font-size: .95rem; }
  .cg-games-hub .game-layout { grid-template-columns: 1fr; }
  .cg-games-hub .game .game-image { order: 0; }
}
@media(max-width:1024px) {
  body.portal-game :is(.game-heading,.game-intro,.cg-games-breadcrumb) { padding-inline: 1rem; }
  body.portal-game .cg-games-challenge { margin-inline: 1rem; }
}

/* Final editorial refinements; original game boards remain independent. */
.cg-games-footer__logo { display: inline-block; margin-bottom: 1.5rem; }
.cg-games-footer__logo img { display: block; width: clamp(4.25rem,3.9rem + 1.3vw,5.5rem); height: auto; }
.cg-games-hub .tip { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem 2rem; padding-block: clamp(1.25rem,2vw,2rem); background: var(--cg-white); color: var(--cg-ink); }
.cg-games-hub .tip p { margin: 0; max-width: 62rem; font-size: .9rem; line-height: 1.7; color: var(--cg-ink); }
.cg-games-hub .tip strong { white-space: normal; }
.cg-games-hub .tip > a { flex: none; margin: 0; color: var(--cg-ink); font-size: .85rem; }
.cg-games-hub .cg-games-footer { margin-top: 0; }
body.portal-game :is(.game-heading,.game-intro) { padding-bottom: clamp(1.25rem,2vw,2rem); }
.portal-game :is(.game-heading__lead,.game-intro__lead) { max-width: 70rem; }
.cg-games-hub :is(.game-image,.choice) { overflow: hidden; }
.cg-games-hub :is(.game-image,.choice) img,.portal-game .cg-other-games__art img { transition: transform 320ms ease; }
.cg-games-hub .choice > span { position: relative; background: var(--cg-white); }
.cg-games-hub :is(.game-image,.choice):is(:hover,:focus-visible) img,
.portal-game .cg-other-games__card:is(:hover,:focus-visible) img { transform: scale(1.035); }
.cg-games-hub .play,.portal-game .cg-other-games__controls button { position: relative; isolation: isolate; overflow: hidden; background-position: 10rem 0; transition: background-color 180ms ease,color 180ms ease; }
.cg-games-hub .play:is(:hover,:focus-visible),
.portal-game .cg-other-games__controls button:is(:hover,:focus-visible) {
  transform: none; border-color: transparent; color: var(--cg-white); background-color: var(--cg-brand-100);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 64' preserveAspectRatio='none'%3E%3Cpath fill='%230849a2' d='M0 31 C 20 20 44 20 64 31 S 108 42 128 31 S 152 22 160 25 V64 H0 Z'/%3E%3C/svg%3E");
  background-repeat: repeat-x; background-size: 10rem 100%; box-shadow: none; animation: cg-games-wave-drift 900ms linear infinite;
}
@keyframes cg-games-wave-drift { from { background-position: 10rem 0; } to { background-position: 0 0; } }
@media(max-width:850px) { .cg-games-hub .tip { flex-direction: column; } }
@media(prefers-reduced-motion:reduce) {
  .cg-games-hub :is(.game-image,.choice) img,.portal-game .cg-other-games__art img { transition: none; transform: none !important; }
  .cg-games-hub .play,.portal-game .cg-other-games__controls button { animation: none !important; transition: none; }
}

/* Instruction rows are normal flow; old grid offsets must not overlap copy. */
.portal-game .game-manual__damage { margin: 1.25rem 0 0; line-height: 1.75; }
.portal-game .game-manual__keys { margin: 1rem 0 0; line-height: 2.4; text-transform: none; letter-spacing: normal; }

/* Polish copy: keep headings together and avoid a short final line in descriptions. */
.cg-games-hub :is(h1,h2,h3),
.portal-game :is(.game-heading h1,.game-intro h1,.game-manual h2,.game-notes h2,.leaderboard__header h2,.cg-other-games__heading h2) { text-wrap: balance; }
.cg-games-hub :is(.intro p,.description,.tip p),
.portal-game :is(.game-heading__lead,.game-intro__lead,.game-manual p,.game-notes p,.leaderboard__header p,.cg-other-games__heading p,.cg-other-games__description),
.cg-games-footer p { text-wrap: pretty; }
