:root {
    --aisg-bg: #1a1110;
    --aisg-panel: #261a18;
    --aisg-border: #8b6c42; /* Gold/Bronze */
    --aisg-accent: #d4af37; /* Bright Gold */
    --aisg-text: #e6dcc8; /* Parchment White */
    --aisg-bar-empty: #3a2a25;
    --aisg-red: #800;
}

#aisg-container {
    background-color: var(--aisg-bg);
    color: var(--aisg-text);
    padding: 2rem;
    border: 2px solid var(--aisg-border);
    border-radius: 8px;
    font-family: 'Cinzel', 'Georgia', serif;
    max-width: 950px;
    margin: 2rem auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(0,0,0,0.5);
    line-height: 1.6;
}

/* --- ROSTER UI --- */
.aisg-roster-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    height: 450px;
}

.aisg-roster-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--aisg-border);
    background: #111;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aisg-roster-item {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    background: #1a1a1a;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.aisg-roster-item:hover { background: #222; }
.aisg-roster-item.active {
    background: #2a2220;
    border-left-color: var(--aisg-accent);
}

.aisg-roster-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    color: #666;
    width: 30px;
    text-align: center;
}
.aisg-roster-item.active .aisg-roster-icon { color: var(--aisg-accent); text-shadow: 0 0 5px var(--aisg-accent); }

.aisg-roster-info { flex: 1; }
.aisg-roster-name { font-weight: bold; font-size: 1.1rem; color: #ddd; }
.aisg-roster-role { font-size: 0.85rem; color: #888; text-transform: uppercase; }

/* Roster Preview Pane */
.aisg-roster-preview {
    flex: 1.5;
    border: 1px solid var(--aisg-border);
    background: var(--aisg-panel);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background-image: radial-gradient(circle at center, #2f2220 0%, #1a1110 80%);
}

.aisg-preview-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--aisg-accent);
    box-shadow: 0 0 20px rgba(212,175,55,0.2);
    margin-bottom: 15px;
}

.aisg-preview-avatar-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 3px solid var(--aisg-border);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 3rem;
    color: #444;
}

.aisg-preview-badge {
    background: #000;
    border: 1px solid #444;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #aaa;
    margin: 5px;
    display: inline-block;
    text-transform: uppercase;
}

.aisg-preview-body {
    margin: 20px 0;
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 100px;
    overflow-y: auto;
}

/* --- RPG CUSTOMIZER --- */
.aisg-rpg-header { text-align: center; border-bottom: 2px solid var(--aisg-border); margin-bottom: 20px; padding-bottom: 15px; }
.aisg-rpg-header h2 { color: var(--aisg-accent); margin: 0; text-transform: uppercase; letter-spacing: 2px; }
.aisg-subtext { color: #888; font-style: italic; }

.aisg-rpg-top-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    background: #111;
    padding: 15px;
    border: 1px solid #333;
    align-items: center;
}

.aisg-portrait-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 120px;
    flex-shrink: 0;
}

.aisg-avatar-circle {
    width: 80px; height: 80px; border-radius: 50%;
    background: #222; border: 2px solid var(--aisg-border);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.aisg-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.aisg-avatar-circle span { font-size: 2rem; color: #444; }

.aisg-loading-pulse { animation: pulse-gold 1.5s infinite; }
@keyframes pulse-gold { 0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); } 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); } }

.aisg-class-selector { flex: 1; }
.aisg-class-selector label { font-size: 0.85rem; color: #888; display: block; margin-bottom: 5px; }

.aisg-archetypes-row { display: flex; gap: 5px; flex-wrap: wrap; }
.aisg-class-btn {
    background: #222; border: 1px solid #444; color: #aaa;
    padding: 6px 12px; font-family: serif; cursor: pointer; font-size: 0.85rem;
}
.aisg-class-btn:hover { background: var(--aisg-accent); color: #000; }

.aisg-tabs { display: flex; justify-content: center; gap: 5px; margin-bottom: 20px; }
.aisg-tab-btn {
    background: var(--aisg-panel); border: 1px solid var(--aisg-border);
    color: #aaa; padding: 10px 20px; font-family: 'Cinzel', serif;
    cursor: pointer; text-transform: uppercase;
}
.aisg-tab-btn.active { background: var(--aisg-border); color: #111; font-weight: bold; }
.aisg-tab-pane { display: none; animation: fadeIn 0.3s; }
.aisg-tab-pane.active { display: block; }

/* Stat Bars */
.aisg-rpg-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.aisg-stat-block { margin-bottom: 15px; }
.aisg-bar-container { height: 18px; background: var(--aisg-bar-empty); border: 1px solid #555; position: relative; }
.aisg-bar-fill { height: 100%; background: linear-gradient(90deg, #800, #f00); transition: width 0.2s; }
.aisg-bar-input { position: absolute; top: -5px; left: 0; width: 100%; height: 30px; opacity: 0; cursor: pointer; }

/* Toggles */
.aisg-toggle-group { display: flex; background: #111; border: 1px solid var(--aisg-border); cursor: pointer; }
.aisg-toggle-option { flex: 1; text-align: center; padding: 8px; color: #666; border-right: 1px solid #333; font-family: serif; font-size: 0.9rem; }
.aisg-toggle-option.selected { background: var(--aisg-border); color: #000; }
.aisg-toggle-option:last-child { border: none; }

/* --- INPUT FIELDS FIX --- */
.aisg-field input, 
.aisg-field textarea, 
.aisg-rpg-select,
.aisg-load-container select {
    background-color: #0a0a0a !important; 
    border: 1px solid #444 !important; 
    color: #ddd !important; 
    padding: 8px !important;
    font-family: 'Georgia', serif; 
    width: 100%; 
    box-sizing: border-box;
    box-shadow: none !important;
}

/* Force dark background on Focus */
.aisg-field input:focus, 
.aisg-field textarea:focus, 
.aisg-rpg-select:focus,
.aisg-load-container select:focus {
    background-color: #000 !important;
    border-color: var(--aisg-accent) !important;
    color: #fff !important;
    box-shadow: 0 0 5px rgba(212,175,55,0.5) !important;
    outline: none !important;
}

/* Fix for Select Options */
select option {
    background-color: #111;
    color: #eee;
}

.aisg-field { margin-bottom: 10px; }
.aisg-field label { display: block; color: #888; font-size: 0.85rem; margin-bottom: 3px; }

/* Perks */
.aisg-skill-tree h4 { color: var(--aisg-accent); border-bottom: 1px solid #444; margin: 15px 0 5px; font-size: 0.9rem; }
.aisg-perk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.aisg-perk-card {
    background: #151010; border: 1px solid #333; padding: 8px;
    text-align: center; cursor: pointer; font-size: 0.8rem; color: #aaa;
}
.aisg-perk-card.active { border-color: var(--aisg-accent); background: rgba(212,175,55,0.1); color: #fff; box-shadow: 0 0 5px var(--aisg-accent); }

/* Buttons */
.aisg-btn-gold {
    width: 100%; background: linear-gradient(180deg, #d4af37, #8b6c42);
    border: 1px solid #ffd700; color: #1a1110; padding: 15px;
    font-family: 'Cinzel', serif; font-weight: bold; font-size: 1.1rem;
    cursor: pointer; text-shadow: 0 1px 0 rgba(255,255,255,0.4); margin-top: 20px;
}
.aisg-btn-gold:hover { filter: brightness(1.2); }
.aisg-btn-small { padding: 5px 10px; font-size: 0.75rem; background: #333; color: #ccc; border: 1px solid #555; cursor: pointer; }

/* Shared */
.aisg-option-btn { width: 100%; padding: 12px; margin-bottom: 8px; background: #222; border: 1px solid #444; color: #ccc; cursor: pointer; text-align: left; }
.aisg-option-btn:hover { border-color: var(--aisg-accent); background: #2a2a2a; }
.aisg-load-container { display: flex; gap: 5px; margin-bottom: 15px; }
.aisg-load-container select { flex-grow: 1; }

/* --- REVIEW MODAL (New) --- */
.aisg-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.aisg-modal-content {
    background: var(--aisg-bg); border: 3px solid var(--aisg-border);
    padding: 30px; max-width: 600px; width: 90%;
    border-radius: 8px; position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.9);
}
.aisg-sheet-header { text-align: center; border-bottom: 2px solid var(--aisg-border); margin-bottom: 20px; padding-bottom: 10px; }
.aisg-sheet-header h2 { color: var(--aisg-accent); margin: 0; text-transform: uppercase; }
.aisg-sheet-subtitle { color: #888; font-style: italic; }

.aisg-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.aisg-summary-col h4 { color: #aaa; border-bottom: 1px solid #444; margin-bottom: 10px; }
.aisg-summary-col div { margin-bottom: 5px; font-size: 0.95rem; color: #ddd; }

.aisg-summary-section h4 { color: #aaa; border-bottom: 1px solid #444; margin-bottom: 10px; }
.aisg-perk-badge {
    display: inline-block; background: #221a1a; border: 1px solid var(--aisg-accent);
    padding: 4px 10px; border-radius: 12px; margin: 3px; font-size: 0.8rem; color: #e6dcc8;
}

.aisg-modal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; border-top: 1px solid #333; padding-top: 20px; }

/* --- STORY SETUP (New) --- */
.aisg-welcome-text { text-align: center; margin-bottom: 30px; }
.aisg-welcome-text h2 { font-size: 2rem; color: var(--aisg-accent); }
.aisg-setup-container { max-width: 500px; margin: 0 auto; }
.aisg-setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.aisg-setting-card {
    background: #151010; border: 1px solid #333; padding: 15px;
    text-align: center; cursor: pointer; color: #aaa; transition: 0.2s;
    font-size: 0.9rem;
}
.aisg-setting-card:hover { border-color: var(--aisg-accent); color: #fff; }
.aisg-setting-card.active {
    background: rgba(212,175,55,0.15); border-color: var(--aisg-accent);
    color: #fff; box-shadow: 0 0 10px rgba(212,175,55,0.2);
}

@media(max-width: 600px) {
    .aisg-roster-layout { flex-direction: column; height: auto; }
    .aisg-roster-list { height: 200px; }
    .aisg-rpg-layout { grid-template-columns: 1fr; }
    .aisg-summary-grid { grid-template-columns: 1fr; }
}