@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

/* Loading Screen Styles */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #97dbf3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingScreen p {
    color: white;
    font-size: 24px;
    font-weight: 500;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

html {
    box-sizing: border-box;
    font-family: "Barlow Condensed", sans-serif;
	overflow: hidden;
}
*, *:before, *:after {
    box-sizing: inherit;
}
html, body {
    height: 100%;
}
body {
    background: #97dbf3;
    color: #d3ddef;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
#playBtn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #222;
    color: #fff;
    cursor: pointer;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}
#playBtn:hover { background-color: #444; }
#playBtn:active { background-color: #000; }
.range input{
    appearance: none;
	-webkit-appearance:none;
	width:50vw;
	height:15px;
	border-radius:5px;
	background-color:#4e4e4e4b;
	outline:none;
}
.range input::-webkit-slider-thumb{
	-webkit-appearance:none;
	width:25px;
	height:25px;
	border-radius:50%;
	background-color:white;
}
.range span{
	position:relative;
	margin-left:14px;
	width:50px;
	height:30px;
	background-color:#222;
	color:#fff;
	border-radius:3px;
	text-align:center;
	line-height:30px;
	flex-shrink:0;
}
.range span:before{
	content:'';
	position:absolute;
	border-right:9px solid transparent;
	border-left:9px solid transparent;
	border-bottom:12px solid #222;
	left:-10px;
	top:50%;
	transform:translateY(-50%) rotate(-90deg);
}
#svgContainer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
}
#svgContainer.grabbing {
    cursor: grabbing;
}
svg {
    position: absolute; 
    height: 100vh;
    width: 100%;
}
svg path {
	transition: filter 0.2s ease;
	cursor: pointer;
}
svg path.highlighted {
	filter: brightness(85%);
}
#data {
	display: none;
	font-weight: bold;
	color: white;
	position: absolute;
	text-align: left;
	background-color: rgba(0, 0, 0, 0.692);
	border: 1px solid white;
	padding: 1vh;
}
#rank {
	position: absolute;
	top: 3vh;
	right: 3vh;
	font-weight: bold;
	text-align: left;
	background-color: rgba(0, 0, 0, 0.692);
	border: 1px solid white;
	padding: 1vh;
	color: white;
	min-width: 175px;
}
#year {
	position: absolute;
	top: 3vh;
	right: 30vh;
	text-align: center;
	color: black;
	font-weight: bold;
	font-size: 50px;
}
#menu {
	position: absolute;
	top: 3vh;
	left: 3vh;
	display: flex;
	flex-direction: column;
	background-color: rgba(0, 0, 0, 0.692);
	border: 1px solid white;
}
.fas {
	padding: 1vh;
	color: white;
	cursor: pointer;
	font-size: 25px;
}
.fas:hover{
	filter: brightness(85%);
}
#info{
	position: absolute;
	top: 3vh;
	left: 12vh;
	background-color: rgba(0, 0, 0, 0.692);
	border: 1px solid white;
	padding: 1vh;
	padding-right: 28px;
	font-weight: bold;
	font-size: 15px;
	color: white;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	max-width: 360px;
	transition: opacity 0.35s ease, transform 0.35s ease;
}
#info.info-hidden {
	opacity: 0;
	transform: translateY(-6px);
	pointer-events: none;
}
#info-close {
	position: absolute;
	top: 2px;
	right: 6px;
	background: transparent;
	border: none;
	color: white;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
	opacity: 0.8;
}
#info-close:hover { opacity: 1; }
#info-hint {
	margin-top: 8px;
	font-size: 11px;
	font-weight: normal;
	font-style: italic;
	opacity: 0.75;
}
#info-hint .fas { font-size: 11px; cursor: default; }

/* Leaderboard */
#rank { max-height: 90vh; overflow-y: auto; }
#rank .rank-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
#rank .rank-tab {
    flex: 1; background: rgba(255,255,255,0.08); color: #fff;
    border: 1px solid rgba(255,255,255,0.4); padding: 3px 6px;
    font: inherit; font-size: 13px; cursor: pointer; border-radius: 2px;
}
#rank .rank-tab.active { background: #fff; color: #000; }
#rank .rank-list { list-style: none; padding: 0; margin: 0 0 4px 0; }
#rank .rank-list li {
    display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 13px;
}
#rank .rank-num { min-width: 22px; text-align: right; }
#rank .rank-name { flex: 1; }
#rank .rank-key {
    display: inline-block; width: 12px; height: 12px;
    border: 1px solid rgba(255,255,255,0.6); flex-shrink: 0;
}
#rank .rank-expand {
    width: 100%; background: transparent; color: #fff;
    border: 1px solid rgba(255,255,255,0.4); padding: 3px;
    font: inherit; font-size: 12px; cursor: pointer; margin-top: 4px; border-radius: 2px;
}
#rank .rank-expand:hover { background: rgba(255,255,255,0.1); }
#rank .rank-extras { margin-top: 4px; border-top: 1px dashed rgba(255,255,255,0.3); padding-top: 4px; }

/* Country detail sidebar (left side) */
#country-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    max-width: 70vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border-right: 1px solid rgba(255,255,255,0.2);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1000;
    overflow-y: auto;
    padding: 10px 14px 18px 14px;
    font-family: "Barlow Condensed", sans-serif;
}
#country-sidebar.open { transform: translateX(0); }

#sidebar-back {
    appearance: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    margin-bottom: 4px;
    border-radius: 4px;
}
#sidebar-back:hover { background: rgba(255,255,255,0.1); }

#sidebar-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.15;
}
#sidebar-flag {
    display: block;
    width: 100%;
    max-height: 110px;
    object-fit: contain;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    margin-bottom: 10px;
}
.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    font-size: 13px;
}
.sidebar-stat .stat-label {
    color: #b8c4d6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-stat .stat-value {
    font-weight: 700;
    font-size: 14px;
    text-align: right;
}
#sidebar-description {
    margin-top: 12px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #e6eaf2;
}
#sidebar-description p { margin: 0 0 10px 0; }
#sidebar-britannica {
    display: inline-block;
    margin-top: 8px;
    color: aqua;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
}
#sidebar-britannica:hover { text-decoration: underline; }
