/* ============================================================
   PLAY LOBBY (page-templates/play.php, assets/js/play.js)
   Today's hero with progress + game of the day, then game tiles.
   ============================================================ */

.swx-lobby { --ac: #22c55e; --spring: cubic-bezier(0.34, 1.56, 0.64, 1); --rim: rgba(255, 255, 255, 0.09); }

/* .swg-hub is a flex column; stop centered sections from shrinking to their content */
.swx-lobby > .swh-wrap { width: 100%; box-sizing: border-box; }

/* ---------- Hero ---------- */

.swx-lobby-hero {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	align-items: center;
	gap: clamp(24px, 4vw, 56px);
	padding-top: clamp(28px, 5vw, 64px);
	padding-bottom: clamp(20px, 3vw, 40px);
}

.swx-lobby-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--card);
	box-shadow: inset 0 0 0 1px var(--rim);
	color: var(--text-2);
	font-size: 0.85rem;
	font-weight: 700;
}
.swx-lobby-kicker [data-lobby-num] { color: #fff; font-weight: 900; }

.swx-lobby-live {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
	animation: swx-lobby-live 2s ease-out infinite;
}
@keyframes swx-lobby-live { 70%, 100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } }

.swx-lobby-title {
	margin: 0 0 12px;
	color: #fff;
	font-size: clamp(2.4rem, 6vw, 4.2rem);
	font-weight: 900;
	letter-spacing: -0.045em;
	line-height: 1;
}

.swx-lobby-sub { max-width: 30em; margin: 0 0 24px; color: var(--text-2); font-size: 1.08rem; line-height: 1.55; }

/* Progress ring + streak + countdown */
.swx-lobby-today { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

.swx-lobby-ring { position: relative; flex: none; width: 64px; height: 64px; }
.swx-lobby-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.swx-lobby-ring circle { fill: none; stroke-width: 5; }
.swx-lobby-ring .track { stroke: var(--card-2); }
.swx-lobby-ring .fill {
	stroke: #22c55e;
	stroke-linecap: round;
	stroke-dasharray: 100;
	stroke-dashoffset: calc(100 - 100 * var(--done));
	transition: stroke-dashoffset 900ms var(--spring);
}
.swx-lobby-ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; color: #fff; font-size: 0.95rem; font-weight: 900; }

.swx-lobby-today-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.swx-lobby-today-text b { color: #fff; font-size: 1.1rem; font-weight: 800; }
.swx-lobby-today-text span { color: var(--text-2); font-size: 0.9rem; }
.swx-lobby-today-text time { color: #fff; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* One chip per game, filled in once it's played today */
.swx-lobby-dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.swx-lobby-dots a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 12px 6px 8px;
	border-radius: 999px;
	background: var(--card);
	box-shadow: inset 0 0 0 1px var(--rim);
	color: var(--text-2);
	font-size: 0.82rem;
	font-weight: 700;
	text-decoration: none;
	transition: color 150ms ease, box-shadow 150ms ease;
}
.swx-lobby-dots a:hover { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.swx-lobby-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ac); }
.swx-lobby-dots .is-done a { color: #fff; }
.swx-lobby-dots .is-done i {
	background: var(--ac) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 9px no-repeat;
	box-shadow: none;
}

/* Game of the day */
.swx-lobby-feature {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 24px;
	background: var(--card);
	color: #fff;
	text-decoration: none;
	box-shadow: inset 0 0 0 1px var(--rim), 0 30px 60px -20px color-mix(in srgb, var(--ac) 45%, transparent);
	transition: transform 260ms var(--spring), box-shadow 200ms ease;
}
.swx-lobby-feature[hidden] { display: none; }
.swx-lobby-feature:hover { color: #fff; transform: translateY(-3px); }
.swx-lobby-feature .swg-art { aspect-ratio: 16 / 10; }
.swx-lobby-feature-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px 22px 22px;
	background: linear-gradient(180deg, color-mix(in srgb, var(--ac) 10%, var(--card)), var(--card));
}
.swx-lobby-chip {
	align-self: flex-start;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--ac);
	color: #000;
	font-size: 0.72rem;
	font-weight: 900;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.swx-lobby-feature-name { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.swx-lobby-feature-desc { color: var(--text-2); font-size: 0.98rem; line-height: 1.5; }
.swx-lobby-play {
	align-self: flex-start;
	margin-top: 8px;
	padding: 11px 20px;
	border-radius: 999px;
	background: #fff;
	color: #000;
	font-size: 0.98rem;
	font-weight: 800;
	transition: transform 200ms var(--spring);
}
.swx-lobby-feature:hover .swx-lobby-play { transform: translateX(3px); }

/* ---------- All games ---------- */

.swx-lobby-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 18px; }
.swx-lobby-head .swh-h2 { margin: 0; }
.swx-lobby-head p { margin: 0; color: var(--text-3); font-size: 0.9rem; font-weight: 700; }

.swx-lobby-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* Wide screens: rows of three, with wide tiles first so no row is left short
   (5 games = 2 wide + 3; 7 = 2 + 2 wide... always full rows) */
@media (min-width: 1000px) {
	.swx-lobby-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.swx-lobby-grid > .swx-tile { grid-column: span 2; }
	.swx-lobby-grid:has(> :first-child:nth-last-child(3n+2)) > :nth-child(-n+2),
	.swx-lobby-grid:has(> :first-child:nth-last-child(3n+1)) > :nth-child(-n+4) { grid-column: span 3; }
	/* Wide tiles keep the same art height as the narrow ones */
	.swx-lobby-grid:has(> :first-child:nth-last-child(3n+2)) > :nth-child(-n+2) .swg-art,
	.swx-lobby-grid:has(> :first-child:nth-last-child(3n+1)) > :nth-child(-n+4) .swg-art { aspect-ratio: 8 / 3; }
}

.swx-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 20px;
	background: var(--card);
	color: #fff;
	text-decoration: none;
	box-shadow: inset 0 0 0 1px var(--rim);
	transition: transform 260ms var(--spring), box-shadow 200ms ease, background-color 200ms ease;
}
.swx-tile::before {
	content: '';
	position: absolute;
	inset: 0 0 auto;
	z-index: 1;
	height: 3px;
	background: var(--ac);
}
.swx-tile:hover {
	color: #fff;
	background: var(--card-2);
	transform: translateY(-4px);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 55%, transparent), 0 24px 44px -18px color-mix(in srgb, var(--ac) 50%, transparent);
}

.swx-tile-art { position: relative; display: block; }
.swx-tile-art .swg-art { transition: transform 400ms ease; }
.swx-tile:hover .swx-tile-art .swg-art { transform: scale(1.04); }

.swx-tile-status {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 1;
	padding: 5px 10px;
	border-radius: 999px;
	background: rgba(10, 10, 14, 0.7);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 800;
}
.swx-tile.is-done .swx-tile-status { background: #22c55e; color: #032b12; }

.swx-tile-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 16px 18px 18px; }
.swx-tile-tag { color: var(--ac); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.swx-tile-name { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.swx-tile-desc { color: var(--text-2); font-size: 0.93rem; line-height: 1.5; }

.swx-tile-modes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.swx-tile-modes span { padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--text-2); font-size: 0.75rem; font-weight: 700; }
.swx-tile-modes .is-daily { color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 60%, transparent); }

.swx-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; }
.swx-tile-me { color: var(--text-3); font-size: 0.82rem; font-weight: 700; }
.swx-tile-go { color: #fff; font-size: 0.92rem; font-weight: 800; transition: transform 200ms var(--spring); }
.swx-tile:hover .swx-tile-go { transform: translateX(3px); }

/* ---------- How it works ---------- */

.swx-lobby-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.swx-lobby-steps > div { padding: 20px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--rim); }
.swx-lobby-steps b {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin-bottom: 12px;
	border-radius: 10px;
	background: conic-gradient(from 200deg, #f78154, #f2c14e, #5fad56, #2387ff, #b4436c, #f78154);
	color: #fff;
	font-weight: 900;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.swx-lobby-steps h3 { margin: 0 0 6px; color: #fff; font-size: 1.05rem; font-weight: 800; }
.swx-lobby-steps p { margin: 0; color: var(--text-2); font-size: 0.93rem; line-height: 1.55; }

/* ---------- Narrower screens ---------- */

@media (max-width: 900px) {
	.swx-lobby-hero { grid-template-columns: minmax(0, 1fr); }
	.swx-lobby-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
	.swx-lobby-hero { padding-top: 20px; gap: 22px; }
	.swx-lobby-sub { font-size: 1rem; margin-bottom: 18px; }
	.swx-lobby-ring { width: 56px; height: 56px; }
	.swx-lobby-dots { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
	.swx-lobby-dots::-webkit-scrollbar { display: none; }
	.swx-lobby-dots li { flex: none; }
	.swx-lobby-feature { border-radius: 20px; }
	.swx-lobby-feature-body { padding: 16px 18px 18px; }
	.swx-lobby-play { align-self: stretch; text-align: center; }

	/* Tiles become compact rows: art on the left */
	.swx-lobby-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
	.swx-tile { display: grid; grid-template-columns: 112px minmax(0, 1fr); border-radius: 16px; }
	.swx-tile::before { inset: 0 auto 0 0; width: 3px; height: auto; }
	.swx-tile-art .swg-art { height: 100%; aspect-ratio: auto; }
	.swx-tile-status { top: auto; right: auto; bottom: 8px; left: 8px; padding: 3px 7px; font-size: 0.68rem; }
	.swx-tile-body { padding: 12px 14px; gap: 3px; }
	.swx-tile-name { font-size: 1.1rem; }
	.swx-tile-desc { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 0.85rem; }
	.swx-tile-modes { display: none; }
	.swx-tile-foot { padding-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.swx-lobby-live { animation: none; }
}
