/* DrapOTS: classic tibia.com spirit. Dark wood frame, parchment pages,
   stepped pixel corners, and one in-game status window as the focal point. */

:root {
	--wood-950: #1e120a;
	--wood-800: #33200f;
	--wood-700: #4a2e19;
	--brass: #c8a04a;
	--brass-light: #e6c97a;
	--parchment: #eadcb8;
	--parchment-dark: #dfcfa6;
	--ink: #2b2016;
	--ink-soft: #5c4a36;
	--link: #1f4e8c;
	--online: #3fbf3f;
	--offline: #e04b3a;
	--focus: #1f4e8c;

	--font-display: "IM Fell English SC", "Palatino Linotype", Palatino, Georgia, serif;
	--font-body: Verdana, Geneva, Tahoma, sans-serif;

	/* 4px steps cut out of every corner, like a sprite border. */
	--px: polygon(0 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px));
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	font: 13px/1.6 var(--font-body);
	color: var(--ink);
	background-color: var(--wood-950);
	background-image:
		repeating-linear-gradient(90deg, rgba(255, 220, 160, 0.025) 0 1px, transparent 1px 9px),
		repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 3px, transparent 3px 41px),
		linear-gradient(180deg, var(--wood-800), var(--wood-950) 420px);
}

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.skip-link {
	position: absolute;
	left: 16px;
	top: -48px;
	padding: 8px 12px;
	background: var(--parchment);
	color: var(--ink);
	z-index: 10;
}
.skip-link:focus { top: 8px; }

/* Masthead */

.masthead {
	border-bottom: 3px solid var(--brass);
	box-shadow: 0 3px 0 var(--wood-950);
}

.masthead-inner {
	max-width: 1240px;
	margin: 0 auto;
	padding: 28px 16px 22px;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 20px;
}

.wordmark {
	font: 3.4rem/1 var(--font-display);
	color: var(--brass-light);
	text-decoration: none;
	text-shadow: 0 2px 0 var(--wood-950), 0 0 18px rgba(200, 160, 74, 0.25);
}

.tagline {
	margin: 0;
	color: var(--parchment-dark);
	font-style: italic;
}

.status-pill { display: none; }

/* Layout */

.layout {
	max-width: 1240px;
	margin: 24px auto 0;
	padding: 0 16px;
	display: grid;
	grid-template-columns: 200px minmax(0, 1fr) 280px;
	grid-template-areas: "nav main aside";
	gap: 20px;
	align-items: start;
}

.site-nav { grid-area: nav; }
.page { grid-area: main; }
.sidebar { grid-area: aside; display: grid; gap: 20px; align-items: start; }

/* Stepped frames: brass edge, clipped twice so the border keeps the steps. */

.frame {
	background: var(--brass);
	padding: 3px;
	clip-path: var(--px);
}

.frame-inner {
	clip-path: var(--px);
	background: var(--wood-700);
	padding: 14px 16px;
}

/* Navigation */

.nav-toggle { display: none; }

.nav-groups { display: grid; gap: 14px; }

.nav-heading,
.box-heading {
	margin: 0 0 8px;
	font: 1.3rem/1.2 var(--font-display);
	color: var(--brass-light);
}

.nav-group ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-group a {
	display: block;
	padding: 4px 6px;
	color: var(--parchment);
	text-decoration: none;
}

.nav-group a:hover { color: #fff; background: rgba(0, 0, 0, 0.2); }

.nav-group a[aria-current="page"] {
	color: var(--wood-950);
	background: var(--brass);
	font-weight: bold;
}

.nav-group a:focus-visible,
.sidebar a:focus-visible,
.copy-button:focus-visible { outline-color: var(--brass-light); }

/* Parchment page */

.parchment {
	background-color: var(--parchment);
	background-image:
		radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.35), transparent 55%),
		radial-gradient(ellipse at 100% 100%, rgba(120, 80, 30, 0.18), transparent 60%);
	padding: 24px 28px 32px;
	min-height: 420px;
}

.page:focus { outline: none; }

.page-title {
	margin: 0 0 18px;
	padding-bottom: 8px;
	font: 2.1rem/1.15 var(--font-display);
	color: var(--wood-700);
	border-bottom: 2px solid var(--brass);
}

.content p,
.content li { max-width: 72ch; }

.content h2,
.content h3 {
	font-family: var(--font-display);
	font-weight: normal;
	color: var(--wood-700);
}

/* Images with fixed sizes (item slots, outfits) keep them: the equipment
   grid is built from tight 32px cells. */
.content img:not([width]):not([style*="width"]) { max-width: 100%; height: auto; }

/* Character page outfit: MyAAC positions this circle with a hard-coded
   margin for tibiacom's fixed layout (and expects content-box sizing).
   Pin it to the top right of the character table instead. */
.content { position: relative; }
.content div[style*="border-radius:50px"] {
	box-sizing: content-box;
	position: absolute !important;
	top: 40px;
	right: 12px;
	margin: 0 !important;
	overflow: hidden;
	border-color: var(--brass) !important;
	background: rgba(255, 255, 255, 0.3);
}

/* MyAAC's built-in pages render data tables with bgcolor and cellpadding
   attributes, so cell padding is left to the markup. */
.content table { border-collapse: collapse; max-width: 100%; }
.content td,
.content th { vertical-align: top; }
.content .white,
.content td.white,
.content .white a { color: var(--parchment); }
.content tr[bgcolor="#4a2e19"] td,
.content tr[bgcolor="#4A2E19"] td { color: var(--parchment); }
.content tr[bgcolor="#4a2e19"] a,
.content tr[bgcolor="#4A2E19"] a { color: var(--brass-light); }
.content .TableContainer,
.content .myaac-table { width: 100%; margin: 12px 0; }

.content .red,
.content .FormFieldError { color: #8b1a1a; }

/* Forms and buttons */

.content input[type="text"],
.content input[type="password"],
.content input[type="email"],
.content input[type="number"],
.content select,
.content textarea,
.content .form-control {
	font: inherit;
	color: var(--ink);
	background: #fbf5e4;
	border: 1px solid var(--ink-soft);
	padding: 5px 8px;
	max-width: 100%;
}

.button,
.content input[type="submit"],
.content button,
.content .btn {
	display: inline-block;
	font: bold 12px/1 var(--font-body);
	color: var(--parchment);
	background: var(--wood-700);
	border: 0;
	padding: 8px 14px;
	text-decoration: none;
	cursor: pointer;
	box-shadow: inset 1px 1px 0 #7a5530, inset -1px -1px 0 var(--wood-950);
}

.button:hover,
.content input[type="submit"]:hover,
.content button:hover,
.content .btn:hover { background: var(--wood-800); color: #fff; }

/* News */

.news + .news {
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1px dashed var(--ink-soft);
}

.news-title {
	margin: 0;
	font: 1.6rem/1.2 var(--font-display);
	color: var(--wood-700);
}

.news-meta { margin: 2px 0 12px; color: var(--ink-soft); }
.news-author { margin-left: 8px; }
.news-comments { text-align: right; }

/* The in-game status window: the one loud element on the page. */

.game-window {
	background: #2a2219;
	border: 2px solid #0d0905;
	box-shadow: inset 1px 1px 0 #6b5a46, inset -1px -1px 0 #120c07, 0 4px 0 rgba(0, 0, 0, 0.35);
	color: #c8c8c8;
	font-weight: bold;
	font-size: 12px;
	text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

.game-window-title {
	margin: 0;
	padding: 4px 10px;
	font: bold 12px/1.4 var(--font-body);
	color: #d8d8d8;
	background: #3d3226;
	border-bottom: 1px solid #0d0905;
}

.game-window-body { padding: 14px 12px; }

.lamp {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 12px;
	font-size: 22px;
	line-height: 1;
}

.lamp::before {
	content: "";
	width: 14px;
	height: 14px;
	box-shadow: 0 0 0 2px #000, 0 0 12px currentColor;
	background: currentColor;
}

.lamp.is-online { color: var(--online); }
.lamp.is-offline { color: var(--offline); }

@media (prefers-reduced-motion: no-preference) {
	.lamp.is-online::before { animation: pulse 2.4s steps(4) infinite; }
}

@keyframes pulse {
	50% { box-shadow: 0 0 0 2px #000, 0 0 4px currentColor; }
}

.stats {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 12px;
	margin: 0 0 12px;
}
.stats dt { color: #9a9a9a; }
.stats dd { margin: 0; color: #f0f0f0; }

.game-note { margin: 0 0 12px; font-weight: normal; }

.game-link { color: #8fb3ff; }

/* Sidebar boxes */

.box { color: var(--parchment); }
.box p { margin: 0 0 10px; }
.box a:not(.button) { color: var(--brass-light); }
.box-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.box .button { background: var(--brass); color: var(--wood-950); box-shadow: inset 1px 1px 0 var(--brass-light), inset -1px -1px 0 #7a5d22; }
.box .button:hover { background: var(--brass-light); }

.steps { margin: 0; padding-left: 20px; }
.steps li + li { margin-top: 8px; }

.copy-row {
	display: grid;
	justify-items: start;
	gap: 6px;
	margin-top: 6px;
}

.copy-row code {
	display: block;
	width: 100%;
	font-size: 10.5px;
	padding: 4px 6px;
	background: var(--wood-950);
	color: var(--brass-light);
	overflow-wrap: anywhere;
}

.empty-state {
	color: var(--ink-soft);
	font-style: italic;
}

.copy-button {
	font: bold 11px/1 var(--font-body);
	padding: 5px 8px;
	border: 0;
	background: var(--brass);
	color: var(--wood-950);
	cursor: pointer;
}

/* Footer */

.site-footer {
	max-width: 1240px;
	margin: 28px auto 0;
	padding: 16px 16px 32px;
	color: var(--parchment-dark);
	text-align: center;
	font-size: 11px;
}
.site-footer a { color: var(--brass-light); }

/* Tablet: sidebar boxes move under the page, side by side. */

@media (max-width: 1080px) {
	.layout {
		grid-template-columns: 200px minmax(0, 1fr);
		grid-template-areas: "nav main" "nav aside";
	}
	.sidebar { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* Phone: one column, menu behind a toggle, status pill in the masthead. */

@media (max-width: 760px) {
	.masthead-inner { padding: 18px 16px 14px; }
	.wordmark { font-size: 2.6rem; }

	.status-pill {
		display: inline-block;
		margin: 6px 0 0;
		padding: 3px 10px;
		background: var(--wood-950);
		font-weight: bold;
	}
	.status-pill.is-online { color: var(--online); }
	.status-pill.is-offline { color: var(--offline); }

	.layout {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "nav" "main" "aside";
		margin-top: 16px;
	}

	.nav-toggle {
		display: block;
		width: 100%;
		padding: 10px 14px;
		font: 1.2rem/1 var(--font-display);
		text-align: left;
		color: var(--wood-950);
		background: var(--brass);
		border: 0;
		cursor: pointer;
	}

	.js .nav-groups { display: none; margin-top: 12px; }
	.js .nav-groups.is-open { display: grid; }

	.parchment { padding: 18px 16px 24px; }
	.content div[style*="border-radius:50px"] {
		position: static !important;
		margin: 0 auto 12px !important;
	}
	.page-title { font-size: 1.7rem; }
	.content { overflow-x: auto; }
}

.content .item_image { image-rendering: pixelated; }

/* ===== Panels, forms and alerts (DrapOTS overrides of MyAAC views) ===== */

.panel {
	margin: 0 0 20px;
	background: #f6eed7;
	border: 1px solid rgba(74, 46, 25, 0.35);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

/* .content scope beats the generic ".content h2" rule below in specificity. */
.content .panel-title {
	margin: 0;
	padding: 8px 14px;
	font: bold 13px/1.4 var(--font-body);
	color: var(--parchment);
	background: var(--wood-700);
	border-bottom: 2px solid var(--brass);
}

.panel-body { padding: 14px; }
.panel-body > table { width: 100%; }
.panel-success .panel-title { background: #2f5d2a; }

.intro { margin-bottom: 18px; }
.lead { font-size: 15px; margin: 0 0 8px; color: var(--wood-700); }
.facts { margin: 0; padding-left: 18px; }
.facts li + li { margin-top: 4px; }

.alert {
	margin: 0 0 18px;
	padding: 12px 14px;
	border-left: 4px solid;
	background: #fbf3e2;
}
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-error { border-color: #8b1a1a; color: #5c1010; }

.form-card { max-width: 640px; }

.form-section {
	margin: 0 0 18px;
	padding: 16px 18px 6px;
	border: 1px solid rgba(74, 46, 25, 0.3);
	background: #f6eed7;
}

.form-section legend {
	padding: 0 8px;
	font: 1.25rem/1 var(--font-display);
	color: var(--wood-700);
}

.field { margin: 0 0 14px; }

.field > label,
.field-label {
	display: block;
	margin-bottom: 4px;
	font-weight: bold;
	color: var(--wood-700);
}

.field-control { display: flex; align-items: center; gap: 8px; }

.content .field input[type="text"],
.content .field input[type="email"],
.content .field input[type="password"],
.content .field select {
	width: 100%;
	max-width: 380px;
	padding: 7px 9px;
}

.field-indicator { width: 16px; height: 16px; }
.field-flag { max-height: 14px; }
.field-hint { margin: 4px 0 0; font-size: 12px; color: var(--ink-soft); }
.field .FormFieldError { display: block; margin-top: 4px; font-size: 12px; }
.field .FormFieldError:empty { display: none; }

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }

.choice {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	background: #fbf5e4;
	border: 1px solid rgba(74, 46, 25, 0.35);
	cursor: pointer;
}
.choice:has(input:checked) { background: var(--brass); border-color: var(--wood-700); font-weight: bold; }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.field-check .choice { background: none; border: 0; padding: 0; }

.form-actions { margin: 6px 0 20px; }
.button-primary { padding: 11px 22px; font-size: 13px; }

/* ===== MyAAC legacy markup (tibiacom-era frames, shadows, captions) ===== */

.content .TableShadowContainerRightTop,
.content .TableShadowRightTop,
.content .TableShadowContainer,
.content .TableBottomShadow,
.content [class^="BoxFrame"],
.content .AttentionSign,
.content [class^="CaptionEdge"],
.content [class^="CaptionVertical"],
.content [class^="CaptionBorder"] { display: none !important; }

.content .TableContentAndRightShadow,
.content .TableContentContainer,
.content .InnerTableContainer,
.content .TableContainer,
.content .CaptionContainer,
.content .CaptionInnerContainer {
	background: none !important;
	border: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	width: auto !important;
	height: auto !important;
}

.content .TableContainer { margin-bottom: 16px !important; }

.content .CaptionContainer .Text,
.content .TableContainer .Text {
	padding: 8px 14px;
	font: bold 13px/1.4 var(--font-body);
	color: var(--parchment);
	background: var(--wood-700);
	border-bottom: 2px solid var(--brass);
}

.content table.TableContent,
.content table.Table1,
.content table.Table3,
.content table.Table5 {
	width: 100% !important;
	border: 0 !important;
	border-collapse: collapse;
	background: #f6eed7;
}

.content table.TableContent td,
.content table.Table1 td,
.content table.Table3 td,
.content table.Table5 td {
	padding: 8px 12px;
	border-bottom: 1px solid rgba(74, 46, 25, 0.12);
}

.content .LabelV,
.content .LabelV150,
.content .LabelH {
	font-weight: bold;
	color: var(--wood-700);
	white-space: nowrap;
}
.content .LabelV150 { width: 150px; }

.content tr:has(> td > .FormFieldError:empty) { display: none; }

/* Data tables (highscores, online, guilds) */
.content .myaac-table { border-collapse: collapse; }
.content .myaac-table > thead > tr > td,
.content .myaac-table > thead > tr > th { padding: 8px 10px; text-align: left; }
.content .myaac-table > tbody > tr > td { padding: 6px 10px; }

@media (max-width: 760px) {
	.field-pair { grid-template-columns: 1fr; }
	.form-section { padding: 14px 12px 4px; }
	.content .LabelV,
	.content .LabelV150 { white-space: normal; width: auto; }
}

/* ===== Home page welcome ===== */

.hero {
	margin: -4px 0 26px;
	padding: 0 0 22px;
	border-bottom: 2px solid var(--brass);
}

.hero-title {
	margin: 0 0 8px;
	font: 2.4rem/1.1 var(--font-display);
	color: var(--wood-700);
}

.hero-text {
	margin: 0 0 16px;
	max-width: 60ch;
	font-size: 15px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }

.button-quiet {
	background: transparent;
	color: var(--wood-700);
	box-shadow: inset 0 0 0 2px var(--wood-700);
}
.button-quiet:hover { background: var(--wood-700); color: var(--parchment); }

.hero-facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 10px;
	margin: 0;
}
.hero-facts div {
	padding: 8px 10px;
	background: rgba(74, 46, 25, 0.08);
	border-left: 3px solid var(--brass);
}
.hero-facts dt { font-size: 11px; color: var(--ink-soft); }
.hero-facts dd { margin: 2px 0 0; font-weight: bold; color: var(--wood-700); }

/* ===== Content pages (rules, server info, downloads) ===== */

.content h3 { margin: 22px 0 8px; font-size: 1.25rem; }
.content h3:first-child { margin-top: 0; }

.info-table {
	width: 100%;
	margin: 0 0 8px;
	border-collapse: collapse;
	background: #f6eed7;
	border: 1px solid rgba(74, 46, 25, 0.25);
}
.info-table th,
.info-table td {
	padding: 7px 12px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid rgba(74, 46, 25, 0.12);
}
.info-table th { width: 45%; color: var(--wood-700); }

@media (max-width: 760px) {
	.hero-title { font-size: 1.9rem; }
	.info-table th { width: 40%; }
}

/* ===== FAQ ===== */

.faq { display: grid; gap: 8px; }

.faq-item {
	background: #f6eed7;
	border: 1px solid rgba(74, 46, 25, 0.3);
}

.faq-item summary {
	padding: 10px 14px;
	font-weight: bold;
	color: var(--wood-700);
	cursor: pointer;
}

.faq-item[open] summary { border-bottom: 1px solid rgba(74, 46, 25, 0.15); }
.faq-answer { padding: 10px 14px 12px; max-width: 72ch; }
