/* ============================================================
   CAPY CROSSING — pantalla de juego y portada.
   El mundo es un <canvas>; las pantallas (título, escenarios, pausa,
   resultados…) son HTML encima, con la paleta del banner oficial:
   naranjas de carátula arcade, madera, turquesa de río y verde selva.
   ============================================================ */
.cc-shell {
  --cc-ink: #fff8ec; --cc-muted: #e7d3b4; --cc-bg: #1d140c; --cc-panel: rgba(38, 24, 13, .92);
  --cc-orange: #ff9a2f; --cc-red: #e8452c; --cc-gold: #ffd166; --cc-teal: #3fd0d4; --cc-green: #7ee081; --cc-line: rgba(255, 210, 150, .28);
  display: flex; flex-direction: column; gap: 10px;
}
.play-capy .page { max-width: 1400px; }
.cc-topbar { min-height: 44px; }
.cc-top-actions { display: flex; align-items: center; gap: 2px; }
.cc-top-actions .tool-btn { text-decoration: none; }
.cc-top-actions .tool-btn.is-off { color: var(--muted); }
.cc-top-actions .tool-btn.is-off svg path:last-child { opacity: .25; }

.cc-stage {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; height: min(calc(100dvh - 150px), 62.5vw); min-height: 320px;
  border-radius: 18px; background: var(--cc-bg); color: var(--cc-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 60px -24px rgba(90, 40, 10, .55);
  font-family: var(--font-ui);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.cc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.cc-shell.cc-full { position: fixed; inset: 0; z-index: 9999; background: #000; gap: 0; }
.cc-shell.cc-full .cc-topbar { display: none; }
.cc-shell.cc-full .cc-stage { height: 100%; border-radius: 0; flex: 1; }
.cc-shell:fullscreen { background: #000; }
@media (max-height: 520px) and (orientation: landscape) {
  .play-capy .topbar, .play-capy .play-motto, .play-capy .sidebar { display: none; }
  .play-capy .app-main { margin-left: 0; }
  .play-capy .page { padding: 0; max-width: none; }
  .cc-shell { gap: 0; }
  .cc-topbar { display: none; }
  .cc-stage { height: 100dvh; border-radius: 0; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .cc-stage { height: calc(100dvh - 170px); min-height: 460px; border-radius: 14px; }
  .cc-top-actions .lbl { display: none; }
}

/* ---------- pantallas ---------- */
.cc-screen {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 18px; overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 10%, rgba(40, 20, 5, .25), rgba(20, 10, 3, .7));
}
.cc-screen[hidden] { display: none; }

/* título: la carátula oficial a pantalla completa; el menú, en una columna a la
   izquierda para no tapar el logotipo (en el teléfono vertical, debajo de la carátula) */
.cc-title { padding: 0; align-items: stretch; justify-content: stretch; background: #120c06; overflow: hidden; }
.cc-cover { position: absolute; inset: 0; display: block; }
.cc-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
.cc-title::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(18, 10, 4, .82) 0, rgba(18, 10, 4, .5) 17%, rgba(18, 10, 4, 0) 27%); pointer-events: none; }
.cc-title-ui { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: min(250px, 24%); min-width: 190px; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 16px; }
.cc-title .cc-menu { width: 100%; gap: 7px; }
.cc-title .cc-btn { min-height: 42px; font-size: .86rem; padding: 0 12px; }
.cc-title .cc-btn-main { min-height: 52px; font-size: 1.05rem; }
.cc-title .cc-hint { text-align: left; }
@media (max-height: 460px) { .cc-title .cc-btn { min-height: 34px; } .cc-title .cc-btn-main { min-height: 42px; } .cc-title .cc-hint { display: none; } }
@media (orientation: portrait) and (max-width: 760px) {
  .cc-title { display: flex; flex-direction: column; justify-content: flex-start; background: radial-gradient(120% 80% at 50% 0, #4a2a12, #120c06 70%); }
  .cc-cover { position: relative; inset: auto; width: 100%; aspect-ratio: 1672 / 941; flex: none; }
  .cc-title::after { display: none; }
  .cc-title-ui { position: relative; width: 100%; min-width: 0; padding: 14px 16px; justify-content: flex-start; flex: 1; }
  .cc-title .cc-menu { display: grid; grid-template-columns: 1fr 1fr; }
  .cc-title .cc-menu .cc-btn-main, .cc-title .cc-menu [data-act="continue"]:not([hidden]) { grid-column: 1 / -1; }
}

.cc-menu { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: min(320px, 100%); }
.cc-hint { margin: 0; font-size: .78rem; color: var(--cc-muted); text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.cc-touchy .cc-hint { display: none; }
.cc-k { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--cc-line); background: rgba(255, 255, 255, .08); font-family: var(--font-num); font-size: .78em; color: var(--cc-ink); }

.cc-btn {
  appearance: none; border: 2px solid rgba(255, 220, 170, .35); background: rgba(48, 30, 16, .88); color: var(--cc-ink);
  min-height: 46px; padding: 0 18px; border-radius: 14px; cursor: pointer;
  font: 800 .95rem/1 var(--font-ui); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.cc-btn:hover, .cc-btn:focus-visible { background: rgba(80, 48, 22, .95); border-color: var(--cc-gold); box-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 0 2px rgba(255, 209, 102, .35); outline: none; }
.cc-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.cc-btn-main { background: linear-gradient(180deg, #ffb347, #ff7a1a 55%, #e8452c); border-color: #fff0c8; color: #fff; text-shadow: 0 2px 0 rgba(120, 30, 0, .55); box-shadow: 0 4px 0 #8f2a12, 0 10px 24px -8px rgba(255, 110, 30, .6); }
.cc-btn-main:hover, .cc-btn-main:focus-visible { background: linear-gradient(180deg, #ffc56a, #ff8a2a 55%, #f0552e); border-color: #fff; box-shadow: 0 4px 0 #8f2a12, 0 0 0 3px rgba(255, 220, 150, .5); }
.cc-btn-ghost { background: rgba(20, 12, 6, .55); }
.cc-btn[hidden] { display: none; }

.cc-panel {
  width: min(580px, 100%); padding: 22px 22px 18px; border-radius: 20px;
  background: var(--cc-panel); border: 2px solid var(--cc-line);
  box-shadow: 0 0 0 1px rgba(255, 154, 47, .12), 0 30px 80px -30px rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 10px; max-height: 100%;
}
.cc-wide { width: min(920px, 100%); }
.cc-scroll { overflow-y: auto; }
.cc-h { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.05rem); font-weight: 900; letter-spacing: .01em; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.cc-win { color: var(--cc-gold); }
.cc-lose { color: #ffb4a2; }
.cc-kicker { margin: 0; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--cc-orange); font-weight: 800; }
.cc-sub { margin: 0; color: var(--cc-muted); font-size: .9rem; }
.cc-story { margin: 0; font-size: .98rem; line-height: 1.45; color: var(--cc-muted); font-style: italic; }
.cc-goal { margin: 0; font-size: 1.02rem; line-height: 1.45; color: var(--cc-ink); }
.cc-facts { margin: 4px 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.cc-facts li { padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--cc-line); font-size: .8rem; color: var(--cc-muted); }
.cc-facts-col { flex-direction: column; }
.cc-facts-col li { border-radius: 12px; }
.cc-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cc-row .cc-btn { flex: 1 1 auto; }

/* escenarios */
.cc-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .cc-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cc-stage-b {
  appearance: none; display: flex; flex-direction: column; gap: 0; text-align: left; padding: 0; overflow: hidden;
  border-radius: 14px; cursor: pointer; background: rgba(48, 30, 16, .9); border: 2px solid var(--cc-line); color: var(--cc-ink); font-family: var(--font-ui);
}
.cc-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; display: block; background: #2a1a0e; }
.cc-stage-txt { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; padding: 8px 10px 9px; align-items: baseline; }
.cc-stage-txt b { font-family: var(--font-num); font-size: .8rem; color: var(--cc-orange); grid-row: span 2; }
.cc-stage-txt span { font-weight: 800; font-size: .84rem; line-height: 1.15; }
.cc-stage-txt i { font-style: normal; color: var(--cc-gold); letter-spacing: .08em; font-size: .86rem; }
.cc-stage-txt small { color: var(--cc-muted); font-size: .7rem; grid-column: 2; }
.cc-stage-b:hover:not(:disabled), .cc-stage-b:focus-visible { border-color: var(--cc-gold); box-shadow: 0 0 0 2px rgba(255, 209, 102, .35); outline: none; }
.cc-stage-b:disabled { cursor: not-allowed; }
.cc-stage-b:disabled .cc-thumb { filter: grayscale(1) brightness(.45); }

/* resultados */
.cc-stars { display: flex; gap: 8px; font-size: 2.4rem; line-height: 1; }
.cc-star { color: rgba(255, 255, 255, .15); }
.cc-star.on { color: var(--cc-gold); text-shadow: 0 0 16px rgba(255, 209, 102, .65); animation: cc-pop .45s both cubic-bezier(.2, 1.6, .4, 1); }
@keyframes cc-pop { from { transform: scale(.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.cc-tally { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.cc-tl { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed rgba(255, 255, 255, .12); animation: cc-in .35s both; }
.cc-tl:last-child { border-bottom: 0; }
.cc-tl dt { color: var(--cc-muted); font-size: .88rem; }
.cc-tl dd { margin: 0; font-family: var(--font-num); font-weight: 700; color: #fff; }
@keyframes cc-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.cc-record { margin: 0; color: var(--cc-gold); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; animation: cc-pulse 1s infinite alternate; }
@keyframes cc-pulse { from { opacity: .65; } to { opacity: 1; } }

/* ayuda */
.cc-help { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; font-size: .9rem; line-height: 1.45; color: var(--cc-ink); }
@media (max-width: 720px) { .cc-help { grid-template-columns: 1fr; } }
.cc-help h3 { margin: 6px 0 4px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--cc-teal); }
.cc-help p { margin: 0 0 8px; }
.cc-keys, .cc-legend { margin: 0 0 8px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }

/* opciones */
.cc-opts { display: flex; flex-direction: column; gap: 12px; }
.cc-opts label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--cc-muted); }
.cc-opts .cc-check { flex-direction: row; align-items: center; gap: 10px; color: var(--cc-ink); }
.cc-opts input[type="range"] { accent-color: var(--cc-orange); }
.cc-opts select { min-height: 40px; border-radius: 10px; background: rgba(20, 12, 6, .8); color: var(--cc-ink); border: 1px solid var(--cc-line); padding: 0 10px; font: inherit; }

/* récords */
.cc-rec-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cc-rec-top div { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--cc-line); display: flex; flex-direction: column; gap: 2px; }
.cc-rec-top small { color: var(--cc-muted); font-size: .72rem; }
.cc-rec-top b { font-family: var(--font-num); font-size: 1.1rem; color: var(--cc-gold); }
.cc-rec { width: 100%; border-collapse: collapse; font-size: .86rem; }
.cc-rec th { text-align: left; color: var(--cc-muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--cc-line); }
.cc-rec td { padding: 6px 4px; border-bottom: 1px dashed rgba(255, 255, 255, .08); }
.cc-rec td:nth-child(2) { color: var(--cc-gold); letter-spacing: .06em; }

.cc-confirm { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(10, 5, 0, .6); }
.cc-confirm[hidden] { display: none; }

/* ---------- controles táctiles ---------- */
.cc-touch { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cc-touch[hidden] { display: none; }
.cc-run-b, .cc-pause-b, .cc-pad-b { pointer-events: auto; touch-action: none; }
.cc-run-b {
  position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom));
  width: 84px; height: 84px; border-radius: 50%; border: 3px solid rgba(255, 240, 210, .7);
  background: radial-gradient(circle at 40% 35%, #ffb347, #e8452c); color: #fff; font: 900 .78rem/1 var(--font-ui); letter-spacing: .06em;
  box-shadow: 0 5px 0 rgba(110, 30, 10, .6), 0 10px 30px -8px rgba(0, 0, 0, .6); opacity: .82;
}
.cc-run-b.on { transform: translateY(3px); box-shadow: 0 2px 0 rgba(110, 30, 10, .6); opacity: 1; }
.cc-pause-b {
  position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom));
  width: 48px; height: 48px; border-radius: 14px; border: 2px solid rgba(255, 240, 210, .5); background: rgba(30, 18, 8, .55);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.cc-pause-b span { width: 6px; height: 18px; border-radius: 2px; background: #fff; }
.cc-pad { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: 156px; height: 156px; pointer-events: none; }
.cc-pad[hidden] { display: none; }
.cc-pad-b { position: absolute; width: 54px; height: 54px; border-radius: 14px; border: 2px solid rgba(255, 240, 210, .55); background: rgba(30, 18, 8, .5); }
.cc-pad-b::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border: 10px solid transparent; }
.cc-pad-b.on { background: rgba(255, 154, 47, .6); }
.cc-up { left: 51px; top: 0; } .cc-up::after { border-bottom-color: #fff; border-top-width: 0; }
.cc-down { left: 51px; bottom: 0; } .cc-down::after { border-top-color: #fff; border-bottom-width: 0; }
.cc-left { left: 0; top: 51px; } .cc-left::after { border-right-color: #fff; border-left-width: 0; }
.cc-right { right: 0; top: 51px; } .cc-right::after { border-left-color: #fff; border-right-width: 0; }

.cc-rotate { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 4; margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(30, 18, 8, .85); color: var(--cc-ink); font-size: .85rem; }
.cc-rotate[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cc-star.on, .cc-tl, .cc-record { animation: none; }
}

/* ---------- portada del juego (/juegos/capy-crossing) ---------- */
.cc-hub-banner { display: block; margin: 6px 0 18px; border-radius: 20px; overflow: hidden; background: #2a1a0e; box-shadow: 0 24px 60px -28px rgba(90, 40, 10, .6); aspect-ratio: 1672 / 941; }
.cc-hub-banner img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .5s ease; }
.cc-hub-banner:hover img { transform: scale(1.015); }
.cc-hub-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.cc-hub-progress div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--surface-2, #f4efe6); }
.cc-hub-progress small { font-size: .72rem; color: var(--muted); }
.cc-hub-progress b { font-family: var(--font-num); font-size: 1.05rem; }
.cc-hub-scenes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.cc-hub-scenes li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2, #f4efe6); border: 1px solid var(--line, rgba(0, 0, 0, .06)); }
.cc-hub-scenes b { font-size: .9rem; }
.cc-hub-scenes span { font-size: .8rem; color: var(--muted); }

/* vitrina en la categoría Arcade */
.cc-showcase { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0; margin: 4px 0 20px; border-radius: 20px; overflow: hidden; background: #2a1a0e; color: #fff8ec; text-decoration: none; box-shadow: 0 24px 60px -30px rgba(90, 40, 10, .6); }
.cc-showcase img { width: 100%; height: 100%; display: block; object-fit: cover; aspect-ratio: 1672 / 941; }
.cc-showcase-copy { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 22px 24px; background: linear-gradient(160deg, #3a2412, #1d120a); }
.cc-showcase-copy .chip { align-self: flex-start; }
.cc-showcase-copy h2 { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 900; color: #ffd166; }
.cc-showcase-copy p { margin: 0; color: #e7d3b4; line-height: 1.45; }
.cc-showcase-copy .btn { align-self: flex-start; }
@media (max-width: 760px) { .cc-showcase { grid-template-columns: 1fr; } }
