:root {
    --bg-dark: #1a1a1a;
    --bg-darker: #121212;
    --surface: #202020;
    --surface-soft: #26231f;
    --gold-accent: #c59b5f;
    --gold-hover: #a8814a;
    --paper: #ead8b6;
    --paper-dark: #d8bd8e;
    --text-light: #f4f4f4;
    --text-muted: #aaa49b;
    --text-dark: #1a1a1a;
    --line: rgba(197, 155, 95, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Montserrat', sans-serif;
}
button, input { font: inherit; }
a { color: inherit; }

.navbar {
    position: relative;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 10px 5%;
    background: var(--bg-darker);
    border-bottom: 1px solid #333;
}
.nav-left, .nav-right, .nav-links { display: flex; align-items: center; }
.nav-left { gap: 40px; }
.nav-right { gap: 20px; }
.logo { display: flex; }
.logo img { display: block; height: 70px; }
.nav-links { gap: 25px; margin: 0; padding: 0; list-style: none; }
.nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    transition: color .2s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--gold-accent); }
.nav-btn-outline, .nav-btn-filled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 22px;
    border: 2px solid var(--gold-accent);
    border-radius: 4px;
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    transition: .25s ease;
}
.nav-btn-outline { color: var(--gold-accent); }
.nav-btn-outline:hover, .nav-btn-outline.active { background: var(--gold-accent); color: var(--bg-darker); box-shadow: 0 4px 15px rgba(197, 155, 95, .3); }
.nav-btn-filled { background: var(--gold-accent); color: var(--bg-darker); box-shadow: 0 4px 10px rgba(197, 155, 95, .2); }
.nav-btn-filled:hover { border-color: var(--gold-hover); background: var(--gold-hover); box-shadow: 0 4px 15px rgba(197, 155, 95, .5); }
.nav-toggle { display: none; }

.wiki-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0;
    min-height: 390px;
    padding: clamp(40px, 10vw, 60px) 20px;
    background:
        linear-gradient(90deg, rgba(18, 18, 18, .94), rgba(18, 18, 18, .78)),
        url('https://bertreich.cz/images/castle-bamberg.jpg') center 45%/cover;
    border-bottom: 3px solid var(--gold-accent);
    text-align: center;
}
.wiki-strip > div { min-width: 210px; }
.wiki-realm-subtitle { display: block; margin: 0 0 5px; color: #fff; font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 400; letter-spacing: clamp(4px, 2vw, 8px); text-shadow: 2px 2px 5px rgba(0, 0, 0, .8); text-transform: uppercase; }
.wiki-strip > div > a { display: block; margin: 0 0 30px; color: var(--gold-accent); font-size: clamp(3.5rem, 10vw, 6.5rem); font-weight: 700; letter-spacing: clamp(2px, 2vw, 5px); line-height: 1; text-decoration: none; text-shadow: 3px 3px 20px rgba(0, 0, 0, .9); text-transform: uppercase; }
.eyebrow { color: var(--gold-accent); font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.top-search {
    width: min(560px, 100%);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(197, 155, 95, .55);
    border-radius: 6px;
    background: rgba(10, 10, 10, .86);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .35);
}
.top-search i { margin-left: 16px; color: var(--gold-accent); }
.top-search input { min-width: 0; padding: 14px 12px; border: 0; outline: 0; background: transparent; color: #fff; }
.top-search button { align-self: stretch; padding: 0 20px; border: 0; background: var(--gold-accent); color: #16100a; font-weight: 800; cursor: pointer; }

.wiki-layout {
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
    padding: 32px 32px 80px 0;
    flex: 1;
}
.wiki-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 0 0 18px;
    border: 1px solid #333;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: var(--bg-darker);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.sidebar-title { padding: 18px 16px; border-bottom: 1px solid #333; color: var(--gold-accent); font-weight: 900; text-transform: uppercase; }
.sidebar-title i { margin-right: 8px; }
.sidebar-home, .topic-link {
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 5px;
    text-decoration: none;
    transition: .2s ease;
}
.sidebar-home { margin: 12px 8px; padding: 12px; font-weight: 800; }
.category { margin: 18px 0 6px; }
.category h2 {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 6px;
    padding: 0 16px;
    color: #ded2c1;
    font-size: .76rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.category h2 span { color: #777; }
.topic-link { margin: 0 8px; padding: 9px 10px; color: #aaa; font-size: .86rem; line-height: 1.35; }
.topic-link i { color: #65523a; font-size: .65rem; }
.sidebar-home:hover, .sidebar-home.active, .topic-link:hover, .topic-link.active { background: rgba(197, 155, 95, .14); color: #fff; }
.topic-link.active i { color: var(--gold-accent); }
.wiki-nav-toggle { display: none; }
.wiki-content { min-width: 0; }

.wiki-hero {
    min-height: 360px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 35px;
    padding: clamp(30px, 6vw, 68px);
    border: 1px solid var(--line);
    border-radius: 9px;
    background:
        linear-gradient(110deg, rgba(18, 18, 18, .96) 12%, rgba(18, 18, 18, .78) 62%, rgba(18, 18, 18, .55)),
        url('https://bertreich.cz/images/castle-bamberg.jpg') center/cover;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.wiki-hero h1 { max-width: 780px; margin: 12px 0 18px; font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: 1.02; }
.wiki-hero p { max-width: 720px; margin: 0; color: #cac5be; font-size: 1.02rem; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.content-button, .copy-ip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 12px 18px;
    border: 1px solid var(--gold-accent);
    border-radius: 5px;
    background: var(--gold-accent);
    color: #17110b;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}
.copy-ip { background: rgba(0, 0, 0, .35); color: var(--gold-accent); }
.wiki-stats { display: grid; grid-template-columns: repeat(2, 115px); gap: 10px; }
.wiki-stats div { padding: 18px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 7px; background: rgba(0, 0, 0, .4); text-align: center; }
.wiki-stats strong, .wiki-stats span { display: block; }
.wiki-stats strong { color: var(--gold-accent); font-size: 2rem; }
.wiki-stats span { margin-top: 4px; color: #bbb; font-size: .72rem; font-weight: 800; text-transform: uppercase; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 34px 0 16px; }
.section-heading h2 { margin: 6px 0 0; font-size: 1.7rem; }
.section-heading > span { color: #888; font-size: .86rem; }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.topic-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    padding: 21px;
    border: 1px solid #333;
    border-radius: 8px;
    background: var(--bg-darker);
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
    transition: transform .2s ease, border-color .2s ease;
}
.topic-card:hover { transform: translateY(-3px); border-color: var(--gold-accent); }
.card-category { color: var(--gold-accent); font-size: .7rem; font-weight: 900; text-transform: uppercase; }
.topic-card h3 { margin: 10px 0; font-size: 1.1rem; line-height: 1.35; }
.topic-card p { margin: 0 0 20px; color: #aaa; font-size: .9rem; line-height: 1.6; }
.card-link { margin-top: auto; color: #d8b77f; font-size: .78rem; font-weight: 800; text-transform: uppercase; }

.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 0 0 14px; color: #8e8e8e; font-size: .8rem; }
.breadcrumbs a { color: var(--gold-accent); text-decoration: none; }
.breadcrumbs i { font-size: .55rem; }
.article {
    overflow: hidden;
    border: 1px solid var(--paper-dark);
    border-radius: 9px;
    background: var(--paper);
    color: #23180e;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.article-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; padding: clamp(28px, 5vw, 56px); border-bottom: 1px solid rgba(74, 48, 24, .2); background: linear-gradient(135deg, #f2e4c8, #dec49a); }
.article h1 { margin: 10px 0 12px; color: #1d130b; font-size: clamp(2rem, 4.5vw, 3.8rem); line-height: 1.05; }
.lead { max-width: 760px; margin: 0; color: #614b36; font-size: 1.02rem; line-height: 1.6; }
.updated { flex: 0 0 auto; color: #775e43; font-size: .78rem; }
.article-body { max-width: 900px; padding: clamp(28px, 5vw, 58px); font-size: 1rem; line-height: 1.78; }
.article-body h2, .article-body h3, .article-body h4 { margin: 1.7em 0 .55em; color: #392616; line-height: 1.25; }
.article-body h2:first-child { margin-top: 0; }
.article-body p { margin: 0 0 1em; }
.article-body ul, .article-body ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.article-body li { margin: .45em 0; }
.article-body code { padding: .16em .4em; border-radius: 4px; background: rgba(62, 39, 17, .12); color: #7b250d; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.article-body pre { overflow: auto; padding: 16px; border-radius: 6px; background: #17120e; color: #f7e7c9; }
.article-body pre code { padding: 0; background: transparent; color: inherit; }
.article-body blockquote { margin: 1.3em 0; padding: 14px 18px; border-left: 4px solid #8e6237; background: rgba(255, 255, 255, .25); font-weight: 700; }
.article-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px clamp(28px, 5vw, 58px); border-top: 1px solid rgba(74, 48, 24, .2); background: rgba(86, 55, 26, .08); }
.article-footer a { color: #6b3d15; font-weight: 800; text-decoration: none; }
.not-found { padding: clamp(35px, 8vw, 90px); }
.not-found p { color: #614b36; line-height: 1.7; }
.not-found .content-button { margin-top: 15px; }
.empty-state { padding: 55px 25px; border: 1px dashed #444; border-radius: 8px; background: #151515; color: #aaa; text-align: center; }
.empty-state i { color: var(--gold-accent); font-size: 2.4rem; }
.empty-state h2 { color: #fff; }

@media (max-width: 1240px) {
    .navbar { flex-wrap: wrap; }
    .nav-left { flex: 1 1 auto; }
    .nav-secondary { display: none; }
    .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    .nav-left { flex-wrap: wrap; gap: 18px; }
    .wiki-layout { grid-template-columns: 1fr; }
    .wiki-nav-toggle { width: calc(100% - 40px); margin: 20px auto 0; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 12px; border: 1px solid var(--gold-accent); border-radius: 6px; background: var(--bg-darker); color: var(--gold-accent); font-weight: 800; }
    .wiki-sidebar { position: static; display: none; max-height: none; border-left: 1px solid #333; border-radius: 8px; }
    .wiki-sidebar.open { display: block; }
    .wiki-hero { flex-direction: column; align-items: stretch; }
    .wiki-stats { align-self: stretch; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
    .navbar { padding: 10px 18px; }
    .logo img { height: 56px; }
    .nav-right { width: 100%; justify-content: space-between; }
    .wiki-strip { min-height: 0; align-items: stretch; padding: 34px 14px 38px; background-position: center top; }
    .wiki-realm-subtitle { margin-bottom: 5px; font-size: 1rem; letter-spacing: 4px; }
    .wiki-strip > div > a { margin-bottom: 22px; font-size: clamp(2.55rem, 14vw, 4rem); letter-spacing: 1px; word-break: break-word; }
    .top-search button { padding: 0 12px; }
    .wiki-layout { width: 100%; padding: 18px 12px 60px; }
    .wiki-nav-toggle { width: calc(100% - 24px); }
    .wiki-hero { min-height: 0; padding: 32px 24px; }
    .topic-grid { grid-template-columns: 1fr; }
    .article-heading, .article-footer { align-items: flex-start; flex-direction: column; }
    .updated { flex: auto; }
}
@media (max-width: 420px) { .wiki-strip > div > a { font-size: 2.75rem; } }
