@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {
	--col-bg: #234;
	--col-text: #fff;
	--col-text-link: #acf;
	--col-canvas-edge: #7f7f7f;
	--col-menu-bg: #468;
	--col-menu-bg-hover: #69c;
	--col-menu-edge: #123;
	--col-menu-edge-hover: #7fccff;
}

body {
	margin: 0;
	
	font-family: "Roboto", serif;
}

a {
	color: var(--col-text-link);
}

#main {
	width: 100vw;
	height: 100vh;
	background-color: var(--col-bg);
	
	display: flex;
	justify-content: center;
    align-items: center;
	
	color: var(--col-text);
}

#toolbar {
	display: flex;
	position: absolute;
	top: 0;
	box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
	
	z-index: 10;
}

#palette {
	display: flex;
	flex-direction: column;
    align-items: center;
	
	position: absolute;
	left: 30px;
	
	z-index: 10;
	
}

#colors {
	box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
}

#colors div {
	display: flex;
	flex-direction: row;
}

.palette-color {
	display: block;
	appearance: none;
	
	border: 1px solid black;
	width: 24px;
	height: 24px;
	margin: 1px;
}

.palette-color:hover {
	border-color: white;
}

#color-preview {
	--col1: #ffffff;
	--col2: #000000;
	
	margin-top: 6px;
	position: relative;
	width: -webkit-fill-available;
	width: -moz-available;
	width: fill-available;
}

#color-preview-1 {
	position: absolute;
	width: 32px;
	height: 32px;
	
	background-color: var(--col1);
	border: 1px solid black;
	outline: 1px solid white;
	box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
	border-radius: 999px;
}

#color-preview-2 {
	position: absolute;
	top: 8px;
	left: 16px;
	width: 32px;
	height: 32px;
	
	background-color: var(--col2);
	border: 1px solid black;
	outline: 1px solid white;
	box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
	border-radius: 999px;
}

#color-picker-1, #color-picker-2 {
	position: absolute;
	right: 0;
	width: 0;
	height: 0;
	opacity: 0;
}

#history-container {
	display: flex;
	flex-direction: column;
	
	width: 150px;
	position: absolute;
	right: 30px;
	background-color: var(--col-bg);
	box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
	
	user-select: none;
	
	z-index: 10;
}

#history-container-title {
	width: -webkit-fill-available;
	width: -moz-available;
	width: fill-available;
	padding: 3px 6px;
	text-align: center;
	font-weight: bold;
	
	background-color: var(--col-menu-bg);
}

#history {
	display: flex;
	flex-direction: column;
	max-height: 200px;
	overflow-y: auto;
	
	border: 1px solid var(--col-menu-bg);
	scrollbar-width: thin;
}

.history-entry {
	padding: 3px 6px;
	display: flex;
    align-items: center;
}

.history-entry.latest {
	font-weight: bold;
	text-decoration: underline;
}

.history-entry.latest ~ .history-entry {
	opacity: 0.5;
	font-style: italic;
}

.history-entry.pencil::before {
	content: "";
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 8px;
	background-color: var(--pencil-mark);
	border: 1px solid black;
	outline: 1px solid white;
	border-radius: 999px;
}

.history-entry.icon::before {	
	content: "";
	display: inline-block;
	width: 16px;
	height: 16px;
	margin-right: 4px;
	
	background-image: var(--icon);
}

.menu {
	display: flex;
	align-items: center;
	position: relative;
	padding: 3px 6px;
	margin-right: 1px;
	
	border-bottom: 2px solid var(--col-menu-edge);
	background-color: var(--col-menu-bg);
	
	user-select: none;
}

.menu:hover:not(:has(#tools)) {
	border-bottom-color: var(--col-menu-edge-hover);
	background-color: var(--col-menu-bg-hover);
}

.menu > input {width: 2.5em;}

.menu-splitter {
	width: 6px;
	height: 4px;
}

.menu-options .menu-splitter {
	width: -webkit-fill-available;
	width: -moz-available;
	width: fill-available;
	height: 1px;
	margin: 6px;
	background-color: var(--col-menu-edge);
}

.menu .menu-options {
	display: none;
	position: absolute;
	left: 0;
    bottom: 0;
    transform: translateY(calc(100% + 2px));
	width: max-content;
	
	background-color: var(--col-menu-bg);
}

.menu:hover .menu-options {
	display: block;
}

.menu .menu-option {
	display: flex;
	flex-direction: row;
	align-items: center;
	padding: 3px 6px;
	white-space: nowrap;
}

.menu .menu-option:hover {
	background-color: var(--col-menu-bg-hover);
}

.menu .menu-option.icon::before {
	display: inline-block;
	content: "";
	min-width: 16px;
	min-height: 16px;
	margin-right: 5px;
	background-image: var(--icon);
}

.menu .menu-option > input:not([type="text"]) {
	width: 24px;
	height: 24px;
	max-width: 24px;
	max-height: 24px;
	appearance: none;
	
	padding: 0;
	margin: 0;
	margin-right: 5px;
	box-sizing: border-box;
}

.menu .menu-option > input[type="checkbox"] {
	border: 1.5px solid #7f7f7f;
    background-color: #ffffff;
    border-radius: 999px;
}

.menu .menu-option > input[type="checkbox"]:checked {
    background-image: radial-gradient(#4f7fff 35%, transparent 40%);
}

.menu .menu-option[data-info]::after {
	content: "[" attr(data-info) "]";
	font-size: 67%;
	opacity: 67%;
	margin-left: 10px;
	width: -webkit-fill-available;
	width: -moz-available;
	width: fill-available;
	text-align: right;
}

#tools input[type="button"] {
	appearance: none;
	width: 24px;
	height: 100%;
	margin: 0 2px;
	border: none;
	background-repeat: no-repeat;
	background-position: center;
	
	background-color: transparent;
}

#tools input[type="button"].current-tool {
	background-color: var(--col-menu-bg-hover);
}

#canvas-container {
	--col-checkerboard-1: #8f8f8f;
	--col-checkerboard-2: #bfbfbf;
	
	position: relative;
	border: 1px solid var(--col-canvas-edge);
	box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.2);
	
	background-image: conic-gradient(var(--col-checkerboard-1) 25%, var(--col-checkerboard-2) 25%, var(--col-checkerboard-2) 50%, var(--col-checkerboard-1) 50%, var(--col-checkerboard-1) 75%, var(--col-checkerboard-2) 75%);
	background-size: 16px 16px;
	
	cursor: url("point.png") 7 7, crosshair;
}

#canvas-container.tool-eraser {
	cursor: url("point-eraser.png") 5 10, crosshair;
}

#canvas {image-rendering: pixelated;}

.preview {image-rendering: pixelated; border: 1px solid transparent; /*the border helps fix the sizing so pixels don't get deformed*/}

#grid {
	--grid-scale: 16px;
	--grid-mask: url("gridmask16.png");
	background: url("grid.png");
	background-repeat: repeat;
	
	mask-image: var(--grid-mask);
	mask-repeat: repeat;
	mask-size: var(--grid-scale) var(--grid-scale);
	
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	
	pointer-events: none;
}

.window {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translateX(-50%) translateY(-50%);
	
	background-color: var(--col-bg);
	border: 2px solid var(--col-menu-bg);
	box-shadow: 0 3px 6px 6px rgba(0, 0, 0, 0.2);
	color: var(--col-text);
	
	z-index: 100;
}

.window .window-title {
	user-select: none;
	font-weight: bold;
	width: 100%;
	padding: 6px;
	text-align: center;
	position: relative;
	
	box-sizing: border-box;
	background-color: var(--col-menu-bg);
}

.window .window-title .window-close {
	position: absolute;
	right: 6px;
	top: 6px;
	bottom: 6px;
	width: 16px;
	
	display: flex;
	align-items: center;
	justify-content: center;
	
	text-align: center;
	height: -webkit-fill-available;
	height: -moz-available;
	height: fill-available;
	
	border: 1.5px solid var(--col-bg);
}

.window .window-title .window-close:hover {
	background-color: #cc3355;
}

.window .window-content {
	min-width: 400px;
	max-width: 400px;
	max-height: 300px;
	padding: 6px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.window-content ul {
	padding: 0;
	padding-left: 1.5em;
}