.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #475569; }

:root {
	--bg-main: #020617;
	--bg-sidebar: #0f172a;
	--bg-panel: #1e293b;
	--bg-card: #0f172a;
	--border-light: #334155;
	--border-dark: #1e293b;

	--text-main: #f1f5f9;
	--text-muted: #94a3b8;

	--accent-green: #10b981;
	--accent-green-dark: #065f46;
	--accent-gold: #fbbf24;
	--accent-gold-dark: #78350f;
	--accent-red: #f43f5e;
	--accent-blue: #60a5fa;
	--accent-purple: #c084fc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background-color: var(--bg-main); color: var(--text-main); min-height: 100vh; overflow: hidden; }
#gameScreen { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* Layout */
.text-green { color: var(--accent-green) !important; }
.sidebar { width: 260px; background-color: var(--bg-sidebar); border-right: 1px solid var(--border-light); display: flex; flex-direction: column; z-index: 10;}
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative;}
.header { background-color: var(--bg-sidebar); border-bottom: 1px solid var(--border-light); padding: 15px 24px; display: flex; justify-content: space-between; align-items: center; }
.main-layout { flex: 1; min-height: 0; display: flex; }
.content-area { flex: 1; min-width: 0; overflow-y: auto; padding: 24px; }
#mobile-menu-btn { display: none; }
.mobile-nav-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(2, 6, 23, 0.58);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 20;
}
.materials-sidebar {
	width: 250px;
	border-left: 1px solid var(--border-light);
	background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.96));
	padding: 18px 14px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.materials-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.materials-sidebar-title {
	font-size: 0.74rem;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #cbd5e1;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}
.materials-toggle-btn {
	display: none;
	border: 1px solid rgba(71, 85, 105, 0.8);
	background: rgba(15, 23, 42, 0.75);
	color: #cbd5e1;
	border-radius: 8px;
	padding: 5px 7px;
	line-height: 1;
	cursor: pointer;
}
.materials-sidebar-body {
	display: contents;
}
.material-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 10px;
	border: 1px solid rgba(71, 85, 105, 0.55);
	border-radius: 10px;
	background: rgba(15, 23, 42, 0.55);
}
.material-label {
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #cbd5e1;
}
.material-label-wood { color: #fde68a; }
.material-label-stone { color: #e2e8f0; }
.material-label-metal { color: #d4d4d8; }
.material-label-hemp { color: #a7f3d0; }
.material-label-food { color: #d9f99d; }
.material-label-water { color: #bfdbfe; }
.material-value {
	font-family: monospace;
	font-size: 1rem;
	font-weight: 800;
	color: #f8fafc;
}

/* Typography & Utilities */
h1, h2, h3 { color: #fff; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; } .mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.icon-sm { width: 14px; height: 14px; }

/* Sidebar Nav */
.brand { padding: 24px; font-size: 1.25rem; font-weight: 900; letter-spacing: 1px; display: flex; align-items: center; gap: 12px; }
.brand-icon { background: linear-gradient(135deg, var(--accent-green), #047857); padding: 8px; border-radius: 8px; color: #000; }
.nav-links { flex: 1; padding: 0 16px; overflow-y: auto; list-style: none; }
.nav-item { padding: 12px 16px; margin-bottom: 4px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; transition: all 0.2s; }
.nav-item:hover { background-color: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background-color: var(--bg-panel); color: var(--accent-green); border: 1px solid var(--border-light); }

/* Header Stats */
.ap-bar-container { flex: 1; max-width: 400px; margin: 0 32px; }
.ap-bar-labels { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; margin-bottom: 6px; color: var(--text-muted); }
.ap-bar-track { height: 10px; background-color: var(--bg-main); border-radius: 10px; border: 1px solid var(--border-light); overflow: hidden; }
.ap-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-green-dark), var(--accent-green)); transition: width 0.3s ease; }

.stat-ribbon { background-color: var(--bg-main); border-bottom: 1px solid var(--border-light); padding: 10px 24px; display: flex; gap: 16px; overflow-x: auto; }
.stat-badge { background-color: rgba(30, 41, 59, 0.5); border: 1px solid rgba(51, 65, 85, 0.5); border-radius: 8px; padding: 8px 16px; display: flex; flex-direction: column; align-items: center; min-width: 100px;}
.stat-badge-title { font-size: 0.7rem; font-weight: bold; text-transform: uppercase; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.stat-badge-value { font-family: monospace; font-size: 1.1rem; font-weight: bold; color: #fff; }
.stat-badge-season {
	position: relative;
	overflow: hidden;
	min-width: 210px;
	align-items: flex-start;
	padding: 10px 14px;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(250, 204, 21, 0.24), rgba(250, 204, 21, 0) 55%),
		linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
	border-color: rgba(250, 204, 21, 0.38);
	box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.15), 0 10px 22px rgba(0, 0, 0, 0.35);
}
.stat-badge-season::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, rgba(255, 255, 255, 0), rgba(250, 204, 21, 0.24), rgba(255, 255, 255, 0));
	transform: translateX(-120%) skewX(-20deg);
	animation: seasonShimmer 4.4s ease-in-out infinite;
	pointer-events: none;
}
.season-badge-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	gap: 10px;
	position: relative;
	z-index: 1;
}
.season-pill {
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border: 1px solid rgba(148, 163, 184, 0.6);
	color: #e2e8f0;
	background: rgba(15, 23, 42, 0.65);
}
.season-pill.active {
	color: #052e16;
	background: linear-gradient(120deg, #4ade80, #86efac);
	border-color: rgba(34, 197, 94, 0.75);
}
.season-pill.paused {
	color: #78350f;
	background: linear-gradient(120deg, #f59e0b, #facc15);
	border-color: rgba(245, 158, 11, 0.75);
}
.season-pill.archived {
	color: #fecdd3;
	background: linear-gradient(120deg, #9f1239, #e11d48);
	border-color: rgba(244, 63, 94, 0.75);
}
.season-badge-number {
	margin-top: 4px;
	font-size: 1.12rem;
	font-weight: 900;
	letter-spacing: 0.04em;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	color: #fde68a;
	text-shadow: 0 0 14px rgba(250, 204, 21, 0.22);
	position: relative;
	z-index: 1;
}
.season-badge-main {
	margin-top: 4px;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	position: relative;
	z-index: 1;
}
.season-countdown {
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #f8fafc;
	text-align: right;
	white-space: nowrap;
}

@keyframes seasonShimmer {
	0%, 60% {
		transform: translateX(-120%) skewX(-20deg);
		opacity: 0;
	}
	75% {
		opacity: 0.85;
	}
	100% {
		transform: translateX(160%) skewX(-20deg);
		opacity: 0;
	}
}

/* Tabs & Sub-tabs */
.sub-tabs { display: inline-flex; background-color: rgba(30, 41, 59, 0.5); padding: 4px; border-radius: 10px; border: 1px solid var(--border-light); margin-bottom: 24px; }
.sub-tab { padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: bold; color: var(--text-muted); border: none; background: transparent; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.sub-tab:hover { color: #fff; }
.sub-tab.active { background-color: var(--bg-panel); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background-color: var(--bg-sidebar); border: 1px solid var(--border-light); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; transition: border-color 0.2s; }
.card:hover { border-color: #64748b; }
.card-header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.card-icon { background-color: var(--border-light); padding: 8px; border-radius: 8px; color: #cbd5e1; }
.card:hover .card-icon { color: var(--accent-green); }
.card-header h3 { font-size: 1rem; margin-bottom: 4px; }

.card-costs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; margin-bottom: 16px; }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-family: monospace; display: inline-flex; align-items: center; border: 1px solid transparent; }
.badge-ap { background-color: rgba(6, 95, 70, 0.3); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.3); }
.badge-gold { background-color: rgba(120, 53, 15, 0.3); color: var(--accent-gold); border-color: rgba(251, 191, 36, 0.3); }
.badge-outline { background-color: var(--border-light); color: #cbd5e1; border-color: #475569; }

/* Buttons */
.btn { padding: 10px 16px; border-radius: 8px; font-weight: bold; font-size: 0.85rem; cursor: pointer; border: none; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-primary { background-color: var(--border-light); color: #fff; }
.btn-primary:hover:not(:disabled) { background-color: #475569; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-success { background-color: var(--accent-green-dark); color: #fff; box-shadow: 0 0 10px rgba(16, 185, 129, 0.2); }
.btn-success:hover:not(:disabled) { background-color: var(--accent-green); }

/* Dashboard Specifics */
.dash-hero { background: linear-gradient(135deg, var(--bg-sidebar), #0f172a); border: 1px solid var(--border-light); border-radius: 16px; padding: 24px; position: relative; }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (max-width: 1024px) {
	.main-layout { flex-direction: column; }
	.materials-sidebar {
		width: 100%;
		border-left: none;
		border-top: 1px solid var(--border-light);
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		padding: 12px;
	}
	.materials-sidebar-title {
		grid-column: 1 / -1;
		margin-bottom: 2px;
	}
}
@media (max-width: 768px) {
	#mobile-menu-btn { display: inline-flex; }
	.sub-tabs {
		width: 100%;
		padding: 3px;
		gap: 2px;
		margin-bottom: 12px;
		overflow-x: auto;
		white-space: nowrap;
	}
	.sub-tab {
		padding: 6px 8px;
		font-size: 0.72rem;
		gap: 4px;
		line-height: 1.1;
		white-space: nowrap;
	}
	.sub-tab .icon-sm {
		width: 12px;
		height: 12px;
	}
	#alliance-tabs .sub-tab {
		padding: 5px 7px;
		font-size: 0.68rem;
	}
	.sidebar {
		display: flex;
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 260px;
		transform: translateX(-105%);
		transition: transform 0.2s ease;
		z-index: 30;
		box-shadow: 16px 0 28px rgba(0, 0, 0, 0.45);
	}
	#gameScreen.mobile-nav-open .sidebar {
		transform: translateX(0);
	}
	#gameScreen.mobile-nav-open .mobile-nav-backdrop {
		opacity: 1;
		pointer-events: auto;
	}
	.materials-sidebar {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 6px;
		padding: 8px;
	}
	.materials-toggle-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	#gameScreen.materials-collapsed .materials-sidebar-body {
		display: none;
	}
	#gameScreen.materials-collapsed .materials-toggle-btn i {
		transform: rotate(180deg);
	}
	.materials-sidebar-title {
		font-size: 0.68rem;
		margin-bottom: 0;
	}
	.material-row {
		padding: 8px 6px;
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	.material-label {
		font-size: 0.66rem;
	}
	.material-value {
		font-size: 0.9rem;
	}
}
.check-item { background: rgba(30, 41, 59, 0.8); border: 1px solid var(--border-light); padding: 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.check-item.done { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.08); }
.daily-checklist-progress-text { margin-top: 8px; }
.daily-checklist-gold-banner {
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid rgba(251, 191, 36, 0.45);
	background: linear-gradient(110deg, rgba(120, 53, 15, 0.38), rgba(251, 191, 36, 0.24), rgba(120, 53, 15, 0.38));
	box-shadow: inset 0 0 0 1px rgba(253, 224, 71, 0.15), 0 0 16px rgba(251, 191, 36, 0.12);
}
.daily-checklist-gold-banner::after {
	content: '';
	position: absolute;
	top: 0;
	left: -40%;
	width: 28%;
	height: 100%;
	background: linear-gradient(120deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
	transform: skewX(-18deg);
	animation: checklistGoldShimmer 2.8s linear infinite;
}
.daily-checklist-gold-banner-icon {
	width: 30px;
	height: 30px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fde68a;
	background: rgba(120, 53, 15, 0.5);
	border: 1px solid rgba(251, 191, 36, 0.4);
	flex-shrink: 0;
}
.daily-checklist-gold-banner-title {
	color: #fef3c7;
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}
.daily-checklist-gold-banner-text {
	color: #fde68a;
	font-size: 0.76rem;
	font-weight: 600;
}
@keyframes checklistGoldShimmer {
	0% { left: -40%; }
	100% { left: 120%; }
}

/* Toast Notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 8px; border: 1px solid; display: flex; align-items: center; gap: 8px; background-color: rgba(2, 6, 23, 0.95); font-size: 0.85rem; font-weight: bold; animation: slideIn 0.3s ease-out forwards; }
.toast.success { border-color: var(--accent-green-dark); color: var(--accent-green); }
.toast.error { border-color: var(--accent-gold-dark); color: var(--accent-red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Active War Banner */
.war-banner { background-color: rgba(159, 18, 57, 0.2); border: 1px solid rgba(225, 29, 72, 0.3); border-radius: 12px; padding: 16px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; }
