/* Copyright © beginning at 2026- BlackDevilCreations
* Author: Patrick Wenzel
* All rights reserved.
* This file and the corresponding Definition is part of a BlackDevilCreations project and may not be distributed, copied,
* or modified without prior written permission from BlackDevilCreations.
*/

@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/cinzel-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/cinzel-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/cinzel-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel Decorative'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/cinzel-decorative-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel Decorative'; font-style: normal; font-weight: 900; font-display: swap; src: url('/fonts/cinzel-decorative-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'IM Fell English'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/im-fell-english-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IM Fell English'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/im-fell-english-latin-400-italic.woff2') format('woff2'); }

:root {
	--bg-abyss: #070607;
	--wood-dark: #1d120c;
	--iron-mid: #2c3037;
	--obsidian-core: #060609;
	--gold-shadow: #4a3512;
	--gold-dark: #7d5b20;
	--gold-mid: #b88c3a;
	--gold-bright: #e7c26c;
	--gold-pale: #fae3a2;
	--blood-abyss: #280206;
	--blood-dark: #58060e;
	--blood-mid: #980d1b;
	--blood-bright: #d91c2e;
	--blood-glow: rgba(217, 28, 46, 0.55);
	--text-parchment: #d6cbb8;
	--text-muted: #a59985;
	--text-gold: #dfba69;
	--header-height: 92px;
	--footer-height: 64px;
	--title-height: 160px;
	--font-ui: 'Cinzel', Georgia, serif;
	--font-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
	--font-text: 'IM Fell English', Georgia, serif;
	--font-mono: ui-monospace, 'Cascadia Code', Consolas, 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
	overflow: hidden;
	background-color: var(--bg-abyss);
	background-image:
		radial-gradient(ellipse at 50% 0%, rgba(120, 14, 24, 0.16) 0%, transparent 55%),
		radial-gradient(ellipse at 15% 40%, rgba(184, 140, 58, 0.06) 0%, transparent 45%),
		radial-gradient(ellipse at 85% 75%, rgba(120, 14, 24, 0.12) 0%, transparent 50%),
		radial-gradient(circle at 50% 50%, #120e0c 0%, #060506 100%);
	color: var(--text-parchment);
	font-family: var(--font-text);
	font-size: 17px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	opacity: 0.35;
	background-image:
		radial-gradient(circle at 20% 30%, #241913 0%, transparent 28%),
		radial-gradient(circle at 75% 20%, #1e1510 0%, transparent 32%),
		radial-gradient(circle at 45% 80%, #261a14 0%, transparent 35%),
		repeating-linear-gradient(12deg, rgba(10, 7, 5, 0.4) 0px, rgba(10, 7, 5, 0.4) 2px, transparent 2px, transparent 9px);
}

body::after {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 50;
	background: radial-gradient(circle at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.72) 100%);
}

a { color: var(--gold-bright); text-decoration-color: rgba(231, 194, 108, 0.45); text-underline-offset: 3px; }
a:hover { color: var(--gold-pale); text-decoration-color: var(--blood-bright); }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
button { font: inherit; }
img { max-width: 100%; height: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== App shell ===== */
.app {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
	height: 100vh;
	height: 100dvh;
}

.site-header {
	position: relative;
	z-index: 20;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 22px;
	padding: 0 64px 0 24px;
	background:
		linear-gradient(180deg, rgba(20, 15, 13, 0.97) 0%, rgba(11, 9, 9, 0.97) 100%);
	border-bottom: 2px solid #2b2116;
	box-shadow:
		0 14px 34px rgba(0, 0, 0, 0.85),
		inset 0 -1px 0 rgba(184, 140, 58, 0.32);
}

.site-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -2px;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--gold-mid), var(--blood-bright), var(--gold-mid), transparent);
}

.nav-group { display: flex; align-items: center; gap: 18px; }
.nav-left { justify-content: flex-end; }
.nav-right { justify-content: flex-start; }

.site-title {
	position: relative;
	z-index: 2;
	align-self: start;
	display: block;
	width: calc(var(--title-height) * 1.8092);
	height: var(--title-height);
	filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 22px rgba(152, 13, 27, 0.25));
	transition: filter 0.3s ease, transform 0.3s ease;
}

.site-title img { display: block; width: 100%; height: 100%; }
.site-title:hover { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 26px rgba(217, 28, 46, 0.45)); }

.login-corner {
	position: absolute;
	top: 8px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 9px;
	font-family: var(--font-ui);
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	color: #9e9382;
	background: linear-gradient(180deg, #23242b 0%, #111115 100%);
	border: 1px solid var(--gold-dark);
	border-radius: 3px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
	transition: color 0.15s ease, border-color 0.15s ease;
}

.login-corner svg { width: 12px; height: 12px; }
.login-corner:hover, .login-corner.is-admin { color: var(--gold-bright); border-color: var(--gold-bright); }

.site-header .menu-toggle { display: none; }
.menu-toggle svg { width: 22px; height: 22px; }

/* ===== Content area ===== */
.content-shell {
	position: relative;
	z-index: 1;
	display: flex;
	min-height: 0;
}

.content-viewport {
	flex: 1;
	min-width: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: none;
	outline: none;
}

.content-viewport::-webkit-scrollbar { display: none; }

.content-inner {
	max-width: 1320px;
	margin: 0 auto;
	padding: calc(var(--title-height) - var(--header-height) + 26px) 28px 48px;
}

.content-inner.is-wide { max-width: 1680px; }
.page-enter { animation: pageEnter 0.32s ease both; }

@keyframes pageEnter {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* ===== Footer ===== */
.site-footer {
	position: relative;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	max-height: var(--footer-height);
	padding: 0 24px;
	background: linear-gradient(180deg, rgba(11, 9, 9, 0.97) 0%, rgba(20, 15, 13, 0.97) 100%);
	border-top: 2px solid #2b2116;
	box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(184, 140, 58, 0.32);
	font-family: var(--font-ui);
	font-size: 0.78rem;
	letter-spacing: 0.12em;
}

.site-footer::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -2px;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--gold-mid), var(--blood-bright), var(--gold-mid), transparent);
}

.footer-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--gold-bright); font-family: var(--font-display); font-weight: 700; letter-spacing: 0.1em; }
.footer-links { display: flex; align-items: center; gap: 18px; }
.footer-links a { color: #b7aa96; text-decoration: none; text-transform: uppercase; font-size: 0.72rem; }
.footer-links a:hover, .footer-links a.active { color: var(--gold-bright); }

/* ===== Ornaments ===== */
.ruby-gem {
	display: inline-block;
	width: 14px;
	height: 14px;
	transform: rotate(45deg);
	background: linear-gradient(135deg, #ff8a96 0%, #d91c2e 32%, #7a0712 72%, #2c0206 100%);
	border: 1.5px solid var(--gold-bright);
	box-shadow: 0 0 10px var(--blood-glow), inset 0 0 3px rgba(255, 220, 225, 0.75);
	position: relative;
	flex-shrink: 0;
}

.ruby-gem::after { content: ""; position: absolute; inset: 2px; border: 1px solid rgba(255, 175, 185, 0.45); }
.ruby-gem.is-small { width: 9px; height: 9px; }

.corner-ornament {
	position: absolute;
	width: 34px;
	height: 34px;
	z-index: 5;
	pointer-events: none;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

.corner-tl { top: 2px; left: 2px; }
.corner-tr { top: 2px; right: 2px; transform: scaleX(-1); }
.corner-bl { bottom: 2px; left: 2px; transform: scaleY(-1); }
.corner-br { bottom: 2px; right: 2px; transform: scale(-1, -1); }

/* ===== Window_Frame ===== */
.window-frame {
	position: relative;
	border-radius: 6px;
	padding: 12px;
	background-color: #140f0c;
	background-image:
		radial-gradient(circle at 12% 18%, rgba(48, 32, 21, 0.7) 0%, transparent 25%),
		radial-gradient(circle at 88% 82%, rgba(44, 28, 18, 0.75) 0%, transparent 28%),
		linear-gradient(180deg, #211914 0%, #0d0908 100%);
	border: 2px solid #3c2b1c;
	box-shadow:
		0 24px 55px rgba(0, 0, 0, 0.92),
		0 0 0 1px #050404,
		inset 0 0 18px rgba(0, 0, 0, 0.95),
		inset 0 1px 0 rgba(184, 140, 58, 0.35);
}

.window-frame + .window-frame { margin-top: 30px; }

.window-frame::before {
	content: "";
	position: absolute;
	inset: 4px;
	border: 1px solid rgba(184, 140, 58, 0.42);
	border-radius: 4px;
	pointer-events: none;
	z-index: 3;
}

.window-stone-body {
	position: relative;
	border-radius: 4px;
	overflow: hidden;
	border: 2px solid #09080a;
	background-color: #141316;
	background-image:
		linear-gradient(335deg, rgba(8, 7, 9, 0.72) 19px, transparent 19px),
		linear-gradient(155deg, rgba(11, 10, 13, 0.78) 19px, transparent 19px),
		linear-gradient(335deg, rgba(32, 29, 35, 0.42) 19px, transparent 19px),
		linear-gradient(155deg, rgba(38, 34, 41, 0.38) 19px, transparent 19px),
		radial-gradient(circle at 50% 0%, rgba(152, 13, 27, 0.12), transparent 65%);
	background-size: 48px 48px, 48px 48px, 48px 48px, 48px 48px, 100% 100%;
	background-position: 0px 2px, 4px 29px, 24px 26px, 28px 5px, 0 0;
	box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.92);
}

.window-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	padding: 14px 22px;
	background: linear-gradient(90deg, rgba(10, 9, 12, 0.96) 0%, rgba(25, 22, 28, 0.92) 50%, rgba(10, 9, 12, 0.96) 100%);
	border-bottom: 2px solid #2b2116;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(231, 194, 108, 0.32), inset 0 -1px 0 rgba(184, 140, 58, 0.25);
}

.window-header::after {
	content: "";
	position: absolute;
	left: 24px;
	right: 24px;
	bottom: -2px;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--gold-mid), var(--blood-bright), var(--gold-mid), transparent);
}

.window-title-group { display: flex; align-items: center; gap: 12px; min-width: 0; }

.window-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.12rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.3;
	color: var(--gold-bright);
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}

.window-content { position: relative; padding: 26px 28px; }
.window-content.is-flush { padding: 0; }

/* ===== Border_Frame ===== */
.border-frame {
	position: relative;
	padding: 18px;
	border-radius: 5px;
	background: linear-gradient(180deg, rgba(16, 13, 12, 0.92) 0%, rgba(10, 9, 11, 0.96) 100%);
	border: 2px solid #2e261f;
	box-shadow:
		inset 0 0 22px rgba(0, 0, 0, 0.95),
		inset 0 0 0 3px #09080a,
		inset 0 0 0 4px rgba(184, 140, 58, 0.38),
		0 10px 24px rgba(0, 0, 0, 0.75);
}

.border-frame-rail {
	position: absolute;
	top: -9px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 2px 14px;
	font-family: var(--font-ui);
	font-size: 0.7rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--gold-bright);
	background: linear-gradient(180deg, #1b1c29 0%, #07070b 100%);
	border: 1px solid var(--gold-mid);
	border-radius: 3px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
}

/* ===== Button_Simple ===== */
.btn-simple {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 150px;
	min-height: 44px;
	padding: 10px 26px;
	font-family: var(--font-ui);
	font-size: 0.86rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	color: #cfc4b2;
	cursor: pointer;
	border-radius: 3px;
	border: 2px solid #41454f;
	background: linear-gradient(180deg, rgba(84, 90, 102, 0.25) 0%, rgba(34, 35, 41, 0.85) 18%, rgba(20, 20, 24, 0.96) 82%, rgba(10, 10, 13, 1) 100%);
	box-shadow:
		0 0 0 2px #1a110b,
		0 0 0 3px #3a2719,
		0 7px 16px rgba(0, 0, 0, 0.88),
		inset 0 1px 0 rgba(190, 198, 214, 0.28),
		inset 0 -2px 5px rgba(0, 0, 0, 0.9);
	transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-simple::before, .btn-simple::after {
	content: "";
	position: absolute;
	top: calc(50% - 3px);
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 35%, #8c95a6, #282b33 70%);
	box-shadow: 0 1px 2px #000;
}

.btn-simple::before { left: 8px; }
.btn-simple::after { right: 8px; }

.btn-simple:hover, .btn-simple.active {
	color: var(--gold-pale);
	border-color: var(--gold-dark);
	background: linear-gradient(180deg, rgba(122, 102, 66, 0.26) 0%, rgba(39, 38, 45, 0.9) 22%, rgba(22, 21, 26, 0.98) 85%, #0c0b0e 100%);
	box-shadow:
		0 0 0 2px #1d130c,
		0 0 0 3px var(--gold-shadow),
		0 9px 20px rgba(0, 0, 0, 0.92),
		0 0 14px rgba(184, 140, 58, 0.2),
		inset 0 1px 0 rgba(231, 194, 108, 0.35);
}

.btn-simple.active { border-color: var(--gold-mid); }

.btn-simple:active {
	transform: translateY(2px);
	box-shadow: 0 0 0 2px #1a110b, 0 0 0 3px #3a2719, 0 2px 6px rgba(0, 0, 0, 0.95), inset 0 3px 8px rgba(0, 0, 0, 0.95);
}

.btn-simple:disabled, .btn-main:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-simple.is-compact { min-width: 0; min-height: 36px; padding: 6px 20px; font-size: 0.74rem; }
.btn-simple.is-danger:hover { color: #ffb3ba; border-color: var(--blood-mid); box-shadow: 0 0 0 2px #1d130c, 0 0 0 3px var(--blood-dark), 0 0 14px rgba(217, 28, 46, 0.35); }

/* ===== Button_Main ===== */
.btn-main {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-width: 180px;
	min-height: 48px;
	padding: 11px 26px;
	font-family: var(--font-display);
	font-size: 0.92rem;
	font-weight: 900;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	white-space: nowrap;
	text-decoration: none;
	color: var(--gold-pale);
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 12px rgba(231, 194, 108, 0.28);
	cursor: pointer;
	border-radius: 4px;
	border: 2px solid var(--gold-mid);
	background: linear-gradient(135deg, rgba(53, 57, 82, 0.42) 0%, rgba(11, 12, 18, 0.95) 35%, rgba(5, 5, 8, 0.99) 68%, rgba(44, 47, 68, 0.45) 100%);
	box-shadow:
		0 0 0 3px #23150d,
		0 0 0 5px #14161b,
		0 0 0 6px var(--gold-dark),
		0 12px 26px rgba(0, 0, 0, 0.95),
		inset 0 1px 1px rgba(250, 227, 162, 0.45),
		inset 0 -3px 8px rgba(0, 0, 0, 0.95);
	transition: transform 0.12s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.btn-main-gem {
	width: 11px;
	height: 11px;
	transform: rotate(45deg);
	background: radial-gradient(circle at 32% 32%, #ff9aa4, var(--blood-bright) 42%, var(--blood-dark) 80%);
	border: 1px solid var(--gold-pale);
	box-shadow: 0 0 10px var(--blood-glow);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-main:hover, .btn-main.active, .btn-main[aria-expanded="true"] {
	border-color: var(--gold-bright);
	box-shadow:
		0 0 0 3px #2b190f,
		0 0 0 5px #1c1f26,
		0 0 0 6px var(--gold-bright),
		0 14px 30px rgba(0, 0, 0, 0.98),
		0 0 22px rgba(184, 140, 58, 0.32),
		0 0 16px rgba(217, 28, 46, 0.28),
		inset 0 1px 2px rgba(250, 227, 162, 0.65);
}

.btn-main:hover .btn-main-gem, .btn-main[aria-expanded="true"] .btn-main-gem { transform: rotate(225deg) scale(1.15); box-shadow: 0 0 15px rgba(255, 45, 65, 0.95); }
.btn-main:active { transform: translateY(2px); }

/* ===== Multibutton The Game ===== */
.multi-button { position: relative; }

.multi-menu {
	position: absolute;
	top: calc(100% + 14px);
	left: 50%;
	z-index: 30;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px 14px;
	min-width: 100%;
	transform: translate(-50%, -8px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	border-radius: 5px;
	background: linear-gradient(180deg, rgba(19, 17, 22, 0.98) 0%, rgba(9, 8, 11, 0.98) 100%);
	border: 2px solid var(--gold-dark);
	box-shadow: 0 0 0 3px #17100b, 0 0 0 4px #2a2c35, 0 18px 40px rgba(0, 0, 0, 0.95), inset 0 0 18px rgba(0, 0, 0, 0.9);
	transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.22s;
}

.multi-menu::before {
	content: "";
	position: absolute;
	top: -8px;
	left: calc(50% - 7px);
	width: 14px;
	height: 14px;
	transform: rotate(45deg);
	background: #131116;
	border-left: 2px solid var(--gold-dark);
	border-top: 2px solid var(--gold-dark);
}

.multi-button.is-open .multi-menu {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate(-50%, 0);
	transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.multi-menu .btn-simple { width: 100%; }

/* ===== Checkbox ===== */
.gothic-checkbox { position: relative; display: inline-flex; align-items: center; gap: 14px; cursor: pointer; padding: 6px 0; }
.gothic-checkbox input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.checkbox-socket {
	position: relative;
	width: 30px;
	height: 30px;
	flex-shrink: 0;
	border-radius: 4px;
	background: radial-gradient(circle at 50% 50%, #070709 0%, #15151b 78%, #262730 100%);
	border: 2px solid #4c3b23;
	box-shadow: 0 0 0 2px #100e11, 0 0 0 3px #2e2f38, inset 0 3px 8px rgba(0, 0, 0, 0.98), 0 4px 10px rgba(0, 0, 0, 0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.checkbox-socket::before { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(184, 140, 58, 0.28); border-radius: 2px; }

.checkbox-jewel {
	width: 13px;
	height: 13px;
	transform: rotate(45deg) scale(0.35);
	opacity: 0;
	background: linear-gradient(135deg, #ff9aa4 0%, #e01b2e 38%, #7d0611 78%, #2e0206 100%);
	border: 1.5px solid var(--gold-pale);
	box-shadow: 0 0 14px rgba(224, 27, 46, 0.92), inset 0 0 4px rgba(255, 225, 230, 0.85);
	transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}

.gothic-checkbox:hover .checkbox-socket { border-color: var(--gold-mid); }
.gothic-checkbox input:focus-visible + .checkbox-socket { outline: 2px solid var(--gold-bright); outline-offset: 4px; }

.gothic-checkbox input:checked + .checkbox-socket {
	border-color: var(--gold-bright);
	background: radial-gradient(circle at 50% 50%, rgba(152, 13, 27, 0.48) 0%, #0a090d 78%);
	box-shadow: 0 0 0 2px #160c0e, 0 0 0 3px var(--gold-mid), 0 0 16px rgba(217, 28, 46, 0.42), inset 0 2px 6px rgba(0, 0, 0, 0.92);
}

.gothic-checkbox input:checked + .checkbox-socket .checkbox-jewel { opacity: 1; transform: rotate(45deg) scale(1); }
.checkbox-label-text { font-family: var(--font-ui); font-size: 0.86rem; font-weight: 600; letter-spacing: 0.06em; color: var(--text-parchment); }

/* ===== Slider_Horizontal ===== */
.gothic-slider { display: flex; align-items: center; gap: 14px; }
.gothic-slider-label { font-family: var(--font-ui); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.gothic-slider-wrapper { position: relative; flex: 1; min-width: 140px; height: 36px; display: flex; align-items: center; padding: 0 12px; }

.gothic-slider-track {
	position: relative;
	width: 100%;
	height: 14px;
	border-radius: 3px;
	background: linear-gradient(180deg, #070709 0%, #16161b 55%, #23242b 100%);
	border: 2px solid #353740;
	box-shadow: 0 0 0 2px #140e0a, 0 0 0 3px var(--gold-shadow), inset 0 3px 7px rgba(0, 0, 0, 0.98);
}

.gothic-slider-track::before, .gothic-slider-track::after {
	content: "";
	position: absolute;
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
	width: 10px;
	height: 10px;
	background: linear-gradient(135deg, var(--gold-pale), var(--gold-dark));
	border: 1px solid #161109;
	z-index: 3;
}

.gothic-slider-track::before { left: -7px; }
.gothic-slider-track::after { right: -7px; }

.gothic-slider-fill {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: var(--slider-percent, 50%);
	border-radius: 2px 0 0 2px;
	background: linear-gradient(180deg, #e02437 0%, #9b0c1a 48%, #47030a 100%);
	box-shadow: 0 0 12px rgba(217, 28, 46, 0.65), inset 0 1px 1px rgba(255, 175, 185, 0.55);
}

.gothic-slider-ticks {
	position: absolute;
	inset: 0;
	background-image: repeating-linear-gradient(90deg, transparent 0%, transparent calc(10% - 1px), rgba(231, 194, 108, 0.25) calc(10% - 1px), rgba(231, 194, 108, 0.25) 10%);
	pointer-events: none;
}

.gothic-slider-thumb {
	position: absolute;
	top: 50%;
	left: var(--slider-percent, 50%);
	width: 22px;
	height: 22px;
	transform: translate(-50%, -50%) rotate(45deg);
	border-radius: 3px;
	background: linear-gradient(135deg, #27293b 0%, #09090e 55%, #1d1f2e 100%);
	border: 2px solid var(--gold-bright);
	box-shadow: 0 0 0 2px #140f0a, 0 4px 12px rgba(0, 0, 0, 0.95), 0 0 12px rgba(184, 140, 58, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	z-index: 4;
}

.gothic-slider-thumb::after {
	content: "";
	width: 8px;
	height: 8px;
	background: radial-gradient(circle at 35% 35%, #ff9aa4, var(--blood-bright) 50%, var(--blood-dark));
	border: 1px solid var(--gold-pale);
	box-shadow: 0 0 8px var(--blood-glow);
}

.gothic-slider-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 5; }
.gothic-slider-input:focus-visible ~ .gothic-slider-track { outline: 2px solid var(--gold-bright); outline-offset: 6px; }

/* ===== ProgressBar_Horizontal ===== */
.progressbar-frame {
	position: relative;
	height: 28px;
	padding: 4px;
	border-radius: 4px;
	background: linear-gradient(180deg, #25262d 0%, #121216 50%, #09090b 100%);
	border: 2px solid var(--gold-dark);
	box-shadow: 0 0 0 2px #17100b, 0 0 0 4px #2c2e36, 0 8px 18px rgba(0, 0, 0, 0.9), inset 0 2px 6px rgba(0, 0, 0, 0.95);
}

.progressbar-cavity { position: relative; width: 100%; height: 100%; border-radius: 2px; overflow: hidden; background: radial-gradient(ellipse at 50% 50%, #140709 0%, #060507 100%); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.98); }

.progressbar-fill {
	position: relative;
	height: 100%;
	width: 0%;
	background: linear-gradient(180deg, #ff4d5e 0%, #c91426 24%, #850814 68%, #3c0208 100%);
	box-shadow: 0 0 18px rgba(217, 28, 46, 0.78), inset 0 1px 1px rgba(255, 210, 215, 0.65);
	transition: width 0.22s ease;
}

.progressbar-fill::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.08) 0px, rgba(255, 255, 255, 0.08) 8px, transparent 8px, transparent 16px); }

.progressbar-label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	font-family: var(--font-ui);
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	color: var(--gold-pale);
	text-shadow: 0 1px 4px #000, 0 0 8px #000;
}

/* ===== Scrollbar_Vertical / ScrollbarKnob_Vertical ===== */
.scrollbar-vertical {
	position: relative;
	width: 26px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 4px 3px;
	background: linear-gradient(90deg, #09080a 0%, #191618 45%, #0c0b0d 100%);
	border-left: 2px solid #2b2117;
	box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.98), inset 1px 0 0 rgba(184, 140, 58, 0.25);
	user-select: none;
	touch-action: none;
}

.scrollbar-vertical.is-hidden { display: none; }

.scrollbar-cap {
	width: 100%;
	height: 14px;
	padding: 0;
	cursor: pointer;
	border-radius: 2px;
	background: linear-gradient(180deg, #32343d 0%, #15161b 100%);
	border: 1px solid var(--gold-dark);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.scrollbar-cap::after { content: ""; width: 5px; height: 5px; transform: rotate(45deg); background: var(--gold-bright); }
.scrollbar-cap:hover { border-color: var(--gold-bright); }

.scrollbar-track-area {
	position: relative;
	flex: 1;
	margin: 5px 0;
	border-radius: 2px;
	background: repeating-linear-gradient(180deg, rgba(184, 140, 58, 0.14) 0px, rgba(184, 140, 58, 0.14) 1px, transparent 1px, transparent 12px), #070709;
	border: 1px solid #22232b;
	cursor: pointer;
}

.scrollbar-knob-vertical {
	position: absolute;
	top: 0;
	left: 1px;
	right: 1px;
	height: 76px;
	border-radius: 3px;
	cursor: grab;
	will-change: transform;
	background: linear-gradient(90deg, #2d3039 0%, #15161d 35%, #09090d 65%, #2b2e38 100%);
	border: 1.5px solid var(--gold-bright);
	box-shadow: 0 0 0 1px #140e09, 0 4px 10px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(250, 227, 162, 0.55), inset 0 -1px 0 rgba(250, 227, 162, 0.35);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scrollbar-knob-vertical:hover, .scrollbar-knob-vertical.dragging {
	cursor: grabbing;
	border-color: var(--gold-pale);
	box-shadow: 0 0 0 1px #140e09, 0 0 14px rgba(184, 140, 58, 0.45), 0 0 10px rgba(217, 28, 46, 0.45), inset 0 1px 0 rgba(250, 227, 162, 0.75);
}

.knob-ridge { width: 8px; height: 1.5px; background: var(--gold-mid); }
.knob-ruby { width: 8px; height: 8px; transform: rotate(45deg); background: radial-gradient(circle at 35% 35%, #ff9aa4, var(--blood-bright) 55%, var(--blood-dark)); border: 1px solid var(--gold-pale); box-shadow: 0 0 8px var(--blood-glow); }
.scrollbar-vertical.is-compact .knob-ridge { display: none; }

.scroll-box {
	position: relative;
	display: flex;
	min-height: 0;
	border-radius: 4px;
	background: linear-gradient(180deg, rgba(16, 13, 12, 0.96) 0%, rgba(10, 9, 10, 0.98) 100%);
	border: 2px solid #2e241b;
	box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.96);
	overflow: hidden;
}

.scroll-box-viewport { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.scroll-box-viewport::-webkit-scrollbar { display: none; }

/* ===== Tab-Box / Tab-Button ===== */
.tab-system { display: flex; flex-direction: column; }
.tab-buttons-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 6px; padding: 0 10px; position: relative; z-index: 4; }

.tab-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 44px;
	padding: 11px 22px 12px;
	font-family: var(--font-ui);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #a99e8c;
	cursor: pointer;
	border-radius: 5px 5px 0 0;
	border: 2px solid #2f2a26;
	border-bottom: none;
	background: linear-gradient(180deg, #252226 0%, #151316 65%, #0d0c0e 100%);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 -3px 10px rgba(0, 0, 0, 0.7);
	transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tab-button:hover { color: var(--gold-bright); border-color: #5b4524; }
.tab-jewel { width: 8px; height: 8px; transform: rotate(45deg); background: #2b1619; border: 1px solid #5c4829; transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }

.tab-button.active {
	color: var(--gold-pale);
	padding-top: 13px;
	margin-bottom: -2px;
	border-color: var(--gold-mid);
	background: linear-gradient(180deg, #262129 0%, #131117 45%, #0a090d 100%);
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.92), 0 0 14px rgba(184, 140, 58, 0.22), inset 0 1px 1px rgba(250, 227, 162, 0.45);
}

.tab-button.active::before { content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold-pale), transparent); }
.tab-button.active .tab-jewel { background: radial-gradient(circle at 35% 35%, #ff9aa4, var(--blood-bright) 55%, var(--blood-dark)); border-color: var(--gold-pale); box-shadow: 0 0 10px var(--blood-glow); }

.tab-box {
	position: relative;
	border-radius: 5px;
	padding: 24px;
	background: radial-gradient(circle at 50% 0%, rgba(152, 13, 27, 0.14) 0%, transparent 55%), linear-gradient(180deg, #131116 0%, #09080b 100%);
	border: 2px solid var(--gold-dark);
	box-shadow: 0 0 0 3px #17100b, 0 0 0 4px #2a2c35, inset 0 0 28px rgba(0, 0, 0, 0.96), 0 14px 30px rgba(0, 0, 0, 0.9);
}

.tab-panel { animation: fadeInGothic 0.28s ease; }
@keyframes fadeInGothic { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Markdown ===== */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-family: var(--font-ui); color: var(--gold-bright); letter-spacing: 0.06em; line-height: 1.25; margin: 1.5em 0 0.55em; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95); }
.md h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 900; background: linear-gradient(180deg, var(--gold-pale) 0%, var(--gold-bright) 42%, var(--gold-dark) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.95)); text-shadow: none; }
.md h2 { font-size: 1.45rem; padding-bottom: 6px; border-bottom: 1px solid rgba(184, 140, 58, 0.28); }
.md h3 { font-size: 1.18rem; }
.md h4, .md h5, .md h6 { font-size: 1rem; color: var(--gold-mid); }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 1em; }
.md strong { color: #efe4cf; }
.md em { color: #e2d6bf; }
.md del { color: var(--text-muted); }
.md ul, .md ol { padding-left: 1.6em; }
.md li::marker { color: var(--blood-bright); }
.md li + li { margin-top: 0.25em; }
.md input[type="checkbox"] { accent-color: var(--blood-mid); margin-right: 0.4em; }
.md hr { height: 14px; border: 0; margin: 2em 0; background: radial-gradient(circle at 50% 50%, var(--blood-bright) 0 3px, transparent 4px), linear-gradient(90deg, transparent, var(--gold-mid) 30%, var(--gold-mid) 70%, transparent) center / 100% 1px no-repeat; }
.md blockquote { padding: 12px 18px; border-left: 3px solid var(--blood-mid); background: rgba(10, 9, 11, 0.7); color: #c8bca8; font-style: italic; box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8); }
.md code { font-family: var(--font-mono); font-size: 0.86em; padding: 1px 6px; border-radius: 3px; background: #0b0a0d; border: 1px solid #2c2620; color: var(--gold-pale); }
.md pre { padding: 14px 16px; overflow-x: auto; border-radius: 4px; background: #08070a; border: 1px solid #2c2620; box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.95); }
.md pre code { padding: 0; border: 0; background: none; color: #d6cbb8; }
.md .table-wrap { overflow-x: auto; }
.md table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
.md th, .md td { padding: 8px 12px; border: 1px solid #3a2d1e; text-align: left; }
.md th { font-family: var(--font-ui); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-bright); background: rgba(24, 20, 18, 0.9); }
.md tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.md .md-small { font-size: 0.82em; }
.md .md-large { font-size: 1.3em; }
.md .md-huge { font-size: 1.8em; line-height: 1.2; }
.md .md-center { display: block; text-align: center; }
.md img { border-radius: 3px; }

.md-media {
	display: block;
	position: relative;
	margin: 1.2em auto;
	padding: 0;
	max-width: 100%;
	width: fit-content;
	cursor: zoom-in;
	border: 2px solid #3c2b1c;
	border-radius: 4px;
	background: #08070a;
	box-shadow: 0 0 0 1px #050404, 0 12px 28px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(184, 140, 58, 0.35);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.md-media img { display: block; max-width: 100%; height: auto; border-radius: 2px; }
.md-media:hover { border-color: var(--gold-mid); box-shadow: 0 0 0 1px #050404, 0 12px 28px rgba(0, 0, 0, 0.85), 0 0 18px rgba(184, 140, 58, 0.25); }
.md-media .md-caption { display: block; padding: 6px 10px; font-family: var(--font-text); font-style: italic; font-size: 0.9rem; color: var(--text-muted); text-align: center; }
.md-media.is-video { cursor: pointer; }
.md-missing { display: inline-block; padding: 4px 10px; font-size: 0.85rem; color: var(--text-muted); border: 1px dashed #4c3b23; border-radius: 3px; }

.play-badge {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 68px;
	height: 68px;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: radial-gradient(circle at 40% 35%, rgba(152, 13, 27, 0.95), rgba(40, 2, 6, 0.95));
	border: 2px solid var(--gold-bright);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.7), 0 0 24px rgba(217, 28, 46, 0.6);
	transition: transform 0.2s ease;
	pointer-events: none;
}

.play-badge::after { content: ""; margin-left: 6px; border-style: solid; border-width: 13px 0 13px 22px; border-color: transparent transparent transparent var(--gold-pale); }
:hover > .play-badge, :hover > * > .play-badge { transform: translate(-50%, -50%) scale(1.1); }

/* ===== Forms ===== */
.form-stack { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.form-row.is-end { justify-content: flex-end; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-family: var(--font-ui); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-mid); }
.field-hint { font-size: 0.85rem; font-style: italic; color: var(--text-muted); }

.text-input, .text-area, .select-input {
	width: 100%;
	min-height: 44px;
	padding: 10px 14px;
	font-family: var(--font-text);
	font-size: 1rem;
	color: var(--text-parchment);
	background: linear-gradient(180deg, #08070a 0%, #121115 100%);
	border: 2px solid #3a2d1e;
	border-radius: 3px;
	box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.95), 0 0 0 1px #050404;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-area { min-height: 110px; resize: vertical; line-height: 1.5; }
.select-input { font-family: var(--font-ui); font-size: 0.86rem; letter-spacing: 0.06em; cursor: pointer; }
.text-input:focus, .text-area:focus, .select-input:focus { outline: none; border-color: var(--gold-mid); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.95), 0 0 0 1px #050404, 0 0 12px rgba(184, 140, 58, 0.3); }
.text-input::placeholder, .text-area::placeholder { color: #6e6456; font-style: italic; }

.drop-zone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 190px;
	padding: 22px;
	text-align: center;
	cursor: pointer;
	border-radius: 5px;
	border: 2px dashed #5b4524;
	background: radial-gradient(circle at 50% 50%, rgba(30, 24, 22, 0.55) 0%, rgba(8, 7, 8, 0.92) 100%);
	box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.9);
	transition: border-color 0.2s ease, background 0.2s ease;
}

.drop-zone:hover, .drop-zone.is-dragover { border-color: var(--gold-bright); background: radial-gradient(circle at 50% 50%, rgba(152, 13, 27, 0.22) 0%, rgba(8, 7, 8, 0.92) 100%); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone-title { font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-bright); }
.drop-zone-preview { max-height: 220px; max-width: 100%; border: 1px solid var(--gold-dark); border-radius: 3px; }
.drop-zone-meta { font-size: 0.88rem; color: var(--text-muted); }

/* ===== Home / text pages ===== */
.page-stack { display: flex; flex-direction: column; gap: 30px; }
.loading-rune { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 60px 20px; font-family: var(--font-ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-mid); }
.loading-rune .ruby-gem { animation: runePulse 1.1s ease-in-out infinite; }
@keyframes runePulse { 0%, 100% { opacity: 0.4; box-shadow: 0 0 4px var(--blood-glow); } 50% { opacity: 1; box-shadow: 0 0 18px var(--blood-glow); } }
.empty-note { padding: 30px 10px; text-align: center; font-style: italic; color: var(--text-muted); }
.error-note { padding: 18px; text-align: center; color: #ffb3ba; border: 1px solid var(--blood-dark); background: rgba(40, 2, 6, 0.55); border-radius: 4px; }

/* ===== Codex (Minions / Dungeons) ===== */
.codex-layout { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
.codex-portrait { margin: 0; }
.codex-portrait .md-media { margin: 0; width: 100%; }
.codex-portrait .md-media img { width: 100%; }
.codex-portrait-empty { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 2px dashed #3a2d1e; border-radius: 4px; color: #6e6456; font-style: italic; }
.codex-media-title { margin: 30px 0 16px; font-family: var(--font-ui); font-size: 0.86rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-mid); display: flex; align-items: center; gap: 10px; }
.codex-media-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-dark), transparent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

.media-tile {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	overflow: hidden;
	cursor: zoom-in;
	border-radius: 3px;
	border: 2px solid #3c2b1c;
	background: #08070a;
	box-shadow: 0 0 0 1px #050404, 0 10px 22px rgba(0, 0, 0, 0.85);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.media-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease, filter 0.3s ease; filter: saturate(0.92) brightness(0.92); }
.media-tile:hover { border-color: var(--gold-mid); box-shadow: 0 0 0 1px #050404, 0 10px 22px rgba(0, 0, 0, 0.85), 0 0 18px rgba(184, 140, 58, 0.28); }
.media-tile:hover img { transform: scale(1.04); filter: saturate(1.05) brightness(1.02); }
.media-tile.is-video { cursor: pointer; }
.media-grid .media-tile { aspect-ratio: 16 / 10; }

.media-tile-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 22px 10px 8px;
	font-family: var(--font-ui);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-align: left;
	color: var(--gold-pale);
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.media-tile:hover .media-tile-caption, .media-tile:focus-visible .media-tile-caption { opacity: 1; transform: none; }

/* ===== Gallery (masonry) ===== */
.gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; margin-bottom: 26px; }
.gallery-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-filter .tab-button { border-bottom: 2px solid #2f2a26; border-radius: 4px; }
.gallery-filter .tab-button.active { margin-bottom: 0; border-bottom-color: var(--gold-mid); }
.gallery-size { width: min(320px, 100%); }
.masonry { position: relative; width: 100%; contain: layout; }
.masonry .media-tile { position: absolute; top: 0; left: 0; will-change: transform; }
.masonry-sentinel { height: 1px; }

/* ===== Blog ===== */
.blog-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
.blog-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.blog-sidebar-title { margin: 0; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: 0.1em; color: var(--gold-bright); display: flex; align-items: center; gap: 10px; }
.blog-list-box { height: min(70vh, calc(100dvh - 340px)); min-height: 260px; }
.blog-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

.blog-list-item {
	display: grid;
	grid-template-columns: 84px minmax(0, 1fr);
	gap: 12px;
	align-items: center;
	width: 100%;
	padding: 8px;
	text-align: left;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	border-radius: 4px;
	border: 1px solid rgba(184, 140, 58, 0.18);
	background: rgba(14, 12, 15, 0.92);
	box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9);
	transition: border-color 0.2s ease, background 0.2s ease;
}

.blog-list-item:hover { border-color: var(--gold-dark); color: inherit; }
.blog-list-item.active { border-color: var(--gold-mid); background: linear-gradient(90deg, rgba(88, 6, 14, 0.4), rgba(14, 12, 15, 0.92)); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(184, 140, 58, 0.18); }
.blog-list-thumb { width: 84px; height: 56px; object-fit: cover; border-radius: 2px; border: 1px solid #3c2b1c; background: #08070a; }
.blog-list-thumb.is-empty { display: flex; align-items: center; justify-content: center; }
.blog-list-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.blog-list-title { font-family: var(--font-ui); font-size: 0.84rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.3; color: var(--gold-bright); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.blog-list-date { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.blog-entry-header { font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; line-height: 1.3; letter-spacing: 0.06em; color: var(--gold-bright); }
.blog-entry-date { margin-top: 26px; padding-top: 12px; border-top: 1px solid rgba(184, 140, 58, 0.22); font-family: var(--font-ui); font-size: 0.78rem; letter-spacing: 0.12em; color: var(--text-muted); text-align: right; }

/* ===== Overlay (Lightbox / Picker / Dialog) ===== */
.overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	overflow: auto;
	overscroll-behavior: contain;
	background: rgba(0, 0, 0, 0.7);
	animation: overlayIn 0.2s ease both;
}

.overlay.is-closing { animation: overlayOut 0.16s ease both; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlayOut { from { opacity: 1; } to { opacity: 0; } }

.overlay-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 100%; min-height: 100%; width: max-content; padding: 64px 40px 40px; }
.overlay-stage.is-fit { width: 100%; }

.overlay-image {
	display: block;
	max-width: none;
	cursor: zoom-out;
	border: 2px solid var(--gold-dark);
	box-shadow: 0 0 0 3px #17100b, 0 0 0 4px #2a2c35, 0 24px 60px rgba(0, 0, 0, 0.95);
	background: #08070a;
}

.overlay-stage.is-fit .overlay-image { max-width: 100%; max-height: calc(100dvh - 220px); width: auto; height: auto; cursor: zoom-in; }
.overlay-caption { width: 100%; max-width: 900px; margin-top: 18px; padding: 14px 20px; text-align: center; background: rgba(8, 7, 10, 0.88); border: 1px solid rgba(184, 140, 58, 0.35); border-radius: 4px; }
.overlay-stage:not(.is-fit) .overlay-caption { max-width: min(900px, 100vw - 80px); position: sticky; left: 40px; }
.overlay-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.08em; color: var(--gold-bright); }
.overlay-info { color: var(--text-parchment); text-align: left; }
.overlay-info:empty { display: none; }
.overlay-video { width: min(1280px, 100vw - 80px, (100dvh - 220px) * 16 / 9); aspect-ratio: 16 / 9; border: 2px solid var(--gold-dark); box-shadow: 0 0 0 3px #17100b, 0 0 0 4px #2a2c35, 0 24px 60px rgba(0, 0, 0, 0.95); background: #000; }
.overlay-video iframe { display: block; width: 100%; height: 100%; border: 0; }

.overlay-close {
	position: fixed;
	top: 16px;
	right: 22px;
	z-index: 1010;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 4px;
	color: var(--gold-pale);
	border: 2px solid var(--gold-mid);
	background: linear-gradient(135deg, rgba(53, 57, 82, 0.42) 0%, rgba(11, 12, 18, 0.95) 35%, rgba(5, 5, 8, 0.99) 68%, rgba(44, 47, 68, 0.45) 100%);
	box-shadow: 0 0 0 3px #23150d, 0 0 0 4px var(--gold-dark), 0 10px 24px rgba(0, 0, 0, 0.95);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.overlay-close:hover { border-color: var(--gold-pale); box-shadow: 0 0 0 3px #23150d, 0 0 0 4px var(--gold-bright), 0 0 18px rgba(217, 28, 46, 0.5); transform: rotate(90deg); }
.overlay-close svg { width: 22px; height: 22px; }
.overlay-panel { width: min(1100px, 100%); }
.overlay-panel.is-small { width: min(520px, 100%); }
.overlay-panel .window-frame { margin: 0; }

.picker-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: calc(100dvh - 330px); overflow-y: auto; padding: 4px; }
.picker-grid .media-tile { aspect-ratio: 4 / 3; cursor: pointer; }
.picker-grid .media-tile .media-tile-caption { opacity: 1; transform: none; padding-top: 14px; font-size: 0.66rem; }
.picker-grid .media-tile.is-selected { border-color: var(--blood-bright); box-shadow: 0 0 0 2px var(--gold-bright), 0 0 18px rgba(217, 28, 46, 0.6); }
.picker-grid .media-tile.is-selected::after { content: ""; position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; transform: rotate(45deg); background: radial-gradient(circle at 35% 35%, #ff9aa4, var(--blood-bright) 55%, var(--blood-dark)); border: 1.5px solid var(--gold-pale); box-shadow: 0 0 10px var(--blood-glow); }

/* ===== Toasts ===== */
.toast-host { position: fixed; right: 22px; bottom: calc(var(--footer-height) + 16px); z-index: 1100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { min-width: 240px; max-width: 420px; padding: 12px 16px; font-family: var(--font-ui); font-size: 0.82rem; letter-spacing: 0.05em; color: var(--gold-pale); background: linear-gradient(180deg, #1b171b 0%, #09080a 100%); border: 1px solid var(--gold-mid); border-radius: 4px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.9); animation: toastIn 0.25s ease both; display: flex; gap: 10px; align-items: center; }
.toast.is-error { border-color: var(--blood-bright); color: #ffc6cc; }
.toast.is-leaving { animation: toastOut 0.25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ===== Admin ===== */
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 26px; }
.admin-user { font-family: var(--font-ui); font-size: 0.8rem; letter-spacing: 0.1em; color: var(--text-muted); }
.admin-controls { display: flex; flex-direction: column; gap: 26px; }
.admin-control .window-header { cursor: pointer; user-select: none; }
.admin-control .window-header:hover .window-title { color: var(--gold-pale); }
.admin-control-chevron { width: 18px; height: 18px; color: var(--gold-mid); transition: transform 0.25s ease; }
.admin-control.is-open .admin-control-chevron { transform: rotate(180deg); }
.admin-control:not(.is-open) .window-content { display: none; }
.admin-login { max-width: 520px; margin: 0 auto; }

.thumb-select { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.thumb-select-preview { width: 140px; height: 90px; object-fit: cover; border: 2px solid #3c2b1c; border-radius: 3px; background: #08070a; display: flex; align-items: center; justify-content: center; color: #6e6456; font-size: 0.8rem; font-style: italic; }

.manage-list { display: flex; flex-direction: column; gap: 12px; }
.manage-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 12px; border-radius: 4px; background: rgba(14, 12, 15, 0.92); border: 1px solid rgba(184, 140, 58, 0.22); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9); }
.manage-item-thumb { width: 120px; height: 80px; object-fit: cover; border: 1px solid #3c2b1c; border-radius: 2px; background: #08070a; cursor: zoom-in; }
.manage-item-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.manage-item-meta { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }
.manage-item-actions { display: flex; flex-direction: column; gap: 10px; }
.manage-item .text-area { min-height: 64px; }
.kind-badge { display: inline-block; margin-right: 8px; padding: 1px 8px; font-family: var(--font-ui); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-bright); border: 1px solid var(--gold-dark); border-radius: 3px; background: #0b0a0d; font-style: normal; }
.kind-badge.is-video { color: #ffb3ba; border-color: var(--blood-mid); }

.chip-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; width: 110px; border: 1px solid #3c2b1c; border-radius: 3px; background: #08070a; overflow: hidden; }
.chip img { display: block; width: 100%; height: 70px; object-fit: cover; }
.chip-actions { display: flex; justify-content: space-between; }
.chip-actions button { flex: 1; min-height: 28px; padding: 0; cursor: pointer; color: var(--gold-mid); background: #121115; border: 0; border-top: 1px solid #3c2b1c; }
.chip-actions button + button { border-left: 1px solid #3c2b1c; }
.chip-actions button:hover { color: var(--gold-pale); background: #1d1a20; }

.codex-admin { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.codex-admin-list { display: flex; flex-direction: column; gap: 8px; }
.codex-admin-list .btn-simple { width: 100%; justify-content: flex-start; min-width: 0; }

/* ===== Markdown editor ===== */
.md-editor { display: flex; flex-direction: column; border: 2px solid var(--gold-dark); border-radius: 4px; background: #0a090c; box-shadow: 0 0 0 2px #17100b, inset 0 0 20px rgba(0, 0, 0, 0.9); }
.md-editor.is-fullscreen { position: fixed; inset: 12px; z-index: 900; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; border-bottom: 1px solid #3a2d1e; background: linear-gradient(180deg, #1a171c 0%, #0f0d11 100%); }
.md-toolbar-sep { width: 1px; height: 26px; margin: 0 4px; background: linear-gradient(180deg, transparent, var(--gold-dark), transparent); }

.md-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	font-family: var(--font-ui);
	font-size: 0.78rem;
	font-weight: 800;
	color: #c9bda9;
	cursor: pointer;
	border-radius: 3px;
	border: 1px solid #3a3a44;
	background: linear-gradient(180deg, #23242b 0%, #111115 100%);
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.md-tool svg { width: 17px; height: 17px; }
.md-tool:hover { color: var(--gold-pale); border-color: var(--gold-mid); background: linear-gradient(180deg, #322b20 0%, #171412 100%); }
.md-tool.active { color: var(--gold-pale); border-color: var(--gold-bright); box-shadow: 0 0 8px rgba(184, 140, 58, 0.35); }
.md-tool-select { height: 36px; min-height: 0; width: auto; padding: 0 8px; font-size: 0.74rem; }
.md-mode { margin-left: auto; display: flex; gap: 4px; }
.md-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 380px; }
.md-editor.is-fullscreen .md-panes { flex: 1; min-height: 0; }
.md-editor[data-mode="write"] .md-panes { grid-template-columns: 1fr; }
.md-editor[data-mode="write"] .md-preview { display: none; }
.md-editor[data-mode="preview"] .md-panes { grid-template-columns: 1fr; }
.md-editor[data-mode="preview"] .md-input { display: none; }

.md-input {
	width: 100%;
	min-height: 380px;
	margin: 0;
	padding: 16px;
	resize: vertical;
	font-family: var(--font-mono);
	font-size: 0.92rem;
	line-height: 1.6;
	tab-size: 4;
	color: #e1d6c2;
	background: #070609;
	border: 0;
	border-right: 1px solid #3a2d1e;
	outline: none;
	caret-color: var(--blood-bright);
}

.md-editor.is-fullscreen .md-input { height: 100%; resize: none; }
.md-input::selection { background: rgba(152, 13, 27, 0.55); }
.md-preview { min-width: 0; max-height: 640px; overflow: auto; padding: 16px 20px; background: rgba(14, 12, 15, 0.6); }
.md-editor.is-fullscreen .md-preview { max-height: none; }
.md-editor.is-dragover { border-color: var(--blood-bright); }
.md-status { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 0.1em; color: var(--text-muted); border-top: 1px solid #3a2d1e; background: #0f0d11; }

/* ===== Responsive ===== */
@media (max-width: 1240px) {
	.site-header { gap: 14px; padding-right: 58px; }
	.nav-group { gap: 12px; }
	.btn-simple { min-width: 120px; padding: 10px 18px; letter-spacing: 0.1em; }
	.btn-main { min-width: 150px; padding: 10px 18px; }
}

@media (max-width: 1020px) {
	:root { --title-height: 120px; }
	.nav-group { display: none; }
	.site-header { grid-template-columns: auto 1fr auto; padding: 0 16px; }
	.site-title { grid-column: 2; justify-self: center; }
	.site-header .menu-toggle { display: inline-flex; grid-column: 1; grid-row: 1; min-width: 0; min-height: 44px; padding: 8px 14px; }
	.login-corner { position: static; grid-column: 3; justify-self: end; }
	.site-header.is-menu-open .mobile-nav { display: flex; }
	.codex-layout, .blog-layout, .codex-admin { grid-template-columns: 1fr; }
	.blog-sidebar { position: static; }
	.blog-list-box { height: 300px; }
}

.mobile-nav {
	display: none;
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	z-index: 40;
	flex-direction: column;
	gap: 12px;
	padding: 22px 20px;
	background: linear-gradient(180deg, rgba(19, 17, 22, 0.99) 0%, rgba(9, 8, 11, 0.99) 100%);
	border-bottom: 2px solid var(--gold-dark);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.95);
}

.mobile-nav .btn-simple { width: 100%; }
.mobile-nav .mobile-sub { display: flex; flex-direction: column; gap: 10px; padding-left: 24px; }

@media (max-width: 640px) {
	:root { --title-height: 96px; --header-height: 72px; --footer-height: 64px; }
	body { font-size: 16px; }
	.content-inner { padding-left: 12px; padding-right: 12px; }
	.window-content { padding: 18px 14px; }
	.window-frame { padding: 8px; }
	.site-footer { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 12px; font-size: 0.66rem; }
	.footer-links { gap: 12px; }
	.manage-item { grid-template-columns: 1fr; }
	.manage-item-actions { flex-direction: row; flex-wrap: wrap; }
	.md-panes { grid-template-columns: 1fr; }
	.md-editor[data-mode="split"] .md-preview { border-top: 1px solid #3a2d1e; }
	.overlay-stage { padding: 72px 12px 24px; }
	.scrollbar-vertical { width: 18px; padding: 3px 2px; }
	.scrollbar-cap { height: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
