/* Ascension - Supernatural Powers CYOA
 * Dark, atmospheric styling with almost black background
 */

/* ===== Root Variables ===== */
:root {
    /* Background - almost completely black */
    --background-color: #050507;
    --background-secondary: #0a0a0f;
    --background-tertiary: #0f0f15;

    /* Text colors */
    --text-primary: #e8e8ec;
    --text-secondary: #c0c0c8;
    --text-muted: #606068;

    /* Accent colors */
    --accent-primary: #7c5cbf;      /* Deep purple for general */
    --accent-material: #4a7c59;      /* Dark green for material powers */
    --accent-conceptual: #7c4a6b;    /* Dark magenta for conceptual powers */
    --accent-essence: #bf8c3c;       /* Gold for essence */
    --accent-ascension: #3c8fbf;     /* Cyan for ascension */

    /* Border colors */
    --border-color: #1a1a24;
    --border-hover: #2a2a38;
    --border-selected: var(--accent-primary);

    /* Entry styling */
    --entry-background: #08080c;
    --entry-background-hover: #0c0c12;
    --entry-background-selected: #12121a;

    /* Grid connectors */
    --connector-color: #2a2a38;
    --connector-active: var(--accent-primary);
    --connector-available: #3a3a48;
}

/* ===== Body & Background ===== */
body {
    background-color: var(--background-color);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    position: relative;
}

/* Background kept simple for performance */

/* ===== Wider Container for Ascension ===== */
.container {
    max-width: 1440px;
}

.footer-wrapper {
    max-width: 1440px;
}

/* ===== Header & Navigation ===== */
.header-section {
    background: linear-gradient(180deg, var(--background-secondary) 0%, var(--background-color) 100%);
    border-bottom: 1px solid var(--border-color);
}

.cyoa-title {
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(124, 92, 191, 0.3);
    letter-spacing: 0.1em;
    font-weight: 300;
}

/* Resource display colors */
.resource-display .resource-essence { color: var(--accent-essence); }
.resource-display .resource-potential { color: var(--accent-primary); }
.resource-display .resource-powerPoints { color: var(--text-primary); }
.resource-display .resource-ascension { color: var(--accent-ascension); }

/* ===== Sections ===== */
.cyoa-section {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.cyoa-section h2 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.section-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Entry Items ===== */
.choice-item,
.option-item {
    background: var(--entry-background);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.choice-item:hover,
.option-item:hover {
    background: var(--entry-background-hover);
    border-color: var(--border-hover);
}

.choice-item.selected,
.option-item.selected {
    background: var(--entry-background-selected);
    border-color: var(--border-selected);
    box-shadow: 0 0 10px rgba(124, 92, 191, 0.15);
}

.choice-item.disabled-choice,
.option-item.disabled-choice {
    opacity: 0.4;
}

.entry-title-container h3 {
    color: var(--text-primary);
    font-weight: 500;
}

.entry-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Grid Layout ===== */
.grid-group-container {
    padding: 1px;
    background: var(--background-tertiary);
    position: relative;
}

.grid-item {
    min-width: 140px;
}

/* Grid connectors */
.grid-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.grid-connector {
    stroke: var(--connector-color);
    stroke-width: 2;
    transition: stroke 0.3s ease;
}

.grid-connector.available {
    stroke: var(--connector-available);
}

.grid-connector.active {
    stroke: var(--connector-active);
    stroke-width: 3;
}

/* ===== Cost Modifiers - HIDDEN ===== */
.cost-modifier {
    display: none !important;
}

/* ===== Resource Indicators ===== */
.destiny-indicator {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    background: var(--background-tertiary);
}

.destiny-indicator.cost {
    color: #cf6679;
}

.destiny-indicator.gain {
    color: #81c784;
}

/* Specific resource colors */
.resource-essence { color: var(--accent-essence) !important; }
.resource-potential { color: var(--accent-primary) !important; }
.resource-powerPoints { color: var(--text-primary) !important; }
.resource-ascension { color: var(--accent-ascension) !important; }

/* Character sheet meta resource accent colors */
.meta-resource-item.resource-essence { color: var(--accent-essence); }
.meta-resource-item.resource-potential { color: var(--accent-primary); }
.meta-resource-item.resource-ascension { color: var(--accent-ascension); }
.stat-item.resource-essence .stat-value { color: var(--accent-essence); }
.stat-item.resource-potential .stat-value { color: var(--accent-primary); }
.stat-item.resource-ascension .stat-value { color: var(--accent-ascension); }

/* ===== Requirements ===== */
.requirements-indicator {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ===== Images ===== */
.entry-image img {
    border: 1px solid var(--border-color);
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.entry-image img:hover {
    opacity: 1;
}

.section-header-image img {
    opacity: 0.85;
}

/* Reserve space for grid images to prevent layout shift during lazy loading */
.grid-item .entry-image img {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ===== Group Headers ===== */
.element-group h3 {
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.group-description {
    color: var(--text-secondary);
}

/* ===== Modal/Popup Styling ===== */
.export-popup-overlay {
    background: rgba(0, 0, 0, 0.9) !important;
}

.export-popup-content {
    background: var(--background-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.export-popup-header {
    background: var(--background-tertiary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.export-popup-header h2 {
    color: var(--text-primary) !important;
}

.export-popup-close {
    color: var(--text-secondary) !important;
    background: transparent !important;
    border: none !important;
}

.export-popup-close:hover {
    color: var(--text-primary) !important;
}

.export-popup-body {
    background: var(--background-secondary) !important;
    color: var(--text-primary) !important;
}

/* Save/Load Modal */
.save-load-modal-body {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.save-slots-info {
    background: rgba(60, 143, 191, 0.15) !important;
    border-left-color: var(--accent-ascension) !important;
    color: var(--text-secondary) !important;
}

.save-slot {
    background: var(--background-tertiary) !important;
    border: 1px solid var(--border-color);
}

.save-slot-name {
    color: var(--text-primary) !important;
}

.save-slot-date {
    color: var(--text-muted) !important;
}

.save-slot-name-input {
    background: var(--background-color) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent-primary) !important;
}

/* Import/Export */
.import-export-section {
    border-top-color: var(--border-color) !important;
}

.import-export-header {
    color: var(--text-primary) !important;
}

.import-textarea {
    background: var(--background-color) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.import-warning {
    background: rgba(191, 140, 60, 0.15) !important;
    border-left-color: var(--accent-essence) !important;
    color: var(--text-secondary) !important;
}

/* Mobile Suggestion Modal */
.mobile-suggestion-content h3 {
    color: var(--text-primary) !important;
}

.mobile-suggestion-content p {
    color: var(--text-secondary) !important;
}

.mobile-suggestion-note {
    color: var(--text-muted) !important;
}

/* ===== Navigation Menu ===== */
.navigation-menu {
    background: var(--background-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

.nav-header {
    background: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color);
}

.nav-content {
    background: var(--background-secondary) !important;
}

.nav-section-title {
    color: var(--accent-primary) !important;
}

.nav-section-title:hover {
    color: var(--text-primary) !important;
    background: var(--background-tertiary) !important;
}

.nav-section-title.nav-danger {
    color: #e57373 !important;
}

.nav-section-title.nav-danger:hover {
    color: #ff6b6b !important;
}

/* ===== Summary Styling ===== */
.summary-container {
    color: var(--text-primary);
}

.summary-character-sheet h2,
.summary-selections h2,
.summary-journal h2 {
    color: var(--accent-primary) !important;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.summary-stat-group {
    background: var(--background-tertiary) !important;
    border: 1px solid var(--border-color);
}

.summary-stat-group h3 {
    color: var(--accent-ascension) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.summary-stats-table td {
    border-bottom: 1px solid var(--border-color);
}

.summary-stat-name {
    color: var(--text-secondary) !important;
}

.summary-stat-value {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

.summary-stat-description {
    color: var(--text-muted) !important;
}

.summary-stat-empty {
    color: var(--text-muted) !important;
}

.summary-section h3 {
    color: var(--accent-essence) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.summary-group h4 {
    color: var(--text-primary) !important;
}

.summary-container ul {
    color: var(--text-secondary);
}

.summary-container li::before {
    color: var(--accent-primary);
}

.summary-journal {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    padding: 1rem;
}

/* Copy button styling */
.export-popup-copy {
    background: var(--accent-primary) !important;
    color: var(--text-primary) !important;
    border: none !important;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.export-popup-copy:hover {
    background: var(--accent-ascension) !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ===== Material vs Conceptual Power Styling ===== */
.material-power .entry-title-container h3 {
    color: var(--accent-material);
}

.conceptual-power .entry-title-container h3 {
    color: var(--accent-conceptual);
}

/* ===== Footer ===== */
.footer-section {
    background: var(--background-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

.changelog-entry {
    border-left: 2px solid var(--accent-primary);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.changelog-entry .version {
    color: var(--accent-primary);
    font-weight: 500;
}

/* ===== Buttons ===== */
button, .btn {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

button:hover, .btn:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
}

/* ===== Links ===== */
a {
    color: var(--accent-primary);
}

a:hover {
    color: var(--text-primary);
}

/* ===== Character Sheet ===== */
.character-sheet {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
}

.character-sheet.minimized {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
}

.character-sheet-header.minimized-header {
    background: transparent;
}

.character-sheet-toggle {
    background: var(--background-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.character-sheet-toggle:hover {
    background: var(--border-color);
}

/* ===== Selection Effects ===== */
::selection {
    background: rgba(124, 92, 191, 0.3);
    color: var(--text-primary);
}

/* ============================================================
   CHOOSE YOUR WORLD - Large cards with structured content
   ============================================================ */
.group-choose-your-world .choices-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.5rem !important;
}

.group-choose-your-world .choice-item {
    flex: none !important;
    width: 85% !important;
    max-width: 85% !important;
    min-width: auto !important;
}

/* World entry structured content */
.world-entry {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.world-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.world-header .world-location {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.world-header .world-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

.world-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.world-section {
    background: var(--background-tertiary);
    padding: 0.75rem;
    border-left: 2px solid var(--accent-primary);
}

.world-section.full-width {
    grid-column: span 2;
}

.world-section-label {
    color: var(--accent-primary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.world-section p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 0.5rem 0;
}

.world-section p:last-child {
    margin-bottom: 0;
}

.world-section.powers {
    border-left-color: var(--accent-material);
}

.world-section.powers .world-section-label {
    color: var(--accent-material);
}

.world-section.threat {
    border-left-color: #cf6679;
}

.world-section.threat .world-section-label {
    color: #cf6679;
}

.world-section.factions {
    border-left-color: var(--accent-essence);
    grid-column: span 2;
}

.world-section.factions .world-section-label {
    color: var(--accent-essence);
}

/* ============================================================
   COMPANION ENTRIES - Two-column grid layout
   ============================================================ */
[class*="group-companions-"] .choices-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
    align-items: start !important;
}

[class*="group-companions-"] .choice-item {
    display: block !important;
    overflow: hidden !important;
    flex: none !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

[class*="group-companions-"] .choice-item .entry-image {
    float: left !important;
    margin: 0 1rem 0.5rem 0 !important;
    height: 280px !important;
    width: auto !important;
}

[class*="group-companions-"] .choice-item .entry-image img {
    height: 100% !important;
    width: auto !important;
    display: block !important;
}

[class*="group-companions-"] .companion-entry {
    display: block !important;
}

[class*="group-companions-"] .companion-header {
    display: inline;
}

[class*="group-companions-"] .companion-description {
    display: inline;
}

@media (max-width: 1100px) {
    [class*="group-companions-"] .choices-container {
        grid-template-columns: 1fr !important;
    }
}

/* Companion structured content */
.companion-entry {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.companion-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.companion-header .companion-affiliation {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.companion-header .companion-age {
    color: var(--accent-essence);
    font-size: 0.85rem;
    float: right;
}

.companion-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.companion-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.companion-detail {
    background: var(--background-tertiary);
    padding: 0.75rem;
}

.companion-detail.brings {
    border-left: 2px solid var(--accent-material);
}

.companion-detail.brings .companion-detail-label {
    color: var(--accent-material);
}

.companion-detail.drawbacks {
    border-left: 2px solid #cf6679;
}

.companion-detail.drawbacks .companion-detail-label {
    color: #cf6679;
}

.companion-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.companion-detail p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* ============================================================
   WORLD MODIFIERS - Two-column grid layout
   ============================================================ */
[class*="group-world-modifiers-"] .choices-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    align-items: start !important;
}

[class*="group-world-modifiers-"] .option-item {
    flex: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    align-self: start !important;
}

@media (max-width: 900px) {
    [class*="group-world-modifiers-"] .choices-container,
    .group-choose-your-world .choices-container {
        grid-template-columns: 1fr !important;
    }

    .group-choose-your-world .choice-item {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================
   MODE OF PLAY - Four-column grid
   ============================================================ */
.group-mode-of-play .choices-container {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1rem !important;
    align-items: start !important;
}

.group-mode-of-play .choice-item {
    flex: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    align-self: start !important;
}

@media (max-width: 1200px) {
    .group-mode-of-play .choices-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .group-mode-of-play .choices-container {
        grid-template-columns: 1fr !important;
    }
}

.mode-table {
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.mode-table-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mode-table-row:last-child {
    border-bottom: none;
}

.mode-table-label {
    color: var(--text-muted);
}

.mode-table-value {
    font-weight: 500;
}

.mode-table-value.positive {
    color: #81c784;
}

.mode-table-value.negative {
    color: #cf6679;
}

.mode-table-value.neutral {
    color: var(--text-secondary);
}

/* ============================================================
   STATISTICS SECTION - Dramatic visual styling
   ============================================================ */
.group-control,
.group-experience,
.group-growth {
    margin-bottom: 2rem;
}

.group-control > h3,
.group-experience > h3,
.group-growth > h3 {
    font-size: 1.3rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.group-control > h3 { color: #6fb3e0; border-bottom-color: #6fb3e0; }
.group-experience > h3 { color: #e0a86f; border-bottom-color: #e0a86f; }
.group-growth > h3 { color: #6fe096; border-bottom-color: #6fe096; }

.group-control .choices-container,
.group-experience .choices-container,
.group-growth .choices-container {
    background: linear-gradient(135deg, var(--background-tertiary) 0%, rgba(15, 15, 21, 0.8) 100%);
    padding: 1rem;
    border: 1px solid var(--border-color);
    gap: 30px !important;
}

.group-control .option-item,
.group-experience .option-item,
.group-growth .option-item {
    background: linear-gradient(180deg, var(--entry-background) 0%, rgba(8, 8, 12, 0.9) 100%);
    padding: 0.6rem;
    min-width: 120px;
    transition: all 0.3s ease;
}

/* Control stat colors */
.group-control .option-item {
    border: 1px solid rgba(111, 179, 224, 0.3);
    border-left: 3px solid #6fb3e0;
}

.group-control .option-item:hover {
    border-color: rgba(111, 179, 224, 0.6);
}

.group-control .option-item.selected {
    background: rgba(111, 179, 224, 0.1);
    border-color: #6fb3e0;
}

.group-control .option-item .entry-title-container h3 {
    color: #6fb3e0;
}

/* Experience stat colors */
.group-experience .option-item {
    border: 1px solid rgba(224, 168, 111, 0.3);
    border-left: 3px solid #e0a86f;
}

.group-experience .option-item:hover {
    border-color: rgba(224, 168, 111, 0.6);
}

.group-experience .option-item.selected {
    background: rgba(224, 168, 111, 0.1);
    border-color: #e0a86f;
}

.group-experience .option-item .entry-title-container h3 {
    color: #e0a86f;
}

/* Growth stat colors */
.group-growth .option-item {
    border: 1px solid rgba(111, 224, 150, 0.3);
    border-left: 3px solid #6fe096;
}

.group-growth .option-item:hover {
    border-color: rgba(111, 224, 150, 0.6);
}

.group-growth .option-item.selected {
    background: rgba(111, 224, 150, 0.1);
    border-color: #6fe096;
}

.group-growth .option-item .entry-title-container h3 {
    color: #6fe096;
}

/* Hide requirements indicator in stat groups (shown via connectors in description) */
.group-control .requirements-indicator,
.group-experience .requirements-indicator,
.group-growth .requirements-indicator {
    display: none;
}

/* Stat level indicator badges */
.stat-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 0.75rem;
}

.stat-level-0 .stat-level-badge { background: rgba(100, 100, 100, 0.3); color: #888; }
.stat-level-1 .stat-level-badge { background: rgba(100, 180, 100, 0.3); color: #81c784; }
.stat-level-2 .stat-level-badge { background: rgba(100, 150, 200, 0.3); color: #64b5f6; }
.stat-level-3 .stat-level-badge { background: rgba(200, 150, 100, 0.3); color: #ffb74d; }

/* Stat description styling */
.stat-description {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.stat-description p {
    margin: 0.4rem 0;
    font-size: 0.8rem;
}

.stat-description .stat-highlight {
    color: var(--text-primary);
    font-weight: 500;
}

.stat-description .stat-warning {
    color: #cf6679;
    font-style: italic;
}

.stat-description .stat-benefit {
    color: #81c784;
}

.stat-meter {
    display: flex;
    gap: 3px;
    margin: 0.5rem 0;
}

.stat-meter-segment {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
}

.stat-meter-segment.filled {
    background: currentColor;
    opacity: 0.7;
}

.stat-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.stat-keyword {
    padding: 0.15rem 0.35rem;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-keyword.positive {
    color: #81c784;
    border-color: rgba(129, 199, 132, 0.3);
}

.stat-keyword.negative {
    color: #cf6679;
    border-color: rgba(207, 102, 121, 0.3);
}

/* ============================================================
   POWER TREE STYLING - Compact with visual hierarchy
   ============================================================ */
.power-tree .grid-group-container {
    background: linear-gradient(135deg, var(--background-tertiary) 0%, rgba(15, 15, 21, 0.9) 100%);
    padding: 1px;
    border: 1px solid var(--border-color);
    /* Use minmax for columns - compact to avoid horizontal scroll */
    grid-template-columns: repeat(var(--grid-cols, 5), minmax(125px, 1fr)) !important;
}

.power-tree .grid-item {
    font-size: 0.8rem;
    padding: 0.6rem;
    transition: all 0.2s ease;
}

.power-tree .grid-item .entry-description,
.power-tree .grid-item p {
    font-size: 0.8rem;
    line-height: 1.45;
}

.power-tree .grid-item .entry-title-container h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.power-tree .grid-item .entry-metadata {
    font-size: 0.75rem;
}

/* Material power accent */
.power-tree.material-power .grid-connector.active {
    stroke: var(--accent-material);
}

.power-tree.material-power .grid-item {
    border: 1px solid rgba(74, 124, 89, 0.3);
}

.power-tree.material-power .grid-item:hover {
    border-color: rgba(74, 124, 89, 0.6);
}

.power-tree.material-power .grid-item.selected {
    border-color: var(--accent-material);
    background: rgba(74, 124, 89, 0.1);
}

.power-tree.material-power .grid-item .entry-title-container h3 {
    color: var(--accent-material);
}

/* Conceptual power accent */
.power-tree.conceptual-power .grid-connector.active {
    stroke: var(--accent-conceptual);
}

.power-tree.conceptual-power .grid-item {
    border: 1px solid rgba(124, 74, 107, 0.3);
}

.power-tree.conceptual-power .grid-item:hover {
    border-color: rgba(124, 74, 107, 0.6);
}

.power-tree.conceptual-power .grid-item.selected {
    border-color: var(--accent-conceptual);
    background: rgba(124, 74, 107, 0.1);
}

.power-tree.conceptual-power .grid-item .entry-title-container h3 {
    color: var(--accent-conceptual);
}

/* ============================================================
   POWER TYPE VISUAL HIERARCHY
   Base powers, branch powers, upgrades, and subsuming upgrades
   each have distinct visual styling for easy identification.
   ============================================================ */

/* Base power - gold/amber accent, foundation of each tree */
.base-power {
    border-left: 3px solid var(--accent-essence) !important;
}

.base-power .entry-title-container h3::before {
    content: "◆ ";
    color: var(--accent-essence);
    font-size: 0.8em;
}

/* Branch power - purple accent, main abilities unlocked by base */
.branch-power {
    border-left: 3px solid var(--accent-primary) !important;
}

.branch-power .entry-title-container h3::before {
    content: "◇ ";
    color: var(--accent-primary);
    font-size: 0.8em;
}

/* Upgrade - green accent, improvements to branch powers */
.upgrade-power {
    border-left: 3px solid #81c784 !important;
}

.upgrade-power .entry-title-container h3::before {
    content: "▸ ";
    color: #81c784;
    font-size: 0.8em;
}

/* Subsuming upgrade - cyan accent, pinnacle abilities */
.subsuming-upgrade {
    border: 1px solid var(--accent-ascension) !important;
    border-left: 3px solid var(--accent-ascension) !important;
    background: rgba(60, 143, 191, 0.05) !important;
}

.subsuming-upgrade .entry-title-container h3 {
    color: var(--accent-ascension) !important;
}

.subsuming-upgrade .entry-title-container h3::before {
    content: "★ ";
    color: var(--accent-ascension);
    font-size: 0.85em;
}

.subsuming-upgrade.selected {
    background: rgba(60, 143, 191, 0.15) !important;
}

/* Power tier indicators */
.power-tier {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.5rem;
}

.power-tier.base {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.power-tier.branch {
    background: rgba(124, 92, 191, 0.2);
    color: var(--accent-primary);
}

.power-tier.upgrade {
    background: rgba(129, 199, 132, 0.2);
    color: #81c784;
}

.power-tier.subsuming {
    background: rgba(60, 143, 191, 0.2);
    color: var(--accent-ascension);
}

/* Power effect tags */
.power-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.power-tag {
    padding: 0.15rem 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================================
   PERK/DRAWBACK STYLING
   ============================================================ */
.perk-entry,
.drawback-entry {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.perk-cost,
.drawback-gain {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.perk-cost {
    background: rgba(207, 102, 121, 0.15);
    color: #cf6679;
}

.drawback-gain {
    background: rgba(129, 199, 132, 0.15);
    color: #81c784;
}

/* ============================================================
   COLORED TEXT UTILITIES - For rich descriptions
   ============================================================ */

/* Primary accent colors */
.t-purple, .t-primary { color: #a88bdb; }
.t-green, .t-material { color: #6db87a; }
.t-magenta, .t-conceptual { color: #c77aab; }
.t-gold, .t-essence { color: #d4a84b; }
.t-cyan, .t-ascension { color: #5bb8d9; }

/* Semantic colors */
.t-danger, .t-warning, .t-negative { color: #e57373; }
.t-success, .t-positive, .t-benefit { color: #81c784; }
.t-info, .t-highlight { color: #64b5f6; }
.t-muted { color: #888; }
.t-white, .t-emphasis { color: #f0f0f0; font-weight: 500; }

/* Special effect colors */
.t-fire { color: #ff8a65; }
.t-ice { color: #80deea; }
.t-lightning { color: #fff59d; }
.t-shadow { color: #b39ddb; }
.t-blood { color: #ef5350; }
.t-spirit { color: #ce93d8; }
.t-fate { color: #90caf9; }
.t-death { color: #a1887f; }
.t-mind { color: #f48fb1; }
.t-time { color: #80cbc4; }
.t-space { color: #9fa8da; }
.t-force { color: #aed581; }
.t-flesh { color: #ffab91; }
.t-entropy { color: #bcaaa4; }

/* Stat-specific colors */
.t-control { color: #6fb3e0; }
.t-experience { color: #e0a86f; }
.t-growth { color: #6fe096; }

/* Number/value highlights */
.t-number {
    color: #fff59d;
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

.t-range {
    color: #80deea;
    font-style: italic;
}

.t-cost {
    color: #ef5350;
    font-weight: 500;
}

.t-gain {
    color: #81c784;
    font-weight: 500;
}

/* Emphasis text (simplified for performance) */
.t-glow-purple { color: #a88bdb; font-weight: 500; }
.t-glow-cyan { color: #5bb8d9; font-weight: 500; }
.t-glow-gold { color: #d4a84b; font-weight: 500; }
.t-glow-green { color: #6db87a; font-weight: 500; }
.t-glow-red { color: #e57373; font-weight: 500; }

/* ============================================================
   ICON STYLING - Ascension-specific icon customizations
   ============================================================ */

/* Entry icons - larger and with purple glow */
.entry-icon img {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 8px rgba(124, 92, 191, 0.4));
}

/* Group icons - with purple glow */
.group-icon img {
    filter: drop-shadow(0 0 6px rgba(124, 92, 191, 0.3));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .entry-icon img {
        width: 48px;
        height: 48px;
    }
}

