* {
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: var(--app-height);
    padding:
        calc(var(--top-safe) + 5rem)
        max(1rem, var(--right-safe))
        calc(var(--footer-height) + var(--bottom-safe) + 1.5rem)
        max(1rem, var(--left-safe));
    overflow-x: hidden;
}

.treasury-container {
    position: relative;
    z-index: 3;
    width: min(760px, 100%);
    border-radius: 32px;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(15, 44, 31, 0.4) 0%, transparent 34%),
        linear-gradient(145deg, rgba(10, 14, 12, 0.94) 0%, rgba(8, 10, 9, 0.94) 100%);
    border: 1px solid rgba(212, 175, 119, 0.18);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.zombie-border-top,
.zombie-border-bottom {
    height: 10px;
    background: linear-gradient(90deg, rgba(139, 30, 47, 0.95) 0%, rgba(212, 175, 119, 0.86) 50%, rgba(74, 222, 128, 0.82) 100%);
}

.header,
.asset-section,
.footer {
    position: relative;
    z-index: 2;
}

.header {
    padding: 1.5rem 1.5rem 1.35rem;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 119, 0.16);
    background: linear-gradient(180deg, rgba(15, 44, 31, 0.5) 0%, rgba(8, 10, 9, 0.12) 100%);
}

.header::before,
.header::after {
    content: "+";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: rgba(212, 175, 119, 0.7);
}

.header::before {
    left: 1.25rem;
}

.header::after {
    right: 1.25rem;
}

.drip {
    position: absolute;
    width: 8px;
    background: linear-gradient(180deg, rgba(139, 30, 47, 0), rgba(139, 30, 47, 0.82));
    border-radius: 0 0 8px 8px;
    animation: drip 3s infinite;
}

.drip:nth-child(1) { left: 12%; animation-delay: 0s; height: 24px; }
.drip:nth-child(2) { left: 30%; animation-delay: 1s; height: 16px; }
.drip:nth-child(3) { left: 50%; animation-delay: 2s; height: 28px; }
.drip:nth-child(4) { left: 70%; animation-delay: 0.5s; height: 20px; }
.drip:nth-child(5) { left: 88%; animation-delay: 1.5s; height: 26px; }

h1 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 10px 34px rgba(0, 0, 0, 0.56);
}

.subtitle {
    color: var(--gold);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.asset-section {
    padding: 1.7rem 1.5rem 1.4rem;
}

.asset-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.08) 0%, rgba(74, 222, 128, 0) 58%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(74, 222, 128, 0.03) 2px, rgba(74, 222, 128, 0.03) 4px);
    pointer-events: none;
}

.image-container {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
}

.image-frame {
    display: inline-flex;
    position: relative;
    padding: 0.8rem;
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(9, 11, 10, 0.94) 0%, rgba(12, 16, 13, 0.88) 100%);
    border: 1px solid rgba(212, 175, 119, 0.22);
    box-shadow:
        0 24px 56px rgba(0, 0, 0, 0.32),
        inset 0 0 0 1px rgba(74, 222, 128, 0.05);
    cursor: pointer;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.image-frame:hover,
.image-frame:focus-visible {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow:
        0 30px 64px rgba(0, 0, 0, 0.38),
        0 0 22px rgba(74, 222, 128, 0.14);
}

.asset-image {
    display: block;
    width: min(100%, 280px);
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    object-fit: cover;
}

.click-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 119, 0.2);
    background: rgba(7, 9, 8, 0.9);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.image-frame:hover .click-overlay,
.image-frame:focus-visible .click-overlay,
.image-frame:active .click-overlay {
    opacity: 1;
    visibility: visible;
}

.asset-title {
    color: var(--text);
    font-size: 1rem;
    text-align: center;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.artifact-dossier {
    margin-top: 1.35rem;
    padding: 1.25rem;
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(212, 175, 119, 0.12);
}

.dossier-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.dossier-kicker {
    color: var(--gold);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.dossier-heading h2,
.detail-panel h3 {
    font-family: var(--font-display);
    color: var(--text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dossier-heading h2 {
    font-size: 1.15rem;
}

.artifact-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: rgba(7, 9, 8, 0.88);
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: var(--glow);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.66rem;
    transition: transform 0.24s ease, border-color 0.24s ease;
}

.artifact-link:hover,
.artifact-link:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 119, 0.24);
}

.dossier-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.dossier-card,
.detail-panel {
    border-radius: 18px;
    background: rgba(7, 9, 8, 0.66);
    border: 1px solid rgba(212, 175, 119, 0.12);
}

.dossier-card {
    padding: 0.95rem 0.85rem;
    text-align: center;
}

.dossier-label {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.dossier-card strong {
    color: var(--gold);
    font-size: 0.98rem;
}

.detail-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.detail-panel {
    padding: 1rem;
}

.detail-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.detail-list {
    display: grid;
    gap: 0.75rem;
}

.detail-list div,
.trait-list li {
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.detail-list dd {
    margin: 0;
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.55;
    word-break: break-word;
}

.trait-list {
    list-style: none;
    display: grid;
    gap: 0.65rem;
}

.trait-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.trait-list span {
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.trait-list strong {
    color: var(--text);
    text-align: right;
}

.screen-radar {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.radar-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    filter:
        drop-shadow(0 0 16px rgba(74, 222, 128, 0.22))
        drop-shadow(0 0 46px rgba(74, 222, 128, 0.14));
    mix-blend-mode: screen;
    opacity: 0.9;
}

.radar-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.08) 0%, rgba(74, 222, 128, 0.03) 28%, rgba(74, 222, 128, 0) 70%);
    filter: blur(30px);
    animation: radarGlowPulse 4s ease-in-out infinite;
}

.footer {
    padding: 1.2rem 1.5rem 1.45rem;
    border-top: 1px solid rgba(212, 175, 119, 0.14);
    background: linear-gradient(180deg, rgba(15, 44, 31, 0.18) 0%, rgba(8, 10, 9, 0.42) 100%);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.stat-item {
    text-align: center;
    padding: 0.95rem 0.75rem;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(212, 175, 119, 0.12);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
}

.stat-value {
    display: block;
    margin-top: 0.5rem;
    color: var(--gold);
    font-size: 0.94rem;
    font-weight: 700;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 80;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: min(680px, 100%);
    padding: 1.5rem;
    border-radius: 28px;
    background:
        radial-gradient(circle at top, rgba(15, 44, 31, 0.38) 0%, transparent 34%),
        linear-gradient(145deg, rgba(10, 14, 12, 0.94) 0%, rgba(8, 10, 9, 0.94) 100%);
    border: 1px solid rgba(212, 175, 119, 0.18);
    box-shadow: var(--shadow);
    position: relative;
}

.modal-header {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(139, 30, 47, 0.9);
    color: #fff;
    border: 1px solid rgba(212, 175, 119, 0.2);
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.close-btn:hover,
.close-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(139, 30, 47, 0.22);
}

.chart-container {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pie-chart {
    width: 300px;
    height: 300px;
    border-radius: 50%;
}

.legend {
    flex: 1;
    min-width: 220px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.7rem;
    color: var(--text);
    font-size: 0.92rem;
}

.legend-color {
    width: 18px;
    height: 18px;
    margin-right: 0.8rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.legend-label {
    flex: 1;
}

.legend-value {
    color: var(--gold);
    font-weight: 700;
    margin-left: 0.8rem;
}

.back-button {
    position: fixed;
    top: calc(var(--top-safe) + 0.45rem);
    left: var(--left-safe);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.85rem 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 119, 0.22);
    background: linear-gradient(135deg, rgba(10, 12, 11, 0.94) 0%, rgba(15, 24, 19, 0.8) 100%);
    color: var(--text);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
}

@keyframes radarGlowPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.96);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.02);
    }
}

@keyframes drip {
    0%,
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
    50% {
        opacity: 0.7;
        transform: translateY(0);
    }
}

@media (max-width: 780px) {
    body {
        display: block;
        padding:
            calc(var(--top-safe) + 4.8rem)
            max(0.85rem, var(--right-safe))
            calc(var(--footer-height) + var(--bottom-safe) + 0.9rem)
            max(0.85rem, var(--left-safe));
    }

    .treasury-container {
        border-radius: 24px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .dossier-grid,
    .detail-columns {
        grid-template-columns: 1fr 1fr;
    }

    .chart-container {
        flex-direction: column;
    }

    .pie-chart {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 520px) {
    .header,
    .asset-section,
    .footer,
    .modal-content {
        padding: 1rem;
    }

    .header::before,
    .header::after {
        display: none;
    }

    .back-button {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.66rem;
    }

    .pie-chart {
        width: 210px;
        height: 210px;
    }

    .artifact-dossier {
        padding: 1rem;
    }

    .dossier-grid,
    .detail-columns {
        grid-template-columns: 1fr;
    }

    .trait-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .trait-list strong {
        text-align: left;
    }
}
