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

body {
	background: #1a1a2e;
	color: #e0e0e0;
	font-family: 'Courier New', monospace;
	overflow: hidden;
}

#gameCanvas {
	display: block;
	image-rendering: pixelated;
	cursor: crosshair;
}

#ui {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

#topbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: rgba(10, 10, 20, 0.9);
	border-bottom: 1px solid #333;
	padding: 6px 12px;
	display: flex;
	gap: 16px;
	align-items: center;
	pointer-events: all;
	z-index: 100;
	min-height: 52px;
}

#game-brand {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-right: 12px;
	min-width: 140px;
}

#game-title {
	font-size: 16px;
	font-weight: 700;
	color: #f1f3f5;
	letter-spacing: 0.04em;
}

#game-subtitle {
	font-size: 10px;
	color: #7fdbff;
	text-transform: uppercase;
	letter-spacing: 0.14em;
}

.stat-pill {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
}

.stat-val {
	font-weight: bold;
	color: #7fdbff;
}

#day-counter {
	font-size: 14px;
	font-weight: bold;
	color: #ffd700;
	margin-right: auto;
}

#camp-level {
	font-size: 10px;
	color: #9bd3ff;
	margin-right: 8px;
}

#speed-btns {
	display: flex;
	gap: 4px;
}

.spd-btn {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid #444;
	color: #ccc;
	padding: 2px 8px;
	font-size: 10px;
	cursor: pointer;
	border-radius: 3px;
}

.spd-btn.active {
	background: #7fdbff;
	color: #000;
}

.topbar-btn {
	background: rgba(255, 200, 0, 0.15);
	border: 1px solid #6b5b2b;
	color: #ffd700;
	padding: 4px 10px;
	font-size: 10px;
	cursor: pointer;
	border-radius: 4px;
}

.topbar-btn.active {
	background: rgba(255, 200, 0, 0.35);
	color: #fff2a8;
}

#sidebar {
	position: fixed;
	right: 0;
	top: 52px;
	bottom: 0;
	width: 260px;
	background: rgba(10, 10, 20, 0.95);
	border-left: 1px solid #333;
	overflow-y: auto;
	pointer-events: all;
	z-index: 90;
}

#build-panel {
	position: fixed;
	top: 64px;
	left: 12px;
	background: rgba(10, 10, 20, 0.96);
	border: 1px solid #333;
	padding: 10px;
	border-radius: 6px;
	width: 300px;
	max-height: 80vh;
	overflow-y: auto;
	display: none;
	z-index: 120;
}

#sidebar-header {
	padding: 8px 12px;
	border-bottom: 1px solid #333;
	font-size: 12px;
	color: #888;
	display: flex;
	justify-content: space-between;
}

#sidebar-task-panel {
	padding: 8px 12px;
	border-bottom: 1px solid #222;
	background: rgba(127, 219, 255, 0.03);
}

#sidebar-task-header {
	font-size: 10px;
	color: #7fdbff;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 6px;
}

#sidebar-task-list {
	display: flex;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	font-size: 11px;
	color: #b5c8d6;
}

#build-list,
#build-locked-list {
	display: flex;
	flex-direction: column;
	gap: 6px;

	flex-direction: column;
	gap: 4px;
}

.sidebar-task-item {
	font-size: 10px;
	color: #bcc6d1;
	padding: 4px 6px;
	border: 1px solid #2a3240;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.02);
}

.person-card {
	padding: 8px 12px;
	border-bottom: 1px solid #1e1e2e;
	cursor: pointer;
	transition: background 0.1s;
}

.person-card:hover,
.person-card.selected {
	background: rgba(127, 219, 255, 0.08);
}

.person-card.dead {
	opacity: 0.4;
}

.person-name {
	font-size: 11px;
	font-weight: bold;
	color: #e0e0e0;
}

.person-skill {
	font-size: 10px;
	color: #7fdbff;
}

.needs-bar {
	display: flex;
	gap: 3px;
	margin-top: 4px;
}

.need {
	flex: 1;
	height: 4px;
	border-radius: 2px;
	background: #222;
	position: relative;
}

.need-fill {
	height: 100%;
	border-radius: 2px;
	transition: width 0.3s;
}

#detail-panel {
	position: fixed;
	left: 0;
	top: 52px;
	bottom: 0;
	width: 240px;
	background: rgba(10, 10, 20, 0.95);
	border-right: 1px solid #333;
	pointer-events: all;
	z-index: 90;
	transform: translateX(-100%);
	transition: transform 0.2s;
}

#detail-panel.open {
	transform: translateX(0);
}

#detail-content {
	padding: 12px;
}

.detail-name {
	font-size: 14px;
	font-weight: bold;
	margin-bottom: 8px;
}

.stat-row {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	margin: 3px 0;
}

.stat-label {
	color: #888;
}

.stat-num {
	color: #7fdbff;
	font-weight: bold;
}

.need-row {
	margin: 4px 0;
}

.need-label {
	font-size: 10px;
	color: #888;
	display: flex;
	justify-content: space-between;
}

.need-track {
	height: 6px;
	background: #222;
	border-radius: 3px;
	margin-top: 2px;
}

.need-fill-d {
	height: 100%;
	border-radius: 3px;
}

.action-btn {
	width: 100%;
	background: rgba(127, 219, 255, 0.1);
	border: 1px solid #7fdbff44;
	color: #7fdbff;
	padding: 6px;
	font-size: 11px;
	cursor: pointer;
	border-radius: 4px;
	margin-top: 6px;
	font-family: 'Courier New', monospace;
}

.action-btn:hover {
	background: rgba(127, 219, 255, 0.2);
}

.relation-row {
	font-size: 10px;
	color: #aaa;
	padding: 2px 0;
}

#log {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 260px;
	height: 80px;
	background: rgba(10, 10, 20, 0.9);
	border-top: 1px solid #333;
	padding: 6px 10px;
	overflow-y: auto;
	pointer-events: all;
	z-index: 90;
}

.log-entry {
	font-size: 10px;
	color: #aaa;
	margin: 1px 0;
}

.log-entry.warn {
	color: #ffd700;
}

.log-entry.danger {
	color: #ff6b6b;
}

.log-entry.good {
	color: #51cf66;
}

#assign-modal {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #0d0d1a;
	border: 1px solid #7fdbff44;
	border-radius: 8px;
	padding: 16px;
	width: 320px;
	z-index: 200;
	pointer-events: all;
}

#inventory-modal {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #0d0d1a;
	border: 1px solid #7fdbff44;
	border-radius: 8px;
	padding: 16px;
	width: 460px;
	max-height: 70vh;
	overflow-y: auto;
	z-index: 210;
	pointer-events: all;
}

.inventory-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.inventory-col {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid #2a3240;
	border-radius: 6px;
	padding: 10px;
}

.inventory-title {
	font-size: 11px;
	color: #7fdbff;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 8px;
}

.inventory-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 11px;
	padding: 4px 6px;
	border: 1px solid #2a3240;
	border-radius: 4px;
	margin-bottom: 6px;
	background: rgba(255, 255, 255, 0.02);
}

.inventory-empty {
	font-size: 10px;
	color: #555;
}

.inv-btn {
	background: rgba(127, 219, 255, 0.12);
	border: 1px solid #7fdbff55;
	color: #7fdbff;
	padding: 2px 6px;
	font-size: 10px;
	cursor: pointer;
	border-radius: 4px;
}

.inv-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.craft-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.craft-item {
	font-size: 10px;
	color: #bcc6d1;
	padding: 6px;
	border: 1px solid #2a3240;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.02);
}

.craft-item.locked {
	opacity: 0.5;
}

#map-task-modal {
	display: none;
	position: fixed;
	background: #0d0d1a;
	border: 1px solid #7fdbff44;
	border-radius: 8px;
	padding: 16px;
	width: 340px;
	max-height: 70vh;
	overflow-y: auto;
	z-index: 205;
	pointer-events: all;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

#modal-bg {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 199;
	pointer-events: all;
}

.event-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 240;
	pointer-events: all;
}

.event-popup {
	width: 720px;
	max-width: 92vw;
	background: linear-gradient(180deg, #3a2c1f, #241912);
	border: 3px solid #b08a4a;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
	border-radius: 10px;
	overflow: hidden;
	color: #f2e7c9;
	font-family: Georgia, serif;
	position: relative;
}

.event-popup.major {
	width: 820px;
	border-width: 4px;
	box-shadow: 0 28px 60px rgba(0, 0, 0, 0.65);
}

.event-close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: none;
	color: #cdbb93;
	font-size: 18px;
	cursor: pointer;
}

.event-header {
	padding: 18px 24px;
	background: linear-gradient(180deg, #5a4528, #3d2d1c);
	border-bottom: 2px solid #b08a4a;
	font-size: 28px;
	font-weight: bold;
	text-align: center;
	color: #f8e7b0;
	letter-spacing: 0.5px;
}

.event-body {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	padding: 18px 22px;
}

.event-illustration {
	height: 220px;
	border: 2px solid #7f6130;
	background: radial-gradient(circle at 30% 20%, rgba(255, 230, 170, 0.18), rgba(20, 12, 8, 0.6)),
		linear-gradient(180deg, #3f3020, #1b120d);
	box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.event-illustration.has-image {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.event-text {
	line-height: 1.7;
	font-size: 16px;
	background: rgba(20, 12, 8, 0.35);
	padding: 14px 16px;
	border: 1px solid rgba(176, 138, 74, 0.35);
	border-radius: 6px;
}

.event-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 0 22px 22px;
}

.event-option {
	background: linear-gradient(180deg, #6f552e, #4d391f);
	color: #f6e7c0;
	border: 1px solid #c49b56;
	padding: 12px 14px;
	font-size: 15px;
	font-family: Georgia, serif;
	cursor: pointer;
	text-align: left;
	transition: transform 0.15s ease, filter 0.15s ease;
}

.event-option:hover {
	transform: translateY(-1px);
	filter: brightness(1.08);
}

.event-option:active {
	transform: translateY(0);
	filter: brightness(0.96);
}

.modal-title {
	font-size: 14px;
	font-weight: bold;
	margin-bottom: 10px;
	color: #7fdbff;
}

.task-btn {
	display: block;
	width: 100%;
	padding: 8px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid #333;
	color: #ccc;
	text-align: left;
	cursor: pointer;
	margin: 3px 0;
	font-family: 'Courier New', monospace;
	font-size: 11px;
	border-radius: 3px;
}

.task-btn:hover {
	background: rgba(127, 219, 255, 0.1);
	border-color: #7fdbff44;
}

.task-empty {
	font-size: 11px;
	color: #888;
	padding: 8px 2px;
}

.task-section-title {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #222;
	font-size: 11px;
	color: #7fdbff;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.cancel-task-btn {
	border-color: #ff6b6b66;
	color: #ffb3b3;
}

.cancel-task-btn:hover {
	background: rgba(255, 107, 107, 0.12);
	border-color: #ff6b6b;
}

.close-btn {
	position: absolute;
	top: 8px;
	right: 12px;
	background: none;
	border: none;
	color: #888;
	cursor: pointer;
	font-size: 16px;
}

#gameover {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	z-index: 300;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	pointer-events: all;
}

#gameover h1 {
	font-size: 48px;
	color: #ff6b6b;
	margin-bottom: 12px;
}

#gameover p {
	color: #aaa;
	font-size: 14px;
}

#go-days {
	color: #7fdbff;
	font-size: 20px;
	margin-top: 8px;
}

#restart-btn {
	margin-top: 24px;
	padding: 10px 24px;
	background: #7fdbff;
	color: #000;
	border: none;
	cursor: pointer;
	font-family: 'Courier New', monospace;
	font-size: 14px;
	border-radius: 4px;
}

#minimap {
	position: fixed;
	bottom: 90px;
	right: 268px;
	width: 100px;
	height: 80px;
	background: rgba(10, 10, 20, 0.8);
	border: 1px solid #333;
	pointer-events: all;
	cursor: pointer;
	z-index: 95;
}

#intro-cinematic {
	position: fixed;
	inset: 0;
	background: radial-gradient(circle at 30% 20%, rgba(127, 219, 255, 0.08), rgba(0, 0, 0, 0.88));
	z-index: 260;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: all;
}

#intro-card {
	width: min(720px, calc(100vw - 40px));
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 20px;
	border: 1px solid #7fdbff66;
	border-radius: 12px;
	background: rgba(8, 10, 24, 0.96);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#intro-title {
	font-size: 18px;
	font-weight: bold;
	color: #7fdbff;
	margin-bottom: 10px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

#intro-dialogue {
	font-size: 13px;
	line-height: 1.5;
	color: #d4dae1;
	white-space: pre-line;
	margin-bottom: 10px;
	min-height: 56px;
}

#intro-help {
	font-size: 12px;
	color: #9fb5c7;
	margin-bottom: 12px;
}

#intro-choices {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	margin-bottom: 12px;
}

#intro-selected {
	font-size: 12px;
	color: #d4dae1;
	padding: 8px 10px;
	border-radius: 6px;
	border: 1px solid #2b3442;
	background: rgba(255, 255, 255, 0.03);
	margin-bottom: 10px;
}

.intro-choice-btn {
	width: 100%;
	text-align: left;
	padding: 10px;
	border-radius: 6px;
	border: 1px solid #2b3442;
	background: rgba(255, 255, 255, 0.04);
	color: #d4dae1;
	cursor: pointer;
	font-family: 'Courier New', monospace;
	font-size: 12px;
}

.intro-choice-btn:hover {
	border-color: #7fdbff66;
	background: rgba(127, 219, 255, 0.12);
}

.intro-choice-btn.selected {
	border-color: #7fdbff;
	background: rgba(127, 219, 255, 0.2);
	color: #f1f3f5;
}

#intro-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

.intro-btn {
	padding: 8px 14px;
	border: 1px solid #7fdbff66;
	border-radius: 6px;
	background: rgba(127, 219, 255, 0.1);
	color: #d6ebff;
	cursor: pointer;
	font-family: 'Courier New', monospace;
	font-size: 12px;
}

.intro-btn:hover {
	background: rgba(127, 219, 255, 0.22);
}

.intro-btn:disabled {
	cursor: not-allowed;
	opacity: 0.55;
	background: rgba(127, 219, 255, 0.06);
}
