/**
 * Team Shay Arcade — Bridge room styling.
 *
 * Theme match (Oct 22, 2026 — Shay: "the arcade does not match
 * the theme style and colors"): the card now wears the room's
 * own clothing. Every surface, border, text and accent value is
 * sampled from the room stylesheet's variables — no colors of
 * its own — so it follows the room in both themes:
 *   --card (panel background), --bg (inset surfaces),
 *   --borders, --radius, --shadow, --text, --headings, --muted,
 *   --mist-green + --mist-green-hover + --mist-green-dark
 *   (accents), rgba(var(--mist-green-rgb), .12) (hover wash),
 *   --on-accent (text on accent fills).
 * Layout, metrics and game behavior are unchanged.
 */

/* Container */
.tsm-arcade {
	background: var(--card);
	border: 1px solid var(--borders);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 12px;
	font-family: inherit;
	color: var(--text);
	/* Whole arcade 10px smaller (Oct 24, 2026 — Shay): 10px narrower
	   here, 10px shorter at minimum in the game area below. */
	max-width: calc(100% - 10px);
	box-sizing: border-box;
}

.tsm-arcade-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	/* Arcade header smaller (Oct 24, 2026 — Shay): band 44px + 10px
	   gap -> 32px + 6px gap, so the arcade itself is 16px shorter
	   at the top. The collapse button drops below the 44px touch
	   target set for iPad — his word on this header wins; if taps
	   get harder, say so and it goes back up. */
	margin-bottom: 6px;
}

.tsm-arcade-emoji {
	font-size: 18px;
}

.tsm-arcade-collapse {
	background: var(--mist-green);
	color: var(--on-accent);
	border: none;
	border-radius: 50%;
	width: 28px;
	height: 28px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.tsm-arcade-collapse:hover,
.tsm-arcade-collapse:focus {
	background: var(--mist-green-hover);
	outline: 2px solid var(--mist-green-dark);
	outline-offset: 2px;
}

.tsm-arcade-body[hidden] {
	display: none;
}

/* Game buttons */
.tsm-game-buttons {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
	flex-wrap: wrap;
}

.tsm-game-btn {
	flex: 1 1 auto;
	background: var(--card);
	border: 1px solid var(--borders);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 13px;
	font-weight: 600;
	padding: 8px 6px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.tsm-game-btn:hover {
	background: rgba(var(--mist-green-rgb), .12);
}

.tsm-game-btn.tsm-active {
	background: var(--mist-green);
	border-color: var(--mist-green);
	color: var(--on-accent);
}

.tsm-game-btn:focus-visible {
	outline: 2px solid var(--mist-green-dark);
	outline-offset: 2px;
}

/* Game area */
.tsm-game-area {
	background: var(--bg);
	border: 1px solid var(--borders);
	border-radius: var(--radius);
	padding: 12px;
	margin-bottom: 12px;
	min-height: 170px;
	text-align: center;
}

/* Scores tab view (Oct 24, 2026 — Shay): the leaderboard lives in
   the game area now, one combined list across all four games. */
.tsm-scores-view {
	text-align: left;
}
.tsm-score-game {
	color: var(--muted);
	font-size: 12px;
	white-space: nowrap;
}

.tsm-game-status {
	font-size: 14px;
	font-weight: 600;
	color: var(--headings);
	margin: 0 0 10px;
}

/* Buttons */
.tsm-btn {
	background: var(--mist-green);
	color: var(--on-accent);
	border: none;
	border-radius: var(--radius);
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	margin: 4px;
}

.tsm-btn:hover:not(:disabled) {
	background: var(--mist-green-hover);
}

.tsm-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.tsm-btn-secondary {
	background: var(--bg);
	color: var(--text);
	border: 1px solid var(--borders);
}

.tsm-btn-secondary:hover {
	background: rgba(var(--mist-green-rgb), .12);
}

.tsm-btn-row {
	margin-top: 8px;
}

/* Tic-Tac-Toe */
.tsm-ttt-grid {
	display: grid;
	grid-template-columns: repeat(3, 64px);
	grid-template-rows: repeat(3, 64px);
	gap: 6px;
	justify-content: center;
	margin-bottom: 10px;
}

.tsm-ttt-cell {
	background: var(--card);
	border: 2px solid var(--mist-green);
	border-radius: var(--radius);
	font-size: 28px;
	font-weight: 700;
	color: var(--mist-green-dark);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tsm-ttt-cell:hover:not(:disabled) {
	background: rgba(var(--mist-green-rgb), .12);
}

.tsm-ttt-cell:disabled {
	cursor: default;
}

/* Snake */
.tsm-snake-canvas {
	border: 2px solid var(--mist-green);
	border-radius: var(--radius);
	max-width: 100%;
	height: auto;
	touch-action: none;
}

/* Pac-Man */
.tsm-pacman-canvas {
	border: 2px solid var(--mist-green);
	border-radius: var(--radius);
	max-width: 100%;
	height: auto;
	touch-action: none;
	display: block;
	margin: 0 auto;
}

.tsm-dpad {
	display: grid;
	grid-template-columns: repeat(3, 44px);
	grid-template-rows: repeat(2, 44px);
	gap: 4px;
	justify-content: center;
	margin: 10px auto 4px;
}
.tsm-dpad-btn {
	width: 44px;
	height: 44px;
	font-size: 18px;
	background: var(--card);
	border: 1px solid var(--borders);
	border-radius: var(--radius);
	cursor: pointer;
	color: var(--text);
}
.tsm-dpad-btn:nth-child(1) { grid-column: 2; grid-row: 1; }
.tsm-dpad-btn:nth-child(2) { grid-column: 1; grid-row: 2; }
.tsm-dpad-btn:nth-child(3) { grid-column: 2; grid-row: 2; }
.tsm-dpad-btn:nth-child(4) { grid-column: 3; grid-row: 2; }
.tsm-dpad-btn:active {
	background: var(--mist-green);
	color: var(--on-accent);
}

/* Clicker */
.tsm-clicker-btn {
	background: var(--mist-green);
	color: var(--on-accent);
	border: none;
	border-radius: 50%;
	width: 120px;
	height: 120px;
	font-size: 20px;
	font-weight: 700;
	cursor: pointer;
	margin: 12px auto;
	display: block;
	transition: transform 0.08s ease;
}

.tsm-clicker-btn:hover {
	background: var(--mist-green-hover);
}

.tsm-clicker-btn:active {
	transform: scale(0.93);
}

/* Leaderboard */
.tsm-scores {
	background: var(--bg);
	border: 1px solid var(--borders);
	border-radius: var(--radius);
	padding: 10px 12px;
}

.tsm-scores-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--headings);
	margin: 0 0 8px;
}

.tsm-score-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 160px;
	overflow-y: auto;
}

.tsm-score-row {
	display: flex;
	gap: 8px;
	align-items: baseline;
	padding: 4px 0;
	border-bottom: 1px dashed var(--borders);
	font-size: 13px;
}

.tsm-score-row:last-child {
	border-bottom: none;
}

.tsm-score-rank {
	color: var(--mist-green-dark);
	font-weight: 700;
	min-width: 24px;
}

.tsm-score-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tsm-score-val {
	font-weight: 700;
	color: var(--headings);
}

.tsm-score-loading,
.tsm-score-empty {
	color: var(--muted);
	font-style: italic;
	font-size: 13px;
}

/* Responsive: full width on small screens */
@media (max-width: 480px) {
	.tsm-ttt-grid {
		grid-template-columns: repeat(3, 56px);
		grid-template-rows: repeat(3, 56px);
	}

	.tsm-clicker-btn {
		width: 100px;
		height: 100px;
		font-size: 17px;
	}
}

/* iPad / touch targets — 44px minimum on interactive controls */
.tsm-game-btn {
	min-height: 44px;
}

.tsm-arcade-collapse {
	width: 32px;
	height: 32px;
}

.tsm-btn {
	min-height: 44px;
}
