@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&display=swap');

:root {
    /* Baroque Death Game Palette */
    --bg-color: #0a000a;
    /* Deep Void Purple */
    --card-bg: #1a0520;
    /* Dark Velvet */
    --cp-yellow: #d4af37;
    /* Antique Gold */
    --cp-cyan: #e6d2b5;
    /* Parchment (replaces cyan) */
    --cp-red: #8a0303;
    /* Blood Red */

    --text-color: #d4af37;
    /* Antique Gold */
    --dim-text: #7d6a80;
    /* Faded Lilac */
    --border-color: #3d0f42;

    --font-main: 'Cinzel', 'Times New Roman', serif;
    /* Default Gold Filter */
    --icon-filter: invert(82%) sepia(34%) saturate(736%) hue-rotate(359deg) brightness(91%) contrast(88%);
}

/* THEMES - Redefined for Baroque Context */
body.theme-search {
    --bg-color: #0a000a;
    --text-color: #d4af37;
    --accent-color: #d4af37;
    --icon-filter: invert(82%) sepia(34%) saturate(736%) hue-rotate(359deg) brightness(91%) contrast(88%);
    /* Gold */
}

body.theme-archive {
    --bg-color: #050a00;
    /* Deep Dark Green/Black for Archive? Or keep purple? Keeping purple for consistency */
    --bg-color: #0f020f;
    --text-color: #bfaec2;
    /* Silver/Purple text */
    --accent-color: #bfaec2;
    --icon-filter: invert(90%) sepia(8%) saturate(300%) hue-rotate(220deg) brightness(95%) contrast(85%);
    /* Silver-ish */
}

body.theme-system {
    --bg-color: #000000;
    --text-color: #a80000;
    /* Blood Red for System */
    --accent-color: #a80000;
    --icon-filter: invert(13%) sepia(90%) saturate(6000%) hue-rotate(350deg) brightness(90%) contrast(110%);
    /* Blood Red */
}

/* Override global variables based on body class */
body {
    --current-accent: var(--accent-color, #d4af37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    /* Damask-like subtle pattern or spotlight effect */
    background-image:
        radial-gradient(circle at center, rgba(30, 0, 30, 0.4) 0%, transparent 80%),
        repeating-linear-gradient(45deg, rgba(20, 0, 20, 0.3) 0, rgba(20, 0, 20, 0.3) 1px, transparent 1px, transparent 10px);
    background-size: 100% 100%, 20px 20px;

    color: var(--text-color);
    transition: background-color 0.8s ease, color 0.8s ease;
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Vignette Effect - Balanced */
/* Vignette Effect - Balanced */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.9) 100%);
    z-index: 50;
    mix-blend-mode: multiply;
    animation: vignettePulse 5s ease-in-out infinite alternate;
}

@keyframes vignettePulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.1);
        /* Stronger breathing */
    }
}
}
}

/* Floating Dust Particles - Subtle */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        radial-gradient(#d4af37 1px, transparent 1px),
        radial-gradient(#fff 1px, transparent 1px);
    background-size: 50px 50px, 100px 100px;
    background-position: 0 0, 50px 50px;
    opacity: 0.15;
    /* Increased slightly from initial 0.1, but much less than 0.4 */
    z-index: 1;
    animation: floatingParticles 60s linear infinite;
    /* Reverted speed */
}

@keyframes floatingParticles {
    0% {
        background-position: 0 0, 50px 50px;
    }

    100% {
        background-position: 50px 50px, 0 0;
    }
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    position: relative;
    z-index: 0;
    /* Established stacking context for watermark */
    border-left: 2px solid var(--text-color);
    border-right: 2px solid var(--text-color);
    transition: border-color 0.5s ease;
}

/* HEADER */
/* HEADER */
header {
    text-align: center;
    margin-bottom: 80px;
    border-bottom: 3px double var(--text-color);
    padding-bottom: 50px;
    /* Increased padding to separate buttons from line */
    transition: border-color 0.5s ease;
    position: relative;
}

/* Header Ornament with Icon */
header::after {
    content: '';
    position: absolute;
    bottom: -33px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: url('image/dg_icon.svg') no-repeat center center;
    background-size: contain;
    /* Reverted to background-image for reliability */
    opacity: 1;
    z-index: 10;
    filter: var(--icon-filter, invert(82%) sepia(34%) saturate(736%) hue-rotate(359deg) brightness(91%) contrast(88%)) drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

/* Watermark Accent */
.app-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: url('image/dg_icon.svg') no-repeat center center;
    background-size: contain;
    /* Reverted to background-image for reliability */
    opacity: 0.05;
    /* 5% opacity as requested */
    pointer-events: none;
    z-index: -1;
    filter: var(--icon-filter, invert(82%) sepia(34%) saturate(736%) hue-rotate(359deg) brightness(91%) contrast(88%));
}

h1 {
    font-size: 3rem;
    letter-spacing: 5px;
    margin-bottom: 20px;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    text-transform: uppercase;
    font-weight: 400;
    /* Serif fonts often look better with lighter weight */
    transition: color 0.5s ease;
}

/* TABS */
.tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.tab-btn {
    padding: 12px 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 1.1rem;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    pointer-events: none;
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--text-color);
    color: #000;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    border-color: #fff;
}

/* SECTIONS */
.tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.tab-content.active {
    display: block;
    opacity: 1;
}

/* SEARCH BAR */
.search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(20, 0, 20, 0.4);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: rgba(10, 0, 10, 0.8);
    border: 1px solid var(--text-color);
    border-left: 3px double var(--text-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 1.2rem;
    outline: none;
    transition: all 0.5s ease;
}

input[type="text"]:focus {
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    background: #000;
}

input[type="text"]::placeholder {
    color: var(--dim-text);
    font-style: italic;
}

button#search-btn,
button#unlock-btn,
.action-btn {
    padding: 12px 35px;
    background: #1a0520;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

button#search-btn::after,
button#unlock-btn::after,
.action-btn::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    bottom: 5px;
    left: 5px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    z-index: -1;
    transition: all 0.3s;
}

button#search-btn:hover,
button#unlock-btn:hover,
.action-btn:hover {
    background: var(--text-color);
    color: #0a000a;
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.6);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}

/* STATUS MESSAGE */
.status-message {
    text-align: center;
    font-weight: bold;
    min-height: 40px;
    margin-bottom: 20px;
    letter-spacing: 2px;
    font-family: 'Courier New', Courier, monospace;
    opacity: 0;
}

.status-error {
    color: var(--cp-red);
    text-shadow: 0 0 5px var(--cp-red);
    border: 1px solid var(--cp-red);
    background: rgba(20, 0, 5, 0.95);
    padding: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 5px 5px 0px rgba(255, 0, 60, 0.3);
    clip-path: polygon(0 0, 100% 0, 100% 80%, 95% 100%, 0 100%);
}

.status-success {
    color: #000;
    background: var(--cp-cyan);
    padding: 10px 20px;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 95% 100%, 0 100%);
    box-shadow: 0 0 10px var(--cp-cyan);
}

.status-icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
    flex-shrink: 0;
}

/* RESULTS GRID/LIST */
.results-container {
    padding-bottom: 50px;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    /* Slightly wider for ornate cards */
    gap: 30px;
}

.list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    /* More padding */
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.4s ease;
}

/* Ornate Corners for Cards */
.result-card::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(20, 0, 20, 0.8), 0 0 15px rgba(212, 175, 55, 0.2);
    border-color: var(--text-color);
}

.result-card::before {
    display: none;
    /* Remove cyber folded corner */
}

.card-title {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 10px;
    font-family: var(--font-main);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 5px;
    transition: color 0.5s ease;
}

.card-info {
    font-size: 0.95rem;
    color: var(--dim-text);
    margin-bottom: 15px;
    font-family: 'Open Sans', sans-serif;
    /* Keep readable font for body text? Or serif? Using serif global now */
    font-style: italic;
}

.card-link {
    display: inline-block;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid var(--text-color);
    font-size: 0.9rem;
    transition: all 0.3s;
}

.card-link:hover {
    text-shadow: 0 0 5px var(--text-color);
}

.card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    margin-bottom: 15px;
    border: 1px solid #000;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    filter: sepia(30%) contrast(1.1);
    /* Antique feel */
    transition: filter 0.4s;
}

.card-img:hover {
    filter: sepia(0%) contrast(1.2);
}

.unlock-status {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--text-color);
    color: #000;
    font-size: 0.8rem;
    padding: 5px 10px;
    font-weight: bold;
    z-index: 10;
    font-family: var(--font-main);
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.5);
}

.unlock-input-container {
    padding-top: 10px;
    display: flex;
    gap: 5px;
}

.unlock-input {
    width: 60%;
    padding: 8px;
    background: #000;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

.unlock-submit {
    flex: 1;
    padding: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.unlock-submit:hover {
    background: var(--text-color);
    color: #000;
}

/* SETTINGS PANEL */
.settings-panel {
    background: var(--card-bg);
    padding: 30px;
    border: 3px double var(--text-color);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    position: relative;
}

.settings-panel::after {
    /* Corner decoration example */
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.control-group {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

h2 {
    color: var(--text-color);
    font-size: 1.8rem;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 10px;
    margin-bottom: 25px;
    text-transform: uppercase;
    text-align: center;
    border-left: none;
    /* Removed side border */
}

h2::before,
h2::after {
    content: '—';
    margin: 0 10px;
    opacity: 0.5;
}

.toggle-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--text-color);
}

.view-toggle {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--text-color);
    color: var(--dim-text);
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.3s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: none;
    /* Remove cyber clip */
}

.view-toggle:last-child {
    border-right: none;
}

.view-toggle.active {
    background: var(--text-color);
    color: #0d020d;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.view-toggle:hover:not(.active) {
    background: rgba(212, 175, 55, 0.1);
    color: var(--text-color);
}

.danger-btn {
    background: #1a0520;
    border: 1px solid var(--cp-red);
    color: var(--cp-red);
    padding: 10px 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-main);
    text-transform: uppercase;
    clip-path: none;
    position: relative;
    overflow: hidden;
}

.danger-btn:hover {
    background: var(--cp-red);
    color: #fff;
    box-shadow: 0 0 20px rgba(138, 3, 3, 0.6);
}

/* FOOTER */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, #000, rgba(0, 0, 0, 0.8));
    padding: 15px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.status-line {
    font-size: 0.9rem;
    color: var(--dim-text);
    font-family: var(--font-main);
    letter-spacing: 1px;
}

#system-status {
    color: var(--text-color);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    /* Stronger blur */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border: 2px solid var(--text-color);
    padding: 50px 40px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), inset 0 0 100px rgba(0, 0, 0, 0.8);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    clip-path: none;
}

/* Decorative Border for Modal */
.modal-content::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    pointer-events: none;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 15px;
    letter-spacing: 3px;
    text-align: center;
    font-weight: 400;
}

.modal-desc {
    color: #ddd;
    margin-bottom: 25px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#modal-unlock-input {
    flex: 1;
    background: #000;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 12px;
    font-size: 1.2rem;
    outline: none;
    text-transform: uppercase;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 0 100%);
}

/* DETAIL MODAL SPECIAL STYLES */
.detail-content {
    width: 95%;
    height: 90vh;
    max-width: 1200px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    /* Allow close button to stick out */
    background: transparent;
    pointer-events: none;
    /* Let clicks pass through if not on content */
}

.iframe-wrapper {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    /* Simple Loading Indicator Support bg */
    background: transparent;
    pointer-events: auto;
    /* Re-enable pointer events for iframe */
}

#detail-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: transparent;
}


.close-icon-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #8a0303;
    /* Deep Red */
    color: #fff;
    border: 2px solid #d4af37;
    /* Gold Border */
    border-radius: 50%;
    /* Keep circular or make diamond? Keeping circular for classic feel */
    font-weight: bold;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(138, 3, 3, 0.8);
    transition: transform 0.3s, box-shadow 0.3s;
    pointer-events: auto;
    font-family: serif;
}

.close-icon-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.6);
    background: #a00;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .detail-overlay {
        padding: 0;
    }

    .detail-overlay .detail-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border: none;
        clip-path: none;
    }

    .detail-content .close-icon-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        background: rgba(138, 3, 3, 0.9);
        border: 2px solid #d4af37;
        border-radius: 50%;
        clip-path: none;
        /* Remove cyber clip */
        pointer-events: auto !important;
        z-index: 1001;
        cursor: pointer;
        box-shadow: 0 0 10px #000;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 80px;
        font-size: 0.9rem;
    }

    .search-bar {
        flex-direction: column;
        padding: 15px;
    }

    .toggle-group {
        display: none;
        /* Simplify for mobile */
    }

    /* Make buttons easier to tap on mobile */
    #search-btn,
    #unlock-btn,
    .action-btn,
    .danger-btn {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
        margin-top: 10px;
        margin-bottom: 5px;
    }
}