* {
	font-family: 'Oxygen', sans-serif;
	box-sizing: border-box;
}

:root {
	--nav: calc(60px + env(safe-area-inset-bottom, 0px));
	--rail: 76px;
	--panel: min(40vw, 480px);
}

body {
	margin: 0;
	font-size: 16px;
	line-height: 1.5;
	color: #222;
	background: #E8E8E9;
	overflow: hidden;
}

/* Phones first: library on top, tab bar at the bottom, panels cover the library. */
#rightMostTab {
	position: fixed;
	z-index: 1000;
	left: 0;
	right: 0;
	bottom: 0;
	height: var(--nav);
	padding-bottom: env(safe-area-inset-bottom, 0px);
	display: flex;
	background: #2b2b2b;
}

.menuImg {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 0;
	margin: 0;
	padding: 6px 0;
	border-radius: 0;
	background: none;
	color: #bbb;
	font-size: 12px;
}

.menuImg img {
	width: 24px;
	height: 24px;
	opacity: 0.7;
}

.menuImg.active {
	color: white;
	background: rgba(255, 255, 255, 0.08);
}

.menuImg.active img {
	opacity: 1;
}

@media (hover: hover) {
	.menuImg:hover {
		color: white;
	}

	.menuImg:hover img {
		opacity: 1;
	}
}

#rightTab {
	display: none;
	position: fixed;
	z-index: 1001;
	top: 0;
	left: 0;
	right: 0;
	bottom: var(--nav);
	padding: 0 20px 20px;
	overflow-y: auto;
	background: white;
}

body.panel-open #rightTab {
	display: block;
}

.tabHeader {
	position: sticky;
	top: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
	padding: 8px 0;
	border-bottom: 1px solid #eee;
	background: white;
}

.tabHeader h2 {
	margin: 0;
	font-size: 20px;
}

#closeTab {
	width: 44px;
	min-height: 44px;
	margin-right: -12px;
	padding: 0;
	background: none;
	color: #555;
	font-size: 28px;
	line-height: 1;
}

#leftTab {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: var(--nav);
}

#canvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #E8E8E9;
	touch-action: none;
}

#lastPostsCanvas {
	display: block;
	width: 100%;
}

#secondaryCanvas, #hidden_image {
	display: none;
}

.actions {
	display: flex;
	gap: 12px;
	margin: 16px 0;
}

.actions button {
	flex: 1;
}

#camera_video {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transform: scaleX(-1);
	border-radius: 8px;
	background: black;
}

#photo_status {
	color: #b00020;
}

button {
	min-height: 48px;
	padding: 12px 20px;
	border: none;
	border-radius: 8px;
	color: white;
	background-color: #4CAF50;
	font-size: 16px;
	text-align: center;
	cursor: pointer;
}

button.secondary {
	border: 1px solid #4CAF50;
	color: #2e7d32;
	background: white;
}

button:focus-visible {
	outline: 3px solid #1976d2;
	outline-offset: 2px;
}

#about {
	word-wrap: break-word;
}

.bignum {
	display: block;
	margin: 8px 0;
	color: #666;
	font-family: monospace;
	font-size: 11px;
	line-height: 1.3;
	word-break: break-all;
}

#titletext {
	position: fixed;
	z-index: 999;
	top: 8px;
	left: 8px;
	padding: 2px 10px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.75);
	font-size: 18px;
	font-weight: 700;
	pointer-events: none;
}

/* Wider screens: icon rail on the right, panel opens beside the library. */
@media (min-width: 768px) {
	#rightMostTab {
		top: 0;
		left: auto;
		width: var(--rail);
		height: auto;
		flex-direction: column;
		gap: 8px;
		padding: 12px 0;
	}

	.menuImg {
		flex: none;
		padding: 10px 0;
	}

	.menuImg img {
		width: 32px;
		height: 32px;
	}

	#rightTab {
		left: auto;
		right: var(--rail);
		bottom: 0;
		width: var(--panel);
		border-left: 1px solid #ddd;
	}

	#leftTab {
		right: var(--rail);
		bottom: 0;
	}

	body.panel-open #leftTab {
		right: calc(var(--rail) + var(--panel));
	}

	#titletext {
		top: 12px;
		left: 12px;
		font-size: 24px;
	}
}
