/* Crazy Fast Food — HUD, drawer, build menu, upgrade panel.
   Border-radius capped at 8px on rectangular elements; pill chips use 999px. */

:root {
	--top-h: 56px;
	--drawer-w: 320px;
	--accent-cash:   #16a34a;
	--accent-cash-2: #166534;
	--accent-grill:  #ef4444;
	--accent-cashier:#fb923c;
	--accent-table:  #4ade80;
	--accent-trash:  #6b7280;
}

* { box-sizing: border-box; }
html, body {
	margin: 0; height: 100%;
	background: var(--bg, #1a1a1a);
	color: var(--text, #f5f5f5);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	overscroll-behavior: none;
	touch-action: none;
	-webkit-user-select: none; user-select: none;
}

.app {
	position: fixed; inset: 0;
	display: grid;
	grid-template-rows: var(--top-h) 1fr;
}

/* Top bar */
header.topbar {
	display: flex; align-items: center; gap: 8px;
	padding: 0 12px;
	background: var(--panel, #232323);
	border-bottom: 1px solid var(--border, #333);
}
.icon-btn {
	width: 40px; height: 40px;
	border: none; background: transparent; color: inherit;
	font-size: 22px; line-height: 1;
	border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.spacer { flex: 1; }

.progress-chip, .cash-chip {
	display: inline-flex; align-items: center; gap: 8px;
	height: 36px; padding: 0 14px;
	border-radius: 999px;
	background: rgba(0,0,0,0.35);
	font-weight: 600;
}
.cash-chip {
	background: linear-gradient(180deg, var(--accent-cash), var(--accent-cash-2));
	color: #fff;
}
.cash-chip .cash-icon {
	width: 22px; height: 22px; border-radius: 999px;
	background: #fff; color: var(--accent-cash);
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 14px;
}
.progress-chip .label { opacity: .6; font-size: 12px; letter-spacing: .08em; }

/* Stage */
.stage {
	position: relative;
	overflow: hidden;
	background: var(--bg-2, #111);
}
canvas#world { display: block; width: 100%; height: 100%; }

.floating-controls {
	position: absolute; right: 14px; bottom: 14px;
	display: flex; flex-direction: column; gap: 10px;
}
.float-btn {
	width: 56px; height: 56px;
	border: none; border-radius: 999px;
	background: var(--panel, #2a2a2a);
	color: var(--text, #f5f5f5);
	font-size: 24px; font-weight: 700;
	box-shadow: 0 4px 14px rgba(0,0,0,0.35);
	cursor: pointer;
}
.float-btn:active { transform: translateY(1px); }
.float-btn.is-active { background: #fbbf24; color: #1f2937; }
.float-btn-danger { background: #7f1d1d; color: #fff; }

.danger-btn {
	padding: 10px 14px; border: none; border-radius: 8px;
	background: #7f1d1d; color: #fff; font-weight: 600;
	cursor: pointer; width: 100%;
}
.danger-btn.confirm { background: #b91c1c; }
.drawer-section .meta {
	font-size: 12px; opacity: 0.65; margin: 6px 0 0;
}

/* Build menu */
.build-menu {
	position: absolute; left: 14px; bottom: 14px;
	display: flex; gap: 8px; flex-wrap: wrap;
	max-width: calc(100% - 90px);
}
.build-chip {
	display: inline-flex; align-items: center; gap: 8px;
	height: 44px; padding: 0 14px;
	background: var(--panel, #2a2a2a);
	color: var(--text, #f5f5f5);
	border: 2px solid transparent;
	border-radius: 8px;
	font-weight: 600; cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.build-chip.is-active { border-color: #fbbf24; }
.build-chip[disabled] { opacity: .45; cursor: not-allowed; }
.build-chip .swatch {
	width: 18px; height: 18px; border-radius: 4px; display: inline-block;
}
.swatch-grill   { background: var(--accent-grill); }
.swatch-stack   { background: #fde68a; }
.swatch-cashier { background: var(--accent-cashier); }
.swatch-table   { background: var(--accent-table); }
.swatch-trash   { background: var(--accent-trash); }
.build-chip .cost { opacity: .7; font-size: 13px; }
.build-chip-cancel { background: #7f1d1d; color: #fff; }

/* Flash */
.flash {
	position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
	display: flex; flex-direction: column; gap: 6px;
	pointer-events: none;
	max-width: 90%;
}
.flash .toast {
	background: rgba(0,0,0,0.7);
	color: #fff;
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 14px;
	animation: toast-in 180ms ease-out;
}
.flash .toast.error  { background: #7f1d1d; }
.flash .toast.warn   { background: #92400e; }
.flash .toast.fade   { opacity: 0; transition: opacity 250ms; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Drawer */
.drawer {
	position: fixed; top: 0; right: 0; bottom: 0;
	width: min(var(--drawer-w), 92vw);
	background: var(--panel, #1f1f1f);
	border-left: 1px solid var(--border, #333);
	transform: translateX(100%);
	transition: transform 220ms ease;
	z-index: 20;
	display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--border, #333);
}
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-body { padding: 12px 14px; overflow: auto; }
.drawer-section { margin-bottom: 18px; }
.drawer-section h3 { font-size: 14px; opacity: .7; margin: 0 0 8px; letter-spacing: .04em; text-transform: uppercase; }
.drawer-link { color: inherit; text-decoration: none; opacity: .7; }
.drawer-link:hover { opacity: 1; }

.drawer-backdrop {
	position: fixed; inset: 0; background: rgba(0,0,0,0.5);
	z-index: 19;
}

.tips { padding-left: 18px; margin: 0; line-height: 1.5; opacity: .85; }
.tips li { margin-bottom: 6px; }

/* Upgrade list */
.upgrade-list { display: flex; flex-direction: column; gap: 8px; }
.upgrade-row {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: rgba(255,255,255,0.04);
	border-radius: 8px;
}
.upgrade-row .label { font-weight: 600; }
.upgrade-row .meta  { font-size: 12px; opacity: .7; }
.upgrade-row button {
	padding: 8px 12px;
	border: none; border-radius: 8px;
	background: var(--accent-cash);
	color: #fff; font-weight: 600;
	cursor: pointer;
}
.upgrade-row button[disabled] { opacity: .5; cursor: not-allowed; }
