:root {
    --bg-deep: #0a0a0a;
    --bg-dark-stone: #1a1a1a;
    --accent-blood: #8a0303;
    --accent-gold: #d4af37;
    --text-main: #c0c0c0;
    --border-stone: #444;
    --pixel-size: 4px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Share Tech Mono', monospace;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.pixel-text {
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    color: var(--accent-gold);
    text-shadow: 2px 2px #000;
}

/* Scanline Effect */
.scanline {
    width: 100%;
    height: 100px;
    z-index: 9999;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.05) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.1;
    position: fixed;
    bottom: 100%;
    animation: scanline 6s linear infinite;
    pointer-events: none;
}

@keyframes scanline {
    0% { bottom: 100%; }
    100% { bottom: -100px; }
}

/* Pixel Art Animated Background */
.pixel-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--bg-deep);
    overflow: hidden;
}

.pixel-bg::before, .pixel-bg::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: 
        2vw 12vh #fff, 10vw 20vh #fff, 18vw 8vh #fff, 25vw 35vh #fff, 30vw 40vh #fff, 
        38vw 15vh #fff, 45vw 55vh #fff, 50vw 10vh #fff, 58vw 48vh #fff, 65vw 22vh #fff, 
        70vw 30vh #fff, 78vw 88vh #fff, 80vw 60vh #fff, 88vw 38vh #fff, 92vw 12vh #fff,
        5vw 65vh #fff, 15vw 15vh #fff, 20vw 80vh #fff, 28vw 68vh #fff, 35vw 95vh #fff,
        40vw 70vh #fff, 48vw 28vh #fff, 55vw 80vh #fff, 60vw 50vh #fff, 68vw 72vh #fff,
        75vw 15vh #fff, 82vw 78vh #fff, 85vw 85vh #fff, 90vw 90vh #fff, 95vw 45vh #fff,
        8vw 42vh #555, 12vw 82vh #555, 22vw 25vh #555, 32vw 62vh #555, 42vw 85vh #555, 
        52vw 32vh #555, 62vw 18vh #555, 72vw 52vh #555, 82vw 25vh #555, 98vw 82vh #555,
        3vw 90vh #555, 15vw 95vh #555, 25vw 50vh #555, 35vw 55vh #555, 45vw 35vh #555,
        55vw 65vh #555, 65vw 75vh #555, 75vw 95vh #555, 85vw 55vh #555, 95vw 15vh #555;
    animation: twinkle 5s linear infinite;
    opacity: 0.3;
}

.pixel-bg::after {
    width: 4px;
    height: 4px;
    box-shadow: 
        15vw 70vh var(--accent-gold), 45vw 25vh var(--accent-gold), 85vw 45vh var(--accent-blood), 
        35vw 85vh var(--accent-gold), 65vw 15vh var(--accent-blood), 95vw 55vh var(--accent-gold),
        5vw 25vh var(--accent-blood), 25vw 75vh var(--accent-gold), 55vw 15vh var(--accent-blood), 
        75vw 85vh var(--accent-gold), 8vw 55vh var(--accent-gold), 92vw 25vh var(--accent-blood),
        18vw 45vh var(--accent-gold), 38vw 15vh var(--accent-blood), 58vw 85vh var(--accent-gold),
        78vw 35vh var(--accent-blood), 48vw 65vh var(--accent-gold), 88vw 75vh var(--accent-gold);
    animation: twinkle 8s linear infinite reverse;
    opacity: 0.1;
}

@keyframes twinkle {
    0% { opacity: 0.1; transform: translateY(0); }
    50% { opacity: 0.6; }
    100% { opacity: 0.1; transform: translateY(-30px); }
}

/* Header & Profile */
header {
    text-align: center;
    margin-bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 50px;
    text-align: left;
    width: 100%;
    max-width: 700px;
}

.pixel-border {
    border: var(--pixel-size) solid var(--border-stone);
    box-shadow: 
        inset -4px -4px 0 0 #000,
        inset 4px 4px 0 0 #555,
        4px 4px 0 0 #000;
}

.profile-photo-container {
    width: 180px;
    height: 180px;
    background: #111;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.profile-info .name {
    font-size: 1.8rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.profile-info .tagline {
    color: var(--accent-blood);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.subtitle {
    color: var(--accent-blood);
    font-size: 1.1rem;
    letter-spacing: 2px;
}

/* RPG Sections */
.rpg-section {
    margin-bottom: 50px;
    padding: 20px;
    background: var(--bg-dark-stone);
    border: var(--pixel-size) solid var(--border-stone);
    position: relative;
    box-shadow: 
        inset -4px -4px 0 0 #000,
        inset 4px 4px 0 0 #555;
}

.section-title {
    font-size: 1rem;
    margin-bottom: 25px;
    display: block;
}

/* Inventory Grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.inventory-slot {
    position: relative;
    background: #222;
    border: 2px solid #333;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.inventory-slot:hover {
    background: #333;
    border-color: var(--accent-gold);
}

.inventory-slot.selected {
    border-color: var(--accent-gold);
    background: #2a2a10;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.slot-checkbox {
    display: none;
}

.slot-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.slot-label {
    font-size: 0.7rem;
    color: #888;
}

.inventory-slot.selected .slot-label {
    color: var(--accent-gold);
}

.local-total {
    margin-top: 30px;
    padding: 20px;
    background: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-style: dashed;
}

.local-total .accent-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    margin-bottom: 0;
}

.calculator-in-form {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--border-stone);
}

.calculator-label {
    font-size: 0.8rem !important;
    color: var(--accent-blood) !important;
    margin-bottom: 15px !important;
    display: block;
}

.calculator-hint {
    font-size: 0.8rem;
    margin-bottom: 15px !important;
}

.calculator-in-form .inventory-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.calculator-in-form .inventory-slot {
    padding: 10px 5px;
}

.calculator-in-form .local-total {
    margin-top: 20px;
    padding: 15px;
    background: #050505;
}

.calculator-in-form .local-total .accent-text {
    font-size: 0.6rem;
}

.calculator-in-form .gold-value {
    font-size: 1rem;
}

/* Lore Section */
.scroll-bg {
    background: #1e1e1a;
    border-color: #5d4a37;
    color: #d1c1a8;
}

.lore-list {
    list-style: none;
    margin-top: 15px;
}

.lore-list li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

/* Separator & Contacts */
.separator-or {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 40px 0;
    color: var(--accent-gold);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
}

.separator-or::before,
.separator-or::after {
    content: '';
    flex: 1;
    border-bottom: 2px dashed var(--border-stone);
}

.separator-or::before { margin-right: 15px; }
.separator-or::after { margin-left: 15px; }

.contact-link {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--accent-gold);
}

/* Form */
.pixel-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--accent-blood);
}

input, textarea {
    background: #000;
    border: 2px solid var(--border-stone);
    color: var(--text-main);
    padding: 10px;
    font-family: inherit;
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--accent-blood);
}

.pixel-button {
    background: var(--accent-blood);
    color: white;
    border: none;
    padding: 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 4px 4px 0 0 #4a0101;
    transition: transform 0.1s;
}

.pixel-button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 0 #4a0101;
}

.lore-item {
    margin-bottom: 30px;
}

.accent-text {
    color: var(--accent-gold);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.flavor-text {
    font-style: italic;
    color: #888;
    margin-bottom: 20px;
}

/* Gold Counter */
#gold-counter {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #000;
    border: 3px solid var(--accent-gold);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 100;
    box-shadow: 5px 5px 0 0 #000;
}

.gold-icon {
    font-size: 1.5rem;
}

.gold-value {
    font-family: 'Press Start 2P', cursive;
    color: var(--accent-gold);
    font-size: 1.2rem;
}

@media (max-width: 600px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .inventory-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .inventory-slot {
        flex: 1 1 120px;
        max-width: 180px;
    }

    header h1 { font-size: 1.5rem; }
}
