/*
 * Page chrome: top bar, main menu, quick bar, header line, content frame.
 * Mirrors game.tpl / stamm.css of the original; images come in through
 * CSS variables that layout.php sets from the active graphics pack.
 */
.top_background {
	position: absolute; top: 0; left: 0; right: 0; height: 27px;
	background: #4a2a10 var(--bg-top, none) repeat-x;
	z-index: 0;
}
/* The page is 1000 px wide like the real game, so the village bar
   with its figures always fits on one line; below that width the
   page takes the window (mobile.css takes over at 900 px) */
.wrap {
	position: relative; z-index: 1;
	width: 1000px; max-width: 100%;
	margin: 11px auto 16px;
}
/* The map page grows with the window, so map and mini map sit side
   by side with room for both; public/js/map.js sets the exact width
   the chosen map size needs, never below the usual page and never
   beyond the window */
body.screen-map .wrap {
	width: min(1400px, calc(100% - 24px));
	min-width: min(1000px, calc(100% - 24px));
	max-width: calc(100% - 24px);
}

/* Bevelled frame around navigation blocks (table.navi-border) */
.navi-border {
	border: 1px solid;
	border-color: var(--edge-light) var(--edge-dark2) var(--edge-dark) var(--edge-light2);
	background: var(--paper2);
}
/* Dark frame around the content (table.content-border) */
.content-border {
	border: 1px solid;
	border-color: #994c00 #603000 #552a00 #804000;
}

/*
 * Main menu, styled after the current game: dark red bar, every entry
 * a dark bracket-shaped button with light text, the ranking entry in
 * the middle carrying rank and points on a second line.
 */
.topbar {
	margin-bottom: 0;
	background: linear-gradient(#9a2a1a, #7a1c12 50%, #55120b);
	border-color: #c2553c #2a0805 #2a0805 #c2553c;
	padding: 4px 4px 3px;
	font-size: 12px;
}
.nav-toggle { position: absolute; left: -9999px; }
.nav-burger { display: none; }
ul.menu {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; align-items: stretch; gap: 3px;
	justify-content: center;
}
/*
 * Tabs like the original: a dark ribbon with pointed ends and a thin
 * red edge (the ::before carries the red ribbon, the link the dark
 * one, one pixel smaller), light bold text.
 */
ul.menu > li {
	position: relative; white-space: nowrap;
	padding: 0; background: none;
}
ul.menu > li::before {
	content: ''; position: absolute; inset: 0;
	background: linear-gradient(#e8734a, #b83a22 45%, #7e1d10);
	clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%,
		calc(100% - 8px) 100%, 8px 100%, 0 50%);
}
ul.menu > li > a {
	position: relative; display: flex; align-items: center; gap: 4px;
	margin: 1px; padding: 2px 16px; min-height: 22px;
	box-sizing: border-box;
	color: #f3e6c8; text-shadow: 0 1px 0 #000; font-weight: bold;
	background: linear-gradient(#5a5856, #2b2a28 50%, #161514);
	clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 50%,
		calc(100% - 7px) 100%, 7px 100%, 0 50%);
}
ul.menu > li > a:hover {
	color: #fff;
	background: linear-gradient(#77746f, #3a3937 50%, #201f1e);
}
/* The ranking tab: a plain lighter block over the full height with
   rank and points on a second line */
ul.menu > li.rank { margin: 0 6px; }
ul.menu > li.rank::before { display: none; }
ul.menu > li.rank > a {
	flex-direction: column; justify-content: center; gap: 0;
	margin: 0; padding: 1px 12px; line-height: 1.2;
	clip-path: none;
	background: linear-gradient(#6f6d69, #4a4846 50%, #2e2d2b);
	border: 1px solid #1a1918;
}
ul.menu > li.rank > a:hover { background: linear-gradient(#85827c, #5a5855 50%, #393836); }
ul.menu > li.rank .rankpos { font-size: 10px; font-weight: bold; color: #f3e6c8; }
/* Icon and count of new reports, mails and forum posts sit on the
   corners of the tab and take no width, so the row never wraps */
.nav-ico { position: absolute; left: 7px; top: 3px; height: 12px; width: auto; }
/* Icon and badge are always in the markup, so the live update of
   public/js/game.js only has to switch them on and off */
.nav-ico.nav-ico-off, .badge[hidden] { display: none; }
ul.menu .badge {
	position: absolute; right: 3px; top: -1px; z-index: 2;
	background: #d9b04c; color: #000; border-radius: 8px;
	padding: 0 4px; font-size: 9px; line-height: 13px; text-shadow: none;
}
ul.menu > li > ul {
	display: none; position: absolute; left: 0; top: 100%;
	list-style: none; margin: 0; padding: 0; min-width: 140px;
	border: 1px solid #000; background: #fff4de; z-index: 50;
}
ul.menu > li:hover > ul { display: block; }
ul.menu > li > ul > li { border-top: 1px solid #e5d3a8; padding: 0; background: #fff4de; }
ul.menu > li > ul > li:first-child { border-top: 0; }
ul.menu > li > ul > li:hover { background: var(--row-a); }
ul.menu > li > ul > li > a { display: block; padding: 3px 8px; }
/* The fold-out hangs from the unclipped li, so nothing cuts it off */
ul.menu > li.sub > ul { top: calc(100% - 1px); }

/*
 * Container of quick bar and village bar: one bevelled parchment
 * frame; inside it the quick bar sits in its own thin box and the
 * village bar's two boxes form the second row, like the real game.
 */
.navbars { padding: 3px 4px 4px; background: var(--bar); }
.quickbar {
	display: flex; flex-wrap: wrap; justify-content: center;
	align-items: center; gap: 0 12px;
	border: 1px solid #b89a66; border-radius: 3px;
	background: var(--paper2);
	margin: 0 0 3px; padding: 1px 4px;
	font-size: 13px;
}
.quickbar a {
	display: inline-flex; align-items: center; gap: 3px;
	padding: 2px 0; white-space: nowrap;
	font-weight: bold; color: #603000;
	background: none;
}
.quickbar a img { width: 16px; height: 16px; }
.quickbar a:hover { color: #603000; text-decoration: underline; }
/* The building icons keep their native 16 or 18 px (no scaling) */


/*
 * Village bar: the village box and the resource box side by side on
 * one line, centred like the menu above, both as rounded parchment
 * boxes; between them the bar's own background shows through.
 * Neither box shrinks or hides anything: the page is wide enough for
 * both (mobile.css stacks them on narrow screens).
 */
.header {
	display: flex; justify-content: center; align-items: center;
	flex-wrap: nowrap; gap: 3px 12px;
	/* Should a very long village name still not fit, the bar grows
	   beyond the page on both sides instead of cutting anything */
	box-sizing: border-box; width: max-content; min-width: 100%;
	position: relative; left: 50%; transform: translateX(-50%);
	padding: 0; font-size: 13px;
}
/* The boxes take the cell colour of the default tables */
.header .village-select,
.header .res {
	display: flex; align-items: center;
	min-height: 22px; padding: 0 6px;
	background: var(--paper2);
	border: 1px solid #b89a66;
	border-radius: 3px;
	white-space: nowrap;
}
/* Attack counter and coins as their own small box at the right */
.header .res .counters {
	margin: -1px -7px -1px 6px; padding: 0 4px;
	min-height: 22px;
	border-left: 1px solid #b89a66;
	border-radius: 0 3px 3px 0;
}
.header .village-select { gap: 3px; flex: 0 0 auto; }
.header .res { flex: 0 0 auto; }
/* Red village arrows: the pack's brown arrows tinted red; the grey
 * ones mark a missing neighbour and stay grey. */
.header .vnav { display: inline-flex; align-items: center; padding: 3px 2px; }
.header .vnav img.arrow {
	width: 11px; height: 11px; display: block;
	filter: sepia(1) saturate(9) hue-rotate(-35deg) brightness(.85);
}
.header .vnav.dim img.arrow { filter: none; opacity: .55; }
.header .vnav:hover img.arrow { filter: sepia(1) saturate(9) hue-rotate(-35deg) brightness(1.1); }
.header .vicon { width: 11px; height: 11px; margin: 0 2px 0 3px; }
.header .vname { font-weight: bold; color: #603000; }
.header .vname:hover { text-decoration: underline; }
.header .coords { font-weight: bold; color: #000; }
/* Small circled "i" leading to the village info page */
.header .vinfo {
	display: inline-flex; align-items: center; justify-content: center;
	width: 13px; height: 13px; margin-left: 3px;
	border: 1px solid #603000; border-radius: 50%;
	font: bold 10px/1 Georgia, "Times New Roman", serif;
	color: #603000; background: #fff;
	text-decoration: none;
}
.header .vinfo:hover { background: #603000; color: #fff; }
/*
 * Village switch as in the original: a small arrow next to the name
 * opens the list. The select itself lies invisible over the arrow,
 * so the browser's own list opens on click; mobile.css shows the
 * full select instead.
 */
.header .vswitch-wrap {
	position: relative; display: inline-flex; align-items: center;
	justify-content: center; flex: none;
	width: 18px; height: 18px; margin-left: 4px;
	background: #fff; border: 1px solid #cdb98e; border-radius: 3px;
}
.header .vswitch-arrow { font-size: 8px; color: #603000; line-height: 1; }
.header .vswitch {
	position: absolute; left: 0; top: 0; width: 100%; height: 100%;
	margin: 0; opacity: 0; cursor: pointer; font-size: 8pt;
}
/* The group choice shows its name, unlike the icon-only village list */
.header .vgroup-wrap { width: auto; height: auto; margin-right: 4px; }
.header .vgroup-wrap .vswitch-arrow { display: none; }
.header select.vgroup {
	position: static; opacity: 1; width: auto; height: 18px;
	border: 0; background: #fff; color: #603000; padding: 0 2px;
}
.header .res { gap: 0; }
.header .res .res-item { display: inline-flex; align-items: center; gap: 2px; padding: 0 3px; }
.header .res .res-item > a { display: inline-flex; align-items: center; }
.header .res .res-item img { width: 18px; height: 18px; }
.header .res .val { color: #000; font-weight: bold; }
/* The original has no dividers between the figures */
.header .res .sep { display: none; }
.header .res .val.warn { color: var(--warn); font-weight: bold; }
.header .res .attacks a, .attackwarn { color: var(--warn); }
.header .res .attacks a, .header .res .supports a { gap: 4px; }
/* Coin and attack counters form one group that wraps as a unit */
.header .res .counters { display: inline-flex; align-items: center; }

/* Content area (table.main with the parchment texture) */
.content {
	background: var(--paper) var(--bg-content, none);
	border: 1px solid var(--brown);
	/* Wider page, wider margins: the tables and the village scene
	   keep a clear strip of parchment at both sides */
	padding: 8px 20px 12px;
	overflow-x: auto;
}
/* Footer line under the content like the original's: server time,
   world, speed, statistics and imprint */
.footer {
	margin: 6px 0 0; padding: 4px 8px; text-align: center;
	font-size: 8pt; color: #5d3d1a;
	background: var(--bar); border: 1px solid #603000;
}
.footer a { color: #603000; }
