:root { --gap: 0; --item-padding: 3px; }
@font-face {
    font-family: 'Avenir';
    font-style: normal;
    font-weight: 400;
    src: local('Avenir'), url('https://fonts.cdnfonts.com/s/71748/avenir_roman_12.woff') format('woff');
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; margin: 0; padding: 0; font-family: 'Avenir', sans-serif;}
body * {
	font-family: 'Avenir', sans-serif;
}
body {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	max-height: 100vh;
	background: #f5f5f5;
}

.life-palace {
	background: #d5d5d5;
}

.no-capture-ghost { display: none !important; } 

.zwds-grid p, .palace-details p {
	margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0;
  margin-inline-end: 0
}

.stars,
.transformation-label,
.transformation-label-circle {
	font-size: clamp(0.4875rem, calc(0.4rem + 0.75vw), 1.25rem);
}

.stars,
.transformation-label {
	font-weight: 600;
}

.stars {
	padding: 3px;
}

.many .stars,
.many .transformation-label,
.many .transformation-label-circle {
	font-size: clamp(0.3rem, calc(0.4rem + 0.45vw), 1.25rem);
}

.heavenly {
	color: maroon;
	text-decoration: underline;
}
.heavenly * {
	color: inherit !important;
}
.fire {
	color: #D72638;
} 
.water {
	color: #0057B8;
} 
.earth {
	color: #A97142;
} 
.wood {
	color: #008000;
} 
.metal {
	color: #4A4A4A;
} 
.active-green {
	background-color: #008000 !important;
	color: white;
	/*z-index: 15;*/
	position: relative;
}
.active-blue {
	background-color: #01a2ff !important;
	color: white;
	/*z-index: 15;*/
	position: relative;
}
.active-orange {
	background-color: #feae01 !important;
	color: white;
	/*z-index: 15;*/
	position: relative;
}
.active-red {
	background-color: #ee2917 !important;
	color: white;
	/*z-index: 15;*/
	position: relative;
}
.editInfo {
	text-decoration: underline;
	cursor: pointer;
}
#lineLayer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.zwds-grid {
	position: relative;
	max-width: 100vw;	
	width: 96vw;
	height: 83vh;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-template-rows: repeat(4, 1fr);
	gap: var(--gap);
	padding: var(--gap);
	grid-template-areas: 
		"p1   p2   p3   p4"
		"p12 p13  p13  p5"
		"p11 p13  p13  p6"
		"p10 p9   p8   p7";
	background: #fff;
	align-items: stretch;
}

@media print {
	.zwds-grid {
		aspect-ratio: 16 / 9;
	}
}

.print-preview {
  width: 297mm;
  height: 210mm;
  padding: 1cm;
  background: white;
  zoom: 1; /* or scale down if needed */
  overflow: hidden;
}

/* Prevent overflow when previewing */
body.print-preview {
  overflow: hidden;
}

.print-preview .zwds-grid {
	aspect-ratio: 16 / 9 !important;
	max-width: 297mm !important;
	width: auto !important;
	height: auto !important;
}

.print-preview .bg-gray-50 {
	background-color: white !important;
}

.zwds-grid > div {
  display: flex;
  align-items: stretch;
}

.zwds-grid > div:not(.p13) {
	display: flex;
	flex-direction: column;
	cursor: pointer;	
	background: #fafafa;
	transition: background .2s;
	outline: 1.5px solid #999;	
}
.zwds-grid > div {
	overflow: hidden;
}
.zwds-grid > .p13 {
	/*font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);*/
	grid-area: p13;
	background: #fafafa;
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	outline: 1.6px solid #999;
	overflow: hidden;
	text-align: center;	
	padding: 20px clamp(25px, 5vw + 5px, 75px);
	min-height: 300px;
}
.zwds-grid > div:not(.p13):hover { background: #e8e8e8; }
/* Wide layout */
.sectionA { flex: 2; display: flex; padding: var(--item-padding); }
.sectionA1, .sectionA2 {
	flex: 1;
	display: flex;
	text-align: left;
	flex-direction: column;
}
.many.sectionA1 {
	display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: max-content;
}
.sectionA1 {
	align-items: flex-start;
	justify-content: flex-start;
	font-size: clamp(0.625rem, calc(0.55rem + 0.5vw), 15px);
}
.sectionA2 { 
	border-right: none; 
	align-items: flex-end;
	justify-content: flex-start;
}
.drange {
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	font-weight: 600;
}
.dpalace {
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	font-weight: 600;
}
.apalace, .lmonth {
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	font-weight: 600;
}
/*.sectionC { 
	flex: 0.5; 
	display: flex; 
	flex-direction: column;
	align-items: anchor-center;
	justify-content: center;
	text-align: center;
	font-weight: 600;
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	padding: var(--item-padding);
}*/
.sectionB { 
	flex: 1; 
	display: flex; 
	background-color: #ededed; 
	padding-left: var(--item-padding);
	padding-right: var(--item-padding);
}
.sectionB1 {
	display: flex;
	justify-content: center;
	align-items: self-start;
	flex-direction: column;
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	text-align: center;
	flex: 0 0 25%;
	font-weight: 600;
	padding-left: 5px;
}
.sectionB1-1, .sectionB1-2 {
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	text-align: center;
}    
.sectionB2 {
	flex: 0 0 50%;
	display: flex;
	flex-direction: column;
	font-weight: 600;
	justify-content: center;
	align-items: center;
}
.sectionB2-1, .sectionB2-2 {
	/*flex: 1;*/
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	text-align: center;
}
.sectionB2-2 { border-bottom: none; }
.sectionB3 {
	flex: 0 0 25%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: self-end;
	font-weight: 600;
	padding-right: 5px;
}
.sectionB3-1, .sectionB3-2 {
	/*flex: 1;*/
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
	
	text-align: center;
}
.sectionB3-2 { border-bottom: none; }
.sectionB3 { border-right: none; }
.selected {
	background-color: #fbe7a1 !important;
}
#custom-menu {
	position: absolute;
    display: block;
    cursor: context-menu;
    background: white;
    border: 1px solid rgb(204, 204, 204);
    padding: 8px;
    z-index: 9999;
    left: 801px;
    top: 699px;
    display: none;
    font-size: clamp(0.625rem, calc(0.475rem + 0.5vw), 1rem);
}
.major {
	color: darkblue;
}
.minor {
	color: lightcoral;
}
.left {
	width: 65%;
  text-align: left;
}
.right {
	width: 25%;
  text-align: left;
}
.rat-tooltip {
	width: 500px;
	left: 50% !important;	
}
#rotate-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: white;
  color: black;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 1.25rem;
  padding: 1.5rem;
  opacity: 0.95;
}

/* Show only if portrait AND screen width is small */
@media screen and (orientation: portrait) and (max-width: 768px) {
  #rotate-warning {
    display: flex;
  }
}

@media (min-width: 601px) {
	.sectionA1 {
		flex: 0 0 75%;
	}
	.many.sectionA1 {
		display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: max-content;
	}
	.zwds-grid {
		/*aspect-ratio: 16 / 9;*/
	}
}
@media (min-width: 801px) {
	.sectionA1 {
		flex: 0 0 56%;
	}
	.many.sectionA1 {
		display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: max-content;
	}
}
@media (max-width: 1000px) {
	.zwds-grid {
		width: 98vw;
		height: auto;		
		/*max-width: 100vw;	*/
	}
}
/* Small screens */
@media (max-width: 600px) {
	.rat-tooltip {
		width: 300px;
		left: 50% !important;
	}
	.sectionA { flex-direction: column; }
	.sectionA1 { border-bottom: 1px solid #ccc; }
	.sectionA2 { flex: 1; border-right: none; }
	.sectionB { flex-direction: column; }
	.sectionB1, .sectionB2, .sectionB3 {
		border-bottom: 1px solid #ccc;
		flex: 1;
	}
	.sectionB1 {
		display: flex;
		justify-content: center;
		flex-direction: row;
	}
	.sectionB1-1, .sectionB1-2 {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.sectionB1-2::before {
		content: "";
		margin-left: 2px;
	}
	.sectionB2 { 
		flex-direction: column; 
		order: 3 
	}
	.sectionB3 { 
		flex-direction: row; 
		justify-content: center;
		order: 2;
	  border-bottom: none; 
	  gap: 5px;
	}
	.sectionB3-1, .sectionB3-2 {
		flex: none;
	}
	.sectionB2-1, .sectionB2-2 {
		justify-content: start;
	}
	.sectionA1, .sectionA2,
	.sectionB2-1, .sectionB2-2, .sectionB3-1, .sectionB3-2 {
/*		white-space: nowrap;*/
		/*overflow: hidden;*/
		/*text-overflow: ellipsis;*/
		flex-direction: column;
		justify-content: space-around;
	}
	.zwds-grid > .p13 {
		padding: 20px;
		white-space: nowrap;
		overflow: hidden;
		text-wrap: auto;
		flex-direction: column;
		justify-content: flex-start;
	}
	.left {
		order: 2;
	}
	.right {
		border-bottom: 1px solid #c7c7c7;
	}
	.left, .right {
		width: 100%;
		text-align: center;
	}
}