/* ============================================================
   Conexiones — superficies del sitio (claro u oscuro según el tema) y
   cuatro colores de grupo apagados, en la familia de ENIGMA:
   1 amarillo · 2 verde · 3 azul · 4 morado. Texto oscuro sobre color.
   ============================================================ */
.cx {
  --cx-1: #E7C866; --cx-2: #A3C385; --cx-3: #96B4DC; --cx-4: #BBA0D3; --cx-on: #1f1a14;
  --cx-tile: color-mix(in srgb, var(--surface-2, #efe8dc) 85%, var(--ink) 4%);
  width: 100%; max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}
:root[data-theme="dark"] .cx { --cx-1: #CDB05A; --cx-2: #8FAE72; --cx-3: #7E9CC4; --cx-4: #A68BBF; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .cx { --cx-1: #CDB05A; --cx-2: #8FAE72; --cx-3: #7E9CC4; --cx-4: #A68BBF; } }
.cx-host { display: block; padding: 6px 0 10px; }

.cx-bars { display: flex; flex-direction: column; gap: 8px; }
.cx-bar {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 72px; padding: 10px 14px; border-radius: var(--r-md); text-align: center; color: var(--cx-on);
}
.cx-bar[data-level="1"] { background: var(--cx-1); } .cx-bar[data-level="2"] { background: var(--cx-2); }
.cx-bar[data-level="3"] { background: var(--cx-3); } .cx-bar[data-level="4"] { background: var(--cx-4); }
.cx-bar-n { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; letter-spacing: .01em; }
.cx-bar-w { font-size: .86rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
/* grupos revelados al terminar sin resolver: rayado sutil en vez de transparencia (el texto conserva su contraste) */
.cx-bar.is-dim { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .22) 0 6px, transparent 6px 14px); }
.cx-bar.is-new { animation: cx-in .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes cx-in { from { opacity: 0; transform: scale(.96); } }

.cx-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cx-grid[hidden] { display: none; }
.cx-tile {
  min-height: 72px; padding: 6px 4px; border: 0; border-radius: var(--r-md); cursor: pointer;
  background: var(--cx-tile); color: var(--ink);
  font-family: var(--font-ui); font-size: clamp(.78rem, 2.1vw, .98rem); font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  line-height: 1.1; white-space: nowrap; overflow: hidden; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.cx-tile.is-long { font-size: clamp(.68rem, 1.8vw, .86rem); letter-spacing: .01em; }
.cx-tile.is-xlong { font-size: clamp(.58rem, 1.55vw, .76rem); letter-spacing: 0; }
.cx-tile:hover:not(:disabled) { background: color-mix(in srgb, var(--cx-tile) 82%, var(--ink) 10%); }
.cx-tile:active:not(:disabled) { transform: scale(.97); }
.cx-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cx-tile.is-sel, .cx-tile.is-sel:hover:not(:disabled) { background: var(--ink); color: var(--on-ink, #fff); }
@media (hover: none) { .cx-tile:hover:not(:disabled):not(.is-sel) { background: var(--cx-tile); } }
.cx-tile-t { display: inline-block; max-width: 100%; }
.cx-tile.is-hop { animation: cx-hop .32s ease both; }
@keyframes cx-hop { 45% { transform: translateY(-6px); } }
.cx-tile.is-shake { animation: cx-shake .38s ease-in-out; }
@keyframes cx-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.cx.is-done .cx-tile { cursor: default; opacity: .7; }

.cx-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }
.cx-lives { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--ink-2); }
.cx-pips { display: inline-flex; gap: 6px; }
.cx-pip { width: 11px; height: 11px; border-radius: 50%; background: var(--ink-2); transition: opacity .3s ease, transform .3s ease; }
.cx-pip.is-spent { opacity: .18; transform: scale(.8); }
.cx-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cx-btns .btn { min-width: 118px; }

.cx-help-levels { display: flex; gap: 6px; margin: 10px 0 0; flex-wrap: wrap; }
.cx-help-levels span { flex: 1 1 0; padding: 6px 8px; border-radius: var(--r-sm); text-align: center; font-size: .8rem; font-weight: 600; color: #1f1a14; }
.cx-help-levels [data-level="1"] { background: #E7C866; } .cx-help-levels [data-level="2"] { background: #A3C385; }
.cx-help-levels [data-level="3"] { background: #96B4DC; } .cx-help-levels [data-level="4"] { background: #BBA0D3; }

@media (max-width: 520px) {
  .cx-grid { gap: 6px; }
  .cx-tile { min-height: 64px; border-radius: var(--r-sm); }
  .cx-bar { min-height: 64px; }
  .cx-btns .btn { min-width: 0; flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-tile.is-hop, .cx-tile.is-shake, .cx-bar.is-new { animation: none; }
}
