.coc {
	--coc-accent: var(--wp--preset--color--primary, var(--wp--preset--color--accent, #c00));
	--coc-error: #b00020;
	max-width: 40rem;
}

.coc [hidden] {
	display: none !important;
}

.coc-form {
	margin: 0 0 1rem;
}

.coc-label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
}

.coc-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.coc-input {
	flex: 1 1 14rem;
	min-width: 0;
	padding: 0.6rem 0.75rem;
	border: 1px solid currentColor;
	border-radius: 4px;
	font: inherit;
	font-size: max(1rem, 16px);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.coc-button {
	display: inline-block;
	padding: 0.6rem 1rem;
	border: 1px solid var(--coc-accent);
	border-radius: 4px;
	background: var(--coc-accent);
	color: #fff;
	font: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.coc-button-secondary {
	background: transparent;
	color: inherit;
}

.coc-button[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.coc-input:focus-visible,
.coc-button:focus-visible {
	outline: 3px solid var(--coc-accent);
	outline-offset: 2px;
}

.coc-captcha:empty {
	display: none;
}

.coc-captcha {
	margin-top: 0.5rem;
}

.coc-message {
	min-height: 1.5em;
	margin: 0.5rem 0 0;
}

.coc-message-error {
	color: var(--coc-error);
}

.coc-result {
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--coc-accent);
	border-radius: 4px;
}

.coc-result-title {
	margin: 0 0 0.5rem;
}

.coc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.coc-primary {
	padding: 0.75rem 1rem;
	border-left: 4px solid var(--coc-accent);
	background: rgba(0, 0, 0, 0.04);
}

.coc-primary > :first-child {
	margin-top: 0;
}

.coc-primary > :last-child {
	margin-bottom: 0;
}

.coc-dialog {
	max-width: min(36rem, calc(100vw - 2rem));
	padding: 1rem;
	border: 0;
	border-radius: 6px;
}

.coc-dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.coc-notice-body > :first-child {
	margin-top: 0;
}

.coc-viewer {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-height: 100vh;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border-radius: 0;
}

.coc-viewer[open] {
	display: flex;
	flex-direction: column;
}

.coc-viewer-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	padding: 0.5rem;
	background: #222;
	color: #fff;
}

.coc-viewer-toolbar .coc-button {
	padding: 0.4rem 0.7rem;
}

.coc-viewer-page {
	min-width: 3.5rem;
	text-align: center;
}

.coc-viewer-close {
	margin-left: auto;
}

/* Floats over the page area, so the page does not move when the status comes and goes. */
.coc-viewer-status {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	box-sizing: border-box;
	width: max-content;
	max-width: calc(100% - 2rem);
	margin: 0;
	padding: 0.75rem 1rem;
	border-radius: 6px;
	background: #222;
	color: #fff;
	text-align: center;
	transform: translate(-50%, -50%);
}

.coc-viewer-status--loading {
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	overflow: hidden;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	background: none;
	text-indent: 100%;
	white-space: nowrap;
	animation: coc-spin 0.8s linear infinite;
}

@keyframes coc-spin {
	to {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.coc-viewer-status--loading {
		animation-duration: 2.4s;
	}
}

.coc-viewer-stage {
	flex: 1;
	overflow: auto;
	scrollbar-gutter: stable;
	padding: 8px;
	background: #555;
	text-align: center;
	-webkit-overflow-scrolling: touch;
}

.coc-viewer-stage canvas {
	display: inline-block;
	background: #fff;
}

.coc-viewer-stage canvas[hidden] {
	display: none;
}
