/**
 * Crafty Barmaid word game (Hitta ord) — front-end styles.
 *
 * Direct port of the legacy hittaord.css: same ids, classes, sizes and
 * colours so existing content and any custom CSS keep working. Only the
 * accessibility additions at the end are new.
 */

#game-container {
	display: flex;
	gap: 20px;
	align-items: flex-start;
	margin: 0 auto;
	width: 100%;
	max-width: 800px;
}

#grid {
	display: flex;
	border-collapse: collapse;
	user-select: none;
	table-layout: fixed;
	margin: 0 auto; /* Center horizontally */
}

#grid tbody {
	margin: 0 auto; /* Center horizontally */
}

.found-count {
	text-align: center;
}

#grid td {
	border: 1px solid black;
	text-align: center;
	font-size: 25px;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	width: 40px;
	height: 40px;
}

@media (max-width: 750px) {
	#grid td {
		font-size: 20px;
		width: 30px;
		height: 30px;
	}
}

#show-word-list-button {
	margin-top: 10px;
	margin-bottom: 10px;
}

#show-results-button {
	margin-top: 10px;
	margin-bottom: 10px;
}

/* Styles for landscape orientation */
@media (orientation: landscape) {
	#game-container {
		flex-direction: row;
	}
}

#grid td.selected {
	background-color: yellow;
}

/* Styles for the line segments */
.line-segment {
	position: absolute;
	background-color: rgb(105, 170, 125);
	opacity: 0.8;
	mix-blend-mode: multiply; /* For blending overlapping lines */
	z-index: 1; /* Place the lines behind the letter */
	border: 1px solid darkgreen; /* Add the border style */
}

.horizontal {
	top: 50%;
	left: -5%;
	width: 110%;
	height: 25px;
	transform: translateY(-50%);
}

.vertical {
	left: 50%;
	top: -5%;
	width: 25px;
	height: 110%;
	transform: translateX(-50%);
}

.left-end {
	top: 50%;
	left: 10%;
	width: 95%;
	height: 25px;
	border-radius: 5px 0 0 5px;
	transform: translateY(-50%);
}

.right-end {
	top: 50%;
	right: 10%;
	width: 95%;
	height: 25px;
	border-radius: 0 5px 5px 0;
	transform: translateY(-50%);
}

.top-end {
	top: 10%;
	left: 50%;
	height: 95%;
	width: 25px;
	border-radius: 5px 5px 0 0;
	transform: translateX(-50%);
}

.bottom-end {
	bottom: 10%;
	left: 50%;
	height: 95%;
	width: 25px;
	border-radius: 0 0 5px 5px;
	transform: translateX(-50%);
}

/*
 * Accessibility additions — selection is no longer colour-only: the yellow
 * fill stays, and selected cells also get a dark inner outline (negative
 * offset keeps it inside the cell, whose overflow is hidden).
 */
#grid td.selected {
	outline: 3px solid #1a1a1a;
	outline-offset: -3px;
}

/* Keyboard focus ring (:focus-visible does not match mouse clicks). */
#grid td:focus-visible {
	outline: 3px solid #0b5fff;
	outline-offset: -3px;
}

/*
 * The legacy assets have no transitions or animations; this guard keeps it
 * that way for users who prefer reduced motion.
 */
@media (prefers-reduced-motion: reduce) {
	#game-container,
	#grid td,
	.line-segment,
	#word-list {
		animation: none;
		transition: none;
	}
}
