* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Roboto, sans-serif;
	background:#0b0b0b;
}

input, button {
	padding:2px 5px;
}

#map-container {
	--map-width:1800px; /* 72 tiles * 25px */
    position: relative;
    width: 100%;
	min-width:var(--map-width);
    height:var(--map-width);
	margin:70px auto;
    overflow: hidden;
    transition: min-width 0.3s ease, height 0.3s ease;
}

#map-container::after {
    content:'';
    position:absolute;
    top:0;
    left:var(--map-width);
    width:calc(100% - var(--map-width));
    height:100%;
    background:#000;
    pointer-events:none;
    transition: width 0.3s ease, left 0.3s ease;
}

#map {
    position: relative;
    width: 100%;
    height: 100%;
    border: 1px solid #333;
    background-color: #56674B;
	user-select: none;
	transition: transform 0.5s ease;
}

#map.flat {
	transform:none;
}

#map.cavalier {
  transform: rotate(33deg) skew(-30deg,-5deg);
}

.expansion {
	background-color: #8FAC7D;
    border: 0;
    box-sizing: border-box;
    z-index: 1;
}

.expansion:not(.ui-draggable-dragging){
    transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.blocked-expansion {
    background-color:#000;
    z-index: 0;
    position: absolute;
    border: none;
}

.non-draggable-expansion {
    border-style: solid;
    position: absolute;
}

.draggable-expansion {
	border-width:1px;
    border-style: dashed;
    border-color: #56674B;
    position: absolute;
    z-index: 2;
    cursor: move;
	touch-action: none;
}

.sub-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 100%;
    height: 100%;
}

.sub-tile {
    border: 1px solid #56674B;
    box-sizing: border-box;
}

.building {
    position: absolute;
    background-color: #ffdd57;
    border: 2px solid #e5a600;
    box-sizing: border-box;
    cursor: move;
    text-align: center;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
	overflow:hidden;
	text-overflow:ellipsis;
	opacity:90%;
    transition: border-color 0.3s ease;
	touch-action: none;
}

.building:not(.ui-draggable-dragging):not(.newBuilding):not(.multidrag){
    transition: border-color 0.3s ease, top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.building.ui-draggable-dragging, .building.newBuilding{
    z-index:100;
}

.building.align-top {
	align-items:start;
}

.building.selected {
	border-color:#cc0000 !important;
	border-style:dashed !important;
}

.building span {
	display: inline-block;   /* Make the span behave like a block element */
	overflow: hidden;        /* Hide the overflow text */
	text-overflow: ellipsis; /* Display ellipsis when text overflows */
	max-width: 100%;         /* Ensure the span stays within the container's width */
}

.building.clan_power_production {
	background-color:#9f8dc5;
	border-color:#826bb3;
	color:#523e7a;
}

.building.culture {
	background-color:#ffec8b;
	border-color:#ffe458;
	color:#a38013;
}

.building.decoration {
	background-color:#91cd9e;
	border-color:#6ebd7f;
	color:#3e874e;
}

.building.goods {
	background-color:#edcb62;
	border-color:#e8bc34;
	color:#a38013;
}

.building.greatbuilding {
	background-color: #d7818e;
	border-color: #c45d6d;
	color: #9a3b49;
}

.building.main_building {
	background-color: #ee9b47;
	border-color: #d97813;
	color: #b3560a;
}

.building.military {
	background-color:#444;
	border-color:#2b2b2b;
	color:#000;
}

.building.production {
	background-color:#9bc4e2;
	border-color:#73add7;
	color:#337cb1;
}

.building.random_production {
	background-color:#adeaea;
	border-color:#84e0e0;
	color:#34caca;
}

.building.residential {
	background-color: #f0d8a4;
	border-color: #e3b86d;
	color: #c28a31;
}

.building.street {
	background-color:#d7d7d7;
	border-color:#bebebe;
}

.building.tower {
	background-color:#9f8dc5;
	border-color:#826bb3;
	color:#523e7a;
}

.building.nostreetrequirement {
	background-image:repeating-linear-gradient(45deg, transparent 0px, transparent 2px, rgba(255,255,255,0.7) 1px, rgba(255,255,255,0.7) 1px, transparent 4px);
}

.close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: red;
    color: white;
    border: none;
    cursor: pointer;
	font-size:70%;
	padding:1px;
}

.building .close-btn, .expansion .close-btn {
	visibility:hidden;
}
.building:hover .close-btn, .expansion:hover .close-btn {
	visibility:visible;
}

#selection-box {
	position:absolute;
	border:1px dashed #ffffff;
	background:rgba(236, 240, 241, 0.2);
	z-index:9999;
	display:none;
	left:0;
	top:0;
	width:0;
	height:0;
}

.toolbar {
    display: flex;
	height:70px;
    justify-content: space-around;
    align-items: center;
    background-color: #222;
    padding: 10px 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 5000;
	user-select:none;
}

.toolbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
	height:inherit;
	padding:10px 20px;
	transition: transform 0.2s ease;
}

.toolbar-item:not(.nohover):hover {
	background-color: #181a1b;
	transform: translateY(-3px);
}

.toolbar-item:not(.nohover):active {
	transform: translateY(0px);
}

.toolbar-item.nohover {
	cursor:auto;
}

.toolbar-item.left {
	margin-right:auto;
}

.toolbar-item.right {
	margin-left:auto;
}

.toolbar-item.active {
	background-color: #181a1b;
}

.toolbar-item.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    height: 100%;
}

.toolbar-item .icon {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
}

.toolbar-item span {
    color: #c0c0c0;
}

.toolbar-item:not(.nohover):hover span {
    color: #fff;
}

.toolbar-menu {
    display: none;
    text-align: center;
    background-color: #1b1b1b;
    color:#ecf0f1;
    padding: 20px;
    position: fixed;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    top: 70px;
    width: 100%;
    z-index: 99;
}

#import-menu > div > div {
    margin-bottom: 15px;
    font-size: 16px;
}

#import-menu img {
    max-width: 100%;
    height: auto;
    margin-top: 5px;
    border-radius: 5px;
}

#importCityBtn {
    background-color: #f39c12;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

#importCityBtn:hover {
    background-color: #d68a10;
    transform: translateY(-2px);
}

.toolbar-menu h4 {
    margin-top: 0;
    font-size: 20px;
    color: #f39c12;
    border-bottom: 1px solid #34495e;
    margin-bottom: 10px;
	padding-bottom:5px;
}

#build-menu #building-search {
    display: flex;
    align-items: center;
    gap: 10px;
}

#build-menu #building-search > img {
	max-width:20px;
}

#build-menu #buildingSearchWrapper {
    flex-grow:1;
	position:relative;
}

#build-menu #buildingSearch {
	width:100%;
	padding-right:30px;
}

.clear-input {
    position: absolute;
    right: 8px;
    top: 50%;
    color: #ecf0f1;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    display: none;
    z-index: 1;
    user-select:none;
}

input:not(:placeholder-shown) + .clear-input {
    display: inline;
}

#build-menu select, #build-menu input {
    padding: 10px;
    border: 1px solid #34495e;
    border-radius: 5px;
    font-size: 16px;
    background-color: #1b1b1b;
    color: #ecf0f1;
    transition: border-color 0.3s ease;
}

#build-menu #buildingSize {
	width:130px;
}

#build-menu select:focus, #build-menu input:focus {
    border-color: #f39c12;
    outline: none;
}

#suggestions-container {
	display: block;
    border: 1px solid #222;
    position: relative;
    z-index: 100;
    width: 100%;
    max-height: 200px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
	color:#fff;
	padding:5px;
    border-radius: 5px;
    margin-top: 10px;
    max-height: 200px;
    background-color: #2c2c2c;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    scrollbar-width: thin;
    scrollbar-color: #f39c12 #1b1b1b;
	user-select: none;
}

#suggestions-container::-webkit-scrollbar {
    width: 8px;
}

#suggestions-container::-webkit-scrollbar-track {
    background: #1b1b1b;
    border-radius: 5px;
}

#suggestions-container::-webkit-scrollbar-thumb {
    background-color: #f39c12;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#suggestions-container::-webkit-scrollbar-thumb:hover {
    background-color: #d68a10;
}

.suggestion-item {
    display: inline-block;
    text-align: center;
    padding: 10px;
    width: 200px;
    margin-right: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
	touch-action: none;
}

.suggestion-item:hover {
    background-color: #34495e;
	transform: translateY(-3px);
}

.suggestion-item:active {
	transform: translateY(0px);
}

.suggestion-item .name {
    position: relative;
    max-width: 180px;
    white-space: no-wrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
	font-weight:bold;
}

.suggestion-item .size {
	font-size:12px;
}

.suggestion-item .size img {
	vertical-align:middle;
}

.suggestion-item .img img {
    width: auto;
	max-width:180px;
    height: 100px;
    margin-top: 5px;
}

#save-menu .options {
    display: flex;
	flex: 1;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 20px;
}

#save-menu .option {
	max-width:33%;
	width:28%;
}

#save-menu strong {
    font-size: 18px;
}

#importCityBtn,
#loadCityAsJSONBtn,
#loadCityAsJSON,
#saveCityAsJSONBtn,
#saveCityAsPNGBtn {
	display: block;
}

.toolbar-menu button, .toolbar-menu input, .toolbar-menu select {
  margin: 10px auto;
}

.toolbar-menu button {
    background-color: #f39c12;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.toolbar-menu button:hover {
    background-color: #d68a10;
    transform: translateY(-2px);
}

#indexedDBKeys {
	width:100%;
	margin:5px 0px;
    padding: 5px;
    border: 1px solid #34495e;
    background-color: #1b1b1b;
    color: #ecf0f1;
    border-radius: 5px;
    margin-left: 10px;
    transition: border-color 0.3s ease;
}

#indexedDBKeys:focus {
    border-color: #f39c12;
    outline: none;
}

#indexedDBKey {
	width:100%;
	margin:5px 0px;
    padding:5px;
	padding-right:30px;
	background-color:#1b1b1b;
    color: #ecf0f1;
    border: 1px solid #34495e;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#indexedDBKey:focus {
    border-color: #f39c12;
    outline: none;
}

#loadCityAsJSON {
    margin-top: 5px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #ecf0f1;
    color: #333;
}

#save-menu > div > div > div {
    font-size: 14px;
    line-height: 1.5;
}

#city-stats {
	display:inline-flex;
	gap:20px;
	max-height:800px;
	overflow-y:auto;
}

#city-stats .statgroup {
	display:inline-flex;
	flex-direction:column;
	gap:5px;
}

#city-stats .stat {
	display: flex;
	align-items: center;
	padding: 10px;
    font-size: 16px;
    color: #bdc3c7;
	max-height:40px;
}

#city-stats .stat:not(:last-child) {
	border-bottom: 1px solid #bdc3c7;
}

#city-stats .stat > img {
	margin-right:10px;
}

#city-stats .stat img {
	vertical-align:middle;
	max-width:20px;
	max-height:20px;
}

#settings-menu input[type="checkbox"] {
    margin-right: 10px;
}

#settings-menu label {
    font-size: 16px;
    cursor: pointer;
    color: #bdc3c7;
}

#settings-menu span {
    font-size: 16px;
    color: #bdc3c7;
}

.toolbar-menu .sidenote {
    font-size: 14px;
    color: #95a5a6;
    line-height: 1.5;
}

#settings-menu a {
    color: #3498db;
    text-decoration: none;
}

#settings-menu a:hover {
    text-decoration: underline;
}

#settings-menu .zoom img {
	cursor:pointer;
	vertical-align:middle;
}

#share-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#generateLinkBtn {
    padding: 10px 20px;
    margin-bottom: 10px;
    cursor: pointer;
}

#shareableLink {
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

#context-menu-building {
	display: none;
	position: absolute;
	background-color: #1b1b1b;
	border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    color: #ecf0f1;
	z-index: 9999;
	padding: 15px;
}
#context-menu-building .name {
    font-size: 18px;
    font-weight: bold;
    color: #f1c40f;
}
#context-menu-building .size {
    font-size: 14px;
    color: #bdc3c7;
}
#context-menu-building .streetRequirement {
	vertical-align:middle;
}
#context-menu-building .era {
    margin-bottom: 5px;
}
#context-menu-building .eraTextOnly {
	display:none;
    font-size: 14px;
    color: #bdc3c7;
}

#context-menu-building .eraSelect {
	display:none;
    padding: 5px;
    border: 1px solid #34495e;
    background-color: #1b1b1b;
    color: #ecf0f1;
    border-radius: 5px;
    margin-left: 10px;
    transition: border-color 0.3s ease;
}

#context-menu-building .eraSelect:focus {
    border-color: #f39c12;
    outline: none;
}

#context-menu-building .level {
	display:none;
    font-size: 14px;
    color: #bdc3c7;
}

#context-menu-building .levelInput {
    width: 60px;
    padding: 5px;
    border: 1px solid #34495e;
    background-color: #1b1b1b;
    color: #ecf0f1;
    border-radius: 5px;
    margin-left: 10px;
    text-align: center;
    transition: border-color 0.3s ease;
}
#context-menu-building .levelInput:focus {
    border-color: #f39c12;
    outline: none;
}
#context-menu-building .img {
	display:block;
	max-width:200px;
	max-height:200px;
    margin:10px auto;
}
#context-menu-building li {
	list-style: none;
	padding: 10px;
    border-radius: 5px;
	cursor: pointer;
	background-color:#f39c12;
    color: #ecf0f1;
    text-align: center;
	margin-bottom:5px;
    transition: background-color 0.3s, transform 0.2s;
}
#context-menu-building li:hover {
    background-color: #d68a10;
    transform: translateY(-2px);
}

.toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	min-width: 200px;
	padding: 10px;
	background-color: #333;
	color: white;
	border-radius: 4px;
	z-index: 9999;
}

#buildings-list {
	color:#ecf0f1;
}