/* Memory de Los Cliucket: página del juego (usa las fuentes y colores de site.css). */
.g-page { min-height: 100vh; display: flex; flex-direction: column; background: #C9EFD9; }
[hidden] { display: none !important; }

/* Cabecera */
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #BFE6FA; border-bottom: 3px solid #1A1A1F;
  padding: 18px max(20px, calc((100% - 1200px) / 2)); }
.g-head .logo img { height: 60px; width: auto; display: block; }
.g-nav { display: flex; align-items: center; gap: 20px; font-size: 16px; font-weight: 500; }
.g-nav a { text-decoration: none; }
.g-nav a[aria-current="page"] { background: #FFD23F; border: 3px solid #1A1A1F; border-radius: 999px; padding: 6px 14px; box-shadow: 3px 3px 0 #1A1A1F; font-weight: 700; }
.g-tools { display: flex; align-items: center; gap: 10px; }
.g-lang { display: flex; align-items: stretch; height: 46px; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 999px; box-shadow: 3px 3px 0 #1A1A1F; overflow: hidden; font-size: 15px; font-weight: 700; }
.g-lang > * { display: flex; align-items: center; padding: 0 13px; text-decoration: none; }
.g-lang [aria-current] { background: #1A1A1F; color: #FFFCF3; }
.g-menu-btn { width: 46px; height: 46px; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 14px; box-shadow: 3px 3px 0 #1A1A1F; display: none; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.g-page .menu-movil { padding-left: max(20px, calc((100% - 640px) / 2)); padding-right: max(20px, calc((100% - 640px) / 2)); }
@media (max-width: 1023px) {
  .g-nav { display: none; }
  .g-menu-btn { display: flex; }
  .g-head { padding-top: 12px; padding-bottom: 12px; }
  .g-head .logo img { height: 46px; }
}

/* Cuerpo */
.g-main { flex-grow: 1; width: 100%; max-width: 1200px; margin: 0 auto; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 64px; align-items: start; padding: 32px 20px 72px; }
.g-play { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.g-side { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.g-eyebrow { font-family: 'Gochi Hand', cursive; font-size: 28px; color: #E4533D; transform: rotate(-2deg); align-self: flex-start; }
.g-title { margin: 0; font-family: 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; font-weight: 400; font-size: 60px; line-height: 1; text-wrap: balance; }
.g-title span { color: #FFFFFF; -webkit-text-stroke: 3px #1A1A1F; paint-order: stroke fill; }
.g-title-m { display: none; text-align: center; font-size: 32px; }
.g-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; counter-reset: s; }
.g-steps li { display: flex; gap: 14px; align-items: flex-start; font-size: 17px; line-height: 1.5; counter-increment: s; }
.g-steps li::before { content: counter(s); flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: #FFD23F; border: 3px solid #1A1A1F; display: flex; align-items: center; justify-content: center;
  font-family: 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; font-size: 17px; box-sizing: border-box; margin-top: -4px; }
.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.g-levels { display: flex; gap: 10px; }
.g-pill { font: 800 15px 'Lexend', system-ui, sans-serif; color: #1A1A1F; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 999px; padding: 7px 16px; box-shadow: 3px 3px 0 #1A1A1F; cursor: pointer; }
.g-pill[aria-pressed="true"] { background: #FFD23F; }
.g-score { display: flex; gap: 10px; font-size: 15px; }
.g-score span { background: #FFFCF3; border: 3px solid #1A1A1F; border-radius: 14px; padding: 5px 12px; font-variant-numeric: tabular-nums; }
.g-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 24px; background: #FFFCF3; border: 3px solid #1A1A1F; border-radius: 30px; box-shadow: 8px 8px 0 #1A1A1F; perspective: 900px; }
.g-board.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-left: 12%; padding-right: 12%; }

/* Cartas */
.g-card { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; max-width: 100%; -webkit-tap-highlight-color: transparent; }
.g-card .in { position: absolute; inset: 0; transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); transform-style: preserve-3d; }
.g-card.up .in { transform: rotateY(180deg); }
.g-face { position: absolute; inset: 0; box-sizing: border-box; border: 3px solid #1A1A1F; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 4px 4px 0 #1A1A1F; overflow: hidden; }
.g-back { background: #E4533D; display: flex; align-items: center; justify-content: center; }
.g-back svg { width: 56%; height: auto; }
.g-front { transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.g-front .art { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 8% 6% 0; box-sizing: border-box; }
.g-front .art img, .g-front .art svg { max-height: 100%; max-width: 100%; width: auto; height: 100%; object-fit: contain; display: block; }
.g-front .name { align-self: stretch; text-align: center; background: #FFFFFF; border-top: 3px solid #1A1A1F; font: 400 clamp(11px, 2.9vw, 18px)/1.65 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; }
.g-card.done .g-face { box-shadow: 4px 4px 0 #1A1A1F, 0 0 0 4px #FFD23F; }
.g-card.done .in { animation: g-pop .5s ease; }
.g-card.shake .in { animation: g-shake .4s ease; }
@keyframes g-pop { 0% { transform: rotateY(180deg) scale(1); } 40% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes g-shake { 0%, 100% { transform: rotateY(180deg) translateX(0); } 25% { transform: rotateY(180deg) translateX(-6px); } 75% { transform: rotateY(180deg) translateX(6px); } }
.g-card:focus-visible { outline: 4px solid #1F3A5F; outline-offset: 3px; border-radius: 14px; }

.g-bubble { min-height: 58px; display: flex; align-items: center; gap: 12px; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 18px; box-shadow: 4px 4px 0 #1A1A1F; padding: 10px 16px; font-size: 16px; font-weight: 500; line-height: 1.4; }
.g-bubble .who { font-family: 'Gochi Hand', cursive; font-size: 23px; color: #E4533D; white-space: nowrap; }
.g-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.g-btn { font: 800 16px 'Lexend', system-ui, sans-serif; color: #1A1A1F; background: #FFD23F; border: 3px solid #1A1A1F; border-radius: 14px; padding: 10px 18px; box-shadow: 4px 4px 0 #1A1A1F; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.g-btn.ghost { background: #FFFFFF; }
.g-btn:active, .g-pill:active { transform: translate(2px, 2px); }
.g-btn[disabled] { opacity: .6; cursor: progress; }

/* Ranking */
.g-rank { display: flex; flex-direction: column; gap: 12px; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 24px; box-shadow: 6px 6px 0 #1A1A1F; padding: 20px 20px 22px; }
.g-rank-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.g-rank h2 { margin: 0; font-family: 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; font-weight: 400; font-size: 26px; }
.g-small { font-size: 14px; line-height: 1.5; color: #4A4A55; margin: 0; }
.g-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.g-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 10px; background: #FFFCF3; border-radius: 12px; font-size: 15px; }
.g-list li:nth-child(even) { background: #FFFFFF; }
.g-list li.me { background: #FFD23F; border: 3px solid #1A1A1F; padding: 3px 7px; }
.g-list .pos { width: 28px; height: 28px; border-radius: 50%; background: #FFFFFF; border: 2px solid #1A1A1F; display: flex; align-items: center; justify-content: center; font-family: 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; font-size: 13px; box-sizing: border-box; }
.g-list li:nth-child(1) .pos { background: #FFD23F; }
.g-list li:nth-child(2) .pos { background: #D9DCE3; }
.g-list li:nth-child(3) .pos { background: #F2B279; }
.g-list .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-list .tr { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-list .tm { font-size: 13px; color: #4A4A55; font-variant-numeric: tabular-nums; }
.g-list .empty { display: block; background: none; color: #4A4A55; font-size: 15px; padding: 4px 2px; }

/* Ventana de «¡Caso resuelto!» */
.g-win { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; background: rgba(26, 26, 31, .55);
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.g-panel { width: 100%; max-width: 440px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 14px; background: #FFFCF3; border: 4px solid #1A1A1F; border-radius: 26px; box-shadow: 8px 8px 0 #1A1A1F; padding: 26px 20px 22px; text-align: center; margin: auto 0; }
.g-stamp { margin: 0; font-family: 'Bagel Fat One', 'Arial Rounded MT Bold', sans-serif; font-weight: 400; font-size: 34px; line-height: 1.05; color: #E4533D; background: #FFFFFF; border: 4px solid #E4533D; border-radius: 14px; padding: 8px 16px; transform: rotate(-5deg); }
.g-stars { display: flex; gap: 6px; }
.g-stars svg { width: 42px; height: 42px; }
.g-result { margin: 0; font-size: 17px; font-weight: 600; }
.g-save { width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; background: #C9EFD9; border: 3px solid #1A1A1F; border-radius: 18px; padding: 14px 14px 16px; text-align: left; }
.g-save .hey { margin: 0; font-family: 'Gochi Hand', cursive; font-size: 24px; line-height: 1.1; }
.g-save label { font-size: 14px; font-weight: 700; }
.g-save input { font: 18px 'Lexend', system-ui, sans-serif; color: #1A1A1F; background: #FFFFFF; border: 3px solid #1A1A1F; border-radius: 12px; padding: 10px 12px; width: 100%; box-sizing: border-box; }
.g-save .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.g-link { font: 700 15px 'Lexend', system-ui, sans-serif; color: #1A1A1F; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 10px 4px; }
.g-msg { margin: 0; font-size: 14px; font-weight: 700; color: #B02E1B; }
.g-msg.ok { color: #1A6B45; }
.g-panel .g-rank { width: 100%; box-sizing: border-box; box-shadow: none; border-width: 0; padding: 0; background: none; text-align: left; }
.g-panel .g-rank h2 { font-size: 22px; }

/* Pie */
.g-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: #1A1A1F; color: #FFFCF3; font-size: 14px;
  padding: 24px max(20px, calc((100% - 1200px) / 2)); }
.g-foot img { height: 44px; width: auto; display: block; }
.g-foot a { color: #FFFCF3; text-underline-offset: 3px; }

/* Móvil */
@media (max-width: 1023px) {
  .g-main { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 18px 16px 48px; max-width: 640px; }
  .g-side .g-eyebrow, .g-side .g-title { display: none; }
  .g-title-m { display: block; }
  .g-bar { justify-content: center; }
  .g-board { gap: 9px; padding: 12px; border-radius: 22px; box-shadow: 5px 5px 0 #1A1A1F; }
  .g-board.n6 { padding-left: 12px; padding-right: 12px; }
  .g-face { border-radius: 12px; }
  .g-bubble { font-size: 14px; }
  .g-btns { justify-content: center; }
  .g-foot { flex-direction: column; text-align: center; }
}
@media (max-width: 380px) { .g-pill { font-size: 13px; padding: 6px 11px; } .g-score { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .g-card .in { transition: none; } .g-card.done .in, .g-card.shake .in { animation: none; } }
