* {
	font-family: 'Open Sans Condensed', sans-serif;
	color: #fff;
	box-sizing: border-box;
}

html, body {
	width: 100%;
	height: 100%;
}

body {
	margin: 0;
	padding: 0;
	text-align: center;
	background: black;
	overflow: hidden;
	touch-action: manipulation;
	visibility: hidden;
}

body.fonts-ready {
	visibility: visible;
}

:root {
	--coaster-bg: hsl(0 70% 45%);
}

h1 {
	margin: 0;
	font-size: 50px;
	font-family: 'Sekuya', serif;
	text-shadow: 2px 2px 20px var(--coaster-bg);
	transition: text-shadow 600ms ease;
}

h1, .hint {
	opacity: 1;
	transition: opacity 1s;
}

body.active h1,
body.active .hint {
	opacity: 0;
}

/* History button stays interactive even when faded. */
#historyBtn {
	position: fixed;
	bottom: 16px;
	right: 16px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.4);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 16px;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

#coaster {
	position: fixed;
	inset: 50% auto auto 50%;
	translate: -50% -50%;
	width: min(100vw, 100vh);
	aspect-ratio: 1 / 1;
	border-radius: 50%;
	background: var(--coaster-bg);
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
	transition: background 600ms ease;
}

body.snap #coaster,
body.snap h1 {
	transition: none;
}

/* --- Dialogs -------------------------------------------------------------- */

dialog {
	border: none;
	border-radius: 16px;
	padding: 24px;
	background: #1a1a1a;
	color: #fff;
	min-width: min(420px, 90vw);
	max-width: 90vw;
	max-height: 85vh;
	overflow: visible;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Floating secondary action below the drink form — sits under the dialog
   body, visually detached. */
.floating-history-btn {
	position: absolute;
	left: 50%;
	top: calc(100% + 14px);
	translate: -50% 0;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.4);
	color: #fff;
	padding: 10px 20px;
	border-radius: 999px;
	font-size: 15px;
	cursor: pointer;
	backdrop-filter: blur(4px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
	white-space: nowrap;
}

.floating-history-btn:hover {
	background: rgba(255, 255, 255, 0.2);
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
}

dialog h2 {
	margin: 0 0 16px;
	font-size: 28px;
}

.type-row {
	display: flex;
	gap: 8px;
	margin-bottom: 20px;
}

.type-btn {
	flex: 1;
	padding: 12px;
	font-size: 16px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	cursor: pointer;
	transition: background 150ms, border-color 150ms;
}

.type-btn:hover {
	background: rgba(255, 255, 255, 0.16);
}

.type-btn.selected {
	background: rgba(255, 255, 255, 0.25);
	border-color: #fff;
}

.slider-row {
	display: block;
	margin: 14px 0;
	text-align: left;
}

.slider-row span {
	display: block;
	margin-bottom: 6px;
	font-size: 16px;
}

.slider-row input[type="range"] {
	width: 100%;
	accent-color: #fff;
}

.slider-row input[type="range"]:disabled {
	opacity: 0.4;
}

.dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin: 20px 0 0;
	padding: 0;
}

.dialog-actions button {
	padding: 10px 18px;
	font-size: 15px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	cursor: pointer;
}

.dialog-actions button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

#drinkSave {
	background: rgba(255, 255, 255, 0.25);
	border-color: #fff;
}

/* --- History -------------------------------------------------------------- */

#historyBody details {
	margin: 8px 0;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 8px;
}

#historyBody summary {
	cursor: pointer;
	font-size: 16px;
}

#historyBody ul {
	margin: 10px 0 4px;
	padding-left: 20px;
	font-size: 14px;
	line-height: 1.6;
}

#historyBody li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 2px 0;
}

.remove-btn {
	padding: 4px 10px;
	font-size: 12px;
	border-radius: 6px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 120ms, background 120ms;
}

.remove-btn:hover {
	opacity: 1;
	background: rgba(255, 80, 80, 0.25);
	border-color: rgba(255, 120, 120, 0.6);
}

#historyBody .empty {
	text-align: center;
	opacity: 0.7;
	margin: 24px 0;
}
