/* ========================================
   Bloomiepedia - Wiki im Look der Spiel-UI
   Farben, Schrift und Fensterrahmen stammen direkt aus dem Spiel
   (StandardThemeAlex.tres, UI/Grafiken, UI/Fonts).
   ======================================== */

/* Pixelschrift aus dem Spiel. Designraster: 16px pro Geviert,
   scharf nur bei 16 / 32 / 48px. Lizenz: CC BY-SA 4.0 (YukiPixels) */
@font-face {
    font-family: 'BoldPixels';
    src: url('../fonts/BoldPixels.ttf') format('truetype');
    font-display: swap;
}

:root {
    --ink: #261a16;          /* Umriss aller Spielfenster */
    --panel: #583e32;        /* Fensterinhalt */
    --panel-deep: #382620;   /* Titelleisten, Einlassungen */
    --row: #4a342a;          /* Listenzeilen im Wechsel */
    --wood-hi: #926d51;      /* Button oben */
    --wood: #825e43;         /* Button Mitte */
    --wood-lo: #6c4d39;      /* Button unten */
    --cream: #fbf1e4;        /* Text */
    --cream-dim: #dcc6ae;    /* Nebentext */
    --sprout: #9eff44;       /* Marken-Gruen (Links, aktiv) */
    --coin: #ffc233;

    --font-pixel: 'BoldPixels', 'M PLUS Rounded 1c', sans-serif;
    --font-ui: 'M PLUS Rounded 1c', 'Noto Sans', sans-serif;

    /* Pixel-Umriss fuer weissen Text auf der Landschaft, wie im Spiel */
    --outline-2: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
                 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
    --outline-3: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
                 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink),
                 0 6px 0 var(--ink);
    --wood-grad: linear-gradient(var(--wood-hi) 0 3px, var(--wood) 3px 55%, var(--wood-lo) 55%);
}

html {
    scroll-padding-top: 72px;
}

/* ---------- Seite: Spielwelt als Hintergrund ---------- */
body.wiki-page {
    font-family: var(--font-ui);
    font-weight: 500;
    color: var(--cream);
    background: #7fb3c9 url('../images/wiki/meadow.png') center bottom / cover fixed no-repeat;
    image-rendering: pixelated;
}

body.wiki-page img {
    image-rendering: pixelated;
}

body.wiki-page .wiki-logo {
    image-rendering: auto;
}

/* ---------- Kopfbereich auf dem Himmel ---------- */
.wiki-hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 36px;
}

.wiki-logo {
    display: block;
    width: 300px;
    height: auto;
    margin-left: -8px;
    filter: drop-shadow(0 6px 0 rgba(38, 26, 22, 0.35));
}

.wiki-title {
    margin-top: 10px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 48px;
    line-height: 1;
    color: #ffffff;
    text-shadow: var(--outline-3);
}

.wiki-subtitle {
    margin-top: 18px;
    max-width: 36em;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.6;
    letter-spacing: 0.02em;
    word-spacing: 0.08em;
    color: #ffffff;
    text-shadow: var(--outline-2);
}

/* ---------- Schnellwahlleiste = Spielkreislauf ---------- */
.wiki-quickbar {
    margin-top: 28px;
}

.wiki-quickbar ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.wiki-quickbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 96px;
    text-decoration: none;
}

/* Slot-Textur aus dem Spiel (16x16), 5-fach vergroessert */
.wiki-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: url('../images/wiki/quickbar-slot.png') 0 0 / 100% 100% no-repeat;
}

.wiki-slot img {
    transition: transform 0.12s steps(2);
}

.wiki-step {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    color: #ffffff;
    text-shadow: var(--outline-2);
}

.wiki-quickbar a:hover .wiki-slot img,
.wiki-quickbar a:focus-visible .wiki-slot img {
    transform: translateY(-4px);
}

.wiki-quickbar a:hover .wiki-step,
.wiki-quickbar a:focus-visible .wiki-step {
    color: var(--sprout);
}

/* ---------- Das Spielfenster ---------- */
/* window.png = Fensterrahmen aus dem Inventar inkl. Bloomie-Silhouetten, 3-fach */
.wiki-window {
    max-width: 1200px;
    margin: 0 auto 64px;
    border-style: solid;
    border-width: 24px 6px 18px 6px;
    border-image: url('../images/wiki/window.png') 8 2 6 2 fill / 24px 6px 18px 6px round;
    filter: drop-shadow(0 8px 0 rgba(21, 17, 16, 0.45));
}

.wiki-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 36px;
    padding: 24px 28px 40px;
    align-items: start;
}

/* ---------- Sidebar: Holzbuttons wie im Shop ---------- */
.wiki-sidebar {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
    padding: 2px 6px 6px 2px;
}

.wiki-search {
    width: 100%;
    margin-bottom: 14px;
    padding: 10px 12px;
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 14px;
    color: var(--cream);
    background: var(--panel-deep);
    border: 3px solid var(--ink);
    border-radius: 0;
    box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.25);
}

.wiki-search::placeholder {
    color: var(--cream-dim);
}

.wiki-search:focus {
    outline: none;
    border-color: var(--sprout);
}

.wiki-nav ol {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Kategorien der Seitenleiste */
.wiki-nav-group + .wiki-nav-group {
    margin-top: 16px;
}

.wiki-nav-group h2 {
    margin: 0 0 6px 2px;
    font-size: 13px;
    font-weight: 800;
    text-align: left;
    color: var(--coin);
    text-shadow: 0 2px 0 var(--ink);
}

.wiki-nav a {
    display: block;
    padding: 7px 12px 8px;
    font-size: 14px;
    font-weight: 800;
    color: var(--cream);
    text-decoration: none;
    background: var(--wood-grad);
    border: 3px solid var(--ink);
    text-shadow: 0 2px 0 var(--ink);
}

.wiki-nav a:hover {
    background: linear-gradient(#a57d5f 0 3px, #936a4c 3px 55%, #7a573f 55%);
}

.wiki-nav a.is-active {
    background: var(--panel-deep);
    color: var(--sprout);
    box-shadow: inset 4px 0 0 var(--sprout);
}

.wiki-nav li.is-hidden {
    display: none;
}

.wiki-no-results {
    display: none;
    padding: 24px 0;
    font-weight: 800;
    color: var(--cream-dim);
}

.wiki-no-results.is-visible {
    display: block;
}

/* ---------- Artikel ---------- */
.wiki-content {
    min-width: 0;
}

.wiki-article {
    margin-bottom: 48px;
}

.wiki-article.is-hidden {
    display: none;
}

.wiki-article p,
.wiki-article li {
    font-size: 16px;
    line-height: 1.7;
}

.wiki-article p {
    margin-bottom: 14px;
    max-width: 44em;
}

.wiki-article ul,
.wiki-article ol {
    margin: 0 0 16px 22px;
    max-width: 44em;
}

.wiki-article li {
    margin-bottom: 6px;
}

.wiki-article li::marker {
    color: var(--coin);
}

.wiki-article strong {
    font-weight: 800;
    color: #ffffff;
}

/* Spielbegriffe (Skills, Optionen) in Muenzgelb, wie hervorgehobene Woerter im Spiel */
.wiki-article em {
    font-style: normal;
    font-weight: 800;
    color: var(--coin);
}

.wiki-article a {
    color: var(--sprout);
    font-weight: 800;
}

/* Seitentitel-Leiste wie "Lavini" / "Pyrone" im Box-Fenster */
.wiki-page-title,
.wiki-section-title {
    margin: 0 0 20px;
    padding: 6px 14px 8px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 32px;
    line-height: 1.25;
    text-align: left;
    color: #ffffff;
    text-shadow: 0 3px 0 var(--ink);
    background: var(--panel-deep);
    border: 3px solid var(--ink);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.wiki-article h3 {
    margin: 28px 0 10px;
    font-weight: 800;
    font-size: 19px;
    color: var(--coin);
    text-shadow: 0 2px 0 var(--ink);
}

.wiki-lead {
    font-size: 18px !important;
    color: var(--cream-dim);
}

.wiki-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: -6px;
    margin: 0 2px;
}

/* ---------- Hinweise: eingelassene Tafel ---------- */
.wiki-tip {
    margin: 18px 0;
    max-width: 44em;
    padding: 12px 16px 14px;
    background: var(--panel-deep);
    border: 3px solid var(--ink);
    box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.25);
}

.wiki-tip p:last-child {
    margin-bottom: 0;
}

.wiki-tip-title {
    display: block;
    margin-bottom: 2px;
    font-weight: 800;
    font-size: 15px;
    color: var(--sprout);
}

.wiki-tip.is-warning .wiki-tip-title {
    color: #ff7a7a;
}

/* ---------- Tabellen: Listenzeilen wie im Shop ---------- */
.wiki-table-wrap {
    overflow-x: auto;
    margin: 16px 0 20px;
    border: 3px solid var(--ink);
}

.wiki-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.wiki-table th,
.wiki-table td {
    padding: 9px 12px;
    text-align: left;
    vertical-align: middle;
}

.wiki-table thead th {
    font-weight: 800;
    font-size: 14px;
    color: var(--cream-dim);
    background: var(--panel-deep);
    border-bottom: 3px solid var(--ink);
    white-space: nowrap;
}

.wiki-table tbody tr {
    background: var(--panel);
}

.wiki-table tbody tr:nth-child(even) {
    background: var(--row);
}

.wiki-table tbody th {
    font-weight: 800;
    white-space: nowrap;
}

/* Gruppenzeilen (Farming, Eggs ...) in der Skill-Tabelle */
.wiki-table tbody th[colspan] {
    font-weight: 800;
    font-size: 15px;
    color: var(--coin) !important;
    background: var(--panel-deep);
}

/* ---------- Element-Plaketten ---------- */
.el {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 4px 2px 0;
    padding: 2px 8px 2px 4px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    background: var(--panel-deep);
    border: 2px solid var(--ink);
    box-shadow: inset 0 -2px 0 currentColor;
}

.el img {
    width: 16px;
    height: 16px;
}

.el-fire     { color: #ff8a5c; }
.el-water    { color: #6fb0ff; }
.el-grass    { color: #6fe070; }
.el-electric { color: #ffd84a; }
.el-ice      { color: #9eeaff; }
.el-earth    { color: #d9a86e; }
.el-light    { color: #fff4c2; }
.el-chaos    { color: #d08cf0; }

/* ---------- Schadenszahlen: wie sie im Spiel aufploppen ---------- */
.dmg-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 16px 0 20px;
}

.dmg-item {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 800;
    color: var(--cream-dim);
    background: var(--panel-deep);
    border: 3px solid var(--ink);
}

.dmg-number {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 32px;
    line-height: 1.1;
    text-shadow: var(--outline-2);
}

.dmg-white  { color: #ffffff; }
.dmg-green  { color: #3dff3d; }
.dmg-red    { color: #ff4040; }
.dmg-yellow { color: #ffff00; font-size: 48px; }
.dmg-aqua   { color: #00ffff; }

/* ---------- Raenge: Umrandungsfarben aus dem Spiel ---------- */
.rank-scale {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin: 16px 0 20px;
}

.rank-chip {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
    color: var(--cream-dim);
    background: var(--panel-deep);
    border: 3px solid var(--ink);
    box-shadow: inset 0 0 0 2px var(--rank-color);
}

.rank-chip b {
    display: block;
    font-weight: 800;
    font-size: 17px;
    color: var(--rank-color);
    text-shadow: 0 2px 0 var(--ink);
}

.rank-chip.is-rainbow {
    box-shadow: none;
    border-color: transparent;
    background:
        linear-gradient(var(--panel-deep), var(--panel-deep)) padding-box,
        linear-gradient(90deg, #ff5e5e, #ffd84d, #5fd264, #5aa2ff, #c07ae0) border-box;
}

.rank-chip.is-rainbow b {
    background: linear-gradient(90deg, #ff5e5e, #ffd84d, #5fd264, #5aa2ff, #c07ae0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
}

/* ---------- Skill-Tabelle ---------- */
.wiki-skill {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    font-weight: 800;
}

.wiki-skill-icon {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* ---------- FAQ: aufklappbare Holzzeilen ---------- */
.wiki-faq details {
    max-width: 44em;
    margin-bottom: 8px;
    background: var(--panel-deep);
    border: 3px solid var(--ink);
}

.wiki-faq summary {
    cursor: pointer;
    padding: 9px 14px 10px;
    font-weight: 800;
    list-style: none;
    background: var(--wood-grad);
    text-shadow: 0 2px 0 var(--ink);
}

.wiki-faq summary::-webkit-details-marker {
    display: none;
}

.wiki-faq summary::before {
    content: '+';
    display: inline-block;
    width: 22px;
    font-family: var(--font-pixel);
    color: var(--coin);
}

.wiki-faq details[open] summary::before {
    content: '-';
}

.wiki-faq details > p {
    margin: 0;
    padding: 12px 14px 14px 36px;
    color: var(--cream-dim);
}

/* ---------- Footer auf der Wiese ---------- */
body.wiki-page .pk-footer {
    color: #ffffff;
    font-weight: 800;
    text-shadow: var(--outline-2);
    border-top: none;
    padding-bottom: 48px;
}

body.wiki-page .pk-footer a {
    color: #ffffff;
}

body.wiki-page .pk-footer a:hover {
    color: var(--sprout);
}

.wiki-credit {
    margin-top: 8px;
    font-size: 12px;
}

/* ---------- Mobile-Inhaltsverzeichnis ---------- */
.wiki-toc-toggle {
    display: none;
}

@media (max-width: 900px) {
    body.wiki-page {
        background-attachment: scroll;
        background-size: auto 100vh;
        background-position: center top;
    }

    .wiki-hero {
        padding: 24px 16px;
    }

    .wiki-logo {
        width: 210px;
    }

    .wiki-title {
        font-size: 32px;
        text-shadow: var(--outline-2), 0 4px 0 var(--ink);
    }

    .wiki-subtitle {
        font-size: 16px;
    }

    .wiki-quickbar ol {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px 6px;
    }

    .wiki-quickbar a {
        width: auto;
    }

    .wiki-slot {
        width: 64px;
        height: 64px;
    }

    .wiki-window {
        margin: 0 8px 40px;
    }

    .wiki-layout {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 10px 28px;
    }

    .wiki-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0;
    }

    .wiki-toc-toggle {
        display: block;
        width: 100%;
        margin-bottom: 8px;
        padding: 9px 12px 10px;
        font-family: var(--font-ui);
        font-size: 14px;
        font-weight: 800;
        text-align: left;
        color: var(--cream);
        cursor: pointer;
        background: var(--wood-grad);
        border: 3px solid var(--ink);
        text-shadow: 0 2px 0 var(--ink);
    }

    .wiki-nav {
        display: none;
        margin-bottom: 8px;
    }

    .wiki-nav.is-open {
        display: block;
    }

    .wiki-page-title,
    .wiki-section-title {
        padding: 4px 10px 6px;
    }

    .wiki-table {
        font-size: 14px;
    }

    .wiki-table th,
    .wiki-table td {
        padding: 8px;
    }

    .wiki-table thead th {
        white-space: normal;
    }

    .wiki-skill {
        min-width: 140px;
        gap: 8px;
    }

    .wiki-skill-icon {
        width: 28px;
        height: 28px;
    }

}

/* ---------- Tastatur-Fokus & reduzierte Bewegung ---------- */
.wiki-nav a:focus-visible,
.wiki-quickbar a:focus-visible,
.wiki-article a:focus-visible,
.wiki-faq summary:focus-visible,
.wiki-toc-toggle:focus-visible {
    outline: 3px solid var(--sprout);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .wiki-slot img {
        transition: none;
    }

    .wiki-quickbar a:hover .wiki-slot img,
    .wiki-quickbar a:focus-visible .wiki-slot img {
        transform: none;
    }
}

/* ---------- Boss-Liste: Sprites als Schatten-Version wie im Kampf ---------- */
.wiki-boss {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wiki-boss img {
    flex: 0 0 auto;
    filter: brightness(0.3) saturate(0.4) drop-shadow(0 0 3px #c07ae0);
}

/* ---------- Kopf auf Unterseiten: Logo + Titel verlinken zur Hauptseite ---------- */
.wiki-home-link {
    display: inline-block;
    text-decoration: none;
}

.wiki-home-link .wiki-title {
    display: block;
}

.wiki-home-link:hover .wiki-title,
.wiki-home-link:focus-visible .wiki-title {
    color: var(--sprout);
}

/* ---------- Brotkrumen ---------- */
.wiki-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 800;
    color: var(--cream-dim);
}

.wiki-breadcrumb a {
    color: var(--sprout);
}

/* ---------- Vor / Zurueck ---------- */
.wiki-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
    padding-top: 24px;
    border-top: 3px solid var(--ink);
}

.wiki-pager a {
    display: block;
    padding: 9px 14px 11px;
    font-weight: 800;
    color: var(--cream);
    text-decoration: none;
    background: var(--wood-grad);
    border: 3px solid var(--ink);
    text-shadow: 0 2px 0 var(--ink);
}

.wiki-pager a:hover {
    background: linear-gradient(#a57d5f 0 3px, #936a4c 3px 55%, #7a573f 55%);
}

.wiki-pager small {
    display: block;
    font-size: 12px;
    color: var(--coin);
}

.wiki-pager-prev small::before {
    content: '‹ ';
}

.wiki-pager-next {
    grid-column: 2;
    text-align: right;
}

.wiki-pager-next small::after {
    content: ' ›';
}

/* ---------- Suchtreffer ---------- */
.wiki-search-box {
    position: relative;
}

.wiki-search-results {
    list-style: none;
    margin: -8px 0 14px;
    background: var(--panel-deep);
    border: 3px solid var(--ink);
    border-top: none;
}

.wiki-search-results a {
    display: block;
    padding: 8px 10px;
    text-decoration: none;
    color: var(--cream-dim);
    font-size: 13px;
    line-height: 1.45;
}

.wiki-search-results li + li a {
    border-top: 2px solid var(--ink);
}

.wiki-search-results a:hover,
.wiki-search-results a:focus-visible {
    background: var(--row);
}

.wiki-search-results b {
    display: block;
    font-size: 14px;
    color: var(--sprout);
}

.wiki-search-results mark {
    background: none;
    color: var(--coin);
    font-weight: 800;
}

.wiki-search-empty {
    padding: 10px;
    font-size: 13px;
    color: var(--cream-dim);
}

/* ---------- Artikeluebersicht auf der Hauptseite ---------- */
.wiki-section-title {
    margin-top: 40px !important;
}

.wiki-portal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.wiki-portal-group {
    padding: 10px 12px 12px;
    background: var(--panel-deep);
    border: 3px solid var(--ink);
}

.wiki-portal-group h3 {
    margin: 0 0 8px !important;
}

.wiki-portal-group ul {
    list-style: none;
    margin: 0 !important;
}

.wiki-portal-group li {
    margin: 0;
}

.wiki-portal-group a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    font-size: 15px;
    text-decoration: none;
    color: var(--cream);
}

.wiki-portal-group a:hover {
    color: var(--sprout);
}

.wiki-portal-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .wiki-pager {
        grid-template-columns: 1fr;
    }

    .wiki-pager-next {
        grid-column: 1;
    }
}
