.cbn-gallery .gallery-sub { font-size: 13px; }
.cbn-gallery .gallery-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; margin: 24px 0; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-input); }
.cbn-gallery .filter-chip { border: 0; border-radius: var(--radius-pill); padding: 10px 18px; min-height: 44px; background: transparent; color: var(--muted); font-weight: 600; }
.cbn-gallery .filter-chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.cbn-gallery .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.cbn-gallery .puzzle-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform 180ms ease, box-shadow 180ms ease; }
.cbn-gallery .puzzle-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.cbn-gallery .puzzle-card canvas { display: block; width: 100%; height: 220px; padding: 24px; object-fit: contain; image-rendering: pixelated; background: var(--input-bg); }
.cbn-gallery .puzzle-meta { display: grid; gap: 8px; padding: 16px; }
.cbn-gallery .puzzle-meta strong { font-size: 16px; }
.cbn-gallery .puzzle-meta > span { font-size: 12px; color: var(--muted); }
.cbn-gallery .puzzle-badge { position: absolute; top: 12px; right: 12px; padding: 5px 10px; background: var(--primary); color: var(--on-primary); border-radius: var(--radius-pill); font-size: 12px; }
.cbn-gallery .puzzle-status { justify-self: start; padding: 4px 10px; background: var(--tint); color: var(--tint-text) !important; border-radius: var(--radius-pill); }
.cbn-gallery .puzzle-progress, .cbn-player .bar { height: 6px; overflow: hidden; background: var(--input-bg); border-radius: var(--radius-pill); }
.cbn-gallery .puzzle-progress i, .cbn-player .bar i { display: block; height: 100%; width: 0; max-width: 100%; background: var(--green-600); }
.cbn-player .player-top { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.cbn-player .player-title { flex: 1; min-width: 100px; display: grid; gap: 8px; }
.cbn-player .player-title strong { overflow-wrap: anywhere; font-size: 18px; }
.cbn-player .player-percent { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.games-page .cbn-icon-btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 8px; width: 44px; height: 44px; border: 1px solid var(--control-border); border-radius: 50%; background: var(--surface); color: var(--text); text-decoration: none; }
.games-page .cbn-icon-btn.games-back { width: auto; border-radius: var(--radius-pill); }
.games-page .cbn-icon-btn:hover { background: var(--tint); color: var(--tint-text); }
.cbn-player .player-stage { position: relative; width: 100%; height: min(65dvh, 680px); min-height: 320px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow); }
.cbn-player #board { display: block; width: 100%; height: 100%; touch-action: none; }
.cbn-player .zoom-cluster { position: absolute; right: 12px; bottom: 48px; display: flex; flex-direction: column; gap: 8px; }
.cbn-player .stage-hint { position: absolute; bottom: 12px; left: 16px; right: 16px; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.cbn-player .palette-bar { padding: 20px 0; }
.cbn-player .palette-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 6px 4px 12px; max-width: 100%; }
.cbn-player .swatch { position: relative; flex: 0 0 52px; width: 52px; height: 52px; border: 3px solid var(--surface); border-radius: 50%; outline: 1px solid var(--border); font-size: 16px; font-weight: 700; }
.cbn-player .swatch[aria-pressed="true"] { outline: 3px solid var(--green-600); outline-offset: 2px; }
.cbn-player .swatch.done { opacity: .55; }
.cbn-player .swatch .left { position: absolute; right: -3px; bottom: -5px; min-width: 20px; padding: 2px 4px; border-radius: var(--radius-pill); background: var(--surface); color: var(--text); font-size: 10px; }
.cbn-player .finish-overlay { display: none; position: absolute; inset: 0; z-index: 3; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 24px; text-align: center; background: var(--green-900); color: var(--neutral-0); }
.cbn-player .finish-overlay.show { display: flex; }
.cbn-player .finish-overlay h2, .cbn-player .finish-overlay p { margin: 0; }
.cbn-player .finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.cbn-player .finish-actions > * { min-height: 44px; padding: 10px 20px; border-radius: var(--radius-pill); border: 1px solid var(--neutral-0); color: var(--neutral-0); background: transparent; text-decoration: none; }
.cbn-player .finish-actions .primary { background: var(--neutral-0); color: var(--green-900); }
.cbn-player .cbn-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.cbn-player .cbn-loading.hidden { display: none; }
body[data-theme="dark"] .cbn-player .swatch[aria-pressed="true"] { outline-color: var(--green-300); }
@keyframes cbn-fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0; } }
@media (max-width: 575px) { .cbn-gallery .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .cbn-gallery .puzzle-card canvas { height: 150px; padding: 12px; } .cbn-gallery .puzzle-meta { padding: 12px; } .cbn-player .player-title { flex-basis: calc(100% - 120px); } .cbn-player .player-stage { height: 55dvh; } }
@media (prefers-reduced-motion: reduce) { .cbn-gallery .puzzle-card:hover { transform: none; } }