[data-pphc-inline-math] .pphc-rich-surface math-field[data-pphc-inline-equation] {
	display: inline-block;
	vertical-align: middle;
	min-width: 90px;
	min-height: 38px;
	margin: 3px 5px;
	padding: 2px 5px;
	border: 1px solid #3858e9;
	border-radius: 5px;
	background: #f7f8ff;
	font-size: 19px;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-line math-field[data-pphc-inline-equation] {
	display: inline-block;
	width: fit-content;
	min-width: 180px;
	margin: 0;
	padding: 6px 8px;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline {
	display: inline-flex;
	align-items: center;
	position: relative;
	gap: 0;
	margin: 0 .08em;
	vertical-align: -.12em;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline math-field[data-pphc-inline-equation] {
	width: auto;
	min-width: 0;
	min-height: 1.25em;
	margin: 0;
	padding: 0 .04em;
	border: 0;
	border-radius: 3px;
	background: transparent;
	box-shadow: none;
	font-size: 1.2em;
	line-height: 1;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline .pphc-inline-equation-delete {
	position: absolute;
	top: -15px;
	left: calc(100% - 5px);
	z-index: 3;
	width: 18px;
	height: 18px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
	font-size: 14px;
	transition: opacity .12s ease;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline:hover .pphc-inline-equation-delete,
.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline:focus-within .pphc-inline-equation-delete {
	opacity: 1;
	pointer-events: auto;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-line {
	display: flex;
	align-items: center;
	width: fit-content;
	max-width: 100%;
	gap: 5px;
	margin: 10px 0;
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-line .pphc-inline-equation-delete {
	position: static;
	flex: 0 0 22px;
	margin: 0;
}

[data-pphc-inline-math] .pphc-rich-surface math-field[data-pphc-inline-equation]:focus-within {
	box-shadow: 0 0 0 2px rgba(56, 88, 233, .2);
}

.pphc-written-attempt [data-pphc-compact] .pphc-equation-inline math-field[data-pphc-inline-equation]:focus-within {
	background: rgba(56, 88, 233, .05);
	box-shadow: 0 0 0 1px rgba(56, 88, 233, .35);
}

[data-pphc-inline-math] math-field[data-pphc-inline-equation]::part(virtual-keyboard-toggle),
[data-pphc-inline-math] math-field[data-pphc-inline-equation]::part(menu-toggle) {
	display: none;
}

/* Read-only equations produced by the shared server-side renderer. */
math-field.pphc-rendered-math {
	display: inline-block;
	width: auto;
	min-width: 0;
	max-width: 100%;
	margin: 0 .12em;
	padding: 0 .08em;
	border: 0;
	background: transparent;
	vertical-align: -.16em;
	pointer-events: none;
}

math-field.pphc-rendered-math--display {
	display: block;
	overflow-x: auto;
	margin: .65em 0;
	padding: .35em 0;
	vertical-align: baseline;
}

math-field.pphc-rendered-math::part(virtual-keyboard-toggle),
math-field.pphc-rendered-math::part(menu-toggle) {
	display: none;
}

.pphc-inline-equation-delete {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: top;
	width: 22px;
	height: 22px;
	margin: 1px 3px 0 -12px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #d63638;
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.pphc-inline-equation-delete:hover,
.pphc-inline-equation-delete:focus {
	background: #b32d2e;
	color: #fff;
	outline: 2px solid #fff;
}

.pphc-math-session-tools {
	position: fixed;
	left: 50%;
	bottom: var(--pphc-math-keyboard-height, 0px);
	transform: translateX(-50%);
	z-index: 100000;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	background: #fff;
	border: 1px solid #8c8f94;
	border-bottom: 0;
	border-radius: 7px 7px 0 0;
	box-shadow: 0 -2px 10px rgba(0, 0, 0, .14);
}

.pphc-math-session-tools[hidden] {
	display: none;
}

.pphc-math-session-tools--candidate-hidden {
	display: none !important;
}

.pphc-math-keyboard-collapse {
	position: fixed;
	right: 18px;
	bottom: calc(var(--pphc-math-keyboard-height, 0px) - 34px);
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 30px;
	padding: 0;
	border: 1px solid #666;
	border-radius: 5px;
	background: #45484c;
	color: #fff;
	font-size: 23px;
	line-height: 1;
	cursor: pointer;
}

.pphc-math-keyboard-collapse[hidden] {
	display: none;
}

.pphc-math-session-tools > span {
	font-weight: 600;
}

.pphc-math-session-tools .pphc-math-text-entry {
	display: flex;
	gap: 6px;
	align-items: center;
}

.pphc-math-session-tools .pphc-math-text-entry[hidden] {
	display: none;
}

.pphc-math-session-tools .pphc-math-text-entry input {
	width: 230px;
	min-height: 32px;
}

.pphc-preview-dossier-layout {
	display: grid;
	grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.pphc-preview-dossier-layout .pphc-preview-case {
	position: sticky;
	top: 42px;
	max-height: calc(100vh - 75px);
	overflow: auto;
	margin: 0;
}

.pphc-preview-case__title {
	display: block;
	margin-bottom: 12px;
}

.pphc-preview-question-statement {
	position: sticky;
	top: 32px;
	z-index: 5;
	padding: 14px;
	margin: -14px -14px 18px;
	background: #fff;
	border-bottom: 1px solid #dcdcde;
	box-shadow: 0 5px 8px rgba(0, 0, 0, .04);
}

@media (max-width: 900px) {
	.pphc-preview-dossier-layout { display: block; }
	.pphc-preview-dossier-layout .pphc-preview-case,
	.pphc-preview-question-statement { position: static; max-height: none; overflow: visible; }
}
