/*
 * games.css
 * Play hub + game pages. Builds on the tokens and buttons in home-companion.css (.swh).
 * Templates: page-templates/play.php, page-templates/game.php, module/games/*.php
 *
 * @package Swatching
 */

/* ============================================================
   GAME CARDS (Play hub, "More games", homepage)
   ============================================================ */

.swg-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
	gap: 16px;
}

.swg-card {
	display: flex;
	flex-direction: column;
	background: var(--card);
	border-radius: 12px;
	overflow: hidden;
	color: var(--text);
	transition: background var(--ease), transform var(--ease);
}

.swg-card:hover { background: var(--card-2); color: var(--text); transform: translateY(-2px); }

.swg-card-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px 20px 20px;
	flex: 1;
}

.swg-tag {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--green);
}

.swg-card-name {
	font-size: 1.3rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.swg-card-desc {
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--text-2);
}

.swg-card-meta {
	margin-top: auto;
	padding-top: 8px;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-3);
}

.swg-card-best { color: var(--text-2); }

.swg-cards--compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.swg-cards--compact .swg-card-desc { display: none; }

/* ---------- Card art ---------- */

.swg-art {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--card-2);
}

.swg-art--color-grid {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 3px;
	padding: 14% 8%;
	background: #101826;
}

.swg-art--color-grid i { border-radius: 3px; }

.swg-art--hue-match {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10%;
	padding: 6% 16%;
	background: #1d1430;
}

.swg-art-split {
	display: flex;
	height: 52%;
	border-radius: 8px;
	overflow: hidden;
}

.swg-art-split i { flex: 1; position: relative; }

.swg-art-split em {
	position: absolute;
	left: 6px;
	top: 6px;
	padding: 1px 7px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	font-style: normal;
}

.swg-art-sliders {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.swg-art-sliders b {
	position: relative;
	display: block;
	height: 7px;
	border-radius: 4px;
}

.swg-art-sliders .h { background: linear-gradient(90deg, #f43f5e, #f59e0b, #22c55e, #06b6d4, #3b82f6, #a855f7, #f43f5e); }
.swg-art-sliders .s { background: linear-gradient(90deg, #8a8079, #e0703f); }
.swg-art-sliders .l { background: linear-gradient(90deg, #000, #e0703f, #fff); }

.swg-art-sliders u {
	position: absolute;
	top: 50%;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid #1d1430;
	transform: translate(-50%, -50%);
}

.swg-art--odd-one-out {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	grid-template-rows: repeat(3, 1fr);
	gap: 4px;
	padding: 8% 14%;
	background: #0f2420;
}

.swg-art--odd-one-out i { border-radius: 4px; background: #2a9d8f; }

.swg-art--odd-one-out i.odd {
	background: #4fc0b1;
	box-shadow: 0 0 0 3px #0f2420, 0 0 0 5px #fff;
	position: relative;
	z-index: 1;
}

.swg-art--hex-guess {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: #0e1c26;
}

.swg-art-code {
	font-family: var(--mono);
	font-size: 1.5rem;
	font-weight: 600;
	color: #fff;
}

.swg-art-opts { display: flex; gap: 6px; }
.swg-art-opts i { width: 34px; height: 34px; border-radius: 6px; }
.swg-art-opts i:first-child { box-shadow: 0 0 0 2px #fff; }


/* ---------- Tool card art (Tools hub) ---------- */

.swt-art--color-extractor {
	background:
		radial-gradient(circle at 25% 32%, #e76f51 0 16%, transparent 40%),
		radial-gradient(circle at 72% 26%, #f4a261 0 12%, transparent 34%),
		radial-gradient(circle at 60% 72%, #2a9d8f 0 18%, transparent 46%),
		linear-gradient(160deg, #264653, #1d3557);
}

.swt-art--color-extractor .node {
	position: absolute;
	width: 18px;
	height: 18px;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
	transform: translate(-50%, -50%);
}

.swt-art--color-extractor .n1 { left: 25%; top: 32%; }
.swt-art--color-extractor .n2 { left: 72%; top: 26%; }
.swt-art--color-extractor .n3 { left: 60%; top: 62%; }

.swt-art--color-extractor .strip {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 22%;
	display: flex;
}

.swt-art--color-extractor .strip i { flex: 1; }

.swt-art--color-converter {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	padding: 0 12%;
	background: #0b1626;
}

.swt-art--color-converter span {
	display: flex;
	justify-content: space-between;
	padding: 5px 10px;
	border-radius: 4px;
	font-family: var(--mono);
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.92);
}

.swt-art--color-converter b { font-weight: 600; opacity: 0.7; }

.swt-art--color-palettes { display: flex; }
.swt-art--color-palettes i { flex: 1; }


/* ============================================================
   TOOLS HUB — one section per tool (page-templates/tools.php)
   Each section's accent comes from the tool's 'accent' (--ta).
   ============================================================ */

.swt-intro .swh-intro-sub { margin-bottom: 20px; }

.swt-jump { display: flex; flex-wrap: wrap; gap: 8px; }

.swt-jump a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--card-2);
	color: var(--text);
	font-size: 0.92rem;
	font-weight: 700;
	transition: background var(--ease);
}

.swt-jump a::before {
	content: '';
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--ta);
}

.swt-jump a:hover { background: var(--card-3); color: var(--text); }

.swt-tool {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	align-items: center;
	gap: clamp(28px, 5vw, 64px);
	margin-top: clamp(56px, 8vw, 104px);
	scroll-margin-top: 24px;
}

.swt-tool--flip .swt-tool-visual { order: 2; }

.swt-tool-visual {
	display: block;
	position: relative;
	aspect-ratio: 4 / 3;
	border-radius: 22px;
	overflow: hidden;
	background:
		radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--ta) 35%, transparent), transparent 60%),
		var(--card);
	box-shadow: inset 0 0 0 1px var(--line);
}

.swt-tool-tag {
	margin: 0 0 8px;
	font-size: 0.85rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ta);
}

.swt-tool-name {
	margin: 0 0 14px;
	font-size: clamp(2rem, 4vw, 3rem);
	font-weight: 900;
	letter-spacing: -0.04em;
	line-height: 1.05;
	color: var(--text);
}

.swt-tool-pitch {
	margin: 0 0 20px;
	font-size: clamp(1rem, 1.4vw, 1.15rem);
	line-height: 1.6;
	color: var(--text-2);
}

.swt-tool-features {
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
}

.swt-tool-features li {
	position: relative;
	margin: 0 0 10px;
	padding-left: 30px;
	font-size: 0.98rem;
	line-height: 1.5;
	color: var(--text);
}

.swt-tool-features li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ta);
}

.swt-tool-features li::after {
	content: '';
	position: absolute;
	left: 6px;
	top: 6px;
	width: 5px;
	height: 9px;
	border: solid #000;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.swt-tool-best {
	margin: 0 0 24px;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--text-2);
}

.swt-tool-best strong { color: var(--text); }

/* ---------- Showcase illustrations ---------- */

.swt-show { position: absolute; inset: 0; }

/* Extractor: a "photo" with sampling nodes + the colors it pulled */
.swt-show--color-extractor .photo {
	position: absolute;
	inset: 9% 22% 22% 8%;
	border-radius: 14px;
	background:
		radial-gradient(circle at 25% 35%, #e76f51 0 18%, transparent 42%),
		radial-gradient(circle at 72% 28%, #f4a261 0 14%, transparent 36%),
		radial-gradient(circle at 62% 76%, #2a9d8f 0 20%, transparent 48%),
		linear-gradient(160deg, #264653, #1d3557);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.swt-show--color-extractor .node {
	position: absolute;
	width: 24px;
	height: 24px;
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 6px 14px rgba(0, 0, 0, 0.4);
	transform: translate(-50%, -50%);
}

.swt-show--color-extractor .n1 { left: 25%; top: 35%; }
.swt-show--color-extractor .n2 { left: 72%; top: 28%; }
.swt-show--color-extractor .n3 { left: 62%; top: 74%; }
.swt-show--color-extractor .n4 { left: 14%; top: 82%; }

.swt-show--color-extractor .chips {
	position: absolute;
	right: 6%;
	bottom: 8%;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px 14px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.swt-show--color-extractor .chips span {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--mono);
	font-size: 0.82rem;
	color: #222;
}

.swt-show--color-extractor .chips i { width: 22px; height: 22px; border-radius: 5px; }

/* Converter: a swatch beside every format */
.swt-show--color-converter {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4%;
	padding: 8%;
}

.swt-show--color-converter .swatch {
	display: flex;
	align-items: flex-end;
	width: 40%;
	aspect-ratio: 3 / 4;
	padding: 12px;
	border-radius: 16px;
	background: #2387ff;
	color: #000;
	font-family: var(--mono);
	font-size: 0.9rem;
	font-weight: 600;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.swt-show--color-converter .rows {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 52%;
}

.swt-show--color-converter .rows span {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 9px 12px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.07);
	font-family: var(--mono);
	font-size: 0.82rem;
	color: var(--text);
	white-space: nowrap;
}

.swt-show--color-converter .rows b { font-family: var(--sans); font-weight: 700; color: var(--text-2); }
.swt-show--color-converter .rows span:last-child { background: #fff; color: #111; }
.swt-show--color-converter .rows span:last-child b { color: #555; }

/* Palettes: three palettes fanned out */
.swt-show--color-palettes .pal {
	position: absolute;
	top: 16%;
	width: 44%;
	padding: 8px 8px 10px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.swt-show--color-palettes .pal:nth-child(1) { left: 6%;  transform: rotate(-8deg) translateY(8%); }
.swt-show--color-palettes .pal:nth-child(2) { left: 28%; transform: rotate(0deg); z-index: 1; }
.swt-show--color-palettes .pal:nth-child(3) { left: 50%; transform: rotate(8deg) translateY(8%); }

.swt-show--color-palettes .bands {
	display: flex;
	aspect-ratio: 1;
	border-radius: 8px;
	overflow: hidden;
}

.swt-show--color-palettes .bands i { flex: 1; }

.swt-show--color-palettes .pal b {
	display: block;
	margin-top: 8px;
	font-size: 0.85rem;
	font-weight: 800;
	color: #111;
}

@media (max-width: 860px) {
	.swt-tool { grid-template-columns: minmax(0, 1fr); gap: 22px; }
	.swt-tool--flip .swt-tool-visual { order: 0; }
}

@media (max-width: 480px) {
	.swt-show--color-extractor .chips { padding: 8px 10px; gap: 4px; }
	.swt-show--color-extractor .chips span { font-size: 0.72rem; gap: 6px; }
	.swt-show--color-extractor .chips i { width: 16px; height: 16px; }
	.swt-show--color-converter .rows span { font-size: 0.7rem; padding: 6px 8px; }
	.swt-show--color-converter .swatch { font-size: 0.75rem; }
	.swt-show--color-palettes .pal b { font-size: 0.7rem; }
}


/* ============================================================
   GAME PAGE
   ============================================================ */

.swg-head { padding-top: clamp(24px, 4vw, 48px); margin-bottom: 24px; }

.swg-back {
	display: inline-block;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--text-2);
	margin-bottom: 12px;
}

.swg-back:hover { color: var(--text); text-decoration: underline; }

.swg-title {
	font-size: clamp(2rem, 4.4vw, 3.2rem);
	font-weight: 900;
	letter-spacing: -0.04em;
	line-height: 1.05;
	color: var(--text);
	margin: 0 0 10px;
}

.swg-lede {
	font-size: 1.05rem;
	line-height: 1.6;
	color: var(--text-2);
	max-width: 40em;
	margin: 0;
}

/* Games whose board comes from page content (Color Grid via the rgber plugin).
   The plugin prints its own H1; the page already has one, so hide the duplicate. */
.swg-content-board { margin-top: 8px; }
.swg-content-board .cpe-title { display: none; }

/* Color Extractor (rgber shortcode): the page header already has the title and intro */
.swt-shortcode-board .cpe-wrapper > .cpe-title,
.swt-shortcode-board .cpe-wrapper > .cpe-description { display: none; }

.swg-board {
	background: var(--card);
	border-radius: 16px;
	padding: clamp(16px, 3vw, 32px);
}

.swg-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 24px;
}

.swg-modes { display: flex; gap: 8px; }

.swg-stats { display: flex; gap: 28px; }

.swg-stat { display: flex; flex-direction: column; }

.swg-stat span {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-3);
}

.swg-stat b {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--text);
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.swg-bar-note {
	margin: 0;
	font-size: 0.95rem;
	color: var(--text-2);
}

.swg-play,
.swg-end {
	max-width: 560px;
	margin: 0 auto;
	text-align: center;
}

.swg-play[hidden],
.swg-end[hidden],
.swg-board [hidden] { display: none; }

.swg-go { margin-top: 8px; min-width: 200px; }

.swg-big-score {
	margin: 0;
	color: var(--text);
	line-height: 1;
}

.swg-big-score b {
	font-size: clamp(3.5rem, 9vw, 5rem);
	font-weight: 900;
	letter-spacing: -0.04em;
}

.swg-big-score span {
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--text-2);
}

.swg-result-line {
	margin: 12px 0 16px;
	font-size: 1rem;
	color: var(--text-2);
	min-height: 1.5em;
}

.swg-squares {
	font-size: 2rem;
	letter-spacing: 0.1em;
	margin: 16px 0 0;
}

.swg-end { padding: 16px 0 8px; }

.swg-end-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-top: 8px;
}

/* ---------- Hue Match ---------- */

/* Daily: target on top, yours underneath */
.swg-hm-stack {
	display: grid;
	grid-template-rows: 1fr 1fr;
	height: clamp(200px, 32vw, 280px);
	border-radius: 14px;
	overflow: hidden;
	margin-bottom: 24px;
}

/* Swatch Match: target palette row above your editable row */
.swg-sm { margin-bottom: 20px; text-align: left; }

.swg-sm-label {
	margin: 0 0 8px;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--text-2);
}

.swg-sm-label span { font-weight: 500; color: var(--text-3); }

.swg-sm-row {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	margin-bottom: 14px;
}

.swg-sm-swatch {
	position: relative;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	height: clamp(70px, 12vw, 104px);
	border: 0;
	border-radius: 10px;
	padding: 0 0 8px;
}

.swg-sm-row--yours .swg-sm-swatch { cursor: pointer; transition: transform var(--ease); }
.swg-sm-row--yours .swg-sm-swatch:hover:not(:disabled) { transform: translateY(-2px); }
.swg-sm-row--yours .swg-sm-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px #fff; }
.swg-sm-row--yours .swg-sm-swatch:disabled { cursor: default; }

.swg-sm-score {
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 800;
}

.swg-sm-score:empty { display: none; }

.swg-hm-swatch {
	position: relative;
	transition: background 120ms linear;
}

.swg-hm-swatch span {
	position: absolute;
	left: 12px;
	top: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
}

.swg-hm-controls {
	display: flex;
	flex-direction: column;
	gap: 18px;
	text-align: left;
}

.swg-hm-controls .swg-go { align-self: center; }

.swg-slider {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--text-2);
}

.swg-slider input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 22px;
	border-radius: 999px;
	background: var(--track, #333);
	cursor: pointer;
	margin: 0;
}

.swg-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid #0b0b10;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.swg-slider input[type="range"]::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid #0b0b10;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.swg-slider input[type="range"]::-moz-range-track { background: transparent; }

.swg-slider input[type="range"]:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 4px;
}

/* ---------- Odd One Out ---------- */

.swg-oo-grid {
	display: grid;
	grid-template-columns: repeat(var(--n, 2), 1fr);
	gap: clamp(3px, 0.8vw, 6px);
	width: min(100%, 480px);
	aspect-ratio: 1;
	margin: 0 auto;
}

.swg-oo-grid button {
	border: 0;
	border-radius: 6px;
	padding: 0;
	cursor: pointer;
	transition: transform 100ms ease-out;
}

.swg-oo-grid button:hover { transform: scale(0.96); }
.swg-oo-grid button.is-reveal { box-shadow: 0 0 0 4px #fff; position: relative; z-index: 1; }
.swg-oo-grid button.is-miss { animation: swg-shake 280ms ease-out; }

@keyframes swg-shake {
	0%, 100% { transform: translateX(0); }
	25%      { transform: translateX(-4px); }
	75%      { transform: translateX(4px); }
}

/* ---------- Read the Hex ---------- */

.swg-hx-code {
	font-family: var(--mono);
	font-size: clamp(2.4rem, 7vw, 3.6rem);
	font-weight: 600;
	color: var(--text);
	margin: 0;
	letter-spacing: 0.02em;
}

.swg-hx-prompt {
	margin: 4px 0 20px;
	color: var(--text-2);
}

.swg-hx-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.swg-hx-options button {
	aspect-ratio: 16 / 10;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 10px;
	transition: transform var(--ease), opacity var(--ease);
}

.swg-hx-options button:hover { transform: scale(0.98); }

/* Hex labels stay hidden until you've answered (otherwise they'd give it away). */
.swg-hx-options button span {
	font-family: var(--mono);
	font-size: 0.9rem;
	font-weight: 600;
	visibility: hidden;
}

.swg-hx-options.is-revealed button span { visibility: visible; }
.swg-hx-options.is-revealed button { opacity: 0.45; cursor: default; transform: none; }
.swg-hx-options.is-revealed button.is-answer { opacity: 1; box-shadow: 0 0 0 4px #fff; }
.swg-hx-options.is-revealed button.is-wrong { opacity: 0.9; box-shadow: 0 0 0 4px #ef4444; }


/* ============================================================
   PAGE LAYOUT (tool + game pages)
   On phones the ad moves above the tool/game; on desktop it sits below the tips.
   ============================================================ */

.swg-page { display: flex; flex-direction: column; }
.swg-page > .swg-head      { order: 0; }
.swg-page > .swg-page-main { order: 1; }
.swg-page > .swg-page-help { order: 2; }
.swg-page > .swg-page-ad   { order: 3; }
.swg-page > .swg-page-more { order: 4; }

.swg-page-ad .sw-ad { margin: 40px auto 0; }

/* Play hub: same idea, ad under the intro on phones */
.swg-hub { display: flex; flex-direction: column; }
.swg-hub-intro { order: 0; }
.swg-hub-main  { order: 1; }
.swg-hub-ad    { order: 2; }
.swg-hub-about { order: 3; }

@media (max-width: 760px) {
	.swg-page > .swg-page-ad { order: 0; }
	.swg-page-ad .sw-ad { margin: 0 auto 20px; }
	.swg-hub-ad { order: 0; }
	.swg-hub-ad .sw-ad { margin: 0 auto; }
	.swg-hub-intro { order: -1; }
}


/* ============================================================
   HELP — "How to play / How to use" popover (inc/help.php, sw-help.js)
   ============================================================ */

.swg-titlerow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin-bottom: 10px;
}

.swg-titlerow .swg-title { margin: 0; }

.swg-help { position: relative; }

.swg-help-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 14px 7px 8px;
	border: 0;
	border-radius: 999px;
	background: var(--card-2);
	color: var(--text);
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
	transition: background var(--ease);
}

.swg-help-btn:hover,
.swg-help-btn[aria-expanded="true"] { background: var(--card-3); }

.swg-help-q {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	color: #000;
	font-size: 0.85rem;
	font-weight: 900;
}

.swg-help-pop {
	position: absolute;
	top: calc(100% + 12px);
	left: 0;
	z-index: 50;
	width: min(380px, calc(100vw - 32px));
	padding: 18px 18px 16px;
	border-radius: 14px;
	background: #fff;
	color: #1a1a22;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* Little arrow pointing at the button */
.swg-help-pop::before {
	content: '';
	position: absolute;
	top: -7px;
	left: 22px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
	border-radius: 2px;
}

.swg-help-pop[hidden] { display: none; }

/* First visit: a gentle pulse on the button instead of opening the popover */
.swg-help-btn.is-new .swg-help-q { animation: swg-pulse 1.8s ease-out 3; }

@keyframes swg-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
	100% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
}

/* Phones and small tablets: a bottom sheet, so it can never run off the side of the screen */
@media (max-width: 760px) {
	.swg-help-pop {
		position: fixed;
		top: auto;
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-height: 75vh;
		overflow-y: auto;
		z-index: 1000;
	}

	.swg-help-pop::before { display: none; }
}

.swg-help-pop-title {
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 900;
	color: #000;
}

.swg-steps { list-style: none; margin: 0 0 14px; padding: 0; }

.swg-steps li {
	display: flex;
	gap: 12px;
	margin: 0 0 10px;
	font-size: 0.95rem;
	line-height: 1.45;
}

.swg-step-n {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #111;
	color: #fff;
	font-size: 0.8rem;
	font-weight: 800;
}

.swg-steps strong { color: #000; }

.swg-steps code {
	font-family: var(--mono);
	font-size: 0.88em;
	background: #eef0f4;
	padding: 1px 5px;
	border-radius: 4px;
}

.swg-help-close {
	width: 100%;
	background: #111;
	border-color: #111;
	color: #fff;
}

.swg-help-close:hover { color: #fff; border-color: #111; }


/* ============================================================
   TIPS + DETAILS (under the tool or game)
   ============================================================ */

.swg-more-help { margin-top: 24px; }

.swg-tips {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 10px;
}

.swg-tip {
	display: flex;
	gap: 12px;
	padding: 14px 16px;
	border-radius: 12px;
	background: var(--card);
}

.swg-tip-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(233, 196, 106, 0.15);
	color: #e9c46a;
}

.swg-tip-title {
	margin: 0 0 2px;
	font-size: 0.95rem;
	font-weight: 800;
	color: var(--text);
}

.swg-tip-text {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--text-2);
}

.swg-faq {
	margin-top: 10px;
	border-radius: 12px;
	background: var(--card);
	overflow: hidden;
}

.swg-faq details + details { border-top: 1px solid var(--line); }

.swg-faq summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	font-size: 0.97rem;
	font-weight: 700;
	color: var(--text);
	cursor: pointer;
	list-style: none;
}

.swg-faq summary::-webkit-details-marker { display: none; }

.swg-faq summary::after {
	content: '+';
	font-size: 1.3rem;
	font-weight: 400;
	color: var(--text-3);
}

.swg-faq details[open] summary::after { content: '−'; }
.swg-faq summary:hover { background: var(--card-2); }

.swg-faq-body { padding: 0 18px 16px; }

.swg-faq-body p {
	margin: 0;
	max-width: 46em;
	font-size: 0.95rem;
	line-height: 1.65;
	color: var(--text-2);
}

.swg-tip-text code,
.swg-faq-body code {
	font-family: var(--mono);
	font-size: 0.9em;
	color: var(--text);
	background: var(--card-2);
	padding: 1px 6px;
	border-radius: 4px;
}

.swg-tip-text strong,
.swg-faq-body strong { color: var(--text); }

.swg-faq-body a,
.swg-tip-text a,
.swg-about a { color: var(--text); text-decoration: underline; }


/* ============================================================
   ABOUT SECTIONS (Play hub, Palettes page)
   A full-size card: big heading on the left, readable text on the right.
   ============================================================ */

.swg-about {
	display: grid;
	grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr);
	column-gap: clamp(24px, 5vw, 72px);
	align-items: start;
	margin-top: clamp(56px, 7vw, 96px);
	padding: clamp(28px, 5vw, 64px);
	border-radius: 22px;
	background:
		radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.05), transparent 50%),
		var(--card);
	color: var(--text-2);
	font-size: clamp(1.12rem, 1.6vw, 1.3rem);
	line-height: 1.7;
}

.swg-about .swh-h2 {
	grid-row: 1 / span 10;
	margin: 0;
	font-size: clamp(1.8rem, 3.6vw, 2.8rem);
	font-weight: 900;
	letter-spacing: -0.035em;
	line-height: 1.08;
}

.swg-about p { margin: 0 0 1em; max-width: 40em; }
.swg-about p:last-child { margin-bottom: 0; }
.swg-about strong { color: var(--text); }

@media (max-width: 860px) {
	.swg-about { grid-template-columns: minmax(0, 1fr); }
	.swg-about .swh-h2 { grid-row: auto; margin-bottom: 8px; }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
	.swg-stats { gap: 20px; }
	.swg-stat b { font-size: 1.25rem; }
	.swg-bar { margin-bottom: 18px; }
	.swg-hx-options { gap: 8px; }
}
