/*
   The menu panel and its toggles, the language list, About and Feedback, the
   winner's Share, and this game's players under the profile. The Theme popup
   is theme-picker.css.
   Loaded in order with the others (see index.html): a later rule wins. */

/* The menu behind the three lines: unfolds from the button, one group open at a time. */
.settings-background.app-menu {
	align-items: flex-start;
	justify-content: flex-end;
	background: rgba(0, 0, 0, 0.5);
}

.app-menu.from-below {
	align-items: flex-end;
}

.app-menu .settings-main {
	width: min(calc(62 * var(--m)), calc(100% - 2 * var(--menu-right, 0px)));
	height: auto;
	max-height: calc(100% - var(--menu-top, 0px) - 2 * var(--m));
	margin: calc(var(--menu-top, 0px) + 1 * var(--m)) var(--menu-right, 0px) 0 0;
	gap: calc(1 * var(--m));
	overflow-y: auto;
	transform-origin: top right;
}

.app-menu.from-below .settings-main {
	margin: 0 var(--menu-right, 0px) calc(var(--menu-top, 0px) + 1 * var(--m)) 0;
	transform-origin: bottom right;
}

/* Beside its button (the players menu on a phone held sideways): from the button's top down to the screen's bottom, unfolding from its corner. */
.app-menu.beside .settings-main {
	width: min(calc(62 * var(--m)), calc(100% - var(--menu-right, 0px) - 2 * var(--m)));
	max-height: calc(100% - var(--menu-top, 0px) - 1 * var(--m));
	margin: var(--menu-top, 0px) calc(var(--menu-right, 0px) + 1 * var(--m)) 0 0;
}

.app-menu .settings-section {
	animation: menu-in var(--medium) var(--ease-out);
}

.app-menu.closing .settings-section {
	animation: menu-out var(--fast) ease-in forwards;
}

@keyframes menu-in {
	from { opacity: 0; transform: scale(0.6); }
}

@keyframes menu-out {
	to { opacity: 0; transform: scale(0.6); }
}

/* Colour says what a button does, as elsewhere in the app: green goes, blue is the
   account (like the player throwing: Join a game, Game history), amber puts aside
   and is the profile itself, red ends. */
:is(.app-menu, .profile-settings-section) .menu-new {
	border-color: var(--checkout);
	background: linear-gradient(var(--go-top), var(--go-bottom));
}

:is(.app-menu, .profile-settings-section) .menu-account {
	border-color: var(--account-line);
	background: linear-gradient(var(--account-top), var(--account-bottom));
}

:is(.app-menu, .profile-settings-section) :is(.menu-pause, .menu-profile) {
	border-color: var(--aside-line);
	background: linear-gradient(var(--aside-top), var(--aside-bottom));
}

:is(.app-menu, .profile-settings-section) .menu-end {
	border-color: var(--end-line);
	background: linear-gradient(var(--end-top), var(--end-bottom));
}

:is(.app-menu, .profile-settings-section) :is(.menu-new, .menu-account, .menu-pause, .menu-profile, .menu-end):active {
	filter: brightness(0.75);
}

.menu-pair {
	display: flex;
	flex: none;
	gap: calc(1 * var(--m));
}

.menu-pair > :not([hidden]) {
	flex: 1;
	min-width: 0;
}

.app-menu [hidden] {
	display: none;
}

.menu-group {
	flex: none;
	border-bottom: 1px solid var(--text-muted);
}

.menu-group:last-child {
	border-bottom: none;
}

/* A heading in a menu (This game, Profile). */
.menu-head {
	display: flex;
	align-items: center;
	margin: 0;
	padding: calc(1.4 * var(--m)) calc(1 * var(--m));
	font-family: var(--font-condensed);
	font-size: calc(3.2 * var(--m));
	font-weight: 600;
	color: var(--text);
}

.menu-title {
	display: flex;
	flex: 1;
	align-items: baseline;
	gap: calc(1.5 * var(--m));
	min-width: 0;
}

.menu-who {
	overflow: hidden;
	font-size: calc(2.4 * var(--m));
	font-weight: normal;
	color: var(--text-soft);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.menu-account-slot .settings-btn-action {
	font-size: calc(3 * var(--m));
}

.app-menu :is([data-action="google"], [data-action="send-code"], [data-action="verify"]) {
	border-color: var(--account-line);
	background: linear-gradient(var(--account-top), var(--account-bottom));
}

.app-menu [data-action="delete"] {
	border-color: var(--end-line);
	background: linear-gradient(var(--end-top), var(--end-bottom));
}

.account-panel {
	display: flex;
	flex-direction: column;
	gap: calc(1.5 * var(--m));
}

@media (orientation: portrait) and (max-aspect-ratio: 3/5) {
	.app-menu .settings-main {
		width: calc(100% - 2 * var(--menu-right, 0px));
	}
}

.menu-body {
	display: flex;
	flex-direction: column;
	gap: calc(1 * var(--m));
	padding-bottom: calc(1.5 * var(--m));
}

/* As a group slides, it's cut off, not squeezed: nothing inside changes size. */
.menu-body > * {
	flex: none;
}

.menu-body .current-game {
	margin: 0 calc(1 * var(--m));
}

/* The game being played: its name in green over how it's played. */
.app-menu .settings-summary b {
	display: block;
	font-size: calc(4.4 * var(--m));
	color: var(--checkout);
}

.app-menu .settings-summary span {
	display: block;
	margin-top: calc(0.3 * var(--m));
	color: var(--text-soft);
}

/* New game and Join a game, Pause and End, between two lines. */
.menu-actions {
	padding-top: calc(1.5 * var(--m));
}

/* Under this game, past its line: the other screens, side by side. */
.menu-more {
	padding-top: calc(0.5 * var(--m));
}

/* Toggles (caller, checkouts, full screen): a row of their own past a line, no heading. */
.menu-toggles {
	margin-top: calc(0.5 * var(--m));
	padding-top: calc(1.5 * var(--m));
	border-top: 1px solid var(--text-muted);
}

/* Smaller than the menu's other buttons, three to a row. */
.menu-toggles > * {
	padding-inline: calc(0.5 * var(--m));
	font-size: calc(3 * var(--m));
	white-space: nowrap;
}

.menu-language,
.menu-toggles > * {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: calc(1 * var(--m));
}

:is(.menu-language, .menu-toggles) .icon {
	width: calc(3 * var(--m));
	height: calc(3 * var(--m));
}

/* The caller's three steps: two waves on (green), one at half volume (amber), crossed out off (red). */
.menu-caller[data-volume="off"] :is(.caller-wave, .caller-loud),
.menu-caller[data-volume="half"] :is(.caller-loud, .caller-off),
.menu-caller[data-volume="on"] .caller-off {
	display: none;
}

/* Checkouts: the target crossed out while off. */
.menu-checkouts[data-on="true"] .checkouts-off {
	display: none;
}

/* A toggle's outline says where it stands: green on, red off, amber for the caller at half volume. */
.app-menu .menu-toggles > :is(.menu-caller[data-volume="on"], .menu-checkouts[data-on="true"], .menu-full-screen.active) {
	border-color: var(--checkout);
}

.app-menu .menu-toggles > :is(.menu-caller[data-volume="off"], .menu-checkouts[data-on="false"], .menu-full-screen:not(.active)) {
	border-color: var(--end-line);
}

.app-menu .menu-toggles > .menu-caller[data-volume="half"] {
	border-color: var(--aside-line);
}

.language-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: calc(1 * var(--m));
}

/* The language on: outlined green, like the theme on. */
.language-list button[aria-checked="true"] {
	border-color: var(--checkout);
}

.about-section,
.feedback-section {
	display: flex;
	flex-direction: column;
	gap: calc(1.5 * var(--m));
}

.feedback-section {
	width: min(calc(62 * var(--m)), 90%);
}

/* The winner popup's Share, and the nudge to sign in beside it. */
.winner-links {
	margin: calc(1 * var(--m)) 0 0;
	font-size: calc(2.4 * var(--m));
	color: var(--text-soft);
	text-align: center;
}

.feedback-status:empty {
	display: none;
}

.feedback-small {
	margin: 0;
}

/* This game's players, under the profile: in line with its buttons, the menu
   growing with them down to the screen's bottom, and only then the list scrolling.
   Add player stays under it, always in view. */
.profile-players,
.profile-players .menu-body {
	display: flex;
	flex-direction: column;
	flex: 0 1 auto;
	min-height: 0;
}

.profile-players .players-scroll {
	flex: 0 1 auto;
	min-height: calc(12 * var(--m));
	margin: 0 -3px;
}

.profile-players .players-add {
	margin: 0;
}
