/* rpg-theme.css */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
    --bg: #050508;
    --panel: #0e0e14;
    --panel2: #161621;
    --border: #8a6f30; /* Dull Gold */
    --border-bright: #ffd700; /* Bright Gold */
    --text: #c0c0c0; /* Silver */
    --muted: #666677;
    --accent: #5e111e; /* Blood Red */
    --accent-hover: #80182a;
    --ok: #1a6b36; /* Forest Green */
    --warn: #b8860b;
    --bad: #8b0000;
    
    --shadow: 4px 4px 0px #000;
    --font-head: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px; /* Slightly larger for pixel fonts */
    background-image: 
        linear-gradient(rgba(10, 10, 16, 0.95), rgba(10, 10, 16, 0.95)),
        repeating-linear-gradient(0deg, transparent, transparent 2px, #1a1a24 2px, #1a1a24 4px);
    background-size: cover;
}

a { color: #d4af37; text-decoration: none; border-bottom: 1px dashed #d4af37; }
a:hover { color: #fff; border-style: solid; }

.container {
    max-width: 1024px;
    margin: 20px auto;
    padding: 20px;
    border: 4px double var(--border);
    background: var(--panel);
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    position: relative;
}

/* Corner Gems */
.container::before { content: '♦'; position: absolute; top: -14px; left: -14px; color: var(--bad); font-size: 24px; background:var(--bg); }
.container::after { content: '♦'; position: absolute; bottom: -14px; right: -14px; color: var(--bad); font-size: 24px; background:var(--bg); }

/* Typography */
.h1, h1 {
    font-family: var(--font-head);
    font-size: 20px;
    color: var(--border-bright);
    text-transform: uppercase;
    text-shadow: 2px 2px #000;
    margin-bottom: 20px;
    line-height: 1.5;
}

.h2, h2 {
    font-family: var(--font-head);
    font-size: 14px;
    color: #a0a0a0;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.small, .muted { font-size: 16px; color: var(--muted); }

/* Panels & Cards */
.panel, .box {
    background: var(--panel2);
    border: 2px solid var(--border);
    padding: 20px;
    box-shadow: inset 0 0 10px #000;
    position: relative;
    margin-bottom: 20px;
}

.cardTile {
    background: var(--panel2);
    border: 2px solid #444;
    transition: transform 0.1s;
    position: relative;
}
.cardTile:hover {
    border-color: var(--border-bright);
    transform: scale(1.02);
    z-index: 10;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.cardItem img, .imgBox img {
    border-bottom: 2px solid #000;
    filter: sepia(20%) contrast(110%); /* Slight vintage look */
}

/* Inputs & Buttons */
input, select, textarea {
    background: #000;
    border: 2px solid #444;
    color: #0f0; /* Terminal Green text */
    font-family: var(--font-body);
    font-size: 18px;
    padding: 10px;
    border-radius: 0; /* No rounded corners */
}
input:focus, select:focus, textarea:focus {
    border-color: var(--border-bright);
    outline: none;
    box-shadow: 0 0 5px var(--border);
}

button, .btn {
    background-color: var(--panel);
    border: 2px solid var(--border);
    color: var(--border-bright);
    font-family: var(--font-head);
    font-size: 10px;
    padding: 12px 20px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    transition: all 0.1s;
    border-radius: 0;
}
button:hover, .btn:hover {
    background-color: var(--border);
    color: #000;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #000;
}
button:active, .btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000;
}

button.primary {
    background-color: var(--accent);
    border-color: #ff4444;
    color: #fff;
}
button.primary:hover { background-color: var(--accent-hover); }

button.danger {
    border-color: #555;
    background: #222;
    color: #888;
}

/* Badges */
.badge, .tag {
    background: #000;
    border: 1px solid #444;
    color: #aaa;
    font-family: var(--font-body);
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 0;
}
.badge.ok, .tag.ok { color: #0f0; border-color: #0f0; }
.badge.warn, .tag.warn { color: gold; border-color: gold; }
.badge.bad, .tag.bad { color: #f00; border-color: #f00; }

/* Grid & Layout Preserves */
.row { display: flex; gap: 15px; flex-wrap: wrap; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }

/* Foils - Magical Glow */
.cardTile.foil {
    border: 2px solid #0ff;
    box-shadow: 0 0 10px #0ff;
}
.foilBadge {
    font-family: var(--font-head);
    font-size: 8px;
    background: rgba(0,0,0,0.8);
    border: 1px solid #0ff;
    color: #0ff;
    top: 5px; right: 5px;
}
/* --- BOOKSHELF EXPANSION --- */

/* The Shelf Grid */
.bookshelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* The Book Object */
.tome-card {
    background: linear-gradient(135deg, #3a1111 0%, #5e1b1b 100%); /* Deep Red Leather */
    border: 4px solid #8a6f30; /* Dull Gold Border */
    border-radius: 4px 12px 12px 4px; /* Curved book spine on right */
    padding: 15px;
    box-shadow: 
        inset 5px 0 20px rgba(0,0,0,0.5), /* Inner shadow */
        10px 10px 20px rgba(0,0,0,0.6); /* Drop shadow */
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
    overflow: hidden;
}

/* The Spine Visual (Left side binding) */
.tome-card::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0; bottom: 0;
    width: 6px;
    background: rgba(0,0,0,0.2);
    border-left: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
}

/* Hover Effect: Float up */
.tome-card:hover {
    transform: translateY(-8px);
    box-shadow: 15px 15px 25px rgba(0,0,0,0.8);
    border-color: #ffd700; /* Bright Gold */
    z-index: 10;
}

/* Gold Corner Accents */
.tome-card::after {
    content: '◇';
    position: absolute;
    top: 5px; right: 5px;
    color: #8a6f30;
    font-size: 20px;
}

/* Internal Layout */
.tome-content {
    margin-left: 20px; /* Make space for the spine binding */
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title Input styling to look like Gold Embossing */
.tome-input {
    background: transparent;
    border: none;
    border-bottom: 2px dashed #553311;
    color: #ffd700; /* Gold Text */
    font-family: var(--font-head);
    font-size: 14px;
    text-align: center;
    width: 100%;
    margin-top: 10px;
    padding-bottom: 5px;
    text-shadow: 2px 2px 0px #000;
}
.tome-input:focus {
    outline: none;
    border-bottom: 2px solid #ffd700;
    background: rgba(0,0,0,0.2);
}

.tome-id {
    font-family: monospace;
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.7;
}

/* Buttons at the bottom of the book */
.tome-actions {
    margin-left: 20px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tome-actions button {
    width: 100%;
    padding: 10px;
    font-size: 10px;
}
/* --- RARITY AURAS --- */
.cardTile.rarity-common { border-color: #6c757d; }
.cardTile.rarity-uncommon { border-color: #b0c4de; box-shadow: 0 0 4px #b0c4de; }
.cardTile.rarity-rare { border-color: #ffd700; box-shadow: 0 0 6px #ffd700; }
.cardTile.rarity-mythic { 
    border-color: #ff4500; 
    box-shadow: 0 0 10px #ff4500; 
    animation: mythicPulse 3s infinite alternate;
}

@keyframes mythicPulse {
    from { box-shadow: 0 0 8px #ff4500; }
    to { box-shadow: 0 0 16px #ff4500; }
}

/* --- SUMMONING CIRCLE (QR) --- */
#qrModal {
    text-align: center;
    background: #000;
    border: 4px double #d4af37;
    padding: 20px;
    box-shadow: 0 0 30px #d4af37;
}
#qrCanvas {
    margin: 20px auto;
    border: 10px solid #fff; /* White border for scanning contrast */
    background: #fff;
    padding: 10px;
}
/* --- FLOATING ACTION ORBS --- */
.floating-actions {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    pointer-events: none; /* Allows clicking through the container */
}

.float-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1a1a2e;
    border: 2px solid #d4af37;
    color: #d4af37;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 0 10px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto; /* Re-enable clicks on buttons */
    opacity: 0;
    transform: translateY(20px) scale(0.8);
}

.float-btn.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.float-btn:hover {
    background: #d4af37;
    color: #1a1a2e;
    box-shadow: 0 0 20px #d4af37;
    transform: translateY(-5px) scale(1.1);
}

/* Tooltips */
.float-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 60px;
    background: #000;
    color: #d4af37;
    padding: 5px 10px;
    font-size: 12px;
    border: 1px solid #d4af37;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    font-family: var(--font-body);
}

.float-btn:hover::after {
    opacity: 1;
}
/* --- SIMPLE RPG FOIL LABEL --- */
.cardTile.foil .foilBadge {
    position: absolute;
    /* Exactly 25px from the top, anchored to the right */
    top: 40px;
    right: 12px;
    
    /* Small, clean label style */
    background: #000;
    color: #0ff; /* Magical Cyan */
    border: 1px solid #0ff;
    font-family: var(--font-head);
    font-size: 8px;
    padding: 3px 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    
    /* Subtle outer glow */
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
    z-index: 5;
    pointer-events: none;
}

/* Optional: Keep the subtle shimmer on the card itself */
.cardTile.foil::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        125deg, 
        transparent 0%, 
        rgba(0, 255, 255, 0.05) 50%, 
        transparent 100%
    );
    pointer-events: none;
}