/* ---------- Connect 4 ---------- */
.c4 { gap: .4rem; }

/* discs (shared by board, bars and markers) */
.c4-disc { border-radius: 50%; }
.c4-disc.red { background: radial-gradient(circle at 35% 30%, #ff8a80 0%, #f0322a 45%, #a3120d 100%);
  box-shadow: inset 0 -.25em .4em #0005, inset 0 0 0 .18em #c81d17; }
.c4-disc.yel { background: radial-gradient(circle at 35% 30%, #fff3a8 0%, #ffcc1f 45%, #c58a00 100%);
  box-shadow: inset 0 -.25em .4em #0004, inset 0 0 0 .18em #e0a800; }

/* player bars */
.c4-bar { flex: none; display: flex; align-items: center; gap: .55rem; padding: .35rem .6rem; border-radius: 14px;
  background: var(--panel); border: 2px solid var(--line); transition: border-color .25s, box-shadow .25s, opacity .3s; min-height: 2.8rem; }
.c4-bar.turn { border-color: #f59e0b; animation: c4breathe 2s ease-in-out infinite; }
.c4-bar.won { border-color: var(--accent); box-shadow: 0 0 22px var(--accent); }
.c4-bar.lost { opacity: .6; }
.c4-bar.offline .c4-who b::after { content: " (offline)"; color: var(--muted); font-weight: 400; font-size: .8em; }
@keyframes c4breathe { 50% { box-shadow: 0 0 16px #f59e0b88; } }
.c4-disc.av { width: 1.9rem; height: 1.9rem; flex: none; font-size: 1rem; }
.c4-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.c4-who b { font-family: var(--fun); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4-who small { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.c4-score { margin-left: auto; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.c4-score b { font-family: var(--fun); font-size: 1.35rem; }
.c4-score small { color: var(--muted); font-size: .65rem; }

/* board — biggest 7:7 box (6 rows + marker row) that fits */
.c4-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.c4-frame { width: min(100cqw, 100cqh); aspect-ratio: 1; display: flex; flex-direction: column; container-type: inline-size;
  touch-action: manipulation; }
.c4-mks { flex: none; height: calc(100cqw / 7); display: grid; grid-template-columns: repeat(7, 1fr); }
.c4-mk { display: grid; place-items: center; font-size: 6cqw; cursor: default; }
.c4-frame.live .c4-mk:not(.full), .c4-frame.live .c4-cell { cursor: pointer; }
.c4-mk .arrow { color: var(--muted); font-size: 4cqw; opacity: .5; animation: c4bob 1.4s ease-in-out infinite; }
.c4-mk.on .arrow { opacity: 1; color: var(--accent); }
.c4-mk .star, .c4-mk .warn { animation: c4bob .8s ease-in-out infinite; }
.c4-mk .c4-disc.mini { display: block; width: 70%; aspect-ratio: 1; font-size: 3cqw; animation: c4bob 1s ease-in-out infinite; }
@keyframes c4bob { 50% { transform: translateY(-1.1cqw); } }

.c4-board { flex: 1; position: relative; border-radius: 3.2cqw; padding: 1.4cqw;
  background: linear-gradient(180deg, #2f6bff, #1c45c9); box-shadow: inset 0 .6cqw 0 #ffffff33, inset 0 -.8cqw 0 #0003, 0 2cqw 4cqw #000a; }
.c4-discs { position: absolute; inset: 1.4cqw; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); }
.c4-cell { position: relative; display: grid; place-items: center; }
.c4-cell::before { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: #120c22;
  box-shadow: inset 0 1cqw 1.2cqw #000c; }
.c4-cell .c4-disc { position: relative; width: 84%; height: 84%; font-size: 3cqw; z-index: 1; }

/* animations */
.c4-disc.drop { animation: c4drop var(--t, .3s) cubic-bezier(.5, 0, .85, .4) both, c4bounce .25s var(--t, .3s) ease-out; }
@keyframes c4drop { from { transform: translateY(calc(var(--fall) * -119%)); } }
@keyframes c4bounce { 40% { transform: translateY(-9%); } }
.c4-disc.last { outline: .7cqw solid #ffffffaa; outline-offset: -.2cqw; }
.c4-disc.win { animation: c4win .9s .4s ease-in-out infinite; outline: .8cqw solid #fff; outline-offset: -.3cqw; }
.c4-disc.drop.win { animation: c4drop var(--t, .3s) cubic-bezier(.5, 0, .85, .4) both, c4win .9s .5s ease-in-out infinite; }
@keyframes c4win { 50% { transform: scale(1.12); filter: brightness(1.35) drop-shadow(0 0 2cqw #fff); } }
.c4-disc.fade { opacity: .45; transition: opacity .6s .5s; }

.c4-ghost { position: absolute; width: calc(100% / 7); height: calc(100% / 6);
  border-radius: 50%; pointer-events: none; opacity: .4; transform: scale(.84); z-index: 2; }
.c4-ghost.red { background: #f0322a; }
.c4-ghost.yel { background: #ffcc1f; }

.c4 .statusbar.nudge { animation: c4shake .4s; }
@keyframes c4shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.c4-resign.armed { color: var(--bad); border-color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  .c4-disc.drop, .c4-disc.win, .c4-bar.turn, .c4-mk * { animation: none !important; }
}
