:root {
    --bg-dark: #090d16;
    --bg-surface: #111827;
    --bg-surface-elevated: #1e293b;
    --bg-card: rgba(17, 24, 39, 0.85);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-highlight: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.25);
    --primary-color: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --gold-gradient: linear-gradient(135deg, #f59e0b, #d97706);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --font-heading: 'Bangers', cursive, sans-serif;
    --font-body: 'Outfit', 'Inter', -apple-system, sans-serif;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --glass-blur: blur(12px);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.18) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(124, 58, 237, 0.18) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.6) 0px, transparent 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Typography & Titles */
h1, h2, h3, .brand-title {
    font-family: var(--font-heading);
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8), 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-title {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.version-tag {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    padding: 2px 8px;
    border-radius: 6px;
    color: #fff;
    vertical-align: middle;
    letter-spacing: 0;
}

/* Layout */
.hero-app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .hero-app-container {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        min-height: 100vh;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: var(--glass-blur);
        border-right: 1px solid var(--border-color);
        position: sticky;
        top: 0;
    }

    main {
        flex: 1;
        max-width: calc(100vw - 250px);
    }
}

.app-header-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(17, 24, 39, 0.6);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.domain-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.github-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.github-link:hover {
    color: #fff;
}

/* Sidebar Nav */
.hero-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: #fff !important;
    text-decoration: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted) !important;
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 4px 12px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(56, 189, 248, 0.12);
    color: #ffffff !important;
    border-left: 3px solid #38bdf8;
}

/* Glass Panels */
.glass-panel, .glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.comic-subpanel {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Generator Controls Bar */
.generator-controls-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.main-cta-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-generate-hero {
    background: var(--primary-gradient);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    letter-spacing: 1px;
    padding: 10px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-generate-hero:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
}

.btn-generate-hero:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-generate-hero:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary-action {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-action:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Dice SVG Component */
.cortex-dice-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.interactive-die {
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.interactive-die:hover {
    transform: scale(1.15) rotate(-3deg);
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7));
}

.interactive-die:active {
    transform: scale(0.95);
}

.dice-svg-container {
    flex-shrink: 0;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.cortex-svg-die {
    display: block;
    overflow: visible;
}

.dice-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Dice Theme Customizer */
.dice-theme-customizer {
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
}

.theme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.theme-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #38bdf8;
}

.btn-toggle-custom {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-toggle-custom:hover {
    color: #fff;
}

.theme-presets-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-badge-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-badge-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.preset-badge-btn.active-preset {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.preset-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.preset-mini-preview {
    display: flex;
    gap: 3px;
}

.mini-swatch {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.color-pick-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.color-pick-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-input-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

/* Superhero Datasheet Card */
.hero-datasheet {
    border: 2px solid rgba(56, 189, 248, 0.3);
    position: relative;
    overflow: hidden;
}

.hero-datasheet::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--primary-gradient);
}

.is-favorite-hero {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.hero-header-banner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.hero-header-left {
    flex: 1;
    min-width: 0;
}

.hero-header-actions-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 115px);
    gap: 8px;
    flex-shrink: 0;
}

.btn-action-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
    padding: 0 8px;
}

.btn-action-tile:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.btn-action-tile.favorited {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fcd34d;
}

.btn-action-tile.favorited:hover {
    background: rgba(245, 158, 11, 0.35);
}

.hero-codename-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-codename {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.2rem;
}

.prodigy-badge {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 6px;
}

.hero-distinctions-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.distinction-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
}

.distinction-text {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.9rem;
}

/* Core Stats Grid */
.hero-core-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.core-stat-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.stat-card-title, .section-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    color: #38bdf8;
    margin-bottom: 0.75rem;
}

.affiliations-list {
    display: flex;
    gap: 1rem;
    justify-content: space-around;
}

.affiliation-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.affil-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.specialties-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.specialty-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 6px;
}

.specialty-name {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Power Sets */
.powersets-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.powerset-header {
    margin-bottom: 0.75rem;
}

.powerset-badge {
    background: var(--primary-gradient);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 6px;
    color: #fff;
}

.powers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.power-trait-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 4px 10px;
    border-radius: 8px;
}

.power-name {
    font-weight: 700;
    color: #ffffff;
    font-size: 0.9rem;
}

.section-micro-header {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 0.6rem 0 0.3rem 0;
}

.sfx-items, .limit-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sfx-item, .limit-item {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    background: rgba(15, 23, 42, 0.4);
    padding: 6px 10px;
    border-radius: 6px;
}

.sfx-tag {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

.limit-tag {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

.sfx-name, .limit-name {
    color: #ffffff;
    margin-right: 4px;
}

.sfx-desc, .limit-desc {
    color: #cbd5e1;
}

/* Milestones */
.milestones-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.milestone-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.6rem;
}

.milestone-star {
    color: #f59e0b;
    font-size: 1.1rem;
}

.milestone-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #f8fafc;
    letter-spacing: 0.5px;
}

.milestone-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.milestone-step-row {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.xp-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    flex-shrink: 0;
}

.xp-1 {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.xp-3 {
    background: rgba(168, 85, 247, 0.25);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.xp-10 {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.xp-text {
    color: #cbd5e1;
}

/* Loading Spinner */
.loading-state-card {
    text-align: center;
    padding: 3rem 1.5rem;
}

.coldstart-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinning-dice {
    animation: bounceRoll 1.5s infinite ease-in-out;
}

@keyframes bounceRoll {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(180deg); }
}

.loading-heading {
    font-size: 1.5rem;
    color: #38bdf8;
}

.loading-msg {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* Advanced Stepper Dice */
.advanced-dice-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 12px;
}

.dice-stepper-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.dice-stepper-btn:hover {
    background: rgba(56, 189, 248, 0.3);
    color: #fff;
}

/* Steppers Grid */
.steppers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.stepper-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.25rem;
    border-radius: 12px;
}

.stepper-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stepper-rating {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #38bdf8;
}

/* Polyhedral Grid */
.polyhedral-tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tier-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.tier-card:hover {
    transform: translateY(-4px);
    border-color: #38bdf8;
}

.tier-card h4 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin: 0.25rem 0 0 0;
}

.tier-name {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dice Pool Builder */
.pool-builder {
    margin-top: 1rem;
}

.pool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1rem;
}

.btn-add-die, .btn-clear-pool {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add-die:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
}

.btn-clear-pool {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    margin-left: auto;
}

.active-pool-tray {
    min-height: 80px;
    background: rgba(15, 23, 42, 0.9);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 1rem;
}

.pool-die-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: transform 0.15s;
}

.pool-die-item:hover {
    transform: scale(1.1);
}

.roll-result-badge {
    background: #2563eb;
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.roll-result-badge.is-hitch {
    background: #dc2626;
    animation: shake 0.5s;
}

.pool-roll-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.btn-roll-pool {
    background: var(--gold-gradient);
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #fff;
    padding: 10px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
}

.roll-summary-card {
    display: flex;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
}

.summary-metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
}

.metric-val {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: #f59e0b;
}

/* Batch Generator Page */
.batch-options-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.count-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-select {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: var(--border-color) !important;
    color: #fff !important;
    font-weight: 600;
    width: 140px;
}

.batch-search-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
}

.hero-search {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--border-color) !important;
    color: #fff !important;
    min-width: 300px;
}

.batch-heroes-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Modals & Drawers */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
}

.favorites-drawer {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    border-radius: 0;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.btn-close-drawer {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.fav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fav-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.fav-item-row:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
}

.fav-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-remove-fav {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-remove-fav:hover {
    color: #ef4444;
}

/* About Page */
.about-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.about-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
}

.about-box h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.about-box a {
    color: #38bdf8;
    text-decoration: none;
}

.about-box a:hover {
    text-decoration: underline;
}

.code-snippet {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    margin-top: 8px;
}

/* Initial App Loader */
.initial-app-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #090d16;
    color: #fff;
    text-align: center;
}

.comic-spin-icon {
    font-size: 3rem;
    animation: bounceRoll 1s infinite alternate;
}

.loader-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-top: 1rem;
    letter-spacing: 1px;
}

.loader-subtitle {
    color: #38bdf8;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.loader-bar-wrap {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.loader-bar-fill {
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    animation: loaderSlide 1.5s infinite;
}

@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==========================================================================
   Hero In-Place Editor Mode Styles
   ========================================================================== */

.datasheet-editing {
    border-color: #f59e0b !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.25) !important;
}

.btn-edit-toggle {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
}

.btn-edit-active {
    background: rgba(34, 197, 94, 0.25) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.hero-identity-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    width: 100%;
    margin-bottom: 0.75rem;
}

.edit-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-name-input {
    font-weight: 700;
    font-size: 1.1rem !important;
    color: #38bdf8 !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
}

.hero-subidentity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.identity-tag {
    font-size: 0.85rem;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.6);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tag-lbl {
    font-weight: 700;
    color: var(--text-muted);
}

.distinctions-wrapper {
    margin-top: 0.75rem;
}

.distinction-edit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 8px;
}

.distinction-input {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    padding: 2px 8px !important;
    width: 180px;
    height: 28px !important;
}

.distinction-input:focus {
    border-color: #38bdf8 !important;
    background: rgba(15, 23, 42, 0.9) !important;
}

.affil-edit-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.die-select {
    width: 68px !important;
    height: 32px !important;
    padding: 2px 6px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    background-color: rgba(30, 41, 59, 0.9) !important;
    border-color: var(--border-color) !important;
    color: #fff !important;
}

.card-title-row, .section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.specialties-edit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.specialty-edit-row, .power-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spec-input, .power-name-input {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    height: 32px !important;
}

.powerset-edit-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.powerset-name-input {
    font-weight: 700;
    color: #f59e0b !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    height: 34px !important;
}

.powers-edit-list, .sfx-edit-list, .limits-edit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.sfx-edit-row, .limit-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sfx-input, .limit-input, .milestone-name-input {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    height: 32px !important;
}

.add-with-select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.sfx-picker-select, .limit-picker-select, .milestone-picker-select {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    height: 32px !important;
}

.btn-add-mini {
    background: rgba(56, 189, 248, 0.2);
    border: 1px dashed #38bdf8;
    color: #38bdf8;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.btn-add-mini:hover {
    background: rgba(56, 189, 248, 0.35);
    color: #fff;
}

.btn-add-section {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #4ade80;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add-section:hover {
    background: rgba(34, 197, 94, 0.35);
    color: #fff;
}

.btn-delete-item {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-item:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fff;
}

.btn-delete-powerset {
    font-size: 0.8rem;
    padding: 4px 12px;
    white-space: nowrap;
}

.empty-edit-placeholder {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.9rem;
    padding: 0.75rem;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

/* SFX, Limits & Milestone Description Editing */
.sfx-edit-block, .limit-edit-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.desc-edit-row, .milestone-edit-desc-wrap {
    width: 100%;
}

.desc-textarea {
    width: 100% !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    resize: vertical;
}

.desc-textarea:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.25) !important;
}

.milestone-edit-desc-wrap {
    margin-top: 8px;
}

/* Dice Testbench Roller Config & Strategy Styles */
.roller-config-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.config-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.strategy-toggle-buttons {
    display: flex;
    gap: 6px;
}

.btn-strategy {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-strategy:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-strategy.active {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.dangerous-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.dangerous-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ef4444;
}

.die-in-total {
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
    border-color: #38bdf8 !important;
}

.die-in-effect {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
    border-color: #f59e0b !important;
}

.role-tag {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.role-total {
    background: #38bdf8;
    color: #090d16;
}

.role-effect {
    background: #f59e0b;
    color: #090d16;
}

.strategy-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    width: 100%;
    margin-top: 1rem;
}

.comparison-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.2s;
}

.comparison-card.active-strategy {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.comp-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.comp-body {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #e2e8f0;
}

/* ==========================================================================
   Google Drive Cloud Sync Styles
   ========================================================================== */

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-nav-sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nav-sync:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #fff;
}

.btn-nav-sync.sync-connected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.sync-nav-icon {
    font-size: 0.95rem;
}

.nav-connected-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    display: inline-block;
}

/* Sync Modal Dialog */
.sync-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.sync-modal-dialog {
    width: 100%;
    max-width: 580px;
    background: #0f172a !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.sync-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sync-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.sync-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sync-modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Status Card */
.sync-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sync-status-card.status-connected {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.08);
}

.sync-status-card.status-disconnected {
    border-color: rgba(255, 255, 255, 0.1);
}

.status-indicator-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

.status-connected .status-indicator-dot {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.status-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-title {
    font-size: 0.95rem;
    color: #fff;
}

.status-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
}

.status-timestamp {
    font-size: 0.75rem;
    color: #38bdf8;
    margin-top: 2px;
}

.btn-connect-google {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-connect-google:hover {
    background: #1d4ed8;
}

.btn-disconnect {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-disconnect:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fff;
}

.sync-alert {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-info {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

/* Actions Grid */
.sync-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.sync-action-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.action-card-header {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.action-card-icon {
    font-size: 1.4rem;
}

.action-card-title {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 2px;
}

.action-card-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0;
}

.pull-options-row {
    margin-top: 4px;
}

.pull-merge-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #cbd5e1;
    cursor: pointer;
}

.btn-sync-action {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-push {
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid #38bdf8;
    color: #38bdf8;
}

.btn-push:hover:not(:disabled) {
    background: #38bdf8;
    color: #090d16;
}

.btn-pull {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #f59e0b;
    color: #f59e0b;
}

.btn-pull:hover:not(:disabled) {
    background: #f59e0b;
    color: #090d16;
}

.btn-sync-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sync-settings-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
}

.btn-toggle-settings {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}

.btn-toggle-settings:hover {
    color: #38bdf8;
    text-decoration: underline;
}

.sync-settings-panel {
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px;
    border-radius: 8px;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.3;
}

.sync-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}