/* Jeroen Coupé's CV-lization: a CV in the style of Civ I (1991). */

:root {
	--black: #000;
	--white: #fcfcfc;
	--yellow: #fcfc54;
	--red: #fc5454;
	--cyan: #54fcfc;
	--gray: #a8a8a8;
	--gray-hi: #d8d8d8;
	--gray-lo: #545454;
	--blue: #1c2c9c;
	--blue-hi: #5c6cfc;
	--blue-lo: #0c1450;
	--ui: "Silkscreen", "Courier New", monospace;
	--text: "Pixelify Sans", "Courier New", monospace;
}

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

html, body { height: 100%; }

body {
	margin: 0;
	background: var(--black);
	color: var(--white);
	font: 17px/1.4 var(--text);
	-webkit-font-smoothing: none;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
a { color: var(--cyan); }
a:hover { color: var(--yellow); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px dashed var(--yellow); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--gray); }
.small { font-size: 14px; }

.noscript { padding: 24px; }

/* ---------- title screen ---------- */
.intro {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	padding: 24px 16px;
	overflow: auto;
	background: var(--black);
	cursor: pointer;
}
.stars { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.intro-inner { position: relative; max-width: 760px; text-align: center; }
.intro-kicker {
	color: var(--gray);
	font: 14px var(--ui);
	letter-spacing: 3px;
	text-transform: uppercase;
}
.intro-title {
	margin: 8px 0 28px;
	color: var(--white);
	font: 700 clamp(22px, 5vw, 40px)/1.2 var(--ui);
	text-shadow: 3px 3px 0 var(--blue);
}
.intro-title span {
	display: block;
	color: var(--yellow);
	font-size: clamp(34px, 9vw, 78px);
	letter-spacing: 2px;
	text-shadow: 4px 4px 0 #a80000;
}
.intro-text {
	min-height: 7.5em;
	max-width: 620px;
	margin: 0 auto 28px;
	color: var(--gray-hi);
	font-size: 19px;
	text-align: left;
}
.intro-text p { margin-bottom: 8px; }
.intro-menu { display: inline-flex; flex-direction: column; gap: 10px; }
.menu-item {
	padding: 8px 22px;
	border: 0;
	background: var(--blue);
	box-shadow: inset 2px 2px 0 var(--blue-hi), inset -2px -2px 0 var(--blue-lo);
	color: var(--white);
	font: 15px var(--ui);
	text-decoration: none;
	cursor: pointer;
}
.menu-item small { color: var(--gray-hi); font-size: 11px; }
.menu-item:hover, .menu-item:focus-visible { background: #2c40c8; color: var(--yellow); }
.intro-hint { margin-top: 26px; color: var(--gray-lo); font: 11px var(--ui); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- game layout ---------- */
.game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.menubar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 4px 10px;
	background: var(--gray);
	box-shadow: inset 0 -2px 0 var(--gray-lo), inset 0 2px 0 var(--gray-hi);
	color: var(--black);
	font: 13px var(--ui);
}
.brand { font-weight: 700; color: #a80000; white-space: nowrap; }
.menu { display: flex; flex-wrap: wrap; gap: 2px; }
.menu button, .menu a {
	padding: 4px 10px;
	border: 0;
	background: none;
	color: var(--black);
	font: 13px var(--ui);
	text-decoration: none;
	cursor: pointer;
}
.menu small { font-size: 10px; }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible {
	background: var(--blue);
	color: var(--white);
}

.layout { flex: 1; display: flex; min-height: 0; }

.mapframe { position: relative; flex: 1; display: flex; min-width: 0; min-height: 0; }
.mapwrap {
	position: relative;
	flex: 1;
	overflow: auto;
	background: var(--black);
	cursor: grab;
	scrollbar-color: var(--gray-lo) var(--black);
}
.mapwrap.dragging { cursor: grabbing; }
.map { display: block; image-rendering: pixelated; }

.side {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 280px;
	flex: none;
	padding: 8px;
	overflow-y: auto;
	background: #181818;
	box-shadow: inset 2px 0 0 var(--gray-lo);
}
.minimap {
	width: 100%;
	image-rendering: pixelated;
	border: 2px solid var(--gray);
	cursor: crosshair;
}

.panel {
	padding: 8px 10px 10px;
	background: var(--gray);
	box-shadow: inset 2px 2px 0 var(--gray-hi), inset -2px -2px 0 var(--gray-lo);
	color: var(--black);
	font-size: 15px;
}
.panel .muted { color: #383838; }
.panel-title { margin-bottom: 4px; font: 700 13px var(--ui); color: var(--blue-lo); text-transform: uppercase; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; margin: 6px 0; }
.stats dt { font: 11px/1.9 var(--ui); }
.stats dd { font-weight: 600; }
.research-label { font-size: 14px; }
.bar { height: 10px; margin-top: 4px; background: var(--black); border: 1px solid var(--gray-lo); }
.bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--cyan) 0 6px, transparent 6px 8px); transition: width .6s steps(8); }

.city-list { display: flex; flex-direction: column; gap: 2px; }
.city-list h3 { margin: 6px 0 2px; font: 11px var(--ui); color: #383838; }
.city-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 2px 4px;
	border: 0;
	background: none;
	color: var(--black);
	font-size: 15px;
	text-align: left;
	cursor: pointer;
}
.city-btn:hover, .city-btn:focus-visible { background: var(--blue); color: var(--white); }
.city-btn .swatch { width: 12px; height: 12px; flex: none; border: 2px solid var(--black); }
.city-btn .yrs { margin-left: auto; font-size: 12px; opacity: .75; white-space: nowrap; }

.statusbar {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 4px 16px;
	padding: 4px 10px;
	background: var(--gray);
	box-shadow: inset 0 2px 0 var(--gray-hi);
	color: var(--black);
	font: 11px var(--ui);
}
.statusbar a { color: var(--blue-lo); }

/* ---------- map overlays ---------- */
.tip {
	position: absolute;
	z-index: 2;
	padding: 3px 8px;
	background: var(--blue);
	box-shadow: inset 1px 1px 0 var(--blue-hi), inset -1px -1px 0 var(--blue-lo), 2px 2px 0 var(--black);
	font-size: 14px;
	white-space: nowrap;
	pointer-events: none;
}
.tip small { color: var(--gray-hi); }

.news {
	position: absolute;
	top: 12px;
	left: 50%;
	z-index: 3;
	width: max-content;
	max-width: calc(100% - 24px);
	padding: 8px 14px;
	background: var(--blue);
	box-shadow: inset 2px 2px 0 var(--blue-hi), inset -2px -2px 0 var(--blue-lo), 4px 4px 0 var(--black);
	font-size: 16px;
	transform: translateX(-50%);
	pointer-events: none;
}
.news b { color: var(--yellow); font-family: var(--ui); font-size: 13px; margin-right: 6px; }
.news small { opacity: .7; font-size: .8em; }

/* ---------- Civ windows ---------- */
.win {
	width: min(640px, calc(100vw - 24px));
	max-height: calc(100vh - 32px);
	padding: 0;
	border: 0;
	background: var(--blue);
	box-shadow: inset 3px 3px 0 var(--blue-hi), inset -3px -3px 0 var(--blue-lo), 6px 6px 0 rgba(0, 0, 0, .7);
	color: var(--white);
	font-size: 17px;
}
.win[open] { display: flex; flex-direction: column; }
.win::backdrop { background: rgba(0, 0, 0, .55); }
.win-title {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 10px 8px 16px;
	background: var(--gray);
	box-shadow: inset 2px 2px 0 var(--gray-hi), inset -2px -2px 0 var(--gray-lo);
	color: var(--black);
}
.win-title h2 { flex: 1; font: 700 15px var(--ui); text-transform: uppercase; }
.win-close {
	width: 28px; height: 28px;
	border: 0;
	background: var(--gray);
	box-shadow: inset 2px 2px 0 var(--gray-hi), inset -2px -2px 0 var(--gray-lo);
	color: var(--black);
	font: 700 18px/1 var(--ui);
	cursor: pointer;
}
.win-body { padding: 16px 18px; overflow-y: auto; }
.win-body h3 { margin: 14px 0 6px; color: var(--yellow); font: 13px var(--ui); text-transform: uppercase; }
.win-body h3:first-child { margin-top: 0; }
.win-body p + p { margin-top: 8px; }
.win-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
.win-foot:empty { display: none; }
.win-btn {
	padding: 6px 14px;
	border: 0;
	background: var(--gray);
	box-shadow: inset 2px 2px 0 var(--gray-hi), inset -2px -2px 0 var(--gray-lo);
	color: var(--black);
	font: 12px var(--ui);
	text-decoration: none;
	cursor: pointer;
}
.win-btn:hover, .win-btn:focus-visible { background: var(--yellow); color: var(--black); }
.win-btn.primary { background: var(--yellow); }

.governor { color: var(--yellow); font-size: 18px; }
.years { color: var(--gray-hi); }
.citizens { display: flex; flex-wrap: wrap; gap: 2px; margin: 10px 0 12px; padding: 4px; background: var(--blue-lo); }
.citizens img { width: 24px; height: 24px; image-rendering: pixelated; }
.improvements { list-style: none; padding: 0; }
.improvements li { position: relative; padding-left: 22px; margin: 4px 0; }
.improvements li::before {
	content: "";
	position: absolute;
	left: 2px; top: .45em;
	width: 10px; height: 10px;
	background: var(--yellow);
	box-shadow: 2px 2px 0 #a8a800;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.chips li { padding: 1px 8px; background: var(--blue-lo); color: var(--cyan); font-size: 15px; }

.row-list { list-style: none; padding: 0; }
.row-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 6px 0; border-bottom: 1px dashed var(--blue-hi); }
.row-list li:last-child { border-bottom: 0; }
.row-list .grow { flex: 1; min-width: 200px; }
.row-list .yr { color: var(--yellow); font-family: var(--ui); font-size: 13px; min-width: 64px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--cyan); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--yellow); }

.era { margin-bottom: 4px; }
.adv { padding: 6px 0; border-bottom: 1px dashed var(--blue-hi); }
.adv:last-child { border-bottom: 0; }
.adv b { color: var(--white); }
.adv .req { color: var(--gray-hi); font-size: 14px; }
.adv.researching b { color: var(--cyan); }

.contact { display: grid; gap: 8px; margin-top: 12px; }
.contact a { font-size: 19px; }

/* ---------- small screens ---------- */
@media (max-width: 800px) {
	body { font-size: 16px; }
	.layout { flex-direction: column; overflow-y: auto; }
	.mapframe { flex: none; height: 62vh; height: 62dvh; }
	.side { width: auto; overflow: visible; box-shadow: none; }
	.minimap { display: none; }
	.menubar { flex-wrap: wrap; gap: 2px 10px; }
	.menu { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
	.menu button, .menu a { white-space: nowrap; }
	.statusbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.intro-hint { animation: none; }
	.bar span { transition: none; }
}


/* =====================================================================
   Civ II (1996): Windows 95 chrome, parchment windows, isometric map.
   ===================================================================== */
.ii { display: none; }
html[data-style="civ2"] {
	--ui: Tahoma, "MS Sans Serif", Verdana, sans-serif;
	--text: "Times New Roman", Times, Georgia, serif;
	--w95: #c0c0c0;
	--w95-hi: #ffffff;
	--w95-lo: #808080;
	--w95-dk: #000000;
	--navy: #000080;
	--parch: #efe3bf;
	--ink: #2a1c08;
	--gold: #b08a3a;
}
html[data-style="civ2"] body { -webkit-font-smoothing: auto; font-size: 17px; }
html[data-style="civ2"] .ii { display: inline; }
html[data-style="civ2"] .map { image-rendering: auto; }

/* title screen */
html[data-style="civ2"] .intro { background: radial-gradient(ellipse at 50% 35%, #1a2448 0%, #070a16 60%, #000 100%); }
html[data-style="civ2"] .stars { opacity: .45; }
html[data-style="civ2"] .intro-kicker { color: #c8b47c; font: italic 18px var(--text); letter-spacing: 1px; text-transform: none; }
html[data-style="civ2"] .intro-title {
	color: #e8d8a8;
	font: 600 clamp(22px, 4vw, 34px)/1.2 "Cinzel", var(--text);
	text-shadow: 0 2px 0 #000, 0 0 18px rgba(0, 0, 0, .8);
}
html[data-style="civ2"] .intro-title span {
	font: 800 clamp(34px, 8vw, 76px)/1.1 "Cinzel", var(--text);
	letter-spacing: 3px;
	color: transparent;
	background: linear-gradient(180deg, #fff6cc 0%, #f0c95a 38%, #a8741c 62%, #f6dc84 100%);
	-webkit-background-clip: text;
	background-clip: text;
	text-shadow: none;
	filter: drop-shadow(0 3px 0 #3a2408) drop-shadow(0 0 12px rgba(0, 0, 0, .9));
}
html[data-style="civ2"] .intro-title .ii { font: inherit; color: inherit; }
html[data-style="civ2"] .intro-text { color: #e8dcc0; font: italic 20px/1.5 var(--text); }
html[data-style="civ2"] .intro-menu {
	min-width: 320px;
	padding: 26px 10px 10px;
	gap: 0;
	position: relative;
	background: var(--w95);
	box-shadow: inset 1px 1px 0 var(--w95-hi), inset -1px -1px 0 var(--w95-dk), inset 2px 2px 0 #dfdfdf, inset -2px -2px 0 var(--w95-lo);
	text-align: left;
}
html[data-style="civ2"] .intro-menu::before {
	content: "CV-lization II";
	position: absolute; top: 3px; left: 3px; right: 3px;
	padding: 2px 6px;
	background: linear-gradient(90deg, var(--navy), #1084d0);
	color: #fff;
	font: bold 12px var(--ui);
}
html[data-style="civ2"] .menu-item {
	padding: 5px 8px 5px 30px;
	position: relative;
	background: none;
	box-shadow: none;
	color: #000;
	font: 14px var(--ui);
	text-align: left;
}
html[data-style="civ2"] .menu-item::before {
	content: "";
	position: absolute; left: 10px; top: 50%;
	width: 12px; height: 12px; margin-top: -6px;
	border-radius: 50%;
	background: #fff;
	box-shadow: inset 1px 1px 0 var(--w95-lo), inset -1px -1px 0 #dfdfdf;
}
html[data-style="civ2"] .menu-item:hover, html[data-style="civ2"] .menu-item:focus-visible { background: var(--navy); color: #fff; outline: none; }
html[data-style="civ2"] .menu-item:hover::before, html[data-style="civ2"] .menu-item:focus-visible::before { background: radial-gradient(circle, #000 0 3px, #fff 3.5px); }
html[data-style="civ2"] .menu-item small { color: inherit; font-size: 12px; }
html[data-style="civ2"] .intro-hint { color: #8a7c5c; font: italic 14px var(--text); }

/* Windows 95 chrome */
html[data-style="civ2"] .menubar,
html[data-style="civ2"] .statusbar {
	background: var(--w95);
	box-shadow: inset 0 1px 0 var(--w95-hi), inset 0 -1px 0 var(--w95-lo);
	font: 12px var(--ui);
}
html[data-style="civ2"] .brand { color: var(--navy); font: bold 13px var(--ui); }
html[data-style="civ2"] .menu button, html[data-style="civ2"] .menu a { font: 12px var(--ui); }
html[data-style="civ2"] .menu small { font-size: 11px; }
html[data-style="civ2"] .menu button:hover, html[data-style="civ2"] .menu a:hover,
html[data-style="civ2"] .menu button:focus-visible, html[data-style="civ2"] .menu a:focus-visible { background: var(--navy); color: #fff; }
html[data-style="civ2"] .statusbar a { color: var(--navy); }

html[data-style="civ2"] .side { background: var(--w95-lo); box-shadow: inset 1px 0 0 var(--w95-hi); }
html[data-style="civ2"] .minimap { border: 0; box-shadow: 0 0 0 2px var(--w95), 0 0 0 3px var(--w95-dk); }
html[data-style="civ2"] .panel {
	background: var(--w95);
	box-shadow: inset 1px 1px 0 var(--w95-hi), inset -1px -1px 0 var(--w95-dk), inset 2px 2px 0 #dfdfdf, inset -2px -2px 0 var(--w95-lo);
	font: 13px/1.45 var(--ui);
}
html[data-style="civ2"] .panel-title { color: var(--navy); font: bold 12px var(--ui); text-transform: none; }
html[data-style="civ2"] .stats dt { font: 12px/1.6 var(--ui); }
html[data-style="civ2"] .stats dd { font-weight: bold; }
html[data-style="civ2"] .research-label { font-size: 12px; }
html[data-style="civ2"] .bar { background: #fff; border: 0; box-shadow: inset 1px 1px 0 var(--w95-lo), inset -1px -1px 0 var(--w95-hi); padding: 2px; height: 14px; }
html[data-style="civ2"] .bar span { background: repeating-linear-gradient(90deg, var(--navy) 0 8px, transparent 8px 10px); }
html[data-style="civ2"] .city-list h3 { font: bold 11px var(--ui); color: #303030; }
html[data-style="civ2"] .city-btn { font: 13px var(--ui); }
html[data-style="civ2"] .city-btn:hover, html[data-style="civ2"] .city-btn:focus-visible { background: var(--navy); }
html[data-style="civ2"] .city-btn .swatch { border-width: 1px; }

html[data-style="civ2"] .tip {
	background: #ffffe1;
	box-shadow: 0 0 0 1px #000;
	color: #000;
	font: 12px var(--ui);
}
html[data-style="civ2"] .tip small { color: #555; }
html[data-style="civ2"] .news {
	background: var(--parch);
	box-shadow: 0 0 0 1px #000, 0 0 0 4px var(--gold), 0 0 0 5px #000, 4px 6px 0 5px rgba(0, 0, 0, .5);
	color: var(--ink);
	font: 17px var(--text);
}
html[data-style="civ2"] .news b { color: #8c1c0c; font: bold 13px var(--ui); }

/* parchment windows with a Windows title bar */
html[data-style="civ2"] .win {
	padding: 3px;
	background: var(--w95);
	box-shadow: inset 1px 1px 0 var(--w95-hi), inset -1px -1px 0 var(--w95-dk), inset 2px 2px 0 #dfdfdf, inset -2px -2px 0 var(--w95-lo), 6px 6px 0 rgba(0, 0, 0, .45);
	color: var(--ink);
}
html[data-style="civ2"] .win-title {
	padding: 3px 3px 3px 8px;
	background: linear-gradient(90deg, var(--navy), #1084d0);
	box-shadow: none;
	color: #fff;
}
html[data-style="civ2"] .win-title h2 { font: bold 13px var(--ui); text-transform: none; }
html[data-style="civ2"] .win-close {
	width: 18px; height: 16px;
	background: var(--w95);
	box-shadow: inset 1px 1px 0 var(--w95-hi), inset -1px -1px 0 var(--w95-dk), inset -2px -2px 0 var(--w95-lo);
	font: bold 12px/1 var(--ui);
}
html[data-style="civ2"] .win-body {
	margin-top: 3px;
	background:
		radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .35), transparent 60%),
		radial-gradient(ellipse at 90% 100%, rgba(140, 100, 40, .18), transparent 55%),
		var(--parch);
	box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 18px rgba(120, 80, 20, .25);
	font: 17px/1.45 var(--text);
}
html[data-style="civ2"] .win-body h3 { color: #8c1c0c; font: bold 14px var(--text); font-variant: small-caps; letter-spacing: 1px; text-transform: none; }
html[data-style="civ2"] .win-foot { padding: 8px 6px 4px; background: var(--w95); }
html[data-style="civ2"] .win-btn {
	min-width: 76px;
	padding: 4px 12px;
	background: var(--w95);
	box-shadow: inset 1px 1px 0 var(--w95-hi), inset -1px -1px 0 var(--w95-dk), inset 2px 2px 0 #dfdfdf, inset -2px -2px 0 var(--w95-lo);
	color: #000;
	font: 12px var(--ui);
}
html[data-style="civ2"] .win-btn:hover { background: #d4d0c8; color: #000; }
html[data-style="civ2"] .win-btn.primary { outline: 1px solid #000; background: var(--w95); }
html[data-style="civ2"] .governor { color: #5a1408; font-weight: bold; font-size: 19px; }
html[data-style="civ2"] .years { color: #5a4a2a; font-style: italic; }
html[data-style="civ2"] .citizens { background: rgba(90, 60, 20, .15); box-shadow: inset 0 0 0 1px var(--gold); }
html[data-style="civ2"] .improvements li::before { background: var(--gold); box-shadow: 1px 1px 0 #5a4010; }
html[data-style="civ2"] .chips li { background: #dccb98; color: #3a2a10; box-shadow: inset 0 0 0 1px var(--gold); font: 14px var(--ui); }
html[data-style="civ2"] .row-list li, html[data-style="civ2"] .adv { border-bottom-color: rgba(140, 100, 40, .45); }
html[data-style="civ2"] .row-list .yr { color: #8c1c0c; font: bold 13px var(--ui); }
html[data-style="civ2"] .link-btn, html[data-style="civ2"] .win a:not(.win-btn) { color: #00007c; }
html[data-style="civ2"] .link-btn:hover { color: #8c1c0c; }
html[data-style="civ2"] .adv b { color: var(--ink); }
html[data-style="civ2"] .adv .req { color: #6a5a3a; }
html[data-style="civ2"] .adv.researching b { color: #00007c; }
html[data-style="civ2"] :focus-visible { outline: 1px dotted #000; outline-offset: -3px; }


/* comic library */
.library { list-style: none; padding: 0; display: grid; gap: 4px; }
.library li { display: grid; grid-template-columns: minmax(0, 1fr) 90px 64px; align-items: center; gap: 10px; font-size: 15px; }
.library small { opacity: .7; font-size: 12px; }
.lib-bar { height: 8px; background: var(--blue-lo); }
.lib-bar span { display: block; height: 100%; background: var(--cyan); }
.library li.done .lib-bar span { background: #54fc54; }
.lib-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.library li.done .lib-num { color: #54fc54; }
html[data-style="civ2"] .library li { font-size: 15px; }
html[data-style="civ2"] .lib-bar { background: rgba(90, 60, 20, .2); box-shadow: inset 0 0 0 1px var(--gold); }
html[data-style="civ2"] .lib-bar span { background: #3a6fb0; }
html[data-style="civ2"] .library li.done .lib-bar span { background: #3c8c28; }
html[data-style="civ2"] .library li.done .lib-num { color: #2c6c18; font-weight: bold; }
@media (max-width: 520px) { .library li { grid-template-columns: minmax(0, 1fr) 56px; } .lib-bar { display: none; } }
