/* ==========================================================================
   PART 1: SHARED PEDAGOGICAL LAYOUT & COMPONENTS
   Used across games for Step 1 (Briefing), Step 2 (Lab Bench), Step 3 (Warm-Up)
   ========================================================================== */

/* Game Return Bar & Title Header */
.game-return-bar {
	margin: 1.5rem 0 0.75rem;
}

.game-return-link {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--accent-cyan);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	transition:
		color 0.2s ease,
		transform 0.2s ease;
}

.game-return-link:hover {
	color: #fff;
	transform: translateX(-2px);
}

.game-page-header {
	margin: 2.5rem 0 1.25rem;
	padding-top: 0.5rem;
}

.game-page-title {
	font-size: clamp(1.6rem, 3.5vw, 2.3rem);
	font-weight: 900;
	margin: 0.5rem 0 0;
	color: var(--text-main);
	line-height: 1.25;
}

.game-page-desc {
	color: var(--text-muted);
	font-size: clamp(0.92rem, 2vw, 1.05rem);
	line-height: 1.6;
	margin: 0.5rem 0 0;
	max-width: 780px;
}

/* Step 1: Codex / Concept Briefing Card */
.codex-card {
	margin: 1.5rem 0 2rem;
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-left: 5px solid var(--accent-cyan);
	border-radius: var(--radius-md);
	padding: 1.5rem;
}

.codex-header-row {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.45rem;
	margin-bottom: 0.85rem;
}

.codex-title {
	font-size: 1.35rem;
	font-weight: 800;
	margin: 0;
	color: var(--text-main);
}

.codex-desc {
	font-size: 1rem;
	line-height: 1.7;
	color: var(--text-muted);
}

.concept-grid-2,
.concept-grid-3,
.concept-grid-4 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
	margin: 1.25rem 0;
}

.concept-info-tile {
	background: var(--bg-surface-elevated);
	padding: 1rem 1.15rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border-color);
}

.concept-info-title {
	font-weight: 800;
	font-size: 1.05rem;
	margin-bottom: 0.25rem;
}

.concept-info-desc {
	font-size: 0.88rem;
	color: var(--text-muted);
	line-height: 1.55;
	margin: 0;
}

/* Step 2: Lab Bench Manipulative Wrapper */
.lab-bench-wrapper {
	padding: 1.5rem;
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	margin: 1.5rem 0;
}

.lab-bench-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	border-bottom: 1px solid var(--border-color);
	padding-bottom: 1rem;
	margin-bottom: 1.25rem;
}

.lab-bench-header > div {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
}

.lab-bench-controls {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* Step 3: Practice Box / Sparring Ring */
.practice-box {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	margin: 1.5rem 0;
}

/* Practice Header: Vertical stack on all devices (badge on line 1, title strictly on line 2) */
.practice-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.45rem;
	margin-bottom: 0.75rem;
}

.practice-title {
	font-size: 1.2rem;
	font-weight: 800;
	margin: 0;
	color: var(--text-main);
}

.practice-question {
	color: var(--text-muted);
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 1rem;
}

.practice-options-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 0.75rem;
	margin-top: 1rem;
}

.practice-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 0.8rem;
	line-height: 1.4rem;
	transition: all 0.2s ease;
	width: 100%;
}

.practice-choice-btn:hover {
	border-color: var(--primary);
	background: var(--bg-surface-hover);
}

.practice-choice-btn.correct {
	background: #065f46 !important;
	border-color: #34d399 !important;
	color: #fff !important;
}

.practice-choice-btn.wrong {
	background: #7f1d1d !important;
	border-color: #f87171 !important;
	color: #fff !important;
}

.practice-feedback {
	display: none;
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	background: var(--bg-surface);
	font-size: 0.95rem;
	line-height: 1.5;
}

/* Formula & Observation callout cards */

.formula-card {
	background: var(--bg-surface);
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	margin: 1rem 0;
	border: 1px solid var(--border-color);
	box-sizing: border-box;
	width: 100%;
	text-align: left;
}

@media (min-width: 768px) {
	.formula-card {
		width: 50%;
		text-align: left;
	}
}

.formula-title {
	font-size: 1.2rem;

	font-weight: 700;
	color: var(--accent-cyan);
	margin-bottom: 0.25rem;
}

.formula-math {
	font-size: 1.15rem;
	color: #fff;
}

/* Additional Shared Pedagogical & Arena Classes (Zero Inline CSS) */
.codex-cyan {
	margin: 1.5rem 0 2rem;
	border-left: 5px solid var(--accent-cyan);
}
.codex-gold {
	margin: 1.5rem 0 2rem;
	border-left: 5px solid var(--accent-gold);
}
.codex-header-clean {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.45rem;
	border: none;
	padding-bottom: 0;
	margin-bottom: 1rem;
}
.codex-badge-cyan {
	background: var(--accent-cyan);
	color: #000;
}
.codex-badge-gold {
	background: var(--accent-gold);
	color: #1a202c;
}
.text-cyan {
	color: var(--accent-cyan);
}
.text-gold {
	color: var(--accent-gold);
}
.text-success {
	color: var(--success);
}
.text-dim {
	color: var(--text-dim);
}
.lab-bench-title {
	font-size: 1.4rem;
	font-weight: 800;
	margin-top: 0.25rem;
}
.lab-bench-desc {
	color: var(--text-muted);
	font-size: 0.88rem;
	margin: 0;
}
.lab-slider {
	width: 140px;
}
.canvas-responsive {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
}
.arena-wrapper {
	margin-top: 2rem;
}
.gauge-w-140 {
	width: 140px;
}
.gauge-w-120 {
	width: 120px;
}
.hud-hp-text {
	font-size: 0.72rem;
	color: var(--text-dim);
	font-family: var(--font-mono);
}
.hud-stat-cyan {
	color: var(--accent-cyan) !important;
}
.hud-stat-gold {
	color: var(--accent-gold) !important;
}
.hud-stat-success {
	color: var(--success) !important;
}
.question-box-md {
	max-width: 580px;
	width: 100%;
}
.question-box-lg {
	max-width: 620px;
	margin: 0 auto 1rem;
	width: 100%;
}
.arena-status-msg {
	font-size: 0.9rem;
	font-weight: 600;
	min-height: 24px;
	text-align: center;
}
.pedagogical-list {
	margin-left: 1.5rem;
	color: var(--text-muted);
	line-height: 1.8;
}
.hud-flex-gap-1 {
	display: flex;
	align-items: center;
	gap: 1rem;
}
.order-target-row {
	display: flex;
	justify-content: space-around;
	align-items: center;
	margin-top: 1rem;
	border-top: 1px solid var(--border-color);
	padding-top: 0.75rem;
}
.order-btn-row {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	justify-content: center;
	margin-bottom: 1rem;
}
.font-mono-lg {
	font-size: 2rem;
	font-weight: 900;
	color: var(--accent-cyan);
	font-family: var(--font-mono);
}
.font-mono-md {
	font-size: 1.6rem;
	font-weight: 800;
	color: var(--text-main);
	font-family: var(--font-mono);
}
.order-label-dim {
	font-size: 0.72rem;
	text-transform: uppercase;
	color: var(--text-dim);
}

/* ==========================================================================
   PART 2: GAME-SPECIFIC STYLES (FOUNDATIONAL REALM)
   ========================================================================== */

/* --- Pizza Panic (pizza-panic.html) --- */
/* Specific styles for Pizza Panic */
.pizza-toy-layout {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 2.5rem;
	margin: 1.5rem 0;
}
.pizza-board {
	width: min(300px, 80vw);
	height: min(300px, 80vw);
	max-width: 100%;
	background: var(--bg-surface-elevated);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 3px solid var(--border-color);
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
	box-sizing: border-box;
}
.pizza-board svg {
	width: 100%;
	height: 100%;
	display: block;
}
.toy-readout {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	width: 100%;
	max-width: 480px;
	min-width: 0;
	box-sizing: border-box;
}

/* --- Fraction Potions (fraction-potions.html) --- */
/* Specific styles for Fraction Potion Brewer */
.potion-lab-layout {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
	margin: 1.5rem 0;
}

.flask-arena {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 3rem;
	min-height: 280px;
	margin-bottom: 1.5rem;
}

.alchemy-flask {
	width: 130px;
	height: 250px;
	border: 3px solid #38bdf8;
	border-top: none;
	border-radius: 0 0 28px 28px;
	position: relative;
	background: rgba(56, 189, 248, 0.04);
	box-shadow:
		0 0 25px rgba(56, 189, 248, 0.25),
		inset 0 0 20px rgba(56, 189, 248, 0.1);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
}

.target-line {
	position: absolute;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--accent-gold);
	box-shadow: 0 0 10px var(--accent-gold);
	z-index: 10;
}

.target-label {
	position: absolute;
	right: 6px;
	top: -18px;
	font-size: 0.75rem;
	font-weight: 800;
	color: var(--accent-gold);
	font-family: var(--font-mono);
	letter-spacing: 0.5px;
}

.liquid-fill {
	width: 100%;
	background: linear-gradient(180deg, #818cf8, #4f46e5);
	transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 0 20px rgba(99, 102, 241, 0.7);
}

/* Vial Button Grid */
.vials-container {
	display: flex;
	gap: 0.85rem;
	flex-wrap: wrap;
	justify-content: center;
	max-width: 620px;
	margin: 1.25rem auto 1.5rem;
}

/* Reagent Vial Buttons */
.vial-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	background: var(--bg-surface-elevated);
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0.8rem 1.3rem;
	color: #fff;
	font-family: var(--font-mono);
	font-size: 1.15rem;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	user-select: none;
	min-width: 110px;
}

.vial-btn:hover {
	border-color: var(--primary);
	background: var(--bg-surface-hover);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px var(--primary-glow);
}

.vial-btn:active {
	transform: translateY(1px) scale(0.97);
}

.vial-icon {
	font-size: 1.35rem;
	filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

.vial-fraction {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
}

.vial-fraction-num {
	font-size: 0.95rem;
}

.vial-fraction-bar {
	width: 100%;
	height: 2px;
	background: currentColor;
	margin: 2px 0;
}

.vial-fraction-den {
	font-size: 0.95rem;
}

/* Distinct Reagent Colors */
.vial-btn[data-den='2'] {
	border-color: #38bdf8;
	background: linear-gradient(
		135deg,
		rgba(56, 189, 248, 0.22),
		rgba(14, 165, 233, 0.08)
	);
	color: #e0f2fe;
}
.vial-btn[data-den='2']:hover {
	border-color: #7dd3fc;
	background: linear-gradient(
		135deg,
		rgba(56, 189, 248, 0.38),
		rgba(14, 165, 233, 0.22)
	);
	box-shadow: 0 0 18px rgba(56, 189, 248, 0.5);
}

.vial-btn[data-den='3'] {
	border-color: #c084fc;
	background: linear-gradient(
		135deg,
		rgba(192, 132, 252, 0.22),
		rgba(168, 85, 247, 0.08)
	);
	color: #f3e8ff;
}
.vial-btn[data-den='3']:hover {
	border-color: #d8b4fe;
	background: linear-gradient(
		135deg,
		rgba(192, 132, 252, 0.38),
		rgba(168, 85, 247, 0.22)
	);
	box-shadow: 0 0 18px rgba(192, 132, 252, 0.5);
}

.vial-btn[data-den='4'] {
	border-color: #34d399;
	background: linear-gradient(
		135deg,
		rgba(52, 211, 153, 0.22),
		rgba(16, 185, 129, 0.08)
	);
	color: #ecfdf5;
}
.vial-btn[data-den='4']:hover {
	border-color: #6ee7b7;
	background: linear-gradient(
		135deg,
		rgba(52, 211, 153, 0.38),
		rgba(16, 185, 129, 0.22)
	);
	box-shadow: 0 0 18px rgba(52, 211, 153, 0.5);
}

.vial-btn[data-den='6'] {
	border-color: #fbbf24;
	background: linear-gradient(
		135deg,
		rgba(251, 191, 36, 0.22),
		rgba(245, 158, 11, 0.08)
	);
	color: #fffbeb;
}
.vial-btn[data-den='6']:hover {
	border-color: #fcd34d;
	background: linear-gradient(
		135deg,
		rgba(251, 191, 36, 0.38),
		rgba(245, 158, 11, 0.22)
	);
	box-shadow: 0 0 18px rgba(251, 191, 36, 0.5);
}

.vial-btn[data-den='12'] {
	border-color: #f87171;
	background: linear-gradient(
		135deg,
		rgba(248, 113, 113, 0.22),
		rgba(239, 68, 68, 0.08)
	);
	color: #fef2f2;
}
.vial-btn[data-den='12']:hover {
	border-color: #fca5a5;
	background: linear-gradient(
		135deg,
		rgba(248, 113, 113, 0.38),
		rgba(239, 68, 68, 0.22)
	);
	box-shadow: 0 0 18px rgba(248, 113, 113, 0.5);
}

/* Action Control Buttons */
.brew-action-btn {
	min-width: 160px;
	font-weight: 800;
	letter-spacing: 0.5px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
	transition: all 0.2s ease;
}

#clearFlaskBtn {
	background: linear-gradient(
		135deg,
		rgba(239, 68, 68, 0.15),
		rgba(185, 28, 28, 0.25)
	);
	border: 2px solid #f87171;
	color: #fca5a5;
}
#clearFlaskBtn:hover {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: #fff;
	box-shadow: 0 0 18px rgba(239, 68, 68, 0.6);
	transform: translateY(-2px);
}

#brewPotionBtn {
	background: linear-gradient(135deg, #059669, #10b981);
	border: 2px solid #34d399;
	color: #fff;
	box-shadow: 0 4px 18px rgba(16, 185, 129, 0.5);
}
#brewPotionBtn:hover {
	background: linear-gradient(135deg, #10b981, #34d399);
	box-shadow: 0 6px 24px rgba(52, 211, 153, 0.75);
	transform: translateY(-2px);
}

/* Guided Practice (Sparring Ring) */

/* --- Factor Fortress (factor-fortress.html) --- */
.gear-toy-layout {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 2rem;
	margin: 1.5rem 0;
}
.gear-canvas-box {
	width: 100%;
	max-width: 500px;
	box-sizing: border-box;
	background: var(--bg-surface-elevated);
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
}
.gear-readout-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	width: 100%;
	max-width: 500px;
	min-width: 0;
	box-sizing: border-box;
}
.fortress-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: all 0.2s ease;
}
.fortress-choice-btn:hover {
	border-color: var(--primary);
}
.fortress-choice-btn.correct {
	background: #065f46;
	border-color: #34d399;
}
.fortress-choice-btn.wrong {
	background: #7f1d1d;
	border-color: #f87171;
}

/* --- Galactic Fuel Run (galactic-fuel-run.html) --- */
.numberline-toy-layout {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
	margin: 1.5rem 0;
}
.numberline-canvas-box {
	width: 100%;
	max-width: 620px;
	background: #050811;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
	padding: 0.5rem;
}
.decimal-readout-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.25rem 2rem;
	text-align: center;
	width: 100%;
	max-width: 620px;
}
.thruster-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
	max-width: 480px;
	margin: 1.25rem 0;
}
.thruster-btn {
	background: var(--bg-surface-elevated);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.9rem;
	font-size: 1.1rem;
	font-weight: 800;
	font-family: var(--font-mono);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all 0.15s ease;
}
.thruster-btn:hover {
	border-color: var(--accent-cyan);
	background: var(--bg-surface-hover);
}
.thruster-btn:active {
	transform: scale(0.96);
}
.thruster-btn.reverse {
	border-color: rgba(239, 68, 68, 0.4);
	color: #f87171;
}
.thruster-btn.reverse:hover {
	border-color: #ef4444;
}
.decimal-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: all 0.2s ease;
}
.decimal-choice-btn:hover {
	border-color: var(--primary);
}
.decimal-choice-btn.correct {
	background: #065f46;
	border-color: #34d399;
}
.decimal-choice-btn.wrong {
	background: #7f1d1d;
	border-color: #f87171;
}
@media (max-width: 600px) {
	.thruster-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 0.35rem;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}
	.thruster-btn {
		padding: 0.65rem 0.2rem;
		font-size: 0.78rem;
		white-space: normal;
		line-height: 1.25;
		text-align: center;
	}
	.decimal-readout-card {
		padding: 1rem 0.75rem;
		max-width: 100%;
		box-sizing: border-box;
	}
	#dockEngageBtn {
		padding: 0.85rem 1.25rem !important;
		font-size: 1rem !important;
		width: 100%;
		max-width: 360px;
	}
}

/* --- Chart Raider (chart-raider.html) --- */
.chart-toy-layout {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
	margin: 1.5rem 0;
}
.chart-canvas-box {
	width: 100%;
	max-width: 580px;
	background: #060913;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
	padding: 0.5rem;
}
.chart-readout-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 0.75rem;
	width: 100%;
	max-width: 580px;
}
.stat-metric-pill {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.8rem;
	text-align: center;
}
.slider-bank {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	justify-content: center;
	margin-top: 0.5rem;
}
.slider-unit {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.75rem;
	color: var(--text-dim);
}
.chart-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: all 0.2s ease;
}
.chart-choice-btn:hover {
	border-color: var(--primary);
}
.chart-choice-btn.correct {
	background: #065f46;
	border-color: #34d399;
}
.chart-choice-btn.wrong {
	background: #7f1d1d;
	border-color: #f87171;
}

/* --- Shape Architect (shape-architect.html) --- */
.shape-toy-layout {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 2rem;
	margin: 1.5rem 0;
}
.shape-canvas-box {
	width: 100%;
	max-width: 480px;
	box-sizing: border-box;
	background: #060913;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
}
.shape-readout-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	width: 100%;
	max-width: 480px;
	min-width: 0;
	box-sizing: border-box;
}
.shape-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: all 0.2s ease;
}
.shape-choice-btn:hover {
	border-color: var(--primary);
}
.shape-choice-btn.correct {
	background: #065f46;
	border-color: #34d399;
}
.shape-choice-btn.wrong {
	background: #7f1d1d;
	border-color: #f87171;
}

/* --- Sequence Cyber Grid (sequence-cyber-grid.html) --- */
.seq-toy-layout {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
	margin: 1.5rem 0;
}
.seq-canvas-box {
	width: 100%;
	max-width: 580px;
	background: #050812;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
	padding: 0.5rem;
}
.seq-readout-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.25rem 2rem;
	text-align: center;
	width: 100%;
	max-width: 580px;
}
.seq-choice-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	color: #fff;
	padding: 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: all 0.2s ease;
}
.seq-choice-btn:hover {
	border-color: var(--primary);
}
.seq-choice-btn.correct {
	background: #065f46;
	border-color: #34d399;
}
.seq-choice-btn.wrong {
	background: #7f1d1d;
	border-color: #f87171;
}

/* --- Basic Maths Game Specific Arena Enhancements --- */
.potion-error-code {
	color: var(--danger);
	font-family: var(--font-mono);
	display: inline-block;
	padding: 0.2rem 0.4rem;
	background: rgba(239, 68, 68, 0.1);
	border-radius: 4px;
	margin: 0 0.3rem;
}
.target-line.potion-target-init {
	bottom: 75%;
}
.liquid-fill.potion-liquid-init {
	height: 0%;
}
.brew-status-msg {
	font-weight: 600;
	color: var(--text-muted);
	margin-bottom: 0.5rem;
	text-align: center;
}
.practice-feedback-box {
	display: none;
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	background: var(--bg-surface);
}
.dock-engage-btn {
	padding: 0.9rem 2.5rem;
	font-size: 1.15rem;
}
.dock-diff-coord {
	margin-top: 0.75rem;
	border-top: 1px solid var(--border-color);
	padding-top: 0.5rem;
	font-size: 0.85rem;
}
.dock-btn-row {
	display: flex;
	gap: 1rem;
	margin-top: 0.5rem;
	justify-content: center;
	width: 100%;
}
.probe-fraction-bar {
	background: var(--bg-surface);
	padding: 0.75rem 1rem;
	border-radius: var(--radius-sm);
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
	font-size: 0.88rem;
	color: var(--text-muted);
}
.toy-pizza-svg {
	width: 100%;
	height: 100%;
	display: block;
}
.pizza-info-box {
	margin-top: 1rem;
	background: var(--bg-surface);
	padding: 0.75rem;
	border-radius: var(--radius-sm);
	font-size: 0.82rem;
	color: var(--text-muted);
}
.order-text-gold {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--accent-gold);
	margin-bottom: 0.5rem;
}
.pizza-target-row {
	display: flex;
	justify-content: space-around;
	align-items: center;
	margin-top: 1rem;
	border-top: 1px solid var(--border-color);
	padding-top: 0.75rem;
}
.shape-info-box {
	background: var(--bg-surface);
	padding: 0.85rem;
	border-radius: var(--radius-sm);
	font-size: 0.92rem;
	color: var(--text-muted);
}
.toy-stream-msg {
	font-size: 1.15rem;
	font-weight: 800;
	margin: 0.75rem 0;
}
.toy-formula-gold {
	font-size: 1.25rem;
	font-weight: 900;
	color: var(--accent-gold);
	font-family: var(--font-mono);
	margin-top: 0.25rem;
}
.cipher-stream-cyan {
	font-size: 2.2rem;
	font-weight: 900;
	color: var(--accent-cyan);
	font-family: var(--font-mono);
	margin: 0.5rem 0;
}

/* ==========================================================================
   PART 3: MOBILE RESPONSIVE LAYOUT (MAX-WIDTH: 768px)
   All labels, badges, titles, and headings are centered using flex columns.
   ========================================================================== */
@media (max-width: 768px) {
	/* Page Header & Return Link */
	.game-page-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		margin: 2.5rem auto 1.25rem;
		padding-top: 0.75rem;
	}
	.game-page-title,
	.game-page-desc {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
	}
	.game-return-link {
		margin: 0 auto;
	}

	/* Step 1: Codex / Concept Briefing */
	.codex-header,
	.codex-header-row,
	.codex-header-clean {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 0.45rem;
	}
	.codex-badge,
	.codex-header .realm-badge,
	.codex-header [class*='badge-'] {
		margin: 0 auto;
	}
	.codex-title,
	.codex-desc {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
	}
	.concept-info-tile {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
	.concept-info-title,
	.concept-info-desc,
	.concept-info-tile strong,
	.concept-info-tile p {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
	}

	/* Step 2: The Lab Bench Header & Controls */
	.lab-bench-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 1rem;
	}
	.lab-bench-header > div {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
	}
	.lab-bench-header .realm-badge,
	.lab-bench-header [class*='badge-'] {
		margin: 0 auto 0.45rem auto;
	}
	.lab-bench-title {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		width: 100%;
	}
	.lab-bench-desc {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		width: 100%;
	}
	.lab-bench-controls,
	.lab-bench-header .flex-row-gap-75,
	.lab-bench-header .flex-row-wrap-gap-10,
	.lab-bench-header .flex-row-wrap-gap-125,
	.lab-bench-header .lab-bench-ctrl-group,
	.lab-bench-header .gacha-controls-bar {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		gap: 0.5rem;
		width: 100%;
	}
	.lab-bench-controls label,
	.lab-bench-header label,
	.control-label-dim-md,
	.control-label-cyan,
	.control-label-gold {
		text-align: center;
		margin: 0 auto;
	}
	.toy-cuts-readout,
	#toyCutsValue,
	.control-val-mono {
		text-align: center;
		margin: 0 auto;
	}

	/* Step 2: Readouts & Visualizer Toys */
	.toy-readout,
	.shape-readout-card,
	.gear-readout-card,
	.seq-readout-card,
	.chart-readout-card,
	.potion-readout-card,
	.alchemist-readout,
	.vault-readout,
	.slope-readout-card {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
		margin: 1rem auto 0;
		box-sizing: border-box;
	}
	.toy-readout > div,
	.shape-readout-card > div,
	.gear-readout-card > div,
	.seq-readout-card > div,
	.chart-readout-card > div,
	.potion-readout-card > div,
	.alchemist-readout > div,
	.vault-readout > div,
	.slope-readout-card > div {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
	}
	.stat-label-dim-b,
	.stat-label-dim-sm,
	.stat-label-cyan-b,
	.stat-label-gold-b,
	[class*='stat-label-'],
	[class*='metric-val-'],
	.simplified-val-text,
	.angles-val-readout,
	.pizza-info-box,
	.shape-info-box,
	.stat-divider-top {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
	}
	.pizza-toy-layout,
	.potion-lab-layout,
	.shape-toy-layout,
	.gear-toy-layout,
	.seq-toy-layout,
	.chart-toy-layout,
	.scale-toy-layout,
	.vault-toy-layout,
	.slope-toy-layout {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
	}
	.pizza-board {
		margin: 0 auto;
	}

	/* Step 3: Quick Warm-Up / Practice Box */
	.practice-box {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
	.practice-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 0.45rem;
		width: 100%;
	}
	.practice-header .realm-badge,
	.practice-header [class*='badge-'] {
		margin: 0 auto;
	}
	.practice-title {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		width: 100%;
	}
	.practice-question,
	.practice-prompt,
	.practice-intro-text {
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		width: 100%;
	}
	.practice-options-grid {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		max-width: 480px;
		margin: 1rem auto 0;
		gap: 0.75rem;
	}
	.practice-options-grid button,
	.practice-choice-btn,
	.shape-choice-btn,
	.decimal-choice-btn,
	.seq-choice-btn,
	.fortress-choice-btn,
	.chart-choice-btn,
	.algebra-choice-btn,
	.euclid-choice-btn,
	.prob-choice-btn,
	.calc-choice-btn {
		text-align: center;
		width: 100%;
	}
	.practice-feedback {
		text-align: center;
		width: 100%;
	}
}

/* ==========================================================================
   PART 15: FRACTION ↔ DECIMAL WORKSHOP STYLES
   ========================================================================== */
.workshop-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.12fr) minmax(290px, 0.88fr);
	gap: 1.25rem;
	align-items: start;
	margin-top: 1rem;
}

.workshop-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: clamp(1.2rem, 3vw, 1.75rem);
	box-shadow: var(--shadow-md);
}

.workshop-card-title {
	margin: 0 0 0.75rem;
	font-size: 1.3rem;
	line-height: 1.25;
	color: var(--text-main);
	font-weight: 800;
}

.workshop-card-sub {
	color: var(--text-muted);
	margin: 0 0 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
}

.workshop-modebar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.workshop-mode-btn {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	border-radius: var(--radius-full);
	padding: 0.55rem 1.15rem;
	font-weight: 700;
	font-size: 0.9rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.workshop-mode-btn:hover {
	color: var(--text-main);
	border-color: var(--text-dim);
}

.workshop-mode-btn[aria-pressed="true"],
.workshop-mode-btn.active {
	background: rgba(6, 182, 212, 0.18);
	color: #fff;
	border-color: var(--accent-cyan);
	box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.workshop-roundbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: var(--text-muted);
	font-size: 0.92rem;
	font-weight: 600;
	margin-bottom: 1rem;
	padding-bottom: 0.6rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.workshop-roundbar strong {
	color: var(--accent-gold);
	font-size: 1.1rem;
	font-weight: 800;
}

.workshop-problem {
	border: 1px solid #3c5772;
	background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(30, 41, 59, 0.65));
	padding: 1.25rem;
	border-radius: var(--radius-md);
	margin-bottom: 1.25rem;
	min-height: 105px;
}

.workshop-problem-kicker {
	display: block;
	letter-spacing: 0.12em;
	color: var(--accent-cyan);
	font-size: 0.76rem;
	font-weight: 800;
	text-transform: uppercase;
	margin-bottom: 0.35rem;
}

.workshop-target {
	font-size: clamp(1.4rem, 3.5vw, 2.1rem);
	font-weight: 800;
	line-height: 1.3;
	color: var(--text-main);
}

.workshop-target span {
	color: var(--accent-gold);
}

.workshop-example {
	color: var(--text-muted);
	font-size: 0.92rem;
	margin: 0.4rem 0 0;
	line-height: 1.5;
}

.workshop-frac,
.frac {
	display: inline-flex;
	vertical-align: middle;
	flex-direction: column;
	align-items: center;
	line-height: 1.05;
	font-size: 1.12em;
	min-width: 1.15em;
}

.workshop-frac .top,
.frac .top {
	border-bottom: 2px solid currentColor;
	width: 100%;
	text-align: center;
	padding: 0 5px 2px;
}

.workshop-frac .bottom,
.frac .bottom {
	padding-top: 2px;
	text-align: center;
}

.workshop-step {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 1.15rem;
	margin-top: 0.85rem;
	transition: border-color 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

.workshop-step-title {
	font-size: 1rem;
	font-weight: 800;
	margin: 0 0 0.35rem;
	color: var(--text-main);
}

.workshop-step-desc {
	color: var(--text-muted);
	font-size: 0.92rem;
	margin: 0 0 0.85rem;
	line-height: 1.5;
}

.workshop-step.completed {
	border-color: var(--success);
	background: rgba(16, 185, 129, 0.05);
}

.workshop-step.locked {
	opacity: 0.52;
}

.workshop-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.workshop-input {
	width: 86px;
	height: 44px;
	background: var(--bg-surface-elevated);
	border: 1px solid #475569;
	border-radius: var(--radius-sm);
	color: var(--text-main);
	text-align: center;
	font-weight: 800;
	font-size: 1.1rem;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.workshop-input:focus {
	outline: none;
	border-color: var(--accent-gold);
	box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.workshop-input.decimal {
	width: 116px;
}

.workshop-input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.workshop-math {
	color: var(--accent-gold);
	font-size: 1.25rem;
	font-weight: 800;
}

.workshop-btn-step {
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	font-weight: 750;
	padding: 0.6rem 1.15rem;
	min-height: 44px;
	background: #3b82f6;
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.workshop-btn-step:hover {
	background: #2563eb;
	transform: translateY(-1px);
}

.workshop-btn-step:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.workshop-actions {
	display: flex;
	gap: 0.65rem;
	flex-wrap: wrap;
	margin-top: 1.25rem;
}

.workshop-btn-hint {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	color: var(--text-main);
	border-radius: var(--radius-sm);
	font-weight: 750;
	padding: 0.65rem 1.15rem;
	min-height: 44px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.workshop-btn-hint:hover {
	background: var(--bg-surface-hover);
	border-color: var(--accent-gold);
	color: var(--accent-gold);
}

.workshop-btn-next {
	background: var(--success);
	color: #fff;
	border: none;
	border-radius: var(--radius-sm);
	font-weight: 800;
	padding: 0.65rem 1.35rem;
	min-height: 44px;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.workshop-btn-next:hover {
	background: #059669;
	transform: translateY(-1px);
}

.workshop-feedback {
	margin-top: 1rem;
	border-radius: var(--radius-sm);
	padding: 0.85rem 1.05rem;
	color: var(--text-muted);
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	min-height: 52px;
	font-size: 0.94rem;
	line-height: 1.55;
	transition: all 0.25s ease;
}

.workshop-feedback.good {
	border-color: #059669;
	background: rgba(16, 185, 129, 0.15);
	color: #a7f3d0;
}

.workshop-feedback.try {
	border-color: #dc2626;
	background: rgba(239, 68, 68, 0.15);
	color: #fecaca;
}

.workshop-feedback.hint {
	border-color: #d97706;
	background: rgba(245, 158, 11, 0.15);
	color: #fde68a;
}

.workshop-note {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin: 0.85rem 0 0;
	line-height: 1.5;
}

/* 100-Square Grid Visualization */
.workshop-viz-card {
	align-self: start;
}

.hundred-legend {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0.85rem 0 1rem;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.hundred-legend-box {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
	background: var(--accent-cyan);
}

.hundred-grid {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: 3px;
	aspect-ratio: 1;
	max-width: 360px;
	margin: 0 auto;
}

.hundred-cell {
	background: #1e293b;
	border: 1px solid #334155;
	border-radius: 2px;
	min-width: 0;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.hundred-cell.filled {
	background: var(--accent-cyan);
	border-color: #67e8f9;
}

.hundred-caption {
	margin: 1rem 0 0;
	color: var(--text-muted);
	text-align: center;
	font-size: 0.92rem;
	line-height: 1.5;
}

.hundred-caption strong {
	color: var(--text-main);
}

/* Lab Bench Preset Buttons */
.bench-presets-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0.85rem 0 1.15rem;
}

.bench-preset-btn {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 0.35rem 0.75rem;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: 0.88rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.bench-preset-btn:hover {
	border-color: var(--accent-cyan);
	color: var(--text-main);
}

.bench-preset-btn.active {
	background: rgba(6, 182, 212, 0.2);
	border-color: var(--accent-cyan);
	color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 780px) {
	.workshop-layout {
		grid-template-columns: 1fr;
	}
	.workshop-viz-card {
		order: -1;
	}
	.hundred-grid {
		max-width: 250px;
	}
	.workshop-card {
		padding: 1.15rem;
	}
}

@media (max-width: 420px) {
	.workshop-input {
		width: 72px;
	}
	.workshop-input.decimal {
		width: 92px;
	}
	.workshop-mode-btn {
		padding: 0.45rem 0.85rem;
		font-size: 0.84rem;
	}
}

/* Workshop Lesson & Visual Comparison Components */
.visual-comparison-box {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 1.25rem;
	margin: 1.25rem 0 1.5rem;
}

.comparison-bar-row {
	margin-bottom: 1rem;
}

.comparison-bar-row:last-child {
	margin-bottom: 0;
}

.comparison-bar-label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.92rem;
	color: var(--text-muted);
	margin-bottom: 0.35rem;
}

.comparison-bar-label strong {
	color: var(--text-main);
}

.comparison-bar-track {
	width: 100%;
	height: 32px;
	background: #1e293b;
	border-radius: var(--radius-sm);
	overflow: hidden;
	position: relative;
	border: 1px solid #334155;
}

.comparison-bar-fill-50 {
	width: 50%;
	height: 100%;
	background: linear-gradient(90deg, #0284c7, #06b6d4);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.88rem;
	color: #fff;
}

.comparison-bar-fill-75 {
	width: 75%;
	height: 100%;
	background: linear-gradient(90deg, #d97706, #f59e0b);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.88rem;
	color: #0f172a;
}

.comparison-bar-fill-60 {
	width: 60%;
	height: 100%;
	background: linear-gradient(90deg, #059669, #10b981);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.88rem;
	color: #fff;
}

/* Method "Try One Yourself" Cards */
.method-try-box {
	background: rgba(99, 102, 241, 0.08);
	border: 1px solid rgba(99, 102, 241, 0.28);
	border-left: 4px solid var(--primary);
	border-radius: var(--radius-sm);
	padding: 1.15rem 1.25rem;
	margin: 1.25rem 0 1.5rem;
}

.method-try-title {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
	font-weight: 800;
	color: var(--text-main);
	font-size: 1.02rem;
	margin: 0 0 0.5rem;
}

.method-try-badge {
	background: var(--primary);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 800;
	padding: 0.2rem 0.6rem;
	border-radius: var(--radius-full);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.method-try-prompt {
	color: var(--text-main);
	font-size: 0.98rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
}

.method-try-hint {
	color: var(--accent-gold);
	font-size: 0.9rem;
	margin: 0 0 0.75rem;
	line-height: 1.5;
}

.method-try-solution {
	padding-top: 0.75rem;
	border-top: 1px dashed rgba(255, 255, 255, 0.12);
	font-size: 0.92rem;
	color: var(--text-muted);
	line-height: 1.55;
}

.method-try-solution strong {
	color: var(--success);
}

/* Explore Further Callout Box */
.explore-further-box {
	background: rgba(16, 185, 129, 0.06);
	border: 1px solid rgba(16, 185, 129, 0.25);
	border-left: 4px solid var(--success);
	border-radius: var(--radius-sm);
	padding: 1.25rem 1.4rem;
	margin-top: 2rem;
}

.explore-further-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.45rem;
	margin-bottom: 0.75rem;
}

.explore-further-badge {
	background: var(--success);
	color: #064e3b;
	font-weight: 800;
	font-size: 0.74rem;
	padding: 0.22rem 0.6rem;
	border-radius: var(--radius-full);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.explore-further-title {
	font-size: 1.12rem;
	font-weight: 800;
	color: var(--text-main);
	margin: 0;
}

/* ==========================================================================
   PART 16: NUMBER QUEST: FIND ITS HOME STYLES
   ========================================================================== */
.quest-arena-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(290px, 0.85fr);
	gap: 1.5rem;
	align-items: start;
	margin-top: 1rem;
}

.quest-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: clamp(1.2rem, 3vw, 1.75rem);
	box-shadow: var(--shadow-md);
}

.quest-counter-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem;
	margin-bottom: 1.25rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text-muted);
}

.quest-counter-header strong {
	color: var(--accent-gold);
	font-size: 1.1rem;
}

.quest-prompt {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--text-muted);
	text-align: center;
	margin: 0 0 0.4rem;
}

.quest-prompt-sub {
	font-size: 0.9rem;
	color: var(--text-muted);
	text-align: center;
	margin: 0 0 1.25rem;
	line-height: 1.5;
}

.quest-simplify-note {
	background: rgba(245, 158, 11, 0.1);
	border: 1px solid rgba(245, 158, 11, 0.35);
	border-left: 4px solid var(--accent-gold);
	border-radius: var(--radius-sm);
	padding: 0.7rem 1.1rem;
	margin: 0 auto 1.25rem;
	font-size: 0.98rem;
	font-weight: 700;
	color: var(--accent-gold);
	text-align: center;
	max-width: 520px;
	width: 100%;
	box-sizing: border-box;
}

/* Rolling Number Display */
.quest-display-frame {
	background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(15, 23, 42, 0.85));
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 2rem 1.5rem;
	text-align: center;
	margin-bottom: 1.5rem;
	position: relative;
	overflow: hidden;
	transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.quest-display-frame.correct {
	border-color: var(--success);
	background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(15, 23, 42, 0.85));
	box-shadow: 0 0 25px rgba(16, 185, 129, 0.3);
}

.quest-display-frame.wrong {
	border-color: var(--danger);
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(15, 23, 42, 0.85));
	box-shadow: 0 0 25px rgba(239, 68, 68, 0.35);
}

.quest-number-display {
	font-size: clamp(2.4rem, 6vw, 4rem);
	font-weight: 900;
	font-family: var(--font-mono, monospace);
	color: var(--text-main);
	line-height: 1.15;
	display: inline-block;
	transition: transform 0.2s ease, color 0.2s ease;
}

.quest-number-display.rolling {
	transform: scale(0.85) rotateX(40deg);
	opacity: 0.4;
}

.quest-number-display.correct {
	color: #6ee7b7;
}

.quest-number-display.wrong {
	color: #fca5a5;
}

/* Target Buttons Grid */
.quest-targets-title {
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--accent-cyan);
	font-weight: 800;
	margin-bottom: 0.75rem;
	text-align: center;
}

.quest-targets-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.quest-target-btn {
	background: var(--bg-surface);
	border: 2px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.85rem 0.5rem;
	color: var(--text-main);
	cursor: pointer;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quest-target-btn:hover:not(:disabled) {
	border-color: var(--accent-cyan);
	background: var(--bg-surface-hover);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.quest-target-badge {
	font-size: 0.7rem;
	font-weight: 900;
	padding: 0.15rem 0.5rem;
	border-radius: var(--radius-full);
	background: rgba(255, 255, 255, 0.08);
	color: var(--text-muted);
}

.quest-target-name {
	font-size: 1.05rem;
	font-weight: 800;
	color: var(--text-main);
}

.quest-target-desc {
	font-size: 0.74rem;
	color: var(--text-muted);
	line-height: 1.25;
}

.quest-target-btn.target-correct {
	background: #065f46;
	border-color: #34d399;
	color: #ecfdf5;
	box-shadow: 0 0 16px rgba(52, 211, 153, 0.4);
}

.quest-target-btn.target-correct .quest-target-badge {
	background: #047857;
	color: #a7f3d0;
}

.quest-target-btn.target-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	border-color: #334155;
	background: #0f172a;
	transform: none;
}

.quest-target-btn.target-revealed {
	background: #78350f;
	border-color: #f59e0b;
	color: #fef3c7;
	box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

/* Feedback & Hints Box */
.quest-feedback-box {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.95rem 1.15rem;
	min-height: 54px;
	font-size: 0.94rem;
	line-height: 1.55;
	color: var(--text-muted);
	transition: all 0.25s ease;
	margin-bottom: 1.25rem;
}

.quest-feedback-box.correct {
	border-color: #059669;
	background: rgba(16, 185, 129, 0.12);
	color: #a7f3d0;
}

.quest-feedback-box.wrong {
	border-color: #dc2626;
	background: rgba(239, 68, 68, 0.12);
	color: #fecaca;
}

.quest-feedback-box.hint {
	border-color: #d97706;
	background: rgba(245, 158, 11, 0.12);
	color: #fde68a;
}

/* Action Buttons */
.quest-actions-row {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	align-items: center;
}

.quest-btn-action {
	border-radius: var(--radius-sm);
	font-weight: 800;
	padding: 0.7rem 1.35rem;
	min-height: 44px;
	cursor: pointer;
	border: none;
	transition: all 0.2s ease;
}

.quest-btn-next {
	background: var(--success);
	color: #fff;
}

.quest-btn-next:hover {
	background: #059669;
	transform: translateY(-1px);
}

.quest-btn-retry {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	color: var(--text-main);
}

.quest-btn-retry:hover {
	border-color: var(--accent-gold);
	color: var(--accent-gold);
}

/* Taxonomy Breakdown Panel (Right Side or Below) */
.quest-taxonomy-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: clamp(1.2rem, 3vw, 1.75rem);
}

.quest-taxonomy-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--text-main);
	margin: 0 0 0.5rem;
}

.quest-taxonomy-sub {
	color: var(--text-muted);
	font-size: 0.9rem;
	margin: 0 0 1.25rem;
	line-height: 1.5;
}

.taxonomy-chain {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	align-items: center;
	margin-bottom: 1.25rem;
}

.taxonomy-node {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.35rem 0.75rem;
	font-size: 0.86rem;
	font-weight: 800;
	color: var(--text-muted);
	transition: all 0.25s ease;
}

.taxonomy-node.active-home {
	background: rgba(6, 182, 212, 0.2);
	border-color: var(--accent-cyan);
	color: #67e8f9;
	box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.taxonomy-node.active-parent {
	border-color: #475569;
	color: var(--text-main);
}

.taxonomy-arrow {
	color: var(--accent-gold);
	font-weight: 900;
	font-size: 0.85rem;
}

.taxonomy-props-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.taxonomy-prop-badge {
	font-size: 0.76rem;
	font-weight: 800;
	padding: 0.25rem 0.65rem;
	border-radius: var(--radius-full);
	background: rgba(99, 102, 241, 0.15);
	color: #c7d2fe;
	border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Lab Bench Concentric Rings Diagram */
.nesting-diagram-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 1.5rem 0;
	width: 100%;
}

.nesting-diagram-svg {
	max-width: 520px;
	width: 100%;
	height: auto;
	display: block;
}

.nesting-tabs-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0;
	justify-content: center;
}

.nesting-tab-btn {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 0.45rem 0.95rem;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: 0.88rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.nesting-tab-btn:hover {
	border-color: var(--accent-cyan);
	color: var(--text-main);
}

.nesting-tab-btn.active {
	background: rgba(6, 182, 212, 0.2);
	border-color: var(--accent-cyan);
	color: #fff;
}

.nesting-info-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 1.25rem;
	width: 100%;
	max-width: 540px;
	margin: 0 auto;
}

.nesting-info-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.nesting-symbol-badge {
	font-family: var(--font-mono, monospace);
	font-size: 1.2rem;
	font-weight: 900;
	color: var(--accent-gold);
}

/* Mobile Responsiveness */
@media (max-width: 780px) {
	.quest-arena-layout {
		grid-template-columns: 1fr;
	}
	.quest-targets-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.quest-target-btn:last-child:nth-child(odd) {
		grid-column: span 2;
	}
}

@media (max-width: 440px) {
	.quest-targets-grid {
		grid-template-columns: 1fr;
	}
	.quest-target-btn:last-child:nth-child(odd) {
		grid-column: span 1;
	}
	.quest-number-display {
		font-size: 2.5rem;
	}
}

/* ==========================================================================
   PART 17: OPERATION ARCHITECT (ORDER OF OPERATIONS GAME)
   ========================================================================== */

.architect-arena-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	gap: 1.5rem;
	align-items: start;
	margin-top: 1rem;
}

.architect-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: clamp(1.2rem, 3vw, 1.85rem);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.architect-hud {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.45rem;
	margin-bottom: 1.25rem;
	padding-bottom: 0.85rem;
	border-bottom: 1px solid var(--border-color);
	font-weight: 800;
	font-size: 0.92rem;
	color: var(--accent-cyan);
}

.architect-zone-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: rgba(6, 182, 212, 0.12);
	border: 1px solid rgba(6, 182, 212, 0.3);
	color: #67e8f9;
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.architect-score-badge {
	color: var(--accent-gold);
	font-family: var(--font-mono, monospace);
	font-size: 1.05rem;
}

.architect-prompt-title {
	font-size: 1.1rem;
	font-weight: 800;
	color: var(--text-main);
	margin: 0 0 0.4rem;
}

.architect-prompt-sub {
	color: var(--text-muted);
	font-size: 0.88rem;
	margin: 0 0 1.25rem;
	line-height: 1.5;
}

/* Expression Stage */
.expression-stage-box {
	background: var(--bg-surface-elevated);
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem 1.25rem;
	text-align: center;
	margin-bottom: 1.25rem;
	position: relative;
	transition: all 0.3s ease;
	min-height: 100px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.expression-stage-box.correct-pulse {
	border-color: var(--success);
	box-shadow: 0 0 24px rgba(16, 185, 129, 0.25);
}

.expression-stage-box.wrong-pulse {
	border-color: #ef4444;
	box-shadow: 0 0 24px rgba(239, 68, 68, 0.25);
	animation: shakeStage 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shakeStage {
	10%, 90% { transform: translate3d(-2px, 0, 0); }
	20%, 80% { transform: translate3d(3px, 0, 0); }
	30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
	40%, 60% { transform: translate3d(5px, 0, 0); }
}

.expr-tokens-row {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.45rem;
	font-family: var(--font-mono, monospace);
	font-size: clamp(1.4rem, 4vw, 2.1rem);
	font-weight: 800;
	color: var(--text-main);
	line-height: 1.4;
}

.expr-token {
	padding: 0.15rem 0.35rem;
	border-radius: var(--radius-sm);
	transition: all 0.2s ease;
}

.expr-token.num {
	color: #f8fafc;
}

.expr-token.paren {
	color: var(--accent-gold);
	font-weight: 900;
}

.expr-token-final-win {
	color: #34d399;
	font-size: 2.4rem;
	animation: popFinal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popFinal {
	from { transform: scale(0.85); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

/* Clickable Operator Buttons */
.expr-op-btn {
	background: var(--bg-surface);
	border: 1.5px solid #475569;
	color: #38bdf8;
	border-radius: var(--radius-sm);
	font-family: var(--font-mono, monospace);
	font-size: clamp(1.25rem, 3.5vw, 1.8rem);
	font-weight: 900;
	padding: 0.25rem 0.65rem;
	min-width: 48px;
	min-height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
}

.expr-op-btn:hover:not(:disabled) {
	background: rgba(56, 189, 248, 0.15);
	border-color: #38bdf8;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.expr-op-btn:focus-visible {
	outline: 2px solid var(--accent-gold);
	outline-offset: 2px;
}

.expr-op-btn.hint-target {
	border-color: #f59e0b;
	color: #fbbf24;
	box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
	animation: pulseHint 1.2s infinite;
}

@keyframes pulseHint {
	0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
	50% { transform: scale(1.06); box-shadow: 0 0 20px rgba(245, 158, 11, 0.6); }
}

.expr-op-btn.wrong-choice {
	border-color: #ef4444;
	background: rgba(239, 68, 68, 0.2);
	color: #fca5a5;
}

.expr-op-btn.active-reduction {
	border-color: #10b981;
	background: rgba(16, 185, 129, 0.2);
	color: #6ee7b7;
}

.expr-op-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Sub-Calculation Panel */
.sub-calc-panel {
	background: var(--bg-surface);
	border: 1.5px solid var(--accent-cyan);
	border-radius: var(--radius-md);
	padding: 1.15rem;
	margin-bottom: 1.25rem;
	box-shadow: 0 6px 20px rgba(6, 182, 212, 0.15);
	animation: fadeInCalc 0.25s ease;
}

@keyframes fadeInCalc {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: translateY(0); }
}

.sub-calc-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.75rem;
}

.sub-calc-title {
	font-weight: 800;
	font-size: 0.95rem;
	color: var(--accent-cyan);
}

.sub-calc-form {
	display: flex;
	gap: 0.65rem;
	align-items: center;
	flex-wrap: wrap;
}

.sub-calc-prompt {
	font-size: 1.15rem;
	font-weight: 800;
	font-family: var(--font-mono, monospace);
	color: #f8fafc;
}

.sub-calc-input {
	background: var(--bg-surface-elevated);
	border: 1.5px solid var(--border-color);
	border-radius: var(--radius-sm);
	color: #ffffff;
	font-family: var(--font-mono, monospace);
	font-size: 1.25rem;
	font-weight: 800;
	padding: 0.45rem 0.75rem;
	width: 90px;
	text-align: center;
	min-height: 44px;
}

.sub-calc-input:focus {
	outline: none;
	border-color: var(--accent-gold);
	box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.sub-calc-submit-btn {
	background: var(--accent-cyan);
	color: #09121d;
	border: none;
	border-radius: var(--radius-sm);
	padding: 0.55rem 1.15rem;
	font-weight: 800;
	font-size: 0.92rem;
	min-height: 44px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.sub-calc-submit-btn:hover {
	background: #38bdf8;
	transform: translateY(-1px);
}

/* Feedback Box */
.architect-feedback-box {
	border-radius: var(--radius-sm);
	padding: 0.85rem 1.15rem;
	margin-bottom: 1.25rem;
	font-size: 0.92rem;
	line-height: 1.55;
	border: 1px solid var(--border-color);
	background: var(--bg-surface-elevated);
	color: var(--text-muted);
	min-height: 48px;
	display: flex;
	align-items: center;
}

.architect-feedback-box.correct {
	border-color: #059669;
	background: rgba(16, 185, 129, 0.12);
	color: #6ee7b7;
}

.architect-feedback-box.wrong {
	border-color: #dc2626;
	background: rgba(239, 68, 68, 0.12);
	color: #fca5a5;
}

.architect-feedback-box.hint {
	border-color: #d97706;
	background: rgba(245, 158, 11, 0.12);
	color: #fde68a;
}

/* Reduction Steps History Trail */
.reduction-trail-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 1rem;
	margin-top: 1rem;
}

.reduction-trail-title {
	font-size: 0.86rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	margin-bottom: 0.65rem;
}

.reduction-steps-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.reduction-step-item {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	font-family: var(--font-mono, monospace);
	font-size: 0.95rem;
	color: #94a3b8;
}

.reduction-step-item.active {
	color: #38bdf8;
	font-weight: 800;
}

.reduction-step-item.solved {
	color: #34d399;
	font-weight: 800;
}

.reduction-step-arrow {
	color: var(--accent-gold);
	font-weight: 900;
}

/* Action Row */
.architect-actions-row {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	align-items: center;
	margin-top: 1rem;
}

/* Architectural Wonder Canvas Card */
.wonder-canvas-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: clamp(1.2rem, 3vw, 1.85rem);
	display: flex;
	flex-direction: column;
	align-items: center;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.wonder-canvas-header {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.wonder-canvas-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--text-main);
	margin: 0;
}

.wonder-canvas-sub {
	font-size: 0.88rem;
	color: var(--text-muted);
	margin: 0 0 1rem;
	width: 100%;
	line-height: 1.45;
}

.wonder-svg-wrap {
	width: 100%;
	max-width: 360px;
	aspect-ratio: 4 / 3.4;
	background: #09121d;
	border: 1.5px solid #1e293b;
	border-radius: var(--radius-sm);
	padding: 0.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.wonder-svg {
	width: 100%;
	height: 100%;
	overflow: visible;
}

.wonder-part {
	transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	transform-origin: center bottom;
}

.wonder-part.hidden {
	opacity: 0;
	transform: translateY(12px) scale(0.95);
	pointer-events: none;
}

.wonder-part.built {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.wonder-progress-bar-wrap {
	width: 100%;
	background: #1e293b;
	height: 6px;
	border-radius: 999px;
	margin-top: 1rem;
	overflow: hidden;
}

.wonder-progress-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, #06b6d4, #f59e0b);
	border-radius: 999px;
	transition: width 0.4s ease;
	width: 0%;
}

.wonder-progress-label {
	font-size: 0.82rem;
	color: var(--text-muted);
	margin-top: 0.4rem;
	font-weight: 700;
}

/* Lab Bench Precedence Explorer (Step 2) */
.precedence-table-box {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	overflow: hidden;
	margin-top: 1.25rem;
}

.precedence-grid-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: 0.92rem;
}

.precedence-grid-table th {
	background: rgba(255, 255, 255, 0.04);
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border-color);
	color: var(--text-muted);
	font-weight: 800;
	text-transform: uppercase;
	font-size: 0.8rem;
	letter-spacing: 0.05em;
}

.precedence-grid-table td {
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var(--border-color);
	color: var(--text-main);
}

.precedence-grid-table tr:last-child td {
	border-bottom: none;
}

.priority-rank-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	font-weight: 900;
	font-size: 0.82rem;
}

.rank-1 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #f59e0b; }
.rank-2 { background: rgba(6, 182, 212, 0.2); color: #38bdf8; border: 1px solid #06b6d4; }
.rank-3 { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #10b981; }

/* Responsive Media Queries */
@media (max-width: 860px) {
	.architect-arena-layout {
		grid-template-columns: 1fr;
	}
	.wonder-canvas-card {
		order: 2;
	}
	.architect-card {
		order: 1;
	}
}

@media (max-width: 540px) {
	.architect-hud {
		flex-direction: column;
		align-items: flex-start;
	}
	.expr-tokens-row {
		gap: 0.3rem;
		font-size: 1.3rem;
	}
	.expr-op-btn {
		min-width: 44px;
		min-height: 44px;
		font-size: 1.25rem;
		padding: 0.2rem 0.5rem;
	}
	.sub-calc-form {
		flex-direction: column;
		align-items: stretch;
	}
	.sub-calc-input {
		width: 100%;
	}
	.sub-calc-submit-btn {
		width: 100%;
	}
}

/* ==========================================================================
   PART 12: TILE WORKSHOP (COMMUTATIVE & DISTRIBUTIVE PROPERTIES)
   Visual arrays, physical transformations, and misconception guards
   ========================================================================== */

.tile-workshop-arena {
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 1.5rem;
	align-items: start;
	margin-top: 1.25rem;
}

.tile-card-main {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.tile-board-viewport {
	background: #090e17;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: var(--radius-sm);
	padding: 1.5rem 1rem;
	min-height: 240px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow-x: auto;
}

.tile-board-header-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
	width: 100%;
	margin-bottom: 0.75rem;
	font-size: 0.85rem;
}

.tile-count-badge {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border-color);
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	font-weight: 700;
	color: var(--text-muted);
}

.tile-board {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	align-items: center;
}

.tile-row {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	transition: all 0.3s ease;
}

.tile-group {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	transition: transform 0.35s ease, margin 0.35s ease;
}

.tile-board.is-split .tile-group-gold {
	margin-left: 1.25rem;
	position: relative;
}

.tile-board.is-split .tile-group-gold::before {
	content: '+';
	position: absolute;
	left: -1rem;
	top: 50%;
	transform: translateY(-50%);
	color: #f59e0b;
	font-weight: 900;
	font-size: 1.1rem;
	pointer-events: none;
}

.tile-cell {
	width: 36px;
	height: 36px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.85rem;
	user-select: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.tile-cell:hover {
	transform: scale(1.08);
}

.tile-blue {
	background: linear-gradient(135deg, #38bdf8, #0284c7);
	border: 1.5px solid #7dd3fc;
	color: #082f49;
}

.tile-gold {
	background: linear-gradient(135deg, #fbbf24, #d97706);
	border: 1.5px solid #fde68a;
	color: #451a03;
}

.tile-cell.misconception-highlight {
	animation: tileMisconceptionPulse 1.2s infinite ease-in-out;
	border: 2px solid #ef4444;
	box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
}

@keyframes tileMisconceptionPulse {
	0%, 100% {
		transform: scale(1);
		box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
	}
	50% {
		transform: scale(1.15);
		box-shadow: 0 0 16px rgba(239, 68, 68, 0.9);
	}
}

/* Header Overlap Prevention & Safe Scroll Margins */
html {
	scroll-padding-top: 140px;
}

.game-stage-wrapper,
.tile-workshop-arena,
.tile-card-main,
.tile-sidebar-card,
.codex-section,
.deep-dive-card,
.practice-box {
	scroll-margin-top: 140px;
}

.game-return-bar {
	margin: 1.5rem 0 0.75rem;
	display: flex;
	align-items: center;
}

.realm-back-btn,
.game-return-link {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--accent-cyan);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	transition: color 0.2s ease, transform 0.2s ease;
}

.realm-back-btn:hover,
.game-return-link:hover {
	color: #fff;
	transform: translateX(-2px);
}

.tile-controls-panel {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: 100%;
}

.tile-primary-actions-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
	width: 100%;
}

.tile-btn-ctrl {
	background: #172232;
	border: 1px solid var(--border-color);
	color: var(--text-main);
	padding: 0.85rem 1.15rem;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: 0.88rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0.5rem;
	transition: all 0.2s ease;
	line-height: 1.4;
}

.tile-btn-ctrl:hover:not(:disabled) {
	background: #1e2e44;
	transform: translateY(-2px);
}

.tile-btn-ctrl:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
}

.tile-btn-turn {
	border-color: rgba(56, 189, 248, 0.45);
	color: #38bdf8;
	background: rgba(56, 189, 248, 0.08);
}

.tile-btn-turn:hover:not(:disabled) {
	background: rgba(56, 189, 248, 0.16);
	box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

.tile-btn-split {
	border-color: rgba(245, 158, 11, 0.45);
	color: #fbbf24;
	background: rgba(245, 158, 11, 0.08);
}

.tile-btn-split:hover:not(:disabled) {
	background: rgba(245, 158, 11, 0.16);
	box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.tile-btn-join {
	border-color: rgba(16, 185, 129, 0.5);
	color: #34d399;
	background: rgba(16, 185, 129, 0.12);
	width: 100%;
	display: none;
}

.tile-btn-join.visible {
	display: inline-flex;
}

.tile-btn-join:hover:not(:disabled) {
	background: rgba(16, 185, 129, 0.22);
	box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.tile-secondary-actions-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.65rem;
	margin-top: 0.25rem;
	padding-top: 0.65rem;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tile-btn-secondary {
	background: transparent;
	border: 1px dashed var(--border-color);
	color: var(--text-muted);
	font-size: 0.82rem;
	padding: 0.45rem 0.85rem;
}

.tile-btn-secondary:hover:not(:disabled) {
	border-color: #a855f7;
	color: #d8b4fe;
	background: rgba(168, 85, 247, 0.08);
}

.tile-btn-reset {
	background: transparent;
	border: none;
	color: var(--text-dim);
	font-size: 0.82rem;
	padding: 0.45rem 0.75rem;
	cursor: pointer;
}

.tile-btn-reset:hover {
	color: var(--text-muted);
	text-decoration: underline;
}

/* Explanatory Observation Banner */
.tile-observation-banner {
	background: rgba(15, 23, 42, 0.95);
	border: 1px solid var(--border-color);
	border-left: 4px solid var(--accent-cyan);
	border-radius: var(--radius-sm);
	padding: 0.85rem 1.15rem;
	font-size: 0.92rem;
	line-height: 1.55;
	color: var(--text-main);
	display: none;
}

.tile-observation-banner.visible {
	display: block;
}

/* Revealed Equation Box */
.tile-equation-box {
	background: rgba(15, 23, 42, 0.85);
	border: 1px solid rgba(56, 189, 248, 0.25);
	border-radius: var(--radius-sm);
	padding: 1rem 1.25rem;
	text-align: center;
	opacity: 0.35;
	transform: translateY(4px);
	transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.35s ease;
}

.tile-equation-box.revealed {
	opacity: 1;
	transform: translateY(0);
	border-color: var(--accent-cyan);
	box-shadow: 0 6px 20px rgba(6, 182, 212, 0.15);
}

.tile-equation-kicker {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: var(--text-muted);
	font-weight: 800;
	margin-bottom: 0.35rem;
}

.tile-equation-math {
	font-size: 1.35rem;
	font-weight: 800;
	color: #f8fafc;
	margin: 0.25rem 0 0.5rem;
	min-height: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tile-property-badge {
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 0.2rem 0.65rem;
	border-radius: 999px;
	background: rgba(6, 182, 212, 0.15);
	color: #38bdf8;
	border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Right Side: Reflection & Misconception Card */
.tile-sidebar-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.tile-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--border-color);
	padding-bottom: 0.75rem;
}

.tile-sidebar-title {
	font-size: 1.15rem;
	font-weight: 800;
	margin: 0;
	color: var(--text-main);
}

.tile-reflection-prompt {
	font-size: 1rem;
	font-weight: 700;
	color: #f8fafc;
	line-height: 1.5;
	margin: 0;
}

.tile-options-list {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.tile-choice-btn {
	background: #172232;
	border: 1px solid var(--border-color);
	color: var(--text-main);
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	font-weight: 600;
	font-size: 0.9rem;
	text-align: left;
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1.45;
}

.tile-choice-btn:hover:not(:disabled) {
	background: #1e2e44;
	border-color: var(--accent-cyan);
	color: #fff;
	transform: translateX(3px);
}

.tile-choice-btn.correct {
	background: rgba(16, 185, 129, 0.18);
	border-color: #10b981;
	color: #34d399;
}

.tile-choice-btn.wrong {
	background: rgba(239, 68, 68, 0.18);
	border-color: #ef4444;
	color: #f87171;
}

.tile-feedback-box {
	background: #0f172a;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 1rem;
	font-size: 0.92rem;
	line-height: 1.55;
	color: var(--text-muted);
	display: none;
}

.tile-feedback-box.visible {
	display: block;
}

.tile-misconception-guard {
	background: rgba(245, 158, 11, 0.1);
	border: 1px solid rgba(245, 158, 11, 0.35);
	border-left: 4px solid #f59e0b;
	border-radius: var(--radius-sm);
	padding: 0.85rem 1rem;
	font-size: 0.88rem;
	line-height: 1.5;
	color: #fef3c7;
	display: none;
}

.tile-misconception-guard.visible {
	display: block;
}

/* Lab Bench Sandbox Controls */
.sandbox-steppers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.sandbox-stepper-tile {
	background: #0f172a;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0.65rem 0.85rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
}

.sandbox-stepper-label {
	font-size: 0.76rem;
	font-weight: 800;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.sandbox-stepper-controls {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.sandbox-btn-step {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #1e293b;
	border: 1px solid var(--border-color);
	color: #f8fafc;
	font-weight: 900;
	font-size: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
}

.sandbox-btn-step:hover {
	background: #334155;
	border-color: var(--accent-cyan);
}

.sandbox-step-val {
	font-weight: 800;
	font-size: 1.05rem;
	color: #f8fafc;
	min-width: 20px;
	text-align: center;
}

/* Responsive adjustments */
@media (max-width: 860px) {
	.tile-workshop-arena {
		grid-template-columns: 1fr;
	}
	.tile-sidebar-card {
		order: 2;
	}
	.tile-card-main {
		order: 1;
	}
}

@media (max-width: 768px) {
	.tile-primary-actions-row {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 540px) {
	.tile-cell {
		width: 30px;
		height: 30px;
		font-size: 0.75rem;
	}
	.tile-board-viewport {
		padding: 1rem 0.5rem;
	}
	.tile-btn-ctrl {
		padding: 0.65rem 0.85rem;
		font-size: 0.82rem;
	}
	.tile-equation-math {
		font-size: 1.15rem;
	}
}

.deep-dive-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
	margin-bottom: 1.25rem;
}

.deep-dive-kicker {
	background: var(--accent-gold);
	color: #1a202c;
	font-size: 0.72rem;
	font-weight: 800;
	padding: 0.25rem 0.65rem;
	border-radius: var(--radius-full);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	display: inline-block;
}
