@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Spline+Sans+Mono:wght@500&display=swap");

:root {
	color-scheme: light dark;
	--ink: #111827;
	--ink-soft: #4b5563;
	--ink-strong: #0b1324;
	--paper: #f7f0e6;
	--paper-strong: #ffffff;
	--paper-alt: #f1e7d8;
	--nav: #0f172a;
	--nav-text: #e2e8f0;
	--accent: #0f766e;
	--accent-strong: #115e59;
	--accent-wash: rgba(15, 118, 110, 0.14);
	--warning: #d97706;
	--stamp: #b91c1c;
	--border: rgba(15, 23, 42, 0.16);
	--shadow: rgba(15, 23, 42, 0.12);
	--shadow-strong: rgba(15, 23, 42, 0.18);
	--glow: rgba(15, 118, 110, 0.18);
	--grid: rgba(15, 23, 42, 0.06);
	--property-brown: #714826;
	--property-cyan: #87d8d9;
	--property-pink: #bc46ca;
	--property-green: #5b933c;
	--property-red: #ab3d31;
	--property-yellow: #f8ff72;
	--property-orange: #e9b054;
	--property-blue: #0e08a2;
}

@media (prefers-color-scheme: dark) {
	:root {
		color-scheme: dark;
		--ink: #e2e8f0;
		--ink-soft: #94a3b8;
		--ink-strong: #f8fafc;
		--paper: #0b1220;
		--paper-strong: #111827;
		--paper-alt: #0f172a;
		--nav: #020617;
		--nav-text: #e2e8f0;
		--accent: #2dd4bf;
		--accent-strong: #0d9488;
		--accent-wash: rgba(45, 212, 191, 0.16);
		--warning: #fbbf24;
		--stamp: #f87171;
		--border: rgba(148, 163, 184, 0.18);
		--shadow: rgba(2, 6, 23, 0.5);
		--shadow-strong: rgba(2, 6, 23, 0.7);
		--glow: rgba(45, 212, 191, 0.2);
		--grid: rgba(148, 163, 184, 0.1);
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 55%),
		radial-gradient(circle at bottom left, rgba(217, 119, 6, 0.14), transparent 50%),
		linear-gradient(160deg, var(--paper) 0%, var(--paper-alt) 100%);
	color: var(--ink);
	font-family: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
	position: relative;
	overflow-x: hidden;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image:
		linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
	background-size: 24px 24px;
	opacity: 0.3;
	pointer-events: none;
	z-index: 0;
}

.page-rules #root {
	position: relative;
	z-index: 1;
}

.rules {
	max-width: 1200px;
	margin: 0 auto;
	padding: 2.5rem 1.5rem 4rem;
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.rules__hero {
	background: var(--paper-strong);
	border-radius: 28px;
	padding: 2.4rem;
	border: 1px solid var(--border);
	box-shadow: 0 24px 45px var(--shadow);
	display: grid;
	gap: 1.5rem;
	position: relative;
	overflow: hidden;
}

.rules__hero::after {
	content: "";
	position: absolute;
	right: -40px;
	top: -60px;
	width: 240px;
	height: 240px;
	background: radial-gradient(circle, rgba(15, 118, 110, 0.35), transparent 65%);
	opacity: 0.8;
}

.rules__hero-top {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
}

.rules__badge {
	font-family: "Spline Sans Mono", "SFMono-Regular", monospace;
	text-transform: uppercase;
	letter-spacing: 0.2em;
	font-size: 0.7rem;
	color: var(--ink-soft);
	background: var(--accent-wash);
	padding: 0.4rem 0.8rem;
	border-radius: 999px;
	border: 1px dashed var(--accent);
}

.rules__title {
	margin: 0;
	font-family: "Fraunces", "Georgia", serif;
	font-size: clamp(2.2rem, 3.5vw + 1rem, 3.8rem);
	color: var(--ink-strong);
}

.rules__subtitle {
	margin: 0.3rem 0 0;
	font-size: 1.1rem;
	color: var(--ink-soft);
	max-width: 36rem;
}

.rules__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	font-size: 0.95rem;
	color: var(--ink-soft);
}

.rules__hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.action-btn {
	border-radius: 999px;
	border: 1px solid var(--border);
	padding: 0.7rem 1.3rem;
	font-weight: 700;
	text-decoration: none;
	color: var(--ink-strong);
	background: var(--paper-alt);
	transition:
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.action-btn.primary {
	background: var(--accent);
	color: #fff;
	border-color: transparent;
	box-shadow: 0 16px 28px var(--glow);
}

.action-btn:hover {
	transform: translateY(-1px);
}

.lang-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	padding: 0.35rem;
	background: var(--paper-alt);
}

.lang-toggle button {
	border: none;
	background: transparent;
	color: var(--ink-soft);
	font-weight: 700;
	padding: 0.4rem 0.85rem;
	border-radius: 999px;
	cursor: pointer;
}

.lang-toggle button.active {
	background: var(--accent);
	color: #fff;
}

.rules__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0.7rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--paper-strong);
	box-shadow: 0 14px 28px var(--shadow);
}

.tab-link {
	text-decoration: none;
	color: var(--ink-soft);
	font-weight: 700;
	padding: 0.6rem 1.1rem;
	border-radius: 999px;
	transition:
		background 0.2s ease,
		color 0.2s ease;
}

.tab-link.active {
	background: var(--accent);
	color: #fff;
}

.tab-link:hover {
	color: var(--ink-strong);
}

.rules__search {
	display: grid;
	gap: 0.5rem;
	padding: 1rem 1.2rem;
	border-radius: 18px;
	border: 1px solid var(--border);
	background: var(--paper-strong);
	box-shadow: 0 16px 30px var(--shadow);
}

.rules__search input {
	width: 100%;
	border-radius: 14px;
	border: 1px solid var(--border);
	padding: 0.75rem 0.9rem;
	font-size: 0.95rem;
	background: var(--paper-alt);
	color: var(--ink-strong);
}

.rules__search small {
	color: var(--ink-soft);
}

.panel {
	background: var(--paper-strong);
	border-radius: 18px;
	padding: 1.25rem;
	border: 1px solid var(--border);
	box-shadow: 0 16px 30px var(--shadow);
}

.panel h3 {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-family: "Spline Sans Mono", monospace;
	color: var(--ink-soft);
}

.rules__content {
	display: grid;
	gap: 1.5rem;
	min-width: 0;
}

.section-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.chip {
	text-decoration: none;
	color: var(--ink-strong);
	background: var(--paper-strong);
	border: 1px solid var(--border);
	padding: 0.45rem 0.85rem;
	border-radius: 999px;
	font-weight: 600;
	transition:
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.rules__content a.chip {
	color: var(--ink-strong);
	text-decoration: none;
	font-weight: 600;
}

.chip:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 18px var(--shadow);
}

.rules__facts {
	background: linear-gradient(140deg, var(--paper-strong), var(--paper-alt));
}

.rules__section {
	background: var(--paper-strong);
	border-radius: 22px;
	border: 1px solid var(--border);
	padding: 1.75rem;
	box-shadow: 0 22px 40px var(--shadow);
	min-width: 0;
}

.rules__section h2 {
	margin: 0 0 0.6rem;
	font-family: "Fraunces", "Georgia", serif;
	font-size: 1.8rem;
	color: var(--ink-strong);
}

.rules__section h3 {
	margin: 1.1rem 0 0.6rem;
	font-size: 1.1rem;
	color: var(--ink-strong);
}

.rules__section p {
	margin: 0 0 0.85rem;
	color: var(--ink-soft);
	line-height: 1.65;
}

.rules__section p:last-child {
	margin-bottom: 0;
}

.rule-list {
	margin: 0;
	padding-left: 1.2rem;
	display: grid;
	gap: 0.45rem;
	color: var(--ink-soft);
}

.rule-cards {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rule-cards.carousel {
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rules__section .rule-cards {
	margin: 0.6rem 0;
}

.rule-card {
	border-radius: 16px;
	border: 1px solid var(--border);
	padding: 1rem;
	background: var(--paper-alt);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.rule-card .rule-list {
	margin-top: 0.6rem;
}

.pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.4rem 0 0.6rem;
}

.pill {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	padding: 0.2rem 0.6rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	background: rgba(15, 118, 110, 0.12);
	color: var(--accent-strong);
	border: 1px solid rgba(15, 118, 110, 0.2);
}

.tier-block h3 {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
	color: var(--ink-strong);
}

.tier-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tier-grid.carousel {
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tier-card {
	border-radius: 16px;
	border: 1px solid var(--border);
	background: var(--paper-alt);
	padding: 1rem;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.tier-head {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.8rem;
	margin-bottom: 0.6rem;
}

.tier-icon {
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: var(--nav);
	color: var(--nav-text);
	display: grid;
	place-items: center;
	font-weight: 800;
	letter-spacing: 0.05em;
	font-size: 0.8rem;
}

.tier-meta span {
	display: block;
	font-family: "Spline Sans Mono", monospace;
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.tier-meta h4 {
	margin: 0.15rem 0 0;
	font-size: 1.05rem;
	color: var(--ink-strong);
}

.tier-price {
	font-family: "Spline Sans Mono", monospace;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--warning);
}

.rule-card.accent-brown {
	border-color: var(--property-brown);
}

.rule-card.accent-cyan {
	border-color: var(--property-cyan);
}

.rule-card.accent-pink {
	border-color: var(--property-pink);
}

.rule-card.accent-green {
	border-color: var(--property-green);
}

.rule-card.accent-red {
	border-color: var(--property-red);
}

.rule-card.accent-yellow {
	border-color: var(--property-yellow);
}

.rule-card.accent-orange {
	border-color: var(--property-orange);
}

.rule-card.accent-blue {
	border-color: var(--property-blue);
}

.rule-card h4 {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
	color: var(--ink-strong);
}

.rule-card p {
	margin: 0 0 0.5rem;
	color: var(--ink-soft);
}

.rule-card .meta {
	font-family: "Spline Sans Mono", monospace;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--warning);
}

.callout {
	border-radius: 16px;
	padding: 1rem 1.1rem;
	background: var(--accent-wash);
	border: 1px solid rgba(15, 118, 110, 0.3);
	color: var(--ink-strong);
}

.rules__section .callout {
	margin: 0.8rem 0;
}

.callout strong {
	display: block;
	font-family: "Spline Sans Mono", monospace;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	font-size: 0.75rem;
	margin-bottom: 0.35rem;
	color: var(--accent-strong);
}

.rule-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.table-wrap {
	overflow-x: auto;
	border-radius: 16px;
	border: 1px solid var(--border);
	margin: 0.6rem 0 0.8rem;
}

.table-cards {
	display: none;
	gap: 1rem;
	overflow-x: auto;
	padding: 0.4rem 0 0.8rem;
	scroll-snap-type: x mandatory;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	padding-right: 1.2rem;
	scroll-padding-right: 1.2rem;
	position: relative;
}

.table-card {
	flex: 0 0 auto;
	width: min(78vw, 300px);
	background: var(--paper-alt);
	border-radius: 16px;
	border: 1px solid var(--border);
	padding: 1rem;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
	scroll-snap-align: start;
}

.table-card::after {
	content: "";
	display: block;
	width: 0;
	height: 0;
}

.table-cards::before,
.table-cards::after {
	content: "";
	position: sticky;
	top: 0;
	width: 12px;
	height: 100%;
	pointer-events: none;
	z-index: 1;
}

.table-cards::before {
	left: 0;
	background: linear-gradient(90deg, var(--paper-strong), transparent);
}

.table-cards::after {
	right: 0;
	background: linear-gradient(270deg, var(--paper-strong), transparent);
}

.table-scroll-hint {
	display: none;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.4rem;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.18em;
	color: var(--ink-soft);
	font-family: "Spline Sans Mono", monospace;
}

.table-scroll-hint .scroll-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 999px;
	border: 1px solid rgba(15, 23, 42, 0.2);
	font-weight: 700;
	color: var(--ink-soft);
}

.table-card__title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 700;
	color: var(--ink-strong);
}

.table-card__swatch {
	display: inline-flex;
	align-items: center;
}

.table-card__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.table-card__field span {
	display: block;
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--ink-soft);
	font-family: "Spline Sans Mono", monospace;
}

.table-card__field strong {
	display: block;
	margin-top: 0.2rem;
	font-size: 0.9rem;
	color: var(--ink-strong);
}

.rule-table th,
.rule-table td {
	padding: 0.6rem 0.7rem;
	border-bottom: 1px solid var(--border);
	text-align: left;
	white-space: nowrap;
}

.rule-table th:first-child,
.rule-table td:first-child {
	text-align: center;
}

.property-color-cell {
	width: 36px;
}

.property-swatch {
	display: inline-block;
	width: 16px;
	height: 16px;
	border-radius: 4px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	box-shadow: 0 4px 10px var(--shadow);
}

.property-swatch.brown {
	background: var(--property-brown);
}

.property-swatch.cyan {
	background: var(--property-cyan);
}

.property-swatch.pink {
	background: var(--property-pink);
}

.property-swatch.green {
	background: var(--property-green);
}

.property-swatch.red {
	background: var(--property-red);
}

.property-swatch.yellow {
	background: var(--property-yellow);
}

.property-swatch.orange {
	background: var(--property-orange);
}

.property-swatch.blue {
	background: var(--property-blue);
}

.rule-table th {
	background: var(--paper-alt);
	font-family: "Spline Sans Mono", monospace;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--ink-soft);
}

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

.search-results {
	border-radius: 18px;
	border: 1px dashed var(--accent);
	padding: 1.2rem;
	background: rgba(15, 118, 110, 0.06);
	display: grid;
	gap: 0.75rem;
}

.search-results h3 {
	margin: 0;
	font-size: 1rem;
	font-family: "Spline Sans Mono", monospace;
	text-transform: uppercase;
	letter-spacing: 0.12em;
}

.search-results ul {
	margin: 0;
	padding-left: 1.2rem;
	display: grid;
	gap: 0.45rem;
	color: var(--ink-soft);
}

.rules__content a {
	color: var(--accent-strong);
	text-decoration: none;
	font-weight: 700;
}

.rules__content a:hover {
	text-decoration: underline;
}

.search-results mark {
	background: rgba(217, 119, 6, 0.3);
	color: inherit;
	padding: 0 0.2rem;
	border-radius: 4px;
}

.quick-facts {
	display: grid;
	gap: 0.75rem;
}

.quick-fact {
	border-radius: 12px;
	padding: 0.65rem 0.75rem;
	background: var(--paper-alt);
	border: 1px solid var(--border);
}

.quick-fact span {
	display: block;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--ink-soft);
	font-family: "Spline Sans Mono", monospace;
}

.quick-fact strong {
	display: block;
	font-size: 1rem;
	margin-top: 0.2rem;
	color: var(--ink-strong);
}

.footer-note {
	text-align: center;
	color: var(--ink-soft);
	font-size: 0.85rem;
}

@media (max-width: 1100px) {
	.rules__tabs {
		border-radius: 18px;
	}
}

@media (max-width: 720px) {
	.rules {
		padding: 2rem 1.1rem 3rem;
	}

	.rules__hero {
		padding: 1.6rem;
	}

	.rules__hero-top {
		flex-direction: column;
	}

	.rules__tabs {
		padding: 0.5rem;
	}

	.tab-link {
		padding: 0.45rem 0.85rem;
	}

	.table-wrap {
		display: none;
	}

	.table-cards {
		display: flex;
	}

	.table-scroll-hint {
		display: inline-flex;
	}

	.rule-cards.carousel {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		padding: 0.2rem 1.2rem 0.6rem 0.8rem;
		margin: 0.4rem -0.2rem 0.8rem;
		max-width: 100%;
		min-width: 0;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
	}

	.rule-cards.carousel .rule-card {
		flex: 0 0 auto;
		width: min(78vw, 300px);
		max-width: 100%;
		scroll-snap-align: start;
	}

	.tier-grid.carousel {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		padding: 0.2rem 1.2rem 0.6rem 0.8rem;
		margin: 0.2rem 0 0.8rem;
		max-width: 100%;
		min-width: 0;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scroll-padding-left: 0.8rem;
		scroll-padding-right: 1.2rem;
	}

	.tier-grid.carousel .tier-card {
		flex: 0 0 auto;
		width: min(82vw, 320px);
		max-width: 100%;
		scroll-snap-align: start;
	}
}
