/* --- VARS & RESET --- */
:root {
    --bg-deep: #050505;
    --bg-panel: #111111;
    --bg-input: #1a1a1a;
    
    --accent-main: #c0392b; /* Sunder Red */
    --accent-glow: rgba(192, 57, 43, 0.4);
    --text-main: #e0e0e0;
    --text-muted: #888888;
    
    --border-light: 1px solid rgba(255, 255, 255, 0.1);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    background-image: radial-gradient(circle at top, #1a0505 0%, var(--bg-deep) 60%);
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: white;
    margin: 0 0 15px 0;
}

/* --- LAYOUT --- */
.sheet {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid var(--accent-main);
    padding-bottom: 20px;
    margin-bottom: 10px;
}

#displayName { font-size: 3rem; text-shadow: 0 0 10px var(--accent-glow); }
#idLine { color: var(--accent-main); font-weight: 600; letter-spacing: 1px; }

.grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

/* --- PANELS & CARDS --- */
.panel {
    background: var(--bg-panel);
    border: var(--border-light);
    border-radius: 4px; /* Sharp corners look more "Sunder" */
    padding: 20px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* Subtle top accent line for panels */
.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-main), transparent);
}

/* --- STATS GRID --- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-box {
    background: var(--bg-input);
    padding: 10px;
    text-align: center;
    border: 1px solid #333;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-box:hover {
    border-color: var(--accent-main);
    transform: translateY(-2px);
}

.stat-box strong {
    font-size: 1.4rem;
    display: block;
    font-family: 'Cinzel', serif;
    color: white;
}

/* --- SOUL WELL (HERO ELEMENT) --- */
.soul-well {
    background: radial-gradient(circle, #2a0a0a 0%, #000 100%);
    border: 1px solid var(--accent-main);
    padding: 30px;
    text-align: center;
    border-radius: 50%; /* Circle */
    width: 200px;
    height: 200px;
    margin: 0 auto 30px auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px var(--accent-glow);
    position: relative;
}

.soul-display {
    font-family: 'Cinzel', serif;
    font-size: 4.5rem;
    color: white;
    text-shadow: 0 0 15px var(--accent-main);
    line-height: 1;
}

.soul-well small {
    color: var(--accent-main);
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* --- BUTTONS --- */
button {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--text-muted);
    padding: 10px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

button:hover {
    border-color: var(--accent-main);
    color: var(--accent-main);
    box-shadow: 0 0 10px var(--accent-glow);
    background: rgba(192, 57, 43, 0.1);
}

button.use {
    border-color: #555;
    color: #888;
}
button.use:hover {
    border-color: white;
    color: white;
    background: rgba(255,255,255,0.1);
}

/* Main Call to Action buttons */
#btnLevelUp, #btnFinishSetup {
    background: var(--accent-main);
    color: white;
    border: none;
}
#btnLevelUp:hover, #btnFinishSetup:hover {
    background: #a93226;
    box-shadow: 0 0 20px var(--accent-glow);
}

/* --- FORMS & INPUTS --- */
input[type="text"], input[type="number"], select, textarea {
    background: transparent;
    border: none;
    border-bottom: 1px solid #444;
    color: white;
    padding: 10px;
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-bottom-color: var(--accent-main);
    background: rgba(255,255,255,0.02);
}

select {
    cursor: pointer;
}
select option {
    background: #111;
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    font-family: 'Inter', sans-serif;
}

td {
    padding: 12px 5px;
    border-bottom: 1px solid #222;
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(255,255,255,0.02);
    color: white;
}

.spell-link {
    color: var(--accent-main);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.spell-link:hover { text-decoration: underline; }

/* --- MODALS --- */
/* --- MODALS --- */
.overlay {
    position: fixed;        /* Fixes it to the viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85); /* Dark dimming layer */
    backdrop-filter: blur(5px);   /* Glass blur effect */
    display: flex;          /* Centers the modal */
    justify-content: center;
    align-items: center;
    z-index: 1000;          /* Ensures it sits on top of everything */
    overflow-y: auto;       /* Allows scrolling if modal is tall */
}

.modal {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(192, 57, 43, 0.2); /* Red glow */
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    color: var(--text-main);
}

.modal h2 {
    color: var(--accent-main);
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
    margin-top: 0;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--accent-main);
}

/* --- UTILS --- */
.hidden { display: none !important; }

/* Subclass selection */
#subclassPrompt {
    border: 1px solid var(--accent-main);
    background: rgba(192, 57, 43, 0.05);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

/* Slots */
.slot-row { margin-bottom: 8px; display: flex; align-items: center; }
.slot-label { width: 60px; font-size: 0.8rem; color: #666; text-transform: uppercase; }
input[type="checkbox"] {
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid #555;
    background: #111;
    cursor: pointer;
    margin-right: 5px;
    transform: rotate(45deg); /* Diamond shape */
}
input[type="checkbox"]:checked {
    background: var(--accent-main);
    border-color: var(--accent-main);
    box-shadow: 0 0 5px var(--accent-main);
}
/* --- CULTIVATOR THEME (Cosmic/Mind) --- */
.cultivator-pool {
    background: radial-gradient(circle, #1a0b2e 0%, #050505 100%) !important; /* Deep Purple Void */
    border-color: #9b59b6 !important; /* Amethyst Border */
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.5) !important; /* Purple Glow */
}

.cultivator-pool .soul-display {
    color: #e0b0ff; /* Light purple text */
    text-shadow: 0 0 15px #9b59b6;
}

.cultivator-pool small {
    color: #9b59b6;
}

/* Update buttons inside the cultivator pool to match */
.cultivator-pool button {
    border-color: #9b59b6;
    color: #e0b0ff;
}
.cultivator-pool button:hover {
    background: rgba(155, 89, 182, 0.2);
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.4);
}

/* --- ARBITER THEME (Water/Flow) --- */
.arbiter-pool {
    background: radial-gradient(circle, #0b2e2e 0%, #050505 100%) !important;
    border-color: #00e5ff !important;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.4) !important;
}

.arbiter-pool .soul-display {
    color: #00e5ff;
    text-shadow: 0 0 15px #00e5ff;
}

.arbiter-pool small { color: #00e5ff; }

.arbiter-pool button {
    border-color: #00e5ff;
    color: #00e5ff;
}
.arbiter-pool button:hover {
    background: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

/* --- SAWBONES THEME (Medical/Chemical) --- */
.sawbones-pool {
    background: radial-gradient(circle, #0a2e0a 0%, #000 100%) !important; /* Dark Green */
    border-color: #2ecc71 !important; /* Medical Green */
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.4) !important;
}

.sawbones-pool .soul-display {
    color: #2ecc71;
    text-shadow: 0 0 15px #2ecc71;
}

.sawbones-pool small { color: #2ecc71; }

.sawbones-pool button {
    border-color: #2ecc71;
    color: #2ecc71;
}
.sawbones-pool button:hover {
    background: rgba(46, 204, 113, 0.2);
}

/* --- ROLL RESULT DISPLAY --- */
#rollResult {
    text-align: center;
    min-height: 20px;
    margin-bottom: 10px;
    font-weight: bold;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--text-main);
    text-shadow: 0 0 5px rgba(255,255,255,0.2);
}

/* --- ACTION ROLL BUTTONS --- */
.roll-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    padding: 2px 8px;
    font-size: 0.7rem;
    margin-left: 5px;
    cursor: pointer;
}
.roll-btn:hover {
    border-color: var(--accent-main);
    background: rgba(255, 255, 255, 0.1);
}

/* Fix HP Input Width */
#curHp {
    width: 60px !important; /* Widen to fit 3 digits */
    text-align: center;
    font-weight: bold;
    color: var(--accent-main);
}
