/*
   The player menu.
   Loaded in order with the others (see index.html): a later rule wins. */

/* PLAYER MENU */

/* Opens beside a player's rows, over the board (placed by JS). */
.player-menu {
	position: absolute;
	z-index: 60;
	display: flex;
	flex-direction: column;
	min-width: 22vmin;
	padding: 0.8vmin;
	gap: 0.4vmin;
	background: var(--menu-panel);
	border: var(--line) solid var(--edit);
	border-radius: var(--radius);
	box-shadow: 0 1vmin 3vmin rgba(0, 0, 0, 0.7);
	font-family: var(--font-condensed);
}

.player-menu.opening {
	animation: menu-in var(--medium) var(--ease-out);
}

.player-menu.closing {
	pointer-events: none;
	animation: menu-out var(--fast) ease-in forwards;
}

/* The player's name, with a pencil on the right to rename them. */
.player-menu-head {
	display: flex;
	align-items: center;
	gap: 1vmin;
	max-width: 30vmin;
	padding-left: 1vmin;
	border-bottom: 1px solid color-mix(in srgb, var(--edit) 50%, transparent);
}

/* All of it (name and pencil) is one button to rename, until renaming. */
.player-menu:not(.renaming) .player-menu-head {
	border-radius: calc(var(--radius) * 0.7) calc(var(--radius) * 0.7) 0 0;
	cursor: pointer;
	transition: background var(--hover-speed);
}

.player-menu-name {
	flex: 1;
	min-width: 0;
	font-size: 2.6vmin;
	color: var(--edit);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Renaming: the name becomes a text field with an amber underline. */
.player-menu-input {
	flex: 1;
	min-width: 0;
	margin: 0.4vmin 0;
	padding: 0.3vmin 0.4vmin;
	font-family: inherit;
	font-size: 2.6vmin;
	color: white;
	background: rgba(0, 0, 0, 0.35);
	border: none;
	border-bottom: 2px solid var(--edit);
	border-radius: 0.4vmin 0.4vmin 0 0;
	outline: none;
}

.player-menu .player-menu-rename {
	flex: none;
	margin: 0.2vmin 0 0.4vmin;
	padding: 0.6vmin 0.8vmin;
	color: white;
}

.player-menu button {
	display: flex;
	align-items: center;
	gap: 1.2vmin;
	padding: 1vmin 1.2vmin;
	font-family: inherit;
	font-size: 3vmin;
	color: var(--text);
	text-align: left;
	background: none;
	border: none;
	border-radius: calc(var(--radius) * 0.7);
	cursor: pointer;
}

.player-menu button span {
	width: 3vmin;
	font-size: 2.4vmin;
	text-align: center;
}

/* Match stats: lines of text, aligned left. */
.player-menu .lines-icon {
	width: 1.2em;
	height: 1.2em;
	margin: auto;
	stroke-width: 2.6;
	filter: none;
}

/* The pencil points down to the left. */
.player-menu button span.flip {
	transform: scaleX(-1);
}

.player-menu button:active {
	background: color-mix(in srgb, var(--edit) 22%, transparent);
}

.player-menu button:disabled {
	color: #646464;
	cursor: default;
}

.player-menu .danger {
	color: var(--bust);
}

@keyframes menu-in {
	from { opacity: 0; transform: translateX(-2vmin); }
}

@keyframes menu-out {
	to { opacity: 0; transform: translateX(-1vmin); }
}

/* In portrait the menu opens above the scores, so it rises from them. */
@keyframes menu-up {
	from { opacity: 0; transform: translateY(2vmin); }
}

@keyframes menu-down {
	to { opacity: 0; transform: translateY(1vmin); }
}
