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

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

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

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

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

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

.evdb-start select,
.evdb-start input[type="text"] {
	width: 100%;
	padding: 6px;
	box-sizing: border-box;
	margin-bottom: 4px;
}

.evdb-mode-row {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.evdb-mode-btn {
	flex: 1;
	padding: 10px;
	border: 2px solid #ddd;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-weight: bold;
}

.evdb-mode-btn.evdb-mode-active {
	border-color: #2EC4B6;
	background: #eafaf8;
}

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

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

/* Outline variant - used for the overlay's "Close" and the status bar's "Restart", so they read
   as secondary actions next to a primary "Play again" / "Copy game log". */
.evdb-btn-secondary {
	background: #fff;
	color: #2EC4B6;
	border: 2px solid #2EC4B6;
	padding: 8px 18px;
}

.evdb-btn-secondary:hover {
	background: #eafaf8;
	opacity: 1;
}

.evdb-overlay-card .evdb-btn {
	margin: 16px 6px 0;
}

.evdb-field-hint {
	font-size: 0.8em;
	color: #757575;
	font-weight: normal;
	margin: 2px 0 0;
}

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

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

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

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

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

.evdb-turn-indicator {
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 0.8em;
	color: #fff;
	background: #999;
}

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

/* --- Board --- */

.evdb-board {
	display: grid;
	border: none;
	width: max-content;
	flex-shrink: 0;
	user-select: none;
	-webkit-user-select: none;
	background: #fff;
}

.evdb-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--evdb-dot, #2D2A4A);
	justify-self: center;
	align-self: center;
}

.evdb-edge {
	position: relative;
	cursor: pointer;
}

.evdb-edge::before {
	content: '';
	position: absolute;
	background: #e2e2e2;
	border-radius: 3px;
	transition: background-color 0.1s ease;
}

.evdb-edge-h::before {
	left: 2px;
	right: 2px;
	top: 40%;
	bottom: 40%;
}

.evdb-edge-v::before {
	top: 2px;
	bottom: 2px;
	left: 40%;
	right: 40%;
}

.evdb-edge:not(.evdb-edge-drawn):hover::before {
	background: #b9ecE7;
}

.evdb-edge-drawn::before {
	background: var(--evdb-line, #2D2A4A);
}

/* Marks whichever line was just drawn (by either side). */
.evdb-edge-lastmove::after {
	content: '';
	position: absolute;
	inset: -3px;
	border-radius: 3px;
	box-shadow: 0 0 0 2px #ffb020;
	animation: evdb-lastmove-pulse 0.9s ease-out;
	pointer-events: none;
}

@keyframes evdb-lastmove-pulse {
	0% { box-shadow: 0 0 0 7px rgba(255, 176, 32, 0.85); }
	100% { box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.85); }
}

.evdb-edge-hint::before {
	background: #ffb020;
}

.evdb-box {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 0.85em;
	color: #fff;
	border-radius: 2px;
}

.evdb-box-p1 {
	background: var(--evdb-p1, #EF4444);
}

.evdb-box-p2 {
	background: var(--evdb-p2, #3B82F6);
}

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

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

.evdb-history {
	min-width: 220px;
	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;
}

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

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

.evdb-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;
}

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

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

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

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

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

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

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

.evdb-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);
}

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

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

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

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

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

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

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

.evdb-howto-body {
	padding: 10px 16px 14px;
}

.evdb-howto-body ol {
	margin: 0;
	padding-left: 20px;
}

.evdb-howto-body li {
	margin-bottom: 8px;
	line-height: 1.45;
	color: #333;
}

@media (max-width: 480px) {
	.evdb-board {
		zoom: 0.85;
	}
}
