@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Silkscreen:wght@400;700&display=swap');

:root {
	--pixel-font: 'Press Start 2P', 'Silkscreen', monospace;
	--ui-font: 'Silkscreen', 'Press Start 2P', monospace;
	--bg-dark: #071911;
	--text-primary: #f0fdf4;
	--text-muted: #86efac;
	--text-gold: #fde047;
	--accent-pink: #f43f5e;
	--accent-cyan: #38bdf8;
	--accent-emerald: #10b981;
	--accent-lime: #a3e635;
	--accent-moss: #15803d;
	--leaf-green: #22c55e;
	--stone-bg: rgba(9, 28, 18, 0.78);
	--stone-border: rgba(74, 222, 128, 0.35);
	--stone-hover-bg: rgba(16, 52, 34, 0.92);
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	width: 100%;
	overflow: hidden;
	background-color: var(--bg-dark);
	font-family: var(--pixel-font);
	color: var(--text-primary);
	-webkit-font-smoothing: none;
	-moz-osx-font-smoothing: unset;
	text-rendering: optimizeSpeed;
	image-rendering: pixelated;
}

/* Background & interactive wildlife canvas */
#nature-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	display: block;
	pointer-events: auto;
}

/* Forest canopy light & dappled leaf shadow overlay */
.canopy-shadows {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
	background: 
		radial-gradient(circle at 20% 15%, rgba(254, 240, 138, 0.08) 0%, transparent 45%),
		radial-gradient(circle at 80% 85%, rgba(56, 189, 248, 0.06) 0%, transparent 40%),
		linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%);
	background-size: 100% 100%, 100% 100%, 100% 4px;
	opacity: 0.85;
}

/* Subtle organic vignette */
.vignette {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
	background: radial-gradient(circle at center, transparent 35%, rgba(2, 9, 6, 0.65) 100%);
}

/* Top-Down Forest Clearing Layout */
.app-viewport {
	position: relative;
	z-index: 10;
	height: 100%;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	pointer-events: none;
}

/* Top toolbar for sound and PGP */
.top-hud {
	position: fixed;
	top: 1rem;
	right: 1rem;
	display: flex;
	gap: 0.75rem;
	z-index: 25;
	pointer-events: auto;
}

.hud-btn {
	background: rgba(7, 24, 16, 0.85);
	border: 2px solid #22c55e;
	color: var(--text-gold);
	font-family: var(--ui-font);
	font-size: 0.65rem;
	padding: 0.5rem 0.8rem;
	cursor: pointer;
	box-shadow: 2px 2px 0px #020805, 0 0 8px rgba(34, 197, 94, 0.25);
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	text-decoration: none;
	transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
	user-select: none;
	border-radius: 4px;
}

.hud-btn:hover {
	background: rgba(14, 48, 30, 0.95);
	border-color: var(--text-gold);
	transform: translate(-1px, -1px);
	box-shadow: 3px 3px 0px #020805, 0 0 12px rgba(253, 224, 71, 0.4);
}

.hud-btn:active {
	transform: translate(1px, 1px);
	box-shadow: 1px 1px 0px #020805;
}

/* Living Forest Character Center Banner */
.clearing-hero {
	position: absolute;
	top: 48%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	pointer-events: auto;
	user-select: none;
	z-index: 15;
}

.avatar-nest {
	position: relative;
	margin-bottom: 0.85rem;
	display: inline-block;
}

.avatar-img {
	width: 82px;
	height: 82px;
	border-radius: 50%;
	display: block;
	border: 3px solid #22c55e;
	box-shadow: 
		0 0 0 3px #14532d,
		0 0 0 7px rgba(34, 197, 94, 0.4),
		0 0 16px rgba(34, 197, 94, 0.35),
		0 10px 24px rgba(0, 0, 0, 0.7);
	image-rendering: auto;
	cursor: pointer;
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.avatar-nest:hover .avatar-img {
	transform: scale(1.1) translateY(-2px);
	border-color: #86efac;
	box-shadow: 
		0 0 0 3px #22c55e,
		0 0 0 8px rgba(74, 222, 128, 0.5),
		0 0 24px rgba(74, 222, 128, 0.65),
		0 14px 30px rgba(0, 0, 0, 0.8);
}

.status-pip {
	position: absolute;
	bottom: 3px;
	right: 5px;
	background: #22c55e;
	border: 2px solid #031209;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	animation: pulsePip 2s infinite;
}

@keyframes pulsePip {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8);
	}
	50% {
		box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
	}
}

.character-title {
	font-size: 1.25rem;
	color: var(--text-gold);
	text-shadow: 
		2px 2px 0px #020804,
		-2px -2px 0px #020804,
		2px -2px 0px #020804,
		-2px 2px 0px #020804,
		0 4px 12px rgba(0, 0, 0, 0.9),
		0 0 16px rgba(253, 224, 71, 0.5);
	letter-spacing: 0.08em;
	margin-bottom: 0.35rem;
	line-height: 1.3;
	position: relative;
}

.character-class {
	font-family: var(--ui-font);
	font-size: 0.72rem;
	color: var(--text-muted);
	letter-spacing: 0.1em;
	text-shadow: 2px 2px 0px #020804, -1px -1px 0px #020804;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

/* Distributed Forest Landmarks across the Viewport */
.forest-map-nav {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.landmark-link {
	position: absolute;
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	padding: 0.6rem 0.85rem;
	text-decoration: none;
	pointer-events: auto;
	user-select: none;
	background: transparent;
	border: none;
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
	cursor: pointer;
	z-index: 15;
}

/* 5 Distinct Viewport Positions (Desktop Realm Map) */
.landmark-link.loc-nw {
	top: 14%;
	left: 8%;
}

.landmark-link.loc-ne {
	top: 14%;
	right: 8%;
}

.landmark-link.loc-sw {
	bottom: 16%;
	left: 8%;
}

.landmark-link.loc-se {
	bottom: 16%;
	right: 8%;
}

.landmark-link.loc-sc {
	bottom: 8%;
	left: 50%;
	transform: translateX(-50%);
}

.landmark-sparkle {
	color: #fde047;
	font-size: 1.15rem;
	line-height: 1;
	text-shadow: 0 0 10px #fde047, 2px 2px 0px #020905;
	margin-top: 3px;
	display: inline-block;
	animation: runeBob 2.4s infinite ease-in-out;
}

.loc-ne .landmark-sparkle { animation-delay: 0.5s; }
.loc-sw .landmark-sparkle { animation-delay: 1.0s; }
.loc-se .landmark-sparkle { animation-delay: 1.5s; }
.loc-sc .landmark-sparkle { animation-delay: 2.0s; }

@keyframes runeBob {
	0%, 100% { transform: translateY(0) scale(1); }
	50% { transform: translateY(-4px) scale(1.3) rotate(20deg); }
}

.landmark-body {
	display: flex;
	flex-direction: column;
	gap: 0.22rem;
}

.landmark-main {
	display: flex;
	align-items: center;
	gap: 0.55rem;
}

.landmark-icon {
	font-size: 1.25rem;
	filter: drop-shadow(2px 2px 0px #020905);
}

.landmark-title {
	font-family: var(--pixel-font);
	font-size: 0.95rem;
	font-weight: 700;
	color: #f0fdf4;
	letter-spacing: 0.06em;
	text-shadow: 
		2px 2px 0px #020905, 
		-2px -2px 0px #020905, 
		2px -2px 0px #020905, 
		-2px 2px 0px #020905, 
		0 4px 12px rgba(0, 0, 0, 0.95);
	transition: color 0.15s ease, text-shadow 0.15s ease;
}

.landmark-hotkey {
	font-family: var(--ui-font);
	font-size: 0.72rem;
	color: #86efac;
	text-shadow: 2px 2px 0px #020905, -1px -1px 0px #020905;
	opacity: 0.8;
	letter-spacing: 0.05em;
	transition: color 0.15s ease, opacity 0.15s ease;
}

.landmark-tag {
	font-family: var(--ui-font);
	font-size: 0.62rem;
	color: #bbf7d0;
	text-shadow: 2px 2px 0px #020905, -1px -1px 0px #020905;
	opacity: 0.85;
	letter-spacing: 0.05em;
	transition: color 0.15s ease, opacity 0.15s ease;
}

/* Interactive Hover & Focus: Floats & Radiant Golden Glow */
.landmark-link:hover,
.landmark-link:focus-visible {
	outline: none;
	transform: translateY(-6px) scale(1.08);
}

.landmark-link.loc-sc:hover,
.landmark-link.loc-sc:focus-visible {
	transform: translateX(-50%) translateY(-6px) scale(1.08);
}

.landmark-link:hover .landmark-title,
.landmark-link:focus-visible .landmark-title {
	color: var(--text-gold);
	text-shadow: 
		2px 2px 0px #020905, 
		-2px -2px 0px #020905, 
		2px -2px 0px #020905, 
		-2px 2px 0px #020905, 
		0 0 18px rgba(253, 224, 71, 0.8);
}

.landmark-link:hover .landmark-hotkey,
.landmark-link:focus-visible .landmark-hotkey {
	color: #fde047;
	opacity: 1;
}

.landmark-link:hover .landmark-tag {
	color: #ffffff;
	opacity: 1;
}

.landmark-link:hover .landmark-sparkle {
	transform: scale(1.4) rotate(45deg);
	color: #ffffff;
	text-shadow: 0 0 12px #fde047, 0 0 20px #86efac;
}

.landmark-link:active {
	transform: translateY(-2px) scale(1.02);
}

.landmark-link.loc-sc:active {
	transform: translateX(-50%) translateY(-2px) scale(1.02);
}

/* PGP Ancient Scroll / Stone Modal */
.pgp-dialog {
	border: 3px solid #facc15;
	background: #071c13;
	color: #f0fdf4;
	padding: 1.5rem;
	max-width: 580px;
	width: 90%;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 100;
	box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.75), 8px 8px 0px #020705, 0 0 24px rgba(34, 197, 94, 0.3);
	font-family: var(--ui-font);
	border-radius: 6px;
}

.pgp-dialog::backdrop {
	background: rgba(0, 0, 0, 0.75);
}

.pgp-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	border-bottom: 2px dashed #22c55e;
	padding-bottom: 0.6rem;
}

.pgp-title {
	font-size: 0.85rem;
	color: var(--text-gold);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.close-btn {
	background: none;
	border: none;
	color: var(--accent-pink);
	font-family: var(--pixel-font);
	font-size: 1.1rem;
	cursor: pointer;
	padding: 0 0.5rem;
}

.close-btn:hover {
	color: #fff;
}

.pgp-content {
	background: #020b07;
	border: 1px solid #166534;
	padding: 0.85rem;
	max-height: 220px;
	overflow-y: auto;
	font-family: 'Courier New', monospace;
	font-size: 0.65rem;
	line-height: 1.45;
	color: #86efac;
	white-space: pre;
	margin-bottom: 1.25rem;
	user-select: all;
	border-radius: 4px;
}

.pgp-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: flex-end;
}

.copy-toast {
	position: fixed;
	bottom: 2rem;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: #22c55e;
	color: #04120a;
	padding: 0.6rem 1.2rem;
	font-size: 0.72rem;
	font-family: var(--ui-font);
	font-weight: bold;
	border: 2px solid #fff;
	box-shadow: 3px 3px 0px #000;
	border-radius: 4px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 200;
}

.copy-toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* Mobile & Tablet responsiveness for the Living Forest Realm */
@media (max-width: 820px) {
	.app-viewport {
		overflow-y: auto;
		pointer-events: auto;
		-webkit-overflow-scrolling: touch;
	}

	.clearing-hero {
		position: relative;
		top: auto;
		left: auto;
		transform: none;
		margin: 3.8rem auto 1.25rem;
	}

	.forest-map-nav {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.85rem;
		width: 100%;
		padding-bottom: 3.5rem;
	}

	.landmark-link {
		position: relative !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		bottom: auto !important;
		transform: none !important;
		width: 88%;
		max-width: 340px;
	}

	.landmark-link:hover,
	.landmark-link:focus-visible {
		transform: translateY(-3px) scale(1.04) !important;
	}

	.avatar-img {
		width: 68px;
		height: 68px;
	}

	.character-title {
		font-size: 1.05rem;
	}

	.character-class {
		font-size: 0.65rem;
	}

	.landmark-title {
		font-size: 0.85rem;
	}

	.top-hud {
		top: 0.6rem;
		right: 0.6rem;
	}

	.hud-btn {
		font-size: 0.58rem;
		padding: 0.4rem 0.65rem;
	}
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.status-pip,
	.landmark-sparkle,
	.avatar-nest::before,
	.avatar-nest::after {
		animation: none !important;
	}
}

