.lenws-workbook,
.lenws-workbook * {
	box-sizing: border-box;
}

.lenws-workbook {
	--lenws-accent: #800000;
	--lenws-accent-dark: #5f0000;
	--lenws-border: #d6d6d6;
	--lenws-panel: #f7f7f7;
	--lenws-answer: #555555;
	width: 100%;
	margin: 30px 0;
	color: #1f1f1f;
	font-family: Arial, Helvetica, sans-serif;
}

.lenws-introduction {
	margin-bottom: 24px;
}

.lenws-introduction h2 {
	margin: 0 0 16px;
	color: var(--lenws-accent);
	font-size: clamp(28px, 4vw, 40px);
	line-height: 1.2;
}

.lenws-introduction p {
	margin: 0 0 12px;
	font-size: 17px;
	line-height: 1.65;
}


.lenws-level-guide {
	margin: 0 0 24px;
	padding: 20px;
	background: #f7f9fb;
	border: 1px solid var(--lenws-border);
	border-radius: 14px;
}

.lenws-level-guide h3 {
	margin: 0 0 10px;
	color: var(--lenws-accent);
	font-size: 23px;
	line-height: 1.3;
}

.lenws-level-guide > p {
	margin: 0 0 16px;
	font-size: 15px;
	line-height: 1.6;
}

.lenws-level-guide-table-wrap {
	width: 100%;
	overflow-x: auto;
}

.lenws-level-guide-table {
	width: 100%;
	min-width: 680px;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.45;
}

.lenws-level-guide-table th,
.lenws-level-guide-table td {
	padding: 11px 12px;
	text-align: left;
	vertical-align: top;
	border: 1px solid #d7d7d7;
}

.lenws-level-guide-table thead th {
	color: #ffffff;
	background: var(--lenws-accent);
}

.lenws-level-guide-table tbody th {
	width: 90px;
	color: var(--lenws-accent);
	background: #fff7f7;
}

.lenws-login-notice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin: 0 0 20px;
	padding: 20px;
	background: #fff7d6;
	border: 1px solid #e0b84f;
	border-left: 6px solid #d89b00;
	border-radius: 12px;
}

.lenws-login-notice-content {
	flex: 1 1 auto;
}

.lenws-login-notice h3 {
	margin: 0 0 7px;
	color: #5f0000;
	font-size: 21px;
	line-height: 1.3;
}

.lenws-login-notice p {
	margin: 0;
	font-size: 16px;
	line-height: 1.55;
}

.lenws-login-button {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.lenws-login-button:hover,
.lenws-login-button:focus {
	color: #ffffff;
	text-decoration: none;
}

.lenws-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 12px;
	margin: 0 0 18px;
	padding: 18px;
	background: var(--lenws-panel);
	border: 1px solid var(--lenws-border);
	border-radius: 14px;
}

.lenws-control-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: min(100%, 260px);
}

.lenws-control-group label {
	font-size: 15px;
	font-weight: 700;
}

.lenws-level-select {
	min-height: 46px;
	padding: 9px 38px 9px 12px;
	font-size: 16px;
	line-height: 1.3;
	background-color: #ffffff;
	border: 1px solid #777777;
	border-radius: 8px;
}

.lenws-button {
	min-height: 46px;
	padding: 10px 18px;
	color: #ffffff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	background: var(--lenws-accent);
	border: 2px solid var(--lenws-accent);
	border-radius: 8px;
	cursor: pointer;
}

.lenws-button:hover,
.lenws-button:focus {
	color: #ffffff;
	background: var(--lenws-accent-dark);
	border-color: var(--lenws-accent-dark);
}

.lenws-button:focus-visible,
.lenws-level-select:focus-visible {
	outline: 3px solid #0067a3;
	outline-offset: 2px;
}

.lenws-button-secondary {
	color: var(--lenws-accent);
	background: #ffffff;
}

.lenws-button-secondary:hover,
.lenws-button-secondary:focus {
	color: #ffffff;
}

.lenws-level-description {
	margin: 0 0 20px;
	padding: 12px 16px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	background: #fff7d6;
	border-left: 5px solid #d89b00;
}

.lenws-sheet {
	width: 100%;
	padding: 22px;
	background: #ffffff;
	border: 1px solid var(--lenws-border);
	border-radius: 14px;
	box-shadow: 0 5px 18px rgba(0, 0, 0, 0.08);
}

.lenws-sheet-header {
	margin-bottom: 20px;
}

.lenws-sheet-title {
	margin: 0 0 14px;
	color: #111111;
	font-size: clamp(23px, 3vw, 32px);
	line-height: 1.25;
	text-align: center;
}

.lenws-pupil-details {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px 24px;
	font-size: 15px;
}

.lenws-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
}

.lenws-grid-wide {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lenws-problem {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 150px;
	padding: 14px 10px;
	font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
	font-size: clamp(19px, 2vw, 25px);
	font-weight: 700;
	background: #ffffff;
	border: 1px solid #dddddd;
	border-radius: 10px;
}

.lenws-problem-vertical {
	align-items: stretch;
}

.lenws-stack {
	display: grid;
	width: max-content;
	min-width: min(100%, 120px);
	max-width: 100%;
	margin: auto;
	font-variant-numeric: tabular-nums;
}

.lenws-stack-row,
.lenws-stack-answer {
	display: grid;
	grid-template-columns: 32px minmax(70px, max-content);
	align-items: center;
	justify-content: end;
	width: 100%;
	min-height: 34px;
	line-height: 34px;
	white-space: nowrap;
}

.lenws-stack-number,
.lenws-stack-answer .lenws-answer-value {
	text-align: right;
}

.lenws-operator {
	text-align: left;
}

.lenws-rule {
	width: 100%;
	margin-top: 4px;
	border-top: 3px solid #111111;
}

.lenws-problem-horizontal {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(74px, max-content);
	align-items: center;
	column-gap: 10px;
	width: 100%;
	text-align: left;
}

.lenws-expression {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 5px;
	min-width: 0;
	min-height: 58px;
	line-height: 1.35;
	text-align: left;
}

.lenws-answer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-width: 74px;
	min-height: 38px;
	margin: 0;
	padding: 0 4px;
	color: var(--lenws-answer);
	font-size: 0.9em;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
	text-align: right;
	border-bottom: 2px solid #9a9a9a;
}

.lenws-stack-answer {
	display: grid;
	grid-template-columns: 32px minmax(70px, max-content);
	align-items: center;
	justify-content: end;
	width: 100%;
	min-width: 0;
	padding: 0;
}

.lenws-mixed-number {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.lenws-fraction {
	display: inline-grid;
	grid-template-rows: auto auto;
	min-width: 30px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	text-align: center;
	vertical-align: middle;
}

.lenws-fraction-numerator {
	padding: 0 4px 3px;
	border-bottom: 2px solid currentColor;
}

.lenws-fraction-denominator {
	padding: 3px 4px 0;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

@media (max-width: 900px) {
	.lenws-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 700px) {
	.lenws-login-notice {
		align-items: stretch;
		flex-direction: column;
	}

	.lenws-login-button {
		width: 100%;
	}
}

@media print {
	.lenws-workbook[data-lenws-can-print="0"] .lenws-sheet {
		display: none !important;
	}
}

@media (max-width: 600px) {
	.lenws-controls {
		align-items: stretch;
	}

	.lenws-control-group,
	.lenws-button {
		width: 100%;
	}

	.lenws-grid {
		grid-template-columns: 1fr;
	}

	.lenws-sheet {
		padding: 15px;
	}

	.lenws-problem {
		min-height: 135px;
	}
}
