html, body {
	height: 100%;
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background-color: #f4f4f9;
	overflow-x: hidden;
}

.container {
	width: 100%;
	max-width: 1600px;
	height: 100vh;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
	box-sizing: border-box;
	overflow: hidden;
}

/* Header */
.app-header {
	padding: 15px 20px;
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
	flex-shrink: 0;
}

h1 {
	color: #0056b3;
	text-align: center;
	margin: 0 0 5px 0;
}

.subtitle {
	text-align: center;
	font-size: 14px;
	color: #6c757d;
	margin: 0 0 15px 0;
}

.subtitle .note { color: #0056b3; }

#locationForm {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
	justify-content: center;
	flex-wrap: wrap;
}

#locationInput {
	flex: 1;
	min-width: 250px;
	max-width: 400px;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 16px;
}

#submitBtn {
	padding: 10px 20px;
	border: none;
	background-color: #007bff;
	color: white;
	border-radius: 4px;
	font-size: 16px;
	cursor: pointer;
	transition: background-color 0.3s;
	white-space: nowrap;
}

#submitBtn:hover:not(:disabled) { background-color: #0056b3; }
#submitBtn:disabled, #locationInput:disabled {
	cursor: not-allowed;
	background-color: #6c757d;
}

#loader { display: none; text-align: center; margin: 10px; font-style: italic; }
#error { color: #d9534f; text-align: center; margin-bottom: 10px; }
#locationInfo { 
	width: 100%; 
	text-align: center; 
	padding: 10px; 
	background-color: #e9ecef; 
	border-radius: 4px; 
	margin-bottom: 15px; 
	box-sizing: border-box; 
	display: none; 
}

/* Main Layout */
.app-main {
	flex: 1;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.layout-container {
	flex: 1;
	display: grid;
	gap: 0;
	background: #e0e0e0;
	overflow: hidden;
	min-height: 0;
	position: relative;
}

/* Section Styling */
.map-section, .table-section, .timescale-section {
	background: #fff;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	border: 1px solid #e0e0e0;
	position: relative;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	background: #f8f9fa;
	border-bottom: 1px solid #dee2e6;
	user-select: none;
	flex-shrink: 0;
}

.section-header h3 {
	margin: 0;
	font-size: 14px;
	color: #495057;
	font-weight: 600;
}

.toggle-btn {
	background: none;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	width: 24px;
	height: 24px;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	color: #6c757d;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
}

.toggle-btn:hover {
	background: #e9ecef;
	color: #495057;
}

.section-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: all 0.3s ease;
	min-height: 0;
}

.section-content.collapsed {
	flex: 0 0 0;
	min-height: 0;
	max-height: 0;
	overflow: hidden;
}

/* Map Section */
.map-section .section-content {
	padding: 12px;
}

#map {
	flex: 1;
	min-height: 150px;
	border-radius: 4px;
	background-color: #a2d1f0;
}

.location-list-container {
	flex-shrink: 0;
	font-size: 13px;
	max-height: 80px;
	overflow-y: auto;
	margin-top: 8px;
	padding: 8px;
	background: #f8f9fa;
	border-radius: 4px;
}

.location-list-container ul { list-style: none; padding: 0; margin: 0; }
.location-list-container li { 
	display: flex; 
	justify-content: space-between; 
	align-items: center; 
	padding: 4px 0; 
	flex-wrap: wrap;
	gap: 8px;
}

.location-text { font-size: 13px; }
.location-coords { font-size: 11px; color: #6c757d; }

.delete-btn {
	background-color: #dc3545; 
	color: white; 
	border: none;
	border-radius: 4px; 
	padding: 2px 8px; 
	font-size: 12px; 
	cursor: pointer; 
	flex-shrink: 0;
}
.delete-btn:hover { background-color: #c82333; }

/* Table Section */
.table-section .section-content {
	padding: 12px;
	overflow: hidden;
}

#results { 
	flex: 1; 
	overflow: auto; 
	min-height: 0;
}

table.dataTable thead th { white-space: nowrap; }
tr.today-row { background-color: #dff0d8 !important; font-weight: bold; }
table.dataTable tbody td { cursor: pointer; }

/* Time Scale Section */
.timescale-section .section-content {
	padding: 12px;
	overflow: hidden;
}

.ts-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
	user-select: none;
	flex-shrink: 0;
}

#time-scale-caption { 
	font-size: 13px; 
	color: #334155; 
	font-weight: 600; 
}

.ts-chart {
	flex: 1;
	min-height: 100px;
	overflow: hidden;
}

/* Resize Handles */
.resize-handle {
	position: absolute;
	background: #ccc;
	transition: background-color 0.2s;
	z-index: 100;
}

.resize-handle:hover {
	background: #999;
}

.resize-handle.resizing {
	background: #666;
}

.resize-handle-horizontal {
	height: 4px;
	cursor: row-resize;
	left: 0;
	right: 0;
	bottom: -2px;
}

.resize-handle-vertical {
	width: 4px;
	cursor: col-resize;
	top: 0;
	bottom: 0;
	right: -2px;
}

/* Responsive Grid Layouts */
@media (min-width: 1200px) {
	.layout-container {
		grid-template-columns: var(--col1-width, 1fr) var(--col2-width, 1fr);
		grid-template-rows: var(--row1-height, 1fr) var(--row2-height, 300px);
		grid-template-areas: 
			"map table"
			"timescale timescale";
	}
	
	.map-section { 
		grid-area: map; 
	}
	
	.table-section { 
		grid-area: table;
	}
	
	.timescale-section { 
		grid-area: timescale;
	}
	
	/* Show resize handles for desktop */
	.map-section .resize-handle-vertical,
	.map-section .resize-handle-horizontal,
	.table-section .resize-handle-horizontal {
		display: block;
	}
}

@media (min-width: 768px) and (max-width: 1199px) {
	.layout-container {
		grid-template-columns: 1fr;
		grid-template-rows: var(--row1-height, 1fr) var(--row2-height, 1fr) var(--row3-height, 250px);
	}
	
	.app-header {
		padding: 12px 15px;
	}
	
	/* Show horizontal resize handles for tablet */
	.map-section .resize-handle-horizontal,
	.table-section .resize-handle-horizontal {
		display: block;
	}
}

@media (max-width: 767px) {
	.app-header {
		padding: 10px 12px;
	}
	
	.layout-container {
		grid-template-columns: 1fr;
		grid-template-rows: var(--row1-height, 1fr) var(--row2-height, 1fr) var(--row3-height, 200px);
	}
	
	.section-header {
		padding: 6px 10px;
	}
	
	.section-header h3 {
		font-size: 13px;
	}
	
	.map-section .section-content,
	.table-section .section-content,
	.timescale-section .section-content {
		padding: 8px;
	}
	
	#locationForm {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}
	
	#locationInput, #submitBtn {
		width: 100%;
		box-sizing: border-box;
	}
	
	.location-list-container {
		max-height: 60px;
		font-size: 12px;
	}
	
	.location-list-container li {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	
	.ts-chart {
		min-height: 80px;
	}
	
	/* Show horizontal resize handles for mobile */
	.map-section .resize-handle-horizontal,
	.table-section .resize-handle-horizontal {
		display: block;
	}
}

/* Hide resize handles by default */
.resize-handle {
	display: none;
}

/* Footer */
.app-footer {
	padding: 15px;
	background: #f8f9fa;
	border-top: 1px solid #e0e0e0;
	flex-shrink: 0;
}

/* ...existing styles for overlays, icons, etc... */
.ranked-map-icon {
	background: rgba(255, 255, 255, 0.9);
	border: 2px solid #003d7a;
	border-radius: 5px;
	padding: 2px 5px;
	box-shadow: 0 2px 5px rgba(0,0,0,0.3);
	display: flex;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
}

.rank-number {
	font-weight: bold;
	color: white;
	background-color: #003d7a;
	border-radius: 50%;
	width: 20px;
	height: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-shrink: 0;
}

.rank-text { font-size: 12px; color: #333; }

#sun-path-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	z-index: 10000;
	justify-content: center;
	align-items: center;
}

#sun-path-container {
	background: white;
	padding: 20px;
	border-radius: 8px;
	width: 90%;
	max-width: 800px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 5px 15px rgba(0,0,0,0.5);
	position: relative;
}

#close-sun-path-btn {
	position: absolute;
	top: 10px;
	right: 15px;
	font-size: 24px;
	font-weight: bold;
	color: #888;
	background: none;
	border: none;
	cursor: pointer;
}

#sun-path-chart svg { width: 100%; border: 1px solid #ccc; }

#sun-path-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	margin-top: 10px;
	font-size: 12px;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-color-box { width: 15px; height: 15px; border: 1px solid #555; }

/* Time Scale Styling */
.ts-svg { width: 100%; height: 120px; }
.ts-axis { stroke: #475569; stroke-width: 1; }
.ts-tick { stroke: #64748b; stroke-width: .75; }
.ts-label { fill: #0f172a; font-size: 11px; }
.ts-band-day { fill: #86efac; opacity: .35; }
.ts-band-civil { fill: #fde68a; opacity: .35; }
.ts-band-nautical { fill: #bfdbfe; opacity: .35; }
.ts-band-astro { fill: #c4b5fd; opacity: .3; }
.ts-band-night { fill: #000000; opacity: .3; }
.ts-marker { stroke: #0f172a; stroke-width: 2; }
.ts-marker-jetzt { fill: #f97316; stroke: #f97316; }
.ts-legend { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ts-legend-item { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; color: #334155; }
.ts-legend-swatch { width: 12px; height: 12px; border: 1px solid #475569; }

