/* Coding Games (assets/play/coding.js). Arrow colors = generator/play_coding.DIR_COLOR. */
.cg-loading { padding: 40px; text-align: center; }
.cg { display: grid; gap: 12px; }
@media (min-width: 760px) { .cg { grid-template-columns: minmax(0, 1.3fr) minmax(290px, 1fr); align-items: start; } }
.cg-board { display: flex; justify-content: center; border-radius: 16px; }
.cg-svg { display: block; width: 100%; height: auto; max-height: min(50vh, 560px); }
.game:fullscreen .cg-svg { max-height: calc(100vh - 330px); }
@media (min-width: 760px) { .game:fullscreen .cg-svg { max-height: calc(100vh - 190px); } }
.cg-board.cg-edge .cg-svg { animation: cg-edge .5s ease-out 2; }
@keyframes cg-edge { 50% { filter: drop-shadow(0 0 6px #ef3b2d) drop-shadow(0 0 2px #ef3b2d); } }

.cg-pic { transform-box: fill-box; transform-origin: center; }
.cg-hero { transition: transform .3s ease-in-out; }
.cg-hero-move, .cg-hero-flip { transform-box: fill-box; transform-origin: center; }
.cg-hero-flip.cg-flipped { transform: scaleX(-1); }
.cg-hero-move.cg-bump { animation: cg-bump .6s ease-out; }
@keyframes cg-bump { 30% { transform: translate(var(--bx), var(--by)) rotate(-8deg); } 55% { transform: translate(0, 0) rotate(6deg); }
  75% { transform: rotate(-4deg); } 100% { transform: none; } }
.cg-hero-move.cg-happy, .cg-pic.cg-happy { animation: cg-hop .45s ease-in-out 3; }
@keyframes cg-hop { 50% { transform: translateY(-14px) scale(1.12); } }
.cg-pic.cg-shake { animation: cg-shake .18s linear 4; }
@keyframes cg-shake { 25% { transform: translateX(-6px) rotate(-5deg); } 75% { transform: translateX(6px) rotate(5deg); } }
.cg-item.cg-got { animation: cg-got .45s ease-in forwards; }
@keyframes cg-got { 40% { transform: scale(1.45); opacity: 1; } 100% { transform: scale(.2) translateY(-60px); opacity: 0; } }
.cg-glow { fill: #ffd23f; opacity: .55; transform-box: fill-box; transform-origin: center; }
.cg-glow.cg-happy { animation: cg-hop .45s ease-in-out 3; }
.cg-trail { fill: none; stroke: #16264a; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 16; opacity: .45; }
.cg-dot { fill: #ffd23f; stroke: #e0a800; stroke-width: 3; opacity: 0; animation: cg-dot .5s ease-out forwards; }
@keyframes cg-dot { 100% { opacity: .95; } }

.cg-panel { display: flex; flex-direction: column; gap: 10px; }
.cg-prog { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 60px; padding: 8px; border-radius: 14px;
  background: #f3f6fb; box-shadow: inset 0 0 0 2px var(--line); }
.cg-over .cg-prog { box-shadow: inset 0 0 0 3px var(--red); }
.cg-blk, .cg-slot { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.cg-blk { border: 0; padding: 0; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; box-shadow: 0 3px 0 rgba(22, 38, 74, .25); transition: transform .12s; }
.cg-blk .cg-ar { width: 28px; height: 28px; }
.cg-loops .cg-blk { width: auto; min-width: 42px; padding: 0 6px; }
.cg-x { font: 800 1.05rem/1 var(--display); color: #fff; padding-right: 2px; }
.cg-blk.cg-in { animation: pop .25s ease-out; }
.cg-blk.cg-now { transform: translateY(-4px) scale(1.08); box-shadow: 0 0 0 4px var(--yellow), 0 3px 0 rgba(22, 38, 74, .25); }
.cg-blk.cg-bad { background: var(--red); box-shadow: 0 0 0 4px #ffc9c4; animation: shake .3s 2; }
.cg-slot { border: 3px dashed #c5cfdd; }
.cg-busy .cg-pad, .cg-busy .cg-row .g-btn:not(.cg-go) { opacity: .55; }
.cg-busy .cg-blk { cursor: default; }

.cg-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cg-key { border: 0; height: 66px; border-radius: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 rgba(22, 38, 74, .28); transition: transform .08s; }
.cg-key:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(22, 38, 74, .28); }
.cg-key .cg-ar { width: 42px; height: 42px; }
.cg-ar path { fill: #fff; stroke: #fff; stroke-width: 9; stroke-linejoin: round; }
.cg-U { background: #12a1dc; } .cg-D { background: #f08c00; } .cg-L { background: #22b573; } .cg-R { background: #6b3fc4; }
.cg-key.cg-wiggle { animation: cg-wiggle .9s ease-in-out infinite; }
@keyframes cg-wiggle { 0%, 100% { transform: none; } 25% { transform: translateY(-6px) rotate(-6deg); } 75% { transform: translateY(-6px) rotate(6deg); } }

.cg-row { display: flex; gap: 8px; align-items: center; }
.cg-row .g-btn { flex: none; }
.cg-row .cg-go { flex: 1 1 auto; font-size: 1.3rem; }
.cg-go.cg-ready { animation: cg-ready 1.1s ease-in-out infinite; }
@keyframes cg-ready { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(239, 59, 45, .25); } }
.cg-tapsay { cursor: pointer; }
@media (max-width: 480px) {
  .cg-row .g-btn span { display: none; }
  .cg-row .g-btn:not(.cg-go) { padding: 8px 10px; }
  .cg-key { height: 60px; }
}
@media (min-width: 760px) { .cg-blk, .cg-slot { width: 46px; height: 46px; } .cg-loops .cg-blk { width: auto; } }
@media (hover: hover) {
  .cg-key:hover { filter: brightness(1.08); }
  .cg-blk:hover { transform: translateY(-2px); }
}
