.evcf-container {
	max-width: 100%;
}

.evcf-wrap {
	display: inline-flex;
	flex-direction: column;
	gap: 12px;
	font-family: inherit;
}

/* --- Start screen --- */

.evcf-start {
	max-width: 420px;
	padding: 20px;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
}

.evcf-start h3 {
	margin-top: 0;
}

.evcf-start label {
	display: block;
	margin-top: 12px;
	margin-bottom: 4px;
	font-weight: bold;
}

.evcf-start select {
	width: 100%;
	padding: 6px;
	margin-bottom: 16px;
}

.evcf-btn {
	display: inline-block;
	padding: 10px 20px;
	border: none;
	border-radius: 6px;
	background: #2EC4B6;
	color: #fff;
	font-weight: bold;
	cursor: pointer;
}

.evcf-btn:hover {
	opacity: 0.9;
}

/* --- Status bar --- */

.evcf-status {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.evcf-scorebar {
	display: flex;
	align-items: center;
	gap: 16px;
	font-weight: bold;
}

.evcf-copy-log {
	margin-left: auto;
	padding: 4px 10px;
	font-size: 0.78em;
	font-weight: normal;
	border: 1px solid #ccc;
	border-radius: 5px;
	background: #fff;
	color: #555;
	cursor: pointer;
}

.evcf-copy-log:hover {
	background: #f2f2f2;
}

.evcf-score-p1 {
	color: var(--evcf-p1, #EF4444);
}

.evcf-score-p2 {
	color: var(--evcf-p2, #3B82F6);
}

.evcf-message {
	min-height: 1.4em;
}

/* --- Board --- */

.evcf-board {
	display: grid;
	grid-auto-rows: var(--evcf-cellsize, 48px);
	border: 3px solid #2D2A4A;
	width: max-content;
	flex-shrink: 0;
	user-select: none;
	-webkit-user-select: none;
}

.evcf-square {
	width: var(--evcf-cellsize, 48px);
	height: var(--evcf-cellsize, 48px);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	position: relative;
	box-sizing: border-box;
}

.evcf-square.evcf-light {
	background-color: var(--evcf-light, #f0d9b5);
}

.evcf-square.evcf-dark {
	background-color: var(--evcf-dark, #4a4a68);
}

.evcf-square.evcf-selected {
	box-shadow: inset 0 0 0 3px #FF6B4A;
}

.evcf-square.evcf-possible::after {
	content: '';
	position: absolute;
	width: 28%;
	height: 28%;
	border-radius: 50%;
	background: rgba(46, 196, 182, 0.75);
}

.evcf-square.evcf-forced-target::after {
	content: '';
	position: absolute;
	width: 34%;
	height: 34%;
	border-radius: 50%;
	background: rgba(255, 107, 74, 0.85);
	animation: evcf-pulse 1s infinite;
}

@keyframes evcf-pulse {
	0% { transform: scale(1); opacity: 0.85; }
	50% { transform: scale(1.25); opacity: 0.5; }
	100% { transform: scale(1); opacity: 0.85; }
}

.evcf-piece {
	width: 72%;
	height: 72%;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.25);
	pointer-events: none;
}

.evcf-piece-p1 {
	background-color: var(--evcf-p1, #EF4444);
}

.evcf-piece-p2 {
	background-color: var(--evcf-p2, #3B82F6);
}

.evcf-piece-hole {
	box-shadow: 0 0 0 3px #ffb020 inset, 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --- Main row (board + move history) --- */

.evcf-main-row {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	flex-wrap: nowrap;
}

.evcf-history {
	min-width: 230px;
	max-width: 300px;
	flex-shrink: 0;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fafafa;
	padding: 10px 12px;
	box-sizing: border-box;
	align-self: stretch;
	display: flex;
	flex-direction: column;
}

.evcf-history-title {
	font-weight: bold;
	font-size: 0.85em;
	color: #444;
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.evcf-history-rows {
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow-y: auto;
}

.evcf-history-row {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.76em;
	line-height: 1.4;
	white-space: normal;
	overflow-wrap: break-word;
	padding: 2px 0;
}

.evcf-history-row-p1 {
	color: var(--evcf-p1, #EF4444);
}

.evcf-history-row-p2 {
	color: var(--evcf-p2, #3B82F6);
}

.evcf-history-empty {
	font-size: 0.8em;
	color: #888;
	font-style: italic;
}

@media (max-width: 640px) {
	.evcf-main-row {
		flex-direction: column;
	}

	.evcf-history {
		max-width: 100%;
		width: 100%;
	}
}

/* --- Game over overlay --- */

.evcf-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

.evcf-overlay-card {
	background: #fff;
	padding: 24px 32px;
	border-radius: 8px;
	text-align: center;
	max-width: 320px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.evcf-overlay-card h3 {
	margin-top: 0;
}

/* --- How-to-play panel --- */

.evcf-howto-wrap {
	max-width: 640px;
	margin-top: 4px;
}

.evcf-howto {
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.evcf-howto-summary {
	padding: 12px 16px;
	font-weight: bold;
	cursor: pointer;
	list-style: revert;
	background: #f7f7f8;
	user-select: none;
}

.evcf-howto[open] .evcf-howto-summary {
	border-bottom: 1px solid #ddd;
}

.evcf-howto-summary:hover {
	background: #efefef;
}

.evcf-howto-body {
	padding: 8px 16px 4px;
}

.evcf-howto-rule {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 0;
	border-bottom: 1px solid #eee;
}

.evcf-howto-rule:last-child {
	border-bottom: none;
}

.evcf-howto-rule-visual {
	flex: 0 0 auto;
	width: 92px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.evcf-howto-svg {
	width: 100%;
	height: auto;
	max-height: 72px;
	border-radius: 4px;
	overflow: visible;
}

.evcf-howto-rule-text {
	flex: 1 1 auto;
	font-size: 0.92em;
	line-height: 1.45;
	color: #333;
}

.evcf-howto-rule-text strong {
	color: #2D2A4A;
}

.evcf-howto-piece {
	stroke: rgba(0, 0, 0, 0.45);
	stroke-width: 1;
}

.evcf-howto-piece-faded {
	opacity: 0.45;
}

.evcf-howto-ring {
	fill: none;
	stroke-width: 2.5;
}

.evcf-howto-ring-ok {
	stroke: #2EC4B6;
	stroke-dasharray: 3 2;
}

.evcf-howto-arrow {
	stroke: #FF6B4A;
	stroke-width: 2.5;
	stroke-linecap: round;
}

.evcf-howto-arrow-dashed {
	stroke: #2D2A4A;
	stroke-dasharray: 4 3;
}

.evcf-howto-arrowhead {
	fill: #FF6B4A;
}

.evcf-howto-arrowhead-2 {
	fill: #2D2A4A;
}

.evcf-howto-x line {
	stroke: #d9455f;
	stroke-width: 2.5;
	stroke-linecap: round;
}

@media (max-width: 480px) {
	.evcf-howto-rule {
		flex-direction: column;
		align-items: flex-start;
	}

	.evcf-howto-rule-visual {
		width: 120px;
	}
}
