/*
 * MiniCoTris 2 — presentation shell.
 *
 * The whole app lives inside a 240x320 box (the size of the original phone
 * canvas). app.js scales that box by a whole-number factor with a CSS
 * transform, so the pixel art stays on exact device pixels while the menu text
 * is re-rasterised crisply at the presentation size.
 */

:root {
	--panel: #1b1f24;
	--panel-edge: #4a5058;
	--ink: #d8dee4;
	--ink-dim: #8b939c;
	--accent: #f2c318;
	--accent-ink: #16181b;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	background: #000;
	color: var(--ink);
	font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
	overflow: hidden;
	-webkit-text-size-adjust: 100%;
}

#stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

/* Sized in JS to the scaled dimensions so flex centering has something to
   centre — a transformed element keeps its untransformed layout box. */
#screen-wrap {
	position: relative;
}

#screen {
	position: absolute;
	top: 0;
	left: 0;
	width: 240px;
	height: 320px;
	transform-origin: 0 0;
	background: #000;
	overflow: hidden;
}

#game {
	display: block;
	width: 240px;
	height: 320px;
	image-rendering: pixelated;
	outline: none;
	touch-action: manipulation;
}

/* --- Overlay: stands in for the MIDP lcdui screens --- */

#overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: linear-gradient(180deg, #10131600 0%, #101316 6%, #0c0e10 100%);
	font-size: 9px;
	line-height: 1.45;
}

#overlay.hidden,
.hidden {
	display: none !important;
}

#ui-title {
	flex: none;
	padding: 5px 7px;
	background: linear-gradient(180deg, #3a4149, #262b31);
	border-bottom: 1px solid var(--panel-edge);
	color: var(--accent);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

#ui-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 4px 0;
	scrollbar-width: thin;
}

#ui-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

#ui-list li {
	padding: 4px 8px;
	color: var(--ink);
	cursor: pointer;
	white-space: normal;
}

#ui-list li.selected {
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 600;
}

#ui-text {
	margin: 0;
	padding: 4px 8px;
	color: var(--ink);
	font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
	font-size: 9px;
	white-space: pre-wrap;
	word-break: break-word;
}

#ui-field {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 4px 8px;
}

#ui-field-label {
	color: var(--ink-dim);
}

#ui-input {
	width: 100%;
	padding: 3px 4px;
	background: #05070a;
	border: 1px solid var(--panel-edge);
	border-radius: 2px;
	color: var(--accent);
	font-family: inherit;
	font-size: 10px;
}

#ui-input:focus {
	outline: 1px solid var(--accent);
}

#softkeys {
	flex: none;
	display: flex;
	justify-content: space-between;
	gap: 6px;
	padding: 4px 6px;
	background: linear-gradient(180deg, #262b31, #16191d);
	border-top: 1px solid var(--panel-edge);
}

#softkeys button {
	padding: 3px 8px;
	background: #333a42;
	border: 1px solid var(--panel-edge);
	border-radius: 2px;
	color: var(--ink);
	font-family: inherit;
	font-size: 9px;
	cursor: pointer;
}

#softkeys button:hover {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
}

/* The right softkey is absent on some screens; keep the left one left-aligned. */
#softkeys button:only-child {
	margin-right: auto;
}

body.load-failed::after {
	content: 'Failed to load game assets — serve this folder over http:// rather than opening the file directly.';
	position: fixed;
	inset: auto 0 0 0;
	padding: 12px;
	background: #601515;
	color: #fff;
	font-size: 13px;
	text-align: center;
}
