/* THE GOWN OF 9S: CORE AESTHETIC ALIGNMENT 
  Vibe: Overlord Throne Room x Persona 3 Dark Hour x Dragon's Crown Inn
*/

:root {
    /* This makes every color change smooth across the whole OS */
    transition: all 1.5s ease-in-out; 
}

body {
    transition: background-color 2s ease;
}

:root {
    /* Overlord: The Obsidian & Bone */
    --bg-void: #0a0a0c;
    --panel-deep: rgba(20, 18, 28, 0.95);
    --bone-white: #e8e8e8;
    
    /* Persona 3: Soul-Fire Cyan */
    --mana-cyan: #00d4ff;
    --mana-glow: rgba(0, 212, 255, 0.5);
    --mana-dim: rgba(0, 212, 255, 0.1);
    
    /* Dragon's Crown: The Gilded Archive */
    --brass-trim: #b8860b;
    --parchment: #f4e4bc;
    --ink-black: #1a1a1a;
    
    /* Manifesto: The Strike */
    --eye-red: #ff3e3e;
    --strike-glow: rgba(255, 62, 62, 0.4);
}

* {
    box-sizing: border-box;
    cursor: url('../images/sds_cursor.cur') 0 0, auto !important;
}

/* Target all window types at once */
.archive-window, 
.help-window, 
.merc-card-inner,
.sds-main-article {
    border-radius: 8px; /* The "Sweet Spot" for tactical UI */
    overflow: hidden;   /* CRITICAL: This prevents the content/images inside from 'leaking' over the rounded corners */
}

.burn-button, .sds-btn, .dock-item img {
    border-radius: 4px; /* Subtle rounding for smaller elements */
}

button, .dock-item, .menu-item, .back-link {
    cursor: url('../images/sds_cursor.cur') 0 0, pointer !important;
}

a, button, .dock-item, .dock-item img, .menu-item {
    cursor: url('../images/sds_cursor.cur') 0 0, pointer !important;
}

.dock-item:hover, .dock-item img:hover {
    cursor: url('../images/sds_cursor.cur') 0 0, pointer !important;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    color: var(--parchment);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow: hidden; 
}

/* Background Texture: The Dragon's Crown Parchment Overlay */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--bg-void);
    pointer-events: none;
    z-index: -1;
    opacity: 1;
    transition: opacity 2s ease-in-out;
}

/* The Eye Effect Layer (Manifesto) */
#eye-effect-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* The Desktop Manifold */
#desktop-environment {
    position: relative;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow: hidden;
}

.p3-dialogue-box, 
.affiliation-gate, 
.contract-window,
.contract-overlay {
    position: absolute !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.5s ease;
    /* animation: window-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); */
}

/* THE MODAL OVERLAYS (Top Layer - Must cover everything) */
.p3-dialogue-box { z-index: 1000; }
.affiliation-gate { z-index: 1010; }

.contract-overlay,
.legal-overlay,
.archive-window { 
    z-index: 2000 !important; /* Forces these to the very front */ 
}

@keyframes window-pop {
    0% {
        /* Start small, slightly transparent, AND centered */
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        /* End full size, fully transparent, AND still centered */
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Diegetic Windows (The 'Inn' Windows) */
.sds-window {
    background: rgba(10, 10, 12, 0.8);;
    border: 1px solid var(--brass-trim);
    drop-shadow: 0 0 20px var(--mana-dim), inset 0 0 10px #000;
    padding: 20px;
    border-radius: 2px;
    position: absolute;
    backdrop-filter: blur(8px);
}

.sds-window-header {
    border-bottom: 1px solid var(--mana-cyan);
    color: var(--mana-cyan);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

/* The Tactical Dock (Aetherpunk Engine) */
.sds-dock-container {
    position: fixed;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1000;
}

.sds-dock {
    background: rgba(10, 10, 12, 0.8);
    border: 1px solid var(--brass-trim);
    padding: 10px 20px;
    display: flex;
    gap: 25px;
    align-items: center;
    drop-shadow: 0 -5px 25px rgba(0, 0, 0, 0.8);
    border-bottom: 3px solid var(--mana-cyan); /* The Soul-Fire Underglow */
    border-radius: 20px 0px 20px 0px; 
}

.dock-item {
    width: 45px;
    height: 45px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: grayscale(1) brightness(0.8);
}

.dock-item:hover {
    transform: translateY(-10px) scale(1.2);
    filter: grayscale(0) drop-shadow(0 0 10px var(--mana-cyan));
}

.dock-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* KaTeX Formatting Alignment */
.katex {
    color: var(--mana-cyan) !important;
    font-size: 1.1em;
}

/* Buttons: The Token Burn Interface */
.burn-button {
    background: transparent;
    border: 1px solid var(--eye-red);
    color: var(--eye-red);
    padding: 10px 25px;
    font-family: inherit;
    text-transform: uppercase;
    transition: 0.2s;
    overflow: hidden;
    position: relative;
}

.burn-button:hover {
    background: var(--eye-red);
    color: var(--bg-void);
    drop-shadow: 0 0 15px var(--strike-glow);
}

/* UI Loading state: The P3 Spin */
#loading-shield {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-void);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: var(--mana-cyan);
    text-shadow: 0 0 10px var(--mana-glow);
}

/* Transitions */
.hidden { opacity: 0; pointer-events: none; }
.visible { opacity: 1; pointer-events: auto; }

/* Add this to assets/css/gown_style.css */
.system-purge {
    filter: grayscale(1) contrast(300%) invert(1);
    background: #000;
    transition: all 0.5s ease-in;
}

.severance-mask {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    font-family: 'JetBrains Mono', monospace;
    color: var(--eye-red);
}

.glitch-text {
    font-size: 2rem;
    /* animation: glitch 0.2s infinite; */
    text-shadow: 2px 0 var(--mana-cyan), -2px 0 var(--eye-red);
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-5px, 5px); }
    40% { transform: translate(-5px, -5px); }
    60% { transform: translate(5px, 5px); }
    80% { transform: translate(5px, -5px); }
    100% { transform: translate(0); }
}

.affiliation-gate {
    width: 400px;
    border-radius: 20px 0px 20px 0px; 
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--mana-cyan);
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--mana-dim);
    color: var(--bone-white);
    padding: 10px;
    font-family: inherit;
    outline: none;
}

.input-group input:focus {
    border-color: var(--mana-cyan);
    drop-shadow: 0 0 10px var(--mana-dim);
}

.status-glow {
    font-size: 0.6rem;
    animation: pulse 2s infinite;
}

@keyframes window-pop {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.contract-overlay {
    width: 650px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border-radius: 20px 0px 20px 0px; 
    /* Apply the fixed animation */
    animation: p3-slide-in 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.contract-scroll {
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--parchment);
}

/* Custom Scrollbar for that Aetherpunk feel */
.contract-scroll::-webkit-scrollbar { width: 4px; }
.contract-scroll::-webkit-scrollbar-track { background: var(--bg-void); }
.contract-scroll::-webkit-scrollbar-thumb { background: var(--mana-cyan); }

.brass-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--brass-trim), transparent);
    margin: 20px 0;
}

.contract-section h4 {
    color: var(--mana-cyan);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.pact-buttons {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    border-top: 1px solid var(--mana-dim);
}

.burn-button.decline {
    border-color: var(--eye-red);
    color: var(--eye-red);
}

.burn-button.decline:hover {
    background: var(--eye-red);
    color: #000;
}

@keyframes p3-slide-in {
    from { 
        /* Start off-center to the right */
        transform: translate(-30%, -50%) scale(0.9); 
        opacity: 0; 
    }
    to { 
        /* End at perfect center */
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1; 
    }
}

.altar-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 90%;
    max-width: 1000px;
    animation: fade-in 1s ease;
}

.status-panel {
    width: fit-content;
    min-width: 250px;
}

.stat-line {
    font-size: 0.9rem;
    margin: 5px 0;
    letter-spacing: 1px;
}

.heavens-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.heaven-card {
    height: 300px;
    background: var(--panel-deep);
    border: 1px solid var(--mana-dim);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    transition: 0.3s;
    cursor: url('../images/sds_cursor.cur');
    position: relative;
    overflow: hidden;
}

.heaven-card:hover {
    border-color: var(--mana-cyan);
    drop-shadow: 0 0 20px var(--mana-dim);
    transform: translateY(-5px);
}

.heaven-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 60%;
    background-size: cover;
    opacity: 0.4;
    transition: 0.5s;
}

/* Specific Tier Icons - Add your images to these */
.virens::before { background-image: url('../images/virens_gate.png'); }
.sylvestris::before { background-image: url('../images/sylvestris_gate.png'); }
.sanguis::before { background-image: url('../images/sanguis_gate.png'); }

.heaven-card:hover::before { opacity: 1; transform: scale(1.1); }

.tier-label {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--brass-trim);
    text-shadow: 0 0 10px #000;
}

.tier-desc {
    font-size: 0.7rem;
    color: var(--mana-cyan);
    opacity: 0.7;
}

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    animation: p3-choice-slide 0.3s ease-out;
}

.choice-btn {
    background: var(--mana-dim);
    border: 1px solid var(--mana-cyan);
    color: var(--mana-cyan);
    padding: 8px 15px;
    text-align: left;
    font-family: inherit;
    transition: 0.2s;
    cursor: url('../images/sds_cursor.cur');
}

.choice-btn:hover {
    background: var(--mana-cyan);
    color: var(--bg-void);
    drop-shadow: 0 0 15px var(--mana-glow);
    padding-left: 25px; /* Subtle movement */
}

@keyframes p3-choice-slide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.archive-window {
    position: absolute;   /* This is the key to 'popping over' */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centers the window perfectly */
    z-index: 3000;        /* Ensures it stays above the dialogue */
    
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    
    background: var(--panel-deep);
    border: 2px solid var(--mana-cyan);
    drop-shadow: 0 0 25px var(--mana-glow), inset 0 0 15px rgba(0,0,0,0.8);
    
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    border-radius: 20px 0px 20px 0px; 
}

.archive-scroll {
    flex: 1;                
    overflow-y: auto;       /* The "Scroll for the rest" logic */
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--mana-cyan) transparent;
    scrollbar-width: thin;
    scrollbar-color: var(--mana-cyan) rgba(0,0,0,0.5);
}

/* Tactile List Styling */
.intel-list {
    list-style: none;
    padding: 0;
}

.intel-entry {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
    cursor: url('../images/sds_cursor.cur');
    transition: 0.2s;
    font-size: 0.9rem;
}

.intel-entry:hover {
    background: rgba(0, 255, 255, 0.1);
    padding-left: 20px;
    color: var(--mana-cyan);
}

.date-tag {
    color: var(--brass-trim);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    margin-right: 10px;
}

.fragment-nav {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.9); /* Matches your window */
    padding-bottom: 10px;
    z-index: 10;
    margin-bottom: 20px;
}

.sds-article-content {
    line-height: 1.6;
    color: var(--mana-white);
}

/* assets/css/gown_style.css */
.sds-article-content h2, 
.sds-article-content h3 {
    display: block;
    clear: both;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--mana-cyan);
    font-family: 'JetBrains Mono', monospace;
}

.sds-article-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.sds-currency-prot {
    color: var(--mana-cyan);
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

/* This targets the desktop ONLY when the archive is open */
#desktop-environment:has(.archive-window) {
    display: flex !important;
    align-items: flex-start !important; /* Forces everything to the top */
    justify-content: center !important; /* Horizontal center only */
    padding-top: 0 !important;
}

.archive-window {
    align-self: flex-start; /* Ensure the window itself doesn't center */
    margin-top: 2vh; /* Small gap from the top of the screen */
}

.archive-scroll {
    display: block !important; /* Blocks don't center vertically */
    height: 70vh; /* Fixed height for the scroll area */
    overflow-y: auto;
    padding: 20px !important;
}

#fragment-viewer, #archive-list-view {
    margin: 0 !important;
    padding: 0 !important;
    display: block;
}

/* Context Menu Bibliography */
#system-help-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    background: #000;
    border: 1px solid var(--mana-cyan);
    padding: 20px;
    z-index: 1000;
    drop-shadow: 0 0 30px rgba(0, 255, 204, 0.2);
    display: none;
    font-family: 'Courier New', Courier, monospace;
}

.help-header {
    color: var(--mana-cyan);
    border-bottom: 1px solid var(--mana-cyan);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: bold;
    letter-spacing: 2px;
}

.biblio-entry {
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 15px;
    line-height: 1.4;
    padding-left: 20px;
    text-indent: -20px; /* APA Hanging Indent */
}

.help-footer {
    margin-top: 20px;
    font-size: 0.6rem;
    color: #666;
    text-align: center;
}

.biblio-entry {
    margin-bottom: 18px;
    line-height: 1.5;
    color: #fff;
    font-size: 0.85rem;
    padding-left: 20px;
    text-indent: -20px; /* Hanging indent for APA7 */
}

.inline-diegetic-link {
    display: inline; /* Keeps it on the same line */
    color: #ff0033; /* Eye-Red */
    text-decoration: none;
    font-size: 0.7rem;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.2s;
}

.inline-diegetic-link:hover {
    text-decoration: underline;
    color: #00ffcc; /* Optional: Shift to Mana-Cyan on hover for feedback */
}

.biblio-entry {
    margin-bottom: 22px;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    padding-left: 12px;
}

/* Sidebar Manifest */
.sds-sidebar {
    width: 200px;
    border-left: 1px solid var(--brass-trim);
    padding-left: 15px;
    margin-left: 20px;
    font-size: 0.75rem;
}
/* Target the individual blocks in the sidebar */
.sidebar-section {
    margin-bottom: 25px; /* This creates the gap between sections */
    display: flex;
    flex-direction: column;
}

.p3-label {
    display: block;
    color: var(--eye-red);
    font-weight: bold;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px; /* Gap between label and content */
    border-bottom: 1px solid rgba(255, 0, 0, 0.3);
    padding-bottom: 2px;
}

.p3-value, .p3-sub-value{
    padding-left: 5px;
    line-height: 1.4;
}

.p3-tags {
    display: flex;
    flex-wrap: wrap;       /* This is the 'Word-Wrap' magic */
    /* gap: 4px;  */
    padding-left: 5px;
    width: 100%;           /* Ensure it uses the full sidebar width */
}

/* The individual tag style */
.tag {
    display: inline;       /* Back to text-style flow */
    color: var(--mana-cyan);
    font-style: italic;
    font-size: 0.75rem;
    white-space: nowrap;   /* Prevents a single tag from breaking in half */
    background: none;
    padding: 0;
}

.mana-text { color: var(--mana-cyan); }
.eye-red-text { color: var(--eye-red); text-shadow: 0 0 5px var(--strike-glow); }

/* The Wrapper that holds Article (left) and Sidebar (right) */
.sds-grid-wrapper {
    display: grid;
    grid-template-columns: 1fr 240px; /* Article takes the rest, Sidebar is fixed width */
    gap: 40px;
    align-items: flex-start;
    padding: 20px;
}

/* Sidebar Styling - Quantitative Look */
.sds-sidebar {
    border-left: 1px solid var(--brass-trim);
    padding-left: 20px;
    font-family: 'Courier New', monospace; /* Professional Framework look */
    font-size: 0.75rem;
    line-height: 1.5;
    position: sticky; /* Keep it visible while scrolling */
    top: 10px;
}

.p3-label {
    display: block;
    color: var(--eye-red);
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255, 0, 0, 0.2);
}

.p3-value {
    color: var(--mana-white);
    margin-bottom: 15px;
    word-wrap: break-word;
}

.tag {
    display: block;
    color: var(--mana-cyan);
    margin-right: 8px;
    font-style: italic;
}

/* Context Menu Polish */
.menu-header {
    font-size: 0.6rem;
    color: var(--brass-trim);
    padding: 5px 15px;
    border-bottom: 1px solid var(--mana-dim);
    margin-bottom: 5px;
}

.menu-sep {
    border: 0;
    height: 1px;
    background: var(--mana-dim);
    margin: 5px 0;
}

.menu-footer {
    font-size: 0.5rem;
    color: #444;
    text-align: center;
    padding: 5px;
}

.sds-redacted {
    background-color: #000;
    color: #000;
    padding: 0 4px;
    user-select: none; /* Prevents people from highlighting to read it */
}

/* The Navigation Header */
.fragment-nav-header {
    display: flex;
    justify-content: flex-start;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--mana-dim);
    margin-bottom: 15px;
}

/* The Arrow Button */
.back-arrow {
    background: none;
    border: none;
    color: var(--mana-cyan);
    font-size: 1.5rem;
    cursor: url('../images/sds_cursor.cur');
    padding: 0 10px;
    transition: transform 0.2s;
    font-family: monospace;
}

.back-arrow:hover {
    color: var(--eye-red);
    transform: translateX(-3px);
}

.encrypted-date {
    font-family: 'Courier New', monospace;
    color: var(--eye-red);
    cursor: help;
    transition: all 0.3s ease;
    border-bottom: 1px dotted var(--eye-red);
}

.encrypted-date:hover {
    color: var(--mana-cyan);
    text-shadow: 0 0 8px var(--mana-glow);
}

/* On hover, we can show the real date using a pseudo-element */
.encrypted-date:hover::after {
    content: " [ DECRYPTED: " attr(data-real-date) " ]";
    font-size: 0.65rem;
    letter-spacing: 1px;
}

/* The 'Actual Company' Protocol - Centered & Brutalist */
.legal-overlay {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important; /* Forces perfect center */
    
    background: #ffffff !important; 
    color: #1a1a1a !important;     
    border: 4px solid #000 !important;
    
    width: 650px !important;
    max-width: 95vw;
    height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
    
    /* Brutalist shadow: solid offset, no blur */
    box-shadow: 15px 15px 0px #000 !important; 
    z-index: 10000 !important;
    overflow: hidden;
}

.legal-overlay .sds-window-header {
    background: #000 !important;
    color: #fff !important;
    font-family: 'Arial', 'Helvetica', sans-serif !important;
    text-transform: uppercase;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 1px;
    flex-shrink: 0;
}

/* The Scrollable Legal Content */
.archive-scroll {
    padding: 40px !important;
    /* background: #fff !important; */
    overflow-y: auto !important;
    flex-grow: 1;
}

.legal-entry h3 {
    color: #000 !important;
    font-family: 'Helvetica', 'Arial', sans-serif !important;
    border-bottom: 2px solid #000 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.legal-entry div, 
.legal-entry p {
    font-family: 'Times New Roman', Times, serif !important; 
    font-size: 1.05rem !important;
    line-height: 1.5 !important;
    color: #111 !important;
}

/* Hardened Agreement Button */
.burn-button {
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    padding: 20px !important;
    font-weight: bold !important;
    cursor: pointer;
    width: 100%;
    font-family: 'Arial', sans-serif !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: background 0.2s;
}

.burn-button:hover {
    background: #333 !important;
}

/* The button they have to click to 'Find Out' */
.burn-button {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    cursor: url('../images/sds_cursor.cur');
}

.burn-button:hover {
    background: var(--eye-red);
}

.archive-body strong {
    color: var(--mana-cyan);
    text-shadow: 0 0 5px var(--mana-glow);
}

.widget-glitch-header {
    font-size: 0.65rem;
    color: var(--mana-cyan);
    border-bottom: 1px solid var(--mana-dim);
    margin-bottom: 10px;
    padding-bottom: 4px;
    letter-spacing: 1.5px;
    font-weight: bold;
}

.sds-widget .data-row span {
    font-family: 'JetBrains Mono', monospace;
}

/* Ensure the widget layer sits correctly over the main desktop */
#sds-widget-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; /* Crucial: Let clicks through to the desktop */
    z-index: 20; /* Higher than dialogue and archive */
}

#widget-sdst-ledger {
    background: linear-gradient(135deg, var(--panel-deep) 0%, rgba(0, 212, 255, 0.02) 100%);
    border-left: 4px solid var(--mana-cyan);
    drop-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

#stat-sdst-balance {
    text-shadow: 0 0 8px var(--mana-glow);
    font-variant-numeric: tabular-nums; /* Prevents numbers from jumping while animating */
}

/* THE WIDGET CONTAINER */
.widget-stack {
    position: fixed; /* Fixed is safer than absolute for overlays */
    bottom: 100px; 
    left: 20px;
    display: flex;
    flex-direction: column-reverse; 
    gap: 15px;
    z-index: 60;
    pointer-events: none; /* Allows clicks to pass through empty space between widgets */
}

/* THE WIDGET BASE (Replaces .sds-widget and .terminal-fragment) */
.sds-widget {
    width: 280px;
    background: var(--panel-deep);
    border: 1px solid var(--mana-dim);
    border-left: 4px solid var(--mana-cyan);
    padding: 12px;
    drop-shadow: 0 0 20px rgba(0,0,0,0.8);
    border-radius: 20px 0px 20px 0px; 
    
    /* INITIAL STATE: Hidden & Pushed Left */
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
    
    /* THE TRANSITION: Smooth "Persona" style curve */
    transition: 
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* THE MANIFEST STATE */
.sds-widget.manifested {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto; /* Becomes interactive only when visible */
}

/* HDDIP DECORATION */
.hddip-wrapper {
    margin-top: 12px;
    padding: 8px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px dashed var(--mana-dim);
}

.hddip-code {
    font-size: 0.65rem;
    color: var(--mana-cyan);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#widget-reports {
    min-width: 300px;
    background: rgba(0, 0, 0, 0.4);
}

.report-grid-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    font-size: 0.6rem;
    color: var(--mana-cyan);
    border-bottom: 1px solid var(--mana-cyan);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

#report-list-container {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.7rem;
    color: #fff;
    max-height: 150px;
    overflow-y: auto;
}

.empty-ledger {
    text-align: center;
    padding: 20px;
    opacity: 0.5;
    font-style: italic;
}

#stack-top-right {
    position: absolute;
    top: 20px;
    right: 20px; /* This forces it to the right */
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Ensures content inside aligns to the right edge */
    gap: 15px;
    z-index: 100;
    pointer-events: none; /* Allows clicking through empty space */
}

#stack-top-right .sds-widget {
    pointer-events: auto; /* Re-enables clicking on the actual widget */
    text-align: right;    /* Keeps text aligned to the outer edge */
}

.report-grid-header {
    display: grid;
    grid-template-columns: 120px 80px 100px; /* Fixed widths prevent 'drifting' */
    gap: 10px;
    font-size: 0.6rem;
    color: var(--mana-cyan);
    border-bottom: 1px solid rgba(0, 255, 204, 0.3);
    padding: 5px 0;
}

#death-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95); /* Deep black blackout */
    color: #00ffff; /* Mana Cyan */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* Above the Eye Effect and Widgets */
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px #00ffff;
}

.gown-stats-table {
    border-collapse: collapse;
    margin-top: 20px;
    width: 80%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.05);
}

.gown-stats-table th, .gown-stats-table td {
    border: 1px solid #00ffff;
    padding: 10px;
    text-align: left;
}

.payment-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    /* min-height: 1000px; */
    background: transparent; 
    border: 1px solid rgba(255, 106, 0, 0.2);
    padding: 0px;
    border-radius: 65px 0px 65px 0px;
    display: block;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.os-window.payment-portal {
    position: fixed;
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #000; 
    border: 1px solid var(--mana-cyan);
    drop-shadow: 0 0 15px var(--mana-glow);
    display: flex;
    flex-direction: column;
    border-radius: 80px 0px 80px 0px; 
    padding: 15px;
    box-sizing: border-box;
    overflow: visible;
}

.window-body {
    flex: 1;          
    display: flex;    
    min-height: 0;
    position: relative;
    drop-shadow: inset 0 0 20px rgba(255, 106, 0, 0.3); 
    border-radius: 65px 0px 65px 0px; 
    overflow-y: auto; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.window-header {
    position: absolute;
    top: -35px;    
    right: 0px;   
    
    font-family: 'JetBrains Mono', monospace;
    color: var(--mana-cyan);
    cursor: pointer !important;
    z-index: 1000001; /* Higher than the arrows and card */
    pointer-events: auto !important;
    
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border: 1px solid var(--mana-cyan);
    border-radius: 8px 8px 0px 0px; 
    transition: all 0.2s ease;
    border-bottom: none;
}

.window-body::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 106, 0, 0.05); /* Subtle tint */
    pointer-events: none; 
    z-index: 2;
    mix-blend-mode: color; 
}

@media print {
    /* 1. Kill everything on the screen globally */
    body * {
        display: none !important;
    }

    /* 2. Resurrect ONLY the article and its header */
    .archive-window, 
    .archive-window *,
    .sds-main-article, 
    .sds-main-article *,
    #inner-content,
    #inner-content * {
        display: block !important;
        visibility: visible !important;
    }

    /* 3. Force the layout to be a simple, full-width white page */
    .archive-window {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        border: none !important;
        color: black !important;
    }

    .archive-scroll {
        overflow: visible !important;
        height: auto !important;
    }

    /* 4. Hide the UI elements you don't want on paper */
    .sds-sidebar, 
    .back-arrow, 
    .fragment-nav-header,
    .sds-window-header {
        display: none !important;
    }

    /* 5. Ensure the text uses the full page width */
    .sds-grid-wrapper {
        display: block !important; /* Kill the 2-column grid for print */
    }
}