/* Word Whack — word tiles rise from rainbow portals. The word is the star. */
.dxg .ww {
	position: relative; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center;
	padding: clamp(10px, 2vh, 22px) clamp(10px, 3vw, 36px);
	background: linear-gradient(to bottom, var(--g-light) 0 62%, #E4F4F2 62% 100%);
}
.ww-board {
	--cols: 3;
	width: min(100%, 860px); flex: 0 1 auto;
	display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: clamp(10px, 3vh, 34px) clamp(10px, 2.5vw, 34px);
}
.ww-hole { position: relative; aspect-ratio: 5 / 3.4; min-height: 0; max-height: 34vh; }
/* the dark opening */
.ww-back {
	position: absolute; left: 4%; right: 4%; bottom: 0; height: 30%;
	border-radius: 50%; background: radial-gradient(ellipse at 50% 35%, #33475C 0 55%, #1C2B3D 56%);
}
/* the tile lives in a window that ends at the middle of the opening */
.ww-slot { position: absolute; left: 0; right: 0; top: 0; bottom: 15%; overflow: hidden; }
.ww-tile {
	position: absolute; left: 10%; right: 10%; bottom: 0; height: 78%;
	display: grid; place-items: center; padding: 0 6px; margin: 0; cursor: pointer;
	background: #fff; border: 3px solid #fff; border-top: 12px solid var(--cap); border-radius: 18px 18px 10px 10px;
	box-shadow: 0 6px 14px rgba(28, 43, 61, .18);
	transform: translateY(110%); transition: transform .2s cubic-bezier(.3, 1.45, .6, 1);
	-webkit-tap-highlight-color: transparent;
}
.ww-tile__word {
	font-family: var(--g-head); font-weight: 500; color: var(--g-navy); line-height: 1;
	font-size: clamp(1.5rem, 1.1rem + 2vw, 2.6rem); letter-spacing: .02em; white-space: nowrap;
}
.ww-hole.is-up .ww-tile { transform: translateY(0); }
.ww-tile:focus-visible { outline: 4px solid var(--g-blue); outline-offset: 2px; }
/* the front lip in the portal's rainbow color, drawn over the tile's base */
.ww-lip {
	position: absolute; left: 1%; right: 1%; bottom: 0; height: 30%; pointer-events: none;
	border-radius: 50%; border: 7px solid var(--cap); border-top-color: transparent; border-left-color: transparent; border-right-color: transparent;
	clip-path: inset(50% 0 0 0);
}
.ww-key {
	position: absolute; right: 2%; bottom: -2px; width: 26px; height: 26px; border-radius: 8px;
	display: grid; place-items: center; background: #fff; border: 1px solid var(--g-border);
	font-family: var(--g-head); font-size: 0.85rem; color: var(--g-muted); pointer-events: none;
}

/* Correct: squash, stars, then drop */
.ww-hole.is-hit .ww-tile {
	transform: translateY(0) scale(1.08, .82); transform-origin: bottom center; transition: transform .1s ease-out;
	background: #E2F5F3; border-color: #7CCBC4; border-top-color: var(--g-aqua);
}
.ww-spark {
	position: absolute; left: 50%; top: 42%; width: 12px; height: 12px; margin: -6px 0 0 -6px; z-index: 3; pointer-events: none;
	clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
	animation: ww-spark .5s ease-out forwards;
}
.ww-spark--0 { background: #F6D878; } .ww-spark--1 { background: #F2A08F; } .ww-spark--2 { background: #9DD3DA; } .ww-spark--3 { background: #A9D8B8; }
@keyframes ww-spark { to { transform: translate(var(--tx), var(--ty)) rotate(90deg) scale(.4); opacity: 0; } }

/* Not a match: gentle wiggle, dashed edge + ✕, word stays readable */
.ww-hole.is-wrong .ww-tile { border-style: dashed; border-color: var(--g-coral); border-top-style: solid; animation: dxg-wiggle .38s ease-in-out; }
.ww-hole.is-wrong .ww-tile::after {
	content: "✕"; position: absolute; top: -18px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
	display: grid; place-items: center; background: #9E3647; color: #fff; font-size: 14px; font-weight: 700; font-family: var(--g-body);
}
.ww-hole.is-sink .ww-tile { transform: translateY(110%); transition-duration: .18s; transition-timing-function: ease-in; }

/* Streak badge */
.ww-streak {
	position: absolute; top: 10px; right: 14px; z-index: 4; padding: 4px 14px; border-radius: 999px;
	background: #FFF5D1; border: 2px solid #E9C85A; font-family: var(--g-head); font-weight: 600; font-size: 1.05rem; color: #5C4500;
	opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s;
}
.ww-streak.is-on { opacity: 1; transform: none; }
.ww-streak.is-pop { animation: ww-pop .5s ease-out; }
@keyframes ww-pop { 40% { transform: scale(1.18); } }
.ww-hint { margin: 10px 0 0; font-size: 0.9rem; color: var(--g-muted); }

@media (prefers-reduced-motion: reduce) {
	.ww-tile { transition: opacity .15s linear; transform: none !important; opacity: 0; }
	.ww-hole.is-up .ww-tile { opacity: 1; }
	.ww-hole.is-sink .ww-tile { opacity: 0; }
}
@media (max-width: 599px) {
	/* Phones: two columns of three so each portal and word is bigger */
	.ww-board { grid-template-columns: repeat(2, 1fr) !important; gap: 12px 14px; }
	.ww-hole { max-height: 24vh; }
	.ww-tile { left: 4%; right: 4%; border-top-width: 9px; }
	.ww-tile__word { font-size: 1.8rem; }
	.ww-key { width: 22px; height: 22px; font-size: 0.75rem; }
	.ww-hint { display: none; }
	.ww-streak { top: 6px; right: 8px; font-size: 0.95rem; }
}
