/* DzerskiPolitik — v4 */
:root {
    --bg: #0c0b09;
    --bg-2: #131110;
    --bg-3: #1a1814;
    --line: #2a2620;
    --line-2: #3a342b;
    --text: #ece4d2;
    --text-2: #c4baa4;
    --muted: #8f8571;
    --dim: #66604f;
    --accent: #c8452c;
    --accent-2: #e4704f;
    --accent-soft: rgba(200, 69, 44, .12);
    --accent-line: rgba(200, 69, 44, .45);
    --display: 'Cinzel', 'Noto Serif Georgian', Georgia, serif;
    --body: 'Manrope', 'Noto Sans Georgian', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, canvas, svg { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
ol, ul { margin: 0; padding: 0; }
h1, h2, h3, h4, h5, p { margin: 0; }
::selection { background: var(--accent); color: #fff; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.accent { color: var(--accent-2); }
.dot { color: var(--accent); }

/* ---------- Reveal (only when JS runs) ---------- */
html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
html.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Shared: highlight (the "lights up" behaviour) ---------- */
.hit { transition: color .2s, border-color .2s, background-color .2s; }
.pick { cursor: pointer; }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pick:hover { border-color: var(--accent-line); }
.pick.is-picked { border-color: var(--accent) !important; background-color: var(--accent-soft) !important; }
.pick.is-picked h3, .pick.is-picked h4, .pick.is-picked h5, .pick.is-picked code, .pick.is-picked .no,
.pick.is-picked .num, .pick.is-picked .lvl { color: var(--accent-2) !important; }

.flash { animation: flash 1.8s ease-out; }
@keyframes flash {
    0%, 35% { outline: 2px solid var(--accent); outline-offset: 6px; box-shadow: 0 0 0 8px var(--accent-soft); }
    100% { outline: 2px solid transparent; outline-offset: 6px; box-shadow: 0 0 0 8px transparent; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 18px; border: 0; border-radius: 9px; cursor: pointer;
    background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px;
    transition: background-color .2s, color .2s, transform .15s;
}
.btn:hover { background: var(--accent-2); color: #fff; }
.btn:active { transform: translateY(1px); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(12, 11, 9, .86);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .04em; white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.nav { display: flex; gap: 22px; }
.nav a { font-size: 14px; color: var(--muted); text-decoration: none; transition: color .2s; }
.nav a:hover { color: var(--accent-2); }
.bar-actions { display: flex; align-items: center; gap: 10px; }

.search { position: relative; display: flex; align-items: center; }
.search input {
    width: 190px; height: 38px; padding: 0 40px 0 14px;
    background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px;
    font-size: 14px; outline: none; transition: border-color .2s, width .3s;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--accent); width: 240px; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
    position: absolute; right: 10px; pointer-events: none;
    font-family: var(--mono); font-size: 12px; color: var(--dim);
    border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; line-height: 18px;
}
.search input:focus + kbd { display: none; }
.search-results {
    position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 60vh; overflow-y: auto;
    background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 12px;
    padding: 6px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); z-index: 60;
}
.search-results[hidden] { display: none; }
.sr-item {
    display: flex; flex-direction: column; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px;
    background: none; text-align: left; cursor: pointer;
}
.sr-item:hover, .sr-item:focus-visible { background: var(--accent-soft); outline: none; }
.sr-title { font-size: 14px; font-weight: 600; }
.sr-sec { font-size: 12px; color: var(--muted); }
.sr-empty { padding: 12px; font-size: 14px; color: var(--muted); }

.copy-btn {
    height: 38px; padding: 0 14px; border-radius: 9px; cursor: pointer;
    background: none; border: 1px solid var(--line-2); font-size: 13px; font-weight: 700; letter-spacing: .08em;
    transition: border-color .2s, color .2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-2); }

.menu-toggle { display: none; width: 40px; height: 38px; background: none; border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; padding: 0; position: relative; }
.menu-toggle span { position: absolute; left: 11px; right: 11px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .2s; }
.menu-toggle span:nth-child(1) { top: 14px; }
.menu-toggle span:nth-child(2) { top: 22px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: calc(100vh - 64px); min-height: calc(100svh - 64px);
    display: flex; align-items: center;
    background:
        linear-gradient(180deg, rgba(12, 11, 9, .15) 0%, rgba(12, 11, 9, .35) 55%, var(--bg) 100%),
        linear-gradient(90deg, rgba(12, 11, 9, .94) 0%, rgba(12, 11, 9, .72) 42%, rgba(12, 11, 9, .15) 100%),
        url('../images/castle.jpg') center 60% / cover no-repeat;
}
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; align-items: center; gap: 24px; padding-top: 48px; padding-bottom: 72px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.hero-title {
    font-family: var(--display); font-weight: 900; font-size: clamp(42px, 7vw, 92px); line-height: 1.02;
    letter-spacing: .02em; margin-bottom: 20px; text-shadow: 0 4px 30px rgba(0, 0, 0, .5);
}
.lead { font-size: 18px; color: var(--text-2); max-width: 44ch; margin-bottom: 32px; }

.ip {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 14px;
    max-width: 100%; padding: 10px 10px 10px 18px;
    background: rgba(12, 11, 9, .7); border: 1px solid var(--line-2); border-radius: 12px;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ip-label { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--muted); }
.ip code { font-family: var(--mono); font-size: 19px; color: var(--text); word-break: break-all; }

.meta { list-style: none; display: flex; flex-wrap: wrap; align-items: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.meta li + li { padding-left: 16px; margin-left: 16px; border-left: 1px solid var(--line-2); }

.status { display: inline-flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 14px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.status[data-state="online"] .status-dot { background: #8fbf6a; box-shadow: 0 0 0 4px rgba(143, 191, 106, .15); }
.status[data-state="offline"] .status-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(200, 69, 44, .15); }

.stage { position: relative; height: 580px; }
.skin-wrap { position: absolute; inset: 0; }
#skin3d { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#skin3d:active { cursor: grabbing; }
.skin-fallback { width: auto; max-width: 180px; margin: 40px auto; image-rendering: pixelated; }
.stage-hint {
    position: absolute; left: 0; right: 0; bottom: 6px; text-align: center;
    font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); pointer-events: none;
}

/* ---------- Sections ---------- */
.section { padding: 120px 0; }
.head { max-width: 640px; margin-bottom: 56px; }
.head .kicker { margin-bottom: 14px; }
.h2 { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4vw, 46px); line-height: 1.15; letter-spacing: .02em; margin-bottom: 14px; }
.head .muted { font-size: 17px; }
.sub { font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 56px 0 20px; }
.note { margin-top: 28px; font-size: 14px; color: var(--muted); }
.note strong { color: var(--text-2); font-weight: 600; }
.note-box {
    border-left: 2px solid var(--accent); background: var(--accent-soft);
    padding: 12px 18px; margin-bottom: 24px; color: var(--text-2); font-size: 15px; border-radius: 0 8px 8px 0;
}
.note-box strong { color: var(--text); }

/* Lore */
.chapters { list-style: none; border-top: 1px solid var(--line); }
.chapter { display: grid; grid-template-columns: 64px 1fr; gap: 20px; padding: 32px 18px; margin: 0 -18px; border-bottom: 1px solid var(--line); border-radius: 0; }
.chapter .num { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--dim); padding-top: 2px; }
.chapter h3 { font-family: var(--display); font-size: 21px; font-weight: 700; margin-bottom: 10px; }
.chapter p { font-size: 17px; color: var(--text-2); max-width: 62ch; }
.chapter:hover { background: var(--bg-2); }
.chapter:hover .num, .chapter:hover h3 { color: var(--accent-2); }

/* Steps */
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 30px 26px; }
.step .num { font-family: var(--mono); font-size: 13px; color: var(--dim); }
.step h3 { font-size: 18px; font-weight: 700; margin: 18px 0 10px; }
.step p { font-size: 15px; color: var(--muted); }
.step code { display: inline-block; font-family: var(--mono); font-size: 14px; color: var(--text); background: var(--bg-3); padding: 6px 10px; border-radius: 6px; word-break: break-all; }
.step:hover { border-color: var(--accent-line); }

/* Mods */
.mods { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mod { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 28px; transition: border-color .2s; }
.mod:hover { border-color: var(--accent-line); }
.mod-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mod h3 { font-family: var(--display); font-size: 18px; font-weight: 700; }
.mod p { font-size: 15px; color: var(--muted); margin-bottom: 18px; }
.mod a { font-size: 14px; font-weight: 700; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.mod a:hover { color: var(--accent-2); border-color: var(--accent-2); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

/* Roles */
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.role { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.role h4 { font-family: var(--display); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.role p { font-size: 14px; color: var(--muted); }
.staff { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 48px; }
.group-title { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 12px; }
.staff-group { display: flex; flex-direction: column; gap: 8px; }
.staff-row { padding: 14px 18px; border-left: 2px solid var(--line-2); border-radius: 0 10px 10px 0; background: transparent; }
.staff-row h5 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.staff-row p { font-size: 14px; color: var(--muted); }

/* Economy */
.eco { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.eco-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.eco-card h3 { font-family: var(--display); font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.eco-card > p.muted { font-size: 15px; }
.cmds { list-style: none; margin: 18px 0; display: flex; flex-direction: column; gap: 6px; }
.cmd { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; }
.cmd code { font-family: var(--mono); font-size: 14px; color: var(--text); word-break: break-word; }
.cmd span { font-size: 13px; color: var(--muted); }
.tip { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.ship { border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; margin-top: 12px; background: transparent; }
.ship-name { font-family: var(--display); font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.recipe { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe span { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--bg-3); padding: 4px 8px; border-radius: 6px; }
.notes { list-style: none; margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.notes strong { color: var(--text-2); font-weight: 600; }

/* Forbidden */
.bans { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ban { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; text-align: center; }
.ban img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; }
.ban span { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.ban-tnt { border-color: var(--accent-line); }
.ban-tnt span { color: var(--accent-2); font-weight: 700; }

/* Ladder (land & nation levels) */
.ladder { list-style: none; border-top: 1px solid var(--line); margin-bottom: 8px; }
.rung {
    display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 18px;
    padding: 22px 18px; margin: 0 -18px; border-bottom: 1px solid var(--line); border-radius: 0;
}
.rung .lvl { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--dim); }
.rung h4 { font-family: var(--display); font-size: 18px; font-weight: 700; }
.rung h4 small { display: block; font-family: var(--body); font-size: 12px; color: var(--muted); letter-spacing: .04em; margin-top: 2px; }
.rung .det { font-size: 14px; color: var(--muted); text-align: right; }
.rung .flag { grid-column: 2 / -1; font-size: 13px; color: var(--accent-2); margin-top: -6px; }
.rung.top .lvl { color: var(--accent); }
.rung:hover { background: var(--bg-2); }
.rung:hover .lvl { color: var(--accent-2); }
.rung.is-picked { margin: 0 -18px; }
.ladder.three { margin-top: 0; }
.sub + .ladder { margin-top: 0; }

/* War */
.war {
    background:
        linear-gradient(180deg, var(--bg) 0%, rgba(12, 11, 9, .82) 18%, rgba(12, 11, 9, .86) 82%, var(--bg) 100%),
        url('../images/war-bg.jpeg') center / cover no-repeat fixed;
}
.war-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; }
.war-box { background: rgba(12, 11, 9, .82); border: 1px solid var(--line-2); border-radius: 14px; padding: 30px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.war-box h3 { font-family: var(--display); font-size: 19px; font-weight: 700; margin-bottom: 18px; }
.causes { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.causes li { font-size: 14px; border: 1px solid var(--accent-line); border-radius: 999px; padding: 6px 14px; color: var(--text-2); }
.warn { font-size: 15px; font-weight: 700; color: var(--accent-2); }
.plain { list-style: none; display: flex; flex-direction: column; }
.plain li { font-size: 15px; color: var(--text-2); padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.plain strong { color: var(--text); font-weight: 600; }
.violation { color: var(--accent-2) !important; }
.war .note { color: var(--muted); }

/* Rules */
.fold { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.fold summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 22px 26px; font-family: var(--display); font-size: 18px; font-weight: 700; transition: color .2s;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary span { font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin-left: auto; margin-right: 12px; }
.fold summary::after { content: '+'; font-family: var(--body); font-size: 22px; font-weight: 300; color: var(--accent-2); line-height: 1; }
.fold[open] summary::after { content: '–'; }
.fold summary:hover { color: var(--accent-2); }
.fold[open] summary { border-bottom: 1px solid var(--line); }
.rules { list-style: none; padding: 8px; }
.rule { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 14px 16px; border: 1px solid transparent; border-radius: 9px; }
.rule .no { font-family: var(--display); font-size: 14px; color: var(--dim); padding-top: 2px; }
.rule p { font-size: 15px; color: var(--text-2); }
.rule small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Community */
.links { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.links a {
    display: flex; align-items: center; justify-content: space-between; padding: 18px 20px;
    border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-size: 17px; font-weight: 600; color: var(--text);
    transition: color .2s, border-color .2s, background-color .2s;
}
.links a::after { content: '→'; color: var(--dim); transition: transform .2s, color .2s; }
.links a:hover { color: var(--accent-2); border-color: var(--accent-line); background: var(--accent-soft); }
.links a:hover::after { color: var(--accent-2); transform: translateX(4px); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 64px 0 36px; }
.foot { display: grid; grid-template-columns: 1fr auto; gap: 48px; }
.foot-brand { display: flex; align-items: center; gap: 14px; }
.foot-brand img { width: 36px; height: 36px; }
.foot-brand strong { display: block; font-family: var(--display); font-size: 16px; font-weight: 700; }
.foot-brand span { display: block; font-size: 13px; color: var(--muted); }
.foot-cols { display: flex; gap: 56px; }
.foot-cols h5 { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 12px; }
.foot-cols a { display: block; font-size: 14px; color: var(--muted); text-decoration: none; padding: 4px 0; transition: color .2s; }
.foot-cols a:hover { color: var(--accent-2); }
.foot-bottom { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--dim); }
.foot-bottom code { font-family: var(--mono); color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
    background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 18px;
    font-size: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); transition: opacity .25s, transform .25s; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .nav {
        display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
        background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 16px;
    }
    .nav.open { display: flex; }
    .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--text-2); }
    .menu-toggle { display: block; }
    .roles { grid-template-columns: repeat(2, 1fr); }
    .eco { grid-template-columns: 1fr 1fr; }
    .eco > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .hero { min-height: 0; }
    .foot { grid-template-columns: 1fr; }
    .seat { height: 200px; width: 180px; margin: 0 auto; }
    .hero-grid { min-height: 0; }
    .stage { height: 440px; }
    .hero-grid { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 24px; gap: 8px; }
    .hero {
        background:
            linear-gradient(180deg, rgba(12, 11, 9, .55) 0%, rgba(12, 11, 9, .8) 60%, var(--bg) 100%),
            url('../images/castle.jpg') 70% 50% / cover no-repeat;
    }
    .lead { font-size: 16px; }
    .stage { height: 440px; }
    .section { padding: 84px 0; }
    .head { margin-bottom: 40px; }
    .steps { grid-template-columns: 1fr; }
    .mods { grid-template-columns: 1fr; }
    .staff { grid-template-columns: 1fr; }
    .war-grid { grid-template-columns: 1fr; }
    .war { background-attachment: scroll; }
    .foot { grid-template-columns: 1fr; gap: 32px; }
    .foot-cols { gap: 36px; flex-wrap: wrap; }
}

@media (max-width: 760px) {
    .wrap { padding: 0 16px; }
    .bar { gap: 10px; }
    .brand span { display: none; }
    .search input { width: 120px; }
    .search input:focus { width: 150px; }
    .search kbd { display: none; }
    .search-results { width: min(300px, calc(100vw - 32px)); }
    .chapter { grid-template-columns: 1fr; gap: 6px; padding: 26px 16px; margin: 0 -16px; }
    .rung { grid-template-columns: 40px 1fr; padding: 18px 16px; margin: 0 -16px; }
    .rung .det { grid-column: 2; text-align: left; }
    .rung .lvl { font-size: 22px; }
    .rung .flag { grid-column: 2; }
    .roles { grid-template-columns: 1fr; }
    .eco { grid-template-columns: 1fr; }
    .stage-hint { display: none; }
    .ip { padding: 10px 10px 10px 14px; }
    .ip code { font-size: 16px; }
    .links { grid-template-columns: 1fr 1fr; }
    .foot-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.js .reveal { transition: none; opacity: 1; transform: none; }
    .flash { animation: none; }
}

/* ===== v5 additions ===== */
.hero { display: block; min-height: 0; }
.hero-grid { min-height: calc(100vh - 64px); min-height: calc(100svh - 64px); padding-top: 40px; padding-bottom: 40px; }
.hero > .wrap:last-child { padding-top: 40px; padding-bottom: 120px; }
.hero > .wrap:last-child .head { margin-bottom: 36px; }
.hero { background-position: center 40%; }

.nav a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* Dark stage: one spotlight from above */
.stage .beam {
    position: absolute; top: -20px; left: 50%; width: 320px; height: 100%; transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(255, 236, 205, .18) 0%, rgba(255, 236, 205, .03) 80%);
    clip-path: polygon(45% 0, 55% 0, 84% 100%, 16% 100%);
    pointer-events: none;
}
.stage .stand {
    position: absolute; left: 50%; bottom: 50px; width: 240px; height: 40px; transform: translateX(-50%);
    pointer-events: none;
}
.stage .stand svg { width: 100%; height: 100%; overflow: visible; }
.stage .stand ellipse { fill: none; stroke: rgba(236, 228, 210, .2); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.stage .stand ellipse:nth-child(2) { stroke: rgba(236, 228, 210, .12); }
.stage .stand ellipse:nth-child(3) { stroke: rgba(255, 236, 205, .42); }


/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.tab {
    background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    padding: 12px 14px; font: 600 14px var(--body); color: var(--muted); cursor: pointer;
    transition: color .2s, border-color .2s;
}
.tab:hover { color: var(--accent-2); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Archive: history */
.story-list { display: flex; flex-direction: column; gap: 14px; }
.story { padding: 6px 26px 30px; color: var(--text-2); font-size: 16px; line-height: 1.8; }
.story p { margin: 0 0 14px; max-width: 74ch; }
.story h4.date { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--accent-2); letter-spacing: .03em; margin: 24px 0 8px; }
.story .caption { font-size: 13px; color: var(--muted); font-style: italic; }
.story ul.summary {
    margin: 0 0 20px; padding: 16px 18px 16px 34px; list-style: disc;
    border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0;
    font-size: 15px; color: var(--text-2);
}
.story ul.summary li { margin: 4px 0; }

/* Archive: gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.shot {
    margin: 0; cursor: zoom-in; overflow: hidden;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
    transition: border-color .2s;
}
.shot:hover { border-color: var(--accent-line); }
.shot img { width: 100%; height: 240px; object-fit: contain; background: var(--bg-3); }
.shot.wide { grid-column: 1 / -1; }
.shot.wide img { height: auto; max-height: 520px; }
.shot figcaption {
    padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line);
    transition: color .2s;
}
.shot:hover figcaption { color: var(--accent-2); }

.lightbox {
    position: fixed; inset: 0; z-index: 90; padding: 24px;
    background: rgba(6, 5, 4, .94);
    display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox figure { margin: 0; text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; width: auto; margin: 0 auto; border-radius: 10px; }
.lightbox figcaption { margin-top: 14px; font-size: 14px; color: var(--muted); }

/* Search: compact */
.search-results { width: 280px; padding: 4px; }
.sr-item { padding: 8px 10px; }
.sr-title { font-size: 13px; }
.sr-sec { font-size: 11px; }

/* Community logos */
.links a { justify-content: flex-start; gap: 14px; }
.links a::after { content: none; }
.links svg { width: 22px; height: 22px; flex-shrink: 0; fill: var(--muted); transition: fill .2s; }
.links a:hover svg { fill: var(--accent-2); }

/* Footer: seated character */
.foot { grid-template-columns: 230px 1fr; align-items: end; gap: 40px; }
.seat { height: 240px; position: relative; }
.seat canvas { width: 100%; height: 100%; display: block; }
.foot-main { min-width: 0; }
.foot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
.foot-bottom { margin-top: 40px; }

/* v5 responsive overrides (after the base rules above) */
@media (max-width: 900px) {
    .hero-grid { min-height: 0; padding-top: 40px; padding-bottom: 24px; }
    .foot { grid-template-columns: 1fr; gap: 28px; }
    .seat { height: 200px; width: 180px; margin: 0 auto; }
    .stage { height: 440px; }
}
@media (max-width: 760px) {
    .hero > .wrap:last-child { padding-bottom: 80px; }
    .shot img { height: 200px; }
    .links { grid-template-columns: 1fr 1fr; }
    .foot-top { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .stage .beam, .stage .stand { display: none; }
}

/* ===== v6 ===== */
/* Buttons keep their colour on click (no accent fill on hover/press) */
.btn, .btn:hover, .btn:focus, .btn:active { background: var(--text); color: var(--bg); transform: none; opacity: 1; }
.copy-btn, .copy-btn:hover, .copy-btn:focus, .copy-btn:active { background: none; border-color: var(--line-2); color: var(--text); }
.menu-toggle, .menu-toggle:hover, .menu-toggle:focus, .menu-toggle:active { background: none; border-color: var(--line-2); }
.tab, .tab:hover, .tab:focus, .tab:active { color: var(--muted); }
.tab.on, .tab.on:hover { color: var(--text); }
button:focus:not(:focus-visible) { outline: none; }


/* Logo wobble (the logo itself, not the character) */
.brand img, .foot-brand img { transform-origin: 50% 50%; }
.brand:hover img, .foot-brand:hover img { animation: logo-wobble .8s ease-in-out; }
@keyframes logo-wobble {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-12deg); }
    40% { transform: rotate(9deg); }
    60% { transform: rotate(-6deg); }
    80% { transform: rotate(3deg); }
}

/* Economy photos */
.card-img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; margin-bottom: 16px; }
.card-img.ship-img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; margin-bottom: 18px; image-rendering: auto; }

/* Footer: static seated figure */
.seat img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Archive: wiki layout */
.wiki { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; }
.wiki-toc { position: sticky; top: 92px; font-size: 14px; border-right: 1px solid var(--line); padding-right: 24px; }
.toc-title { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; }
.wiki-toc ol { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wiki-toc a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; transition: color .2s; }
.wiki-toc a:hover { color: var(--text-2); }
.wiki-toc a.on { color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.wiki-body { min-width: 0; }
.article { color: var(--text-2); font-size: 16px; line-height: 1.8; }
.article-title {
    font-family: var(--display); font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; line-height: 1.2;
    color: var(--text); margin: 0 0 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.article h2 { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--text); margin: 44px 0 6px; }
.article .range { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.article p { margin: 0 0 14px; max-width: 72ch; }
.article h4.date { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--accent-2); margin: 24px 0 8px; }
.article .caption { font-size: 13px; color: var(--muted); font-style: italic; }
.article ul.summary { margin: 0 0 22px; padding: 16px 18px 16px 34px; list-style: disc; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; font-size: 15px; }
.article ul.summary li { margin: 4px 0; }
.infobox { float: right; width: 280px; margin: 0 0 22px 32px; padding: 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.infobox h4 { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.infobox figure { margin: 0; }
.infobox img { width: 100%; height: auto; border-radius: 6px; background: var(--bg-3); }
.infobox figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; text-align: center; }
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skins img { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.article::after { content: ''; display: block; clear: both; }

@media (max-width: 900px) {
    .wiki { grid-template-columns: 1fr; gap: 28px; }
    .wiki-toc { position: static; border-right: 0; padding-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
    .infobox { float: none; width: 100%; margin: 0 0 22px; }
}


/* ===== Wiki links and inline player photos ===== */
.article a.ent { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(200, 69, 44, .4); }
.article a.ent:hover { border-bottom-color: var(--accent); }
.article .kind { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); margin: 12px 0 0; }
.pl-inline { float: right; width: 170px; margin: 4px 0 14px 24px; text-align: center; }
.pl-inline img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.pl-inline figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
@media (max-width: 760px) { .pl-inline { float: none; width: 150px; margin: 0 auto 16px; } }

/* ===== Hero atmosphere ===== */
.stage .skin-wrap { z-index: 1; }
.stage .beam { z-index: 0; filter: blur(7px); }
.stage .haze {
    position: absolute; left: 50%; top: -15%; width: 680px; height: 130%; transform: translateX(-50%);
    background: radial-gradient(ellipse closest-side at 50% 30%, rgba(255, 232, 196, .025), rgba(255, 232, 196, 0));
    pointer-events: none; z-index: 0;
}
@media (max-width: 760px) { .stage .haze { width: 420px; } }

/* No light beam: the figure is drawn unlit so it stays clearly visible */
.stage .beam { display: none; }
