html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
	background-color: #f1f3f4;
}

#layout {
	display: flex;
	flex-direction: row;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	--ai-size: 34%;
}

#pg0-pane {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	position: relative;
	background-color: #f1f3f4;
}

#ai-pane {
	flex: 0 0 var(--ai-size);
	min-width: 0;
	min-height: 0;
	position: relative;
	background-color: #ffffff;
}

#divider {
	flex: 0 0 6px;
	background-color: #d0d4d8;
	cursor: col-resize;
	touch-action: none;
	position: relative;
	z-index: 2;
}
#divider::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 2px;
	height: 28px;
	margin-left: -1px;
	margin-top: -14px;
	border-radius: 1px;
	background-color: #8a9096;
}

iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background-color: transparent;
}

@media (orientation: portrait) {
	#layout {
		flex-direction: column;
	}
	#divider {
		cursor: row-resize;
	}
	#divider::after {
		width: 28px;
		height: 2px;
		margin-left: -14px;
		margin-top: -1px;
	}
}

body.dragging iframe {
	pointer-events: none;
}
body.dragging {
	user-select: none;
	-webkit-user-select: none;
}

/* The screen library of PG0 covers the whole window, AI pane included. */
body.screen-full #pg0-pane {
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	z-index: 1000;
}

/* PG0's editor on a phone, with the keyboard up: the frame covers what the
   keyboard leaves visible (frame.js sets its top and height). The pane keeps
   its place, so the agent's page is not laid out again. */
body.edit-full #pg0-frame {
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	z-index: 1000;
}

/* Asks a browser inside another app on iOS to hand the page to Safari
   (inapp.js). PG0 and the agent share what is left below it. */
body.has-inapp-banner {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
}
body.has-inapp-banner #layout {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
}
#inapp-banner {
	flex: 0 0 auto;
	position: relative;
	padding: 8px 40px 8px 12px;
	padding-top: calc(8px + env(safe-area-inset-top));
	background-color: #fff6db;
	border-bottom: 1px solid #e6d18f;
	color: #4a3b00;
	font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
	font-size: 13px;
	line-height: 1.5;
}
#inapp-banner [hidden] {
	display: none;
}
.inapp-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}
.inapp-open, .inapp-copy {
	display: inline-block;
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
}
.inapp-open {
	background-color: #1a73e8;
	border: 1px solid #1a73e8;
	color: #ffffff;
	font-weight: bold;
}
.inapp-copy {
	background-color: #ffffff;
	border: 1px solid #c9b46a;
	color: #4a3b00;
}
.inapp-hint {
	margin-top: 6px;
	font-size: 12px;
}
.inapp-close {
	position: absolute;
	right: 4px;
	top: calc(4px + env(safe-area-inset-top));
	width: 32px;
	height: 32px;
	border: 0;
	background: transparent;
	color: #6b5a1a;
	font-size: 20px;
	cursor: pointer;
}
