:root {
    --bg-image: url("Assets/pink2.png");

    --page-bg-fallback: #1c1b2b;
    --panel-dark: rgba(24, 20, 40, 0.82);
    --panel-main: rgba(24, 20, 40, 0.78);

    --border-color: #f4bcc9;
    --light-panel: rgba(255, 241, 246, 0.88);
    --light-panel-2: rgba(255, 248, 250, 0.92);

    --text-dark: #18131f;
    --text-accent: #3b2941;
    --text-light: #ffe6ee;

    --button-bg: rgba(255, 241, 246, 0.92);
    --button-hover: rgba(244, 188, 201, 0.60);
    --button-active: rgba(244, 188, 201, 0.76);

    --glow: rgba(244, 188, 201, 0.22);
    --shadow-strong: rgba(244, 188, 201, 0.40);
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        linear-gradient(rgba(20, 15, 30, 0.30), rgba(20, 15, 30, 0.30)),
        var(--bg-image) center center / cover no-repeat fixed;
    background-color: var(--page-bg-fallback);
    color: var(--text-dark);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.page-layout {
    width: min(95%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 10px 0;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 220px;
    gap: 20px;
    align-items: stretch;
}

.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.main-column {
    min-width: 0;
    display: flex;
}

.nav-panel {
    margin: 0;
}

.content-box {
    position: relative;
    width: 100%;
    padding: 20px;
    border: 2px solid var(--border-color);
    background: var(--panel-main);
    border-radius: 8px;
    box-shadow: 0 0 12px var(--glow);
}

.header {
    text-align: center;
    margin-bottom: 15px;
    padding-inline: 60px;
}

.header img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
    margin: 0 auto;
}

.home-button {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 52px;
    height: 52px;
    background: var(--panel-dark);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px var(--shadow-strong);
    z-index: 2;
    transition: 0.2s ease;
}

.home-button:hover {
    box-shadow: 0 0 14px var(--shadow-strong);
    transform: translateY(-2px);
}

.home-button img {
    width: 70%;
    height: auto;
    display: block;
}

.view-toggle-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.view-toggle {
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    background: var(--button-bg);
    color: var(--text-dark);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
}

.view-toggle:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
}

.view-toggle.active {
    background: var(--button-active);
    box-shadow: 0 0 10px var(--glow);
}

.almanica-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 20px;
    align-items: stretch;
}

.map-panel,
.overview-panel,
.details-panel {
    background: var(--light-panel);
    border: 2px solid var(--border-color);
    padding: 18px;
    min-width: 0;
}

.map-panel {
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.map-image {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
}

.overview-panel {
    min-height: 340px;
    display: flex;
    flex-direction: column;
}

.details-panel {
    grid-column: 1 / -1;
    min-height: 180px;
}

.section-title {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: clamp(20px, 2vw, 26px);
    font-weight: bold;
    text-align: center;
    color: var(--text-accent);
}

.overview-content,
.details-content {
    font-size: clamp(14px, 1.1vw, 16px);
    line-height: 1.6;
    color: var(--text-dark);
}

.character-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.character-card {
    border: 2px solid var(--border-color);
    background: var(--light-panel-2);
    overflow: hidden;
}

.character-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-bottom: 2px solid var(--border-color);
}

.character-card-body {
    padding: 12px;
}

.character-card-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text-accent);
}

.character-card-desc {
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
    color: var(--text-dark);
}

.hidden {
    display: none;
}

.side-panel {
    border: 2px solid var(--border-color);
    background: var(--panel-dark);
    box-shadow: 0 0 10px var(--glow);
}

.panel-title {
    padding: 16px;
    font-size: clamp(18px, 2vw, 22px);
    font-weight: bold;
    text-align: center;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.panel-content {
    padding: 20px;
    text-align: center;
    min-height: 120px;
    color: var(--text-light);
    font-weight: bold;
    line-height: 1.45;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.side-link {
    display: block;
    width: 100%;
    padding: 18px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: clamp(16px, 1.4vw, 18px);
    font-weight: bold;
    border-top: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
    transition: 0.2s ease;
}

.side-link:hover {
    background: rgba(255, 255, 255, 0.16);
}

.side-dropdown {
    position: relative;
}

.dropdown-toggle {
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.dropdown-toggle.side-link {
    display: block;
    width: 100%;
    padding: 18px 12px;
    font-size: clamp(16px, 1.4vw, 18px);
    font-weight: bold;
    text-align: center;
    color: var(--text-light);
    text-decoration: none;
    border-top: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: 0.2s ease;
}

.dropdown-toggle.side-link:hover {
    background: rgba(255, 255, 255, 0.16);
}

.dropdown-menu {
    position: absolute;
    top: 50%;
    left: calc(100% + 6px);
    transform: translateY(-18px);
    min-width: 260px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    background: var(--panel-dark);
    border: 2px solid var(--border-color);
    box-shadow: 0 0 14px var(--glow);
    border-radius: 10px;
    padding: 8px;
    display: none;
    z-index: 1000;
}

.side-dropdown.open .dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.side-dropdown.open::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    width: 8px;
    height: 2px;
    background: var(--border-color);
    box-shadow: 0 0 6px var(--shadow-strong);
    z-index: 1001;
    pointer-events: none;
}

.dropdown-item {
    display: block;
    padding: 14px 16px;
    text-decoration: none;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
    background: var(--light-panel-2);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: 0.2s ease;
}

.dropdown-item:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
}

.icon-panel {
    padding: 12px;
    background: var(--panel-dark);
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.icon-button {
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: 0.2s ease;
    color: var(--text-light);
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 10px var(--glow);
    transform: translateY(-2px);
}

.icon-button img {
    width: 60%;
    height: auto;
    display: block;
}

.locations-panel {
    overflow: hidden;
}

.location-button {
    display: block;
    width: 100%;
    padding: 24px 14px;
    border: none;
    border-top: 2px solid var(--border-color);
    background: var(--button-bg);
    color: var(--text-dark);
    font-size: clamp(18px, 1.5vw, 20px);
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: 0.2s ease;
}

.location-button:hover {
    background: var(--button-hover);
}

.location-button.active {
    background: var(--button-active);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
}

.corner-sticker {
    position: fixed;
    bottom: 15px;
    left: 15px;
    width: clamp(50px, 7vw, 70px);
    height: auto;
    z-index: 999;
}

@media (max-width: 1100px) {
    .page-layout {
        min-height: auto;
        grid-template-columns: 1fr;
        padding: 20px 0;
    }

    .sidebar-left,
    .sidebar-right,
    .main-column {
        width: 100%;
    }

    .almanica-main-grid {
        grid-template-columns: 1fr;
    }

    .header {
        padding-inline: 0;
        padding-top: 60px;
    }

    .home-button {
        top: 10px;
        left: 10px;
    }

    .dropdown-menu {
        top: calc(100% + 8px);
        left: 0;
        transform: none;
        min-width: 100%;
        max-height: none;
    }

    .map-panel,
    .overview-panel,
    .details-panel {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    .content-box,
    .side-panel {
        padding-left: 12px;
        padding-right: 12px;
    }

    .map-panel,
    .overview-panel,
    .details-panel {
        padding: 12px;
    }

    .corner-sticker {
        width: 48px;
        bottom: 10px;
        left: 10px;
    }

    .view-toggle-row {
        flex-direction: column;
    }
}