@import url(https://fonts.googleapis.com/css?family=Lato:300);

* {
	box-sizing: border-box;
}

/* Tokens live in design-system.css — load-page overrides only */
:root {
	--bg-deep: var(--bg);
	--sidebar-ad-h: calc(100vh - var(--header-h) - var(--footer-h));
}

html {
	height: auto;
	min-height: 100%;
	overflow-x: hidden;
	overflow-y: scroll;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
}

html:not(.embedded-portal) {
	overflow-y: scroll !important;
	height: auto !important;
}

html:not(.embedded-portal) body {
	overflow-y: auto !important;
	height: auto !important;
	min-height: 100vh;
}

html:not(.embedded-portal) #page {
	height: auto;
	overflow: visible;
}

body {
	margin: 0;
	min-height: 100vh;
	height: auto;
	overflow-x: hidden;
	overflow-y: visible;
	background: var(--bg-deep);
	color: #fff;
	font-family: 'Lato', sans-serif;
	font-size: 17px;
	font-weight: 300;
	line-height: 1.5;
	text-align: center;
}

#page {
	width: 100%;
	min-height: 100vh;
	margin: 0 auto;
	padding: 20px 20px 120px;
	max-width: calc(640px + var(--sidebar-w) * 2);
	background:
		radial-gradient(ellipse 80% 50% at 50% 0%, rgba(88, 28, 180, 0.35) 0%, transparent 55%),
		radial-gradient(ellipse 60% 40% at 80% 100%, rgba(60, 10, 120, 0.25) 0%, transparent 50%),
		var(--bg-deep);
}

html:not(.embedded-portal) #page {
	padding-left: 16px;
	padding-right: 16px;
}

html:not(.embedded-portal) .load-content-wrap {
	max-width: 560px;
}

#content {
	max-width: 560px;
	margin: 0 auto;
	padding: 0 8px;
}

.load-topbar {
	text-align: left;
	margin: 0 0 10px;
}

.load-back {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(200, 160, 255, 0.85);
}

.load-back:hover {
	color: #fff;
}

html.embedded-portal .load-topbar {
	display: none;
}

#loadLegacyFooter {
	display: none;
}

#logo {
	margin: 12px 0 10px;
	font-size: clamp(28px, 5vw, 48px);
	font-weight: 300;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #fff;
	line-height: 1.1;
}

.tagline {
	text-transform: uppercase;
	font-size: clamp(13px, 2vw, 18px);
	font-weight: 300;
	line-height: 1.35;
	margin: 0 0 20px;
	color: rgba(255, 255, 255, 0.75);
	letter-spacing: 0.06em;
}

p {
	text-align: center;
	margin: 4px 0;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	color: #fff;
}

.difficulty {
	color: rgba(200, 160, 255, 0.55);
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin-left: 6px;
}

h2 {
	font-size: 1.15rem;
	font-weight: normal;
	margin: 28px 0 8px;
	color: rgba(255, 255, 255, 0.9);
}

.warn {
	color: #fa4;
	font-size: 0.95rem;
	min-height: 1.4em;
}

#form {
	background: var(--panel-bg);
	border: 1px solid rgba(168, 85, 247, 0.2);
	border-radius: 10px;
	padding: 16px 18px 18px;
	text-align: left;
}

input,
textarea {
	margin: 8px 0;
	width: 100%;
	font-size: 15px;
	font-family: inherit;
	background-color: rgba(30, 30, 35, 0.95);
	color: #ddd;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 6px;
	padding: 10px 12px;
}

textarea {
	height: 110px;
	min-height: 88px;
	max-height: 160px;
	resize: vertical;
	line-height: 1.45;
}

input:focus,
textarea:focus {
	color: #222;
	background-color: #fff;
	border-color: var(--accent);
	outline: none;
}

button {
	margin-top: 10px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: #fff;
	background-color: var(--accent);
	border: 0;
	border-radius: 6px;
	padding: 11px 16px;
	width: 100%;
	cursor: pointer;
}

button:hover {
	background-color: #fff;
	color: var(--accent);
}

label.check {
	cursor: pointer;
	display: block;
	padding: 0;
	margin: 0.35em 0;
	font-weight: 400;
	font-size: 0.92rem;
	text-align: left;
	color: rgba(255, 255, 255, 0.88);
}

input[type="checkbox"] {
	cursor: pointer;
	position: relative;
	display: inline-block;
	appearance: none;
	-webkit-appearance: none;
	background: rgba(30, 30, 35, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.15);
	height: 20px;
	width: 20px;
	vertical-align: top;
	margin: 1px 8px 0 0;
	padding: 0;
	border-radius: 4px;
}

input[type="checkbox"]:checked {
	border-color: var(--accent);
	background: var(--accent);
}

input[type="checkbox"]::after {
	display: block;
	position: absolute;
	content: "";
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: 0 solid #555;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

input[type="checkbox"]:checked::after {
	border-color: #fff;
}

/* Sidebar ads (standalone page only) */
.ad-sidebar {
	position: fixed;
	top: var(--header-h);
	bottom: var(--footer-h);
	width: var(--sidebar-w);
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--ad-stack-gap);
	padding: 14px 6px;
	box-sizing: border-box;
}

#leftSidebar { left: 0; }
#rightSidebar { right: 0; }

.ad-slot {
	position: relative;
	width: 160px;
	flex-shrink: 0;
	border: 1px solid rgba(168, 85, 247, 0.25);
	border-radius: 6px;
	overflow: hidden;
	background: rgba(20, 8, 40, 0.75);
}

.ad-sidebar .ad-slot.sz-tall {
	flex: 0 0 var(--ad-tall-h);
	height: var(--ad-tall-h);
	max-height: var(--ad-tall-h);
}

.ad-sidebar .ad-slot.sz-banner {
	flex: 0 0 var(--ad-ban-h);
	height: var(--ad-ban-h);
	max-height: var(--ad-ban-h);
}

.ad-sidebar .ad-rotator {
	position: relative;
	width: 100%;
	height: 100%;
}

.ad-sidebar .ad-rotator,
.ad-sidebar .ad-frame {
	width: 100%;
	height: 100%;
}

.ad-sidebar .ad-frame {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}

.ad-sidebar .ad-frame.active {
	opacity: 1;
	pointer-events: auto;
}

.ad-sidebar .ad-frame iframe {
	width: 160px !important;
	height: 100% !important;
	max-width: 100%;
	border: none;
	display: block;
}

.ad-fallback {
	width: 100%;
	height: 100%;
	background: rgba(30, 10, 60, 0.5);
}

/* Embedded inside typing-trainer portal iframe */
html.embedded-portal .ad-sidebar {
	display: none !important;
}

html.embedded-portal {
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
	overflow: visible !important;
}

html.embedded-portal body {
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
	overflow: visible !important;
}

html.embedded-portal #page {
	min-height: 0;
	padding: 8px 12px 48px;
	max-width: 100%;
	overflow: visible;
}

html.embedded-portal #logo {
	margin: 4px 0 6px;
	font-size: 26px;
}

html.embedded-portal .tagline {
	margin-bottom: 14px;
	font-size: 12px;
}

html.embedded-portal textarea {
	height: 88px;
	min-height: 72px;
}

html.embedded-portal h2 {
	margin-top: 18px;
}

.about-section {
	margin-top: 36px;
	padding-top: 28px;
	border-top: 1px solid rgba(168, 85, 247, 0.22);
	text-align: left;
}

.about-section h2 {
	text-align: center;
	font-size: 1.35rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-bottom: 14px;
	color: rgba(255, 255, 255, 0.95);
}

.about-lead {
	text-align: center;
	font-size: 1rem;
	line-height: 1.65;
	color: rgba(255, 255, 255, 0.82);
	margin: 0 0 22px;
}

.about-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	margin-bottom: 20px;
}

.about-card {
	background: var(--panel-bg);
	border: 1px solid rgba(168, 85, 247, 0.18);
	border-radius: 10px;
	padding: 16px 14px;
}

.about-card h3 {
	margin: 0 0 8px;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--accent);
	text-transform: uppercase;
}

.about-card p {
	text-align: left;
	margin: 0;
	font-size: 0.88rem;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.78);
}

.about-keywords {
	text-align: center;
	font-size: 0.92rem;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.72);
	margin: 0 0 16px;
}

.about-keywords em {
	font-style: normal;
	color: rgba(200, 160, 255, 0.95);
}

.about-cta {
	text-align: center;
	margin: 0;
	font-size: 0.9rem;
}

.about-link {
	font-weight: 600;
	letter-spacing: 0.03em;
}

.about-sep {
	color: rgba(255, 255, 255, 0.35);
	margin: 0 6px;
}

html.embedded-portal .about-section {
	margin-top: 22px;
	padding-top: 18px;
}

html.embedded-portal .about-grid {
	grid-template-columns: 1fr;
	gap: 10px;
}

@media (max-width: 720px) {
	.about-grid {
		grid-template-columns: 1fr;
	}
}

html.embedded-portal #loadLegacyFooter {
	display: none;
}

@media (max-width: 960px) {
	.ad-sidebar { display: none !important; }
	#page {
		padding-left: 16px;
		padding-right: 16px;
	}
}

@media (max-width: 480px) {
	body { font-size: 16px; }
	#form { padding: 12px 14px; }
}
