/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e8e8e8;
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.app-header {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #d4af37;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.app-header h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #d4af37;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.header-controls .btn {
    white-space: nowrap;
    min-width: 120px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(45deg, #d4af37, #f4d03f);
    color: #1a1a2e;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #f4d03f, #d4af37);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #4a5568, #718096);
    color: #e8e8e8;
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #718096, #4a5568);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(113, 128, 150, 0.4);
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    color: white;
    min-width: 45px;
    padding: 12px;
    font-size: 1.2rem;
}

.btn-info:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

/* Character Sheet Sections */
.character-sheet {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #4a5568;
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(5px);
}

section h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: #d4af37;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 10px;
}

section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: #d4af37;
    margin-bottom: 15px;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #cbd5e0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    padding: 12px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.8);
    color: #e8e8e8;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

input[readonly] {
    background: rgba(74, 85, 104, 0.3);
    cursor: not-allowed;
}

/* Grid Layouts */
.basic-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.abilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.ability-score {
    text-align: center;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease;
}

.ability-score:hover {
    transform: translateY(-5px);
}

.ability-score label {
    display: block;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #d4af37;
}

.ability-score input {
    width: 80px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.modifier {
    font-size: 1.1rem;
    font-weight: bold;
    color: #4fd1c7;
    background: rgba(79, 209, 199, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.combat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-group {
    background: rgba(79, 209, 199, 0.1);
    border: 1px solid #4fd1c7;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.stat-group input {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
}

.hp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.hp-group {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.hp-group input {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Spellcasting Styles */
.spellcasting {
    background: rgba(138, 43, 226, 0.1);
    border: 2px solid #8a2be2;
}

.spell-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.spell-stat {
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid #8a2be2;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.spell-stat input {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Cantrips Section */
.cantrips-section {
    margin-bottom: 25px;
}

.cantrips-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cantrips-known, .spells-known {
    color: #d4af37;
    font-weight: 600;
}

/* Spell Slots */
.spell-slots-section {
    margin-bottom: 25px;
}

.spell-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.spell-slot-level {
    background: rgba(138, 43, 226, 0.2);
    border: 2px solid #8a2be2;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.spell-slot-level h4 {
    color: #d4af37;
    margin-bottom: 10px;
    font-size: 1rem;
}

.spell-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.spell-slot {
    width: 20px;
    height: 20px;
    border: 2px solid #8a2be2;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
}

.spell-slot.used {
    background: #8a2be2;
}

.spell-slot:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.spell-slots-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Spell Lists */
.spells-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.spell-level-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #4a5568;
    padding-bottom: 10px;
}

.spell-tab {
    padding: 8px 16px;
    background: rgba(74, 85, 104, 0.3);
    border: 1px solid #4a5568;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #cbd5e0;
    font-weight: 600;
}

.spell-tab.active {
    background: rgba(138, 43, 226, 0.3);
    border-color: #8a2be2;
    color: #d4af37;
}

.spell-tab:hover {
    background: rgba(138, 43, 226, 0.2);
}

.spells-list {
    display: grid;
    gap: 10px;
}

.spell-item {
    background: rgba(74, 85, 104, 0.2);
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.spell-item:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: #8a2be2;
}

.spell-item.prepared {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
}

.spell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.spell-name {
    font-weight: 600;
    color: #d4af37;
    font-size: 1.1rem;
}

.spell-level-indicator {
    background: rgba(138, 43, 226, 0.3);
    color: #e8e8e8;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.spell-school {
    color: #cbd5e0;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 8px;
}

.spell-description {
    color: #a0aec0;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.spell-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.spell-prepared-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #cbd5e0;
    font-size: 0.9rem;
}

.spell-prepared-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #d4af37;
}

.spell-cast-btn {
    padding: 4px 12px;
    background: linear-gradient(45deg, #8a2be2, #9932cc);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.spell-cast-btn:hover {
    background: linear-gradient(45deg, #9932cc, #8a2be2);
    transform: translateY(-1px);
}

.spell-cast-btn:disabled {
    background: rgba(74, 85, 104, 0.5);
    cursor: not-allowed;
    transform: none;
}

.spell-delete-btn {
    padding: 4px 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.spell-delete-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Skills Section */
.ability-skills-group {
    margin-bottom: 25px;
    background: rgba(74, 85, 104, 0.1);
    border: 1px solid #4a5568;
    border-radius: 10px;
    padding: 20px;
}

.ability-header {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 8px;
}

.skills-in-ability {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(74, 85, 104, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.skill-item:hover {
    background: rgba(74, 85, 104, 0.4);
    border-color: #d4af37;
}

.skill-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.skill-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d4af37;
    cursor: pointer;
}

.skill-info label {
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    cursor: pointer;
    color: #e8e8e8;
    font-size: 1rem;
}

.skill-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.ability-mod {
    background: rgba(79, 209, 199, 0.2);
    color: #4fd1c7;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
    border: 1px solid #4fd1c7;
}

.prof-bonus {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
    border: 1px solid #d4af37;
}

.total-bonus {
    background: rgba(138, 43, 226, 0.2);
    color: #8a2be2;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
    border: 1px solid #8a2be2;
    font-weight: bold;
}

.skills-legend {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid #4a5568;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.legend-title {
    color: #d4af37;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

.legend-info-btn {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e0;
    font-size: 0.9rem;
}

.legend-item .sample {
    font-weight: 600;
}

/* Equipment and Notes */
.equipment-section textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    width: 100%;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 5% auto;
    padding: 30px;
    border: 2px solid #d4af37;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    margin-bottom: 20px;
    text-align: center;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #d4af37;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.character-list-item {
    background: rgba(74, 85, 104, 0.3);
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.character-list-item:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
}

.character-info h4 {
    color: #d4af37;
    margin-bottom: 5px;
}

.character-info p {
    color: #cbd5e0;
    font-size: 0.9rem;
}

.delete-character {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.delete-character:hover {
    background: #c0392b;
}

/* Navigation Styles */
.main-navigation {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #d4af37;
    border-radius: 15px;
    padding: 5px;
    backdrop-filter: blur(10px);
}

.nav-tab {
    flex: 1;
    max-width: 200px;
    padding: 15px 25px;
    background: transparent;
    border: none;
    color: #e8e8e8;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tab:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
}

.nav-tab.active {
    background: linear-gradient(145deg, #d4af37, #f4d03f);
    color: #1a1a2e;
    text-shadow: none;
}

.nav-tab.active:hover {
    background: linear-gradient(145deg, #f4d03f, #d4af37);
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.dice-main {
    width: 100%;
}

.spells-main {
    width: 100%;
}

/* Skill Results Display */
.skill-results-display {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(8px);
}

.skill-results-display h4 {
    color: #d4af37;
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Cinzel', serif;
    font-size: 1.1em;
}

.skill-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.skill-group-result {
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 12px;
}

.skill-group-result h5 {
    color: #d4af37;
    font-family: 'Cinzel', serif;
    font-size: 0.9em;
    margin: 0 0 10px 0;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 5px;
}

.skill-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin: 2px 0;
    font-size: 0.85em;
    border-radius: 4px;
}

.skill-result-item.proficient {
    background: rgba(212, 175, 55, 0.15);
    border-radius: 4px;
    padding: 6px 8px;
    margin: 2px 0;
}

.skill-result-item.proficient .skill-name {
    color: #d4af37;
    font-weight: 600;
}

.skill-result-item .skill-name {
    color: #ffffff;
    font-weight: 500;
}

.skill-result-item .skill-result {
    color: #d4af37;
    font-weight: 700;
    font-size: 1em;
    min-width: 30px;
    text-align: right;
}

.skill-result-item .skill-result.critical-success {
    color: #4ade80;
    text-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
}

.skill-result-item .skill-result.critical-failure {
    color: #f87171;
    text-shadow: 0 0 5px rgba(248, 113, 113, 0.5);
}

/* Responsive Design for Skill Results */
@media (max-width: 768px) {
    .skill-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-width: 100%;
    }
    
    .skill-group-result {
        padding: 10px;
    }
    
    .skill-result-item {
        font-size: 0.8em;
        padding: 4px 6px;
    }
    
    .skill-result-item.proficient {
        padding: 4px 6px;
    }
}

@media (max-width: 480px) {
    .skill-results-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Dice Rolling Styles */
.dice-section {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #d4af37;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.dice-section h2 {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.dice-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

/* Dice Grid */
.dice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.dice-button {
    background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dice-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    border-color: #f4d03f;
}

.dice-button:active {
    transform: translateY(-1px);
}

.dice-button.rolling {
    animation: diceRoll 0.6s ease-in-out;
}

@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1.2); }
    75% { transform: rotate(270deg) scale(1.1); }
}

.dice-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dice-type {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #d4af37;
    font-weight: 600;
}

.dice-result {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e8e8e8;
    min-height: 30px;
    display: flex;
    align-items: center;
}

.dice-result.critical {
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.dice-result.fumble {
    color: #666;
}

/* Roll Controls */
.roll-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    color: #d4af37;
    font-weight: 600;
    font-size: 0.9rem;
}

.control-group input {
    padding: 8px 12px;
    border: 1px solid #d4af37;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #e8e8e8;
    font-size: 1rem;
}

.advantage-controls {
    display: flex;
    gap: 5px;
}

.advantage-controls .btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.advantage-controls .btn.active {
    background: #d4af37;
    color: #1a1a2e;
}

/* Custom Roll */
.custom-roll {
    grid-column: 1 / -1;
    display: flex;
    gap: 15px;
    align-items: end;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 25px;
}

.custom-roll label {
    color: #d4af37;
    font-weight: 600;
    white-space: nowrap;
}

.custom-roll input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #d4af37;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #e8e8e8;
    font-size: 1rem;
}

/* Roll Result Display */
.roll-result-display {
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #d4af37;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

.result-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.result-label {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 1.2rem;
    font-weight: 600;
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #e8e8e8;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.result-value.critical {
    color: #ff6b6b;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.7);
}

.result-value.fumble {
    color: #666;
}

.result-breakdown {
    color: #b8b8b8;
    font-size: 0.9rem;
    font-style: italic;
}

/* Roll History */
.roll-history {
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.history-header h4 {
    color: #d4af37;
    font-family: 'Cinzel', serif;
    margin: 0;
}

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

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border-left: 3px solid #d4af37;
}

.history-roll {
    color: #e8e8e8;
    font-weight: 500;
}

.history-result {
    color: #d4af37;
    font-weight: bold;
}

.history-time {
    color: #888;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-navigation {
        margin-bottom: 20px;
        padding: 3px;
    }
    
    .nav-tab {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .dice-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .dice-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .dice-button {
        padding: 15px;
    }
    
    .dice-type {
        font-size: 1rem;
    }
    
    .dice-result {
        font-size: 1.5rem;
    }
    
    .custom-roll {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .advantage-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .app-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-controls {
        justify-content: center;
        width: 100%;
    }
    
    .header-controls .btn {
        min-width: 100px;
        font-size: 0.9em;
    }

    .basic-info-grid {
        grid-template-columns: 1fr;
    }

    .abilities-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .combat-grid {
        grid-template-columns: 1fr;
    }

    .hp-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .skills-in-ability {
        grid-template-columns: 1fr;
    }

    .skill-breakdown {
        gap: 6px;
        font-size: 0.8rem;
    }

    .ability-mod, .prof-bonus, .total-bonus {
        min-width: 30px;
        padding: 3px 6px;
        font-size: 0.8rem;
    }

    .skills-legend {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .legend-item {
        justify-content: center;
    }

    .spell-info-grid {
        grid-template-columns: 1fr;
    }

    .spell-slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .spell-level-tabs {
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .info-btn {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        margin-left: 6px;
    }
    
    .info-btn::before {
        font-size: 0.75rem;
        padding: 6px 10px;
        max-width: 320px;
        bottom: 140%;
    }
    
    .info-btn::after {
        bottom: 130%;
    }
    
    .legend-info-btn::before {
        max-width: 280px;
        bottom: 140%;
    }
    
    .legend-info-btn::after {
        bottom: 130%;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }

    section {
        padding: 15px;
    }

    .abilities-grid {
        grid-template-columns: 1fr;
    }

    .hp-grid {
        grid-template-columns: 1fr;
    }

    .spell-slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .spell-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .spell-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.6s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 26, 46, 0.5);
}

::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #f4d03f;
}

/* Info Modal Styles */
.info-modal {
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}

.info-modal h2 {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2rem;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 15px;
}

.info-section {
    margin-bottom: 30px;
    background: rgba(74, 85, 104, 0.1);
    border: 1px solid #4a5568;
    border-radius: 10px;
    padding: 20px;
}

.info-section h3 {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 1.4rem;
    margin-bottom: 15px;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 8px;
}

.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.practice-item {
    background: rgba(79, 209, 199, 0.1);
    border: 1px solid #4fd1c7;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.practice-item h4 {
    color: #4fd1c7;
    margin-bottom: 8px;
    font-size: 1rem;
}

.practice-item p {
    color: #cbd5e0;
    font-size: 0.9rem;
    margin: 0;
}

.warning-box {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.warning-box p {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.warning-box ul {
    color: #ffb3b3;
    margin-left: 20px;
}

.warning-box li {
    margin-bottom: 5px;
}

.tip-box {
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid #8a2be2;
    border-radius: 8px;
    padding: 15px;
}

.tip-box p {
    color: #da70d6;
    margin: 0;
    font-style: italic;
}

.info-section h4 {
    color: #4fd1c7;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.info-content p {
    color: #e8e8e8;
    line-height: 1.6;
    margin-bottom: 12px;
}

.info-content strong {
    color: #d4af37;
}

.info-note {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #d4af37;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    color: #f4d03f;
}

.info-benefits {
    margin-top: 15px;
}

.info-benefits ul {
    list-style: none;
    padding-left: 0;
}

.info-benefits li {
    color: #e8e8e8;
    margin-bottom: 8px;
    padding-left: 10px;
}

.modal-content {
    width: 95%;
    margin: 10% auto;
}

.info-modal {
    width: 95%;
    max-height: 90vh;
    margin: 5% auto;
}

.practice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}

.info-section {
    padding: 15px;
}

.info-modal h2 {
    font-size: 1.5rem;
}

.info-section h3 {
    font-size: 1.2rem;
}

.header-controls {
    flex-wrap: wrap;
    gap: 8px;
}

.header-controls .btn {
    font-size: 0.8rem;
    padding: 8px 12px;
}

.btn-info {
    min-width: 35px;
    padding: 8px;
    font-size: 1rem;
}

/* Info Button Styles */
.info-btn {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
    position: relative;
}

.info-btn:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(23, 162, 184, 0.4);
}

/* Custom Tooltip Styles */
.info-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    max-width: 400px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    font-weight: normal;
    border: 1px solid #d4af37;
}

.info-btn::after {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.info-btn:hover::before,
.info-btn:hover::after,
.info-btn.tooltip-visible::before,
.info-btn.tooltip-visible::after {
    opacity: 1;
    visibility: visible;
}

/* Special positioning for legend info button */
.legend-info-btn::before {
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 350px;
}

.legend-info-btn::after {
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
}

.input-with-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-info input {
    flex: 1;
}

/*=============================================
=            Journal Section                  =
=============================================*/

.journal-section-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #4a5568;
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(5px);
    margin-top: 30px;
}

.journal-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: #d4af37;
    margin-bottom: 15px;
}

.journal-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.journal-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.journal-filter-btn {
    padding: 8px 16px;
    border: 1px solid #4a5568;
    background-color: transparent;
    color: #cbd5e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.journal-filter-btn:hover {
    background-color: #4a5568;
    color: white;
}

.journal-filter-btn.active {
    background-color: #d4af37;
    color: #1a1a2e;
    border-color: #d4af37;
    font-weight: bold;
}

.journal-entry-box {
    display: flex;
    gap: 10px;
}

.journal-input {
    flex-grow: 1;
    min-height: 50px;
    resize: vertical;
}

.journal-add-btn {
    align-self: flex-end;
}

.equipment-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.journal-notes-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.journal-note {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    border-left: 5px solid #666; /* Default color */
    transition: all 0.3s ease;
}

.journal-note.pinned {
    background: rgba(212, 175, 55, 0.15);
    border-left-color: #f4d03f;
}

.journal-note[data-category="general"] { border-left-color: #fd7e14; }
.journal-note[data-category="inventory"] { border-left-color: #20c997; }
.journal-note[data-category="npc"] { border-left-color: #17a2b8; }
.journal-note[data-category="lore"] { border-left-color: #6f42c1; }


.journal-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.journal-note-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: #a0aec0;
}

.journal-note-category {
    font-weight: bold;
    text-transform: uppercase;
}

.journal-note-actions button {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.3s ease;
}

.journal-note-actions button:hover {
    color: white;
}

.journal-note-actions .pin-note-btn.pinned {
    color: #d4af37;
}

.journal-note-content {
    white-space: pre-wrap; /* Preserve line breaks */
    word-break: break-word;
}

/* Note Animations */
@keyframes noteFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes noteFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.journal-note.new {
    animation: noteFadeInUp 0.4s ease-out forwards;
}

.journal-note.deleting {
    animation: noteFadeOut 0.3s ease-out forwards;
}

/* Styles for when a note is being edited */
.journal-note.editing .journal-note-header,
.journal-note.editing .journal-note-content {
    display: none; /* Hide the static text and header */
}

.journal-note-edit-area {
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.journal-note.editing .journal-note-edit-area {
    display: flex; /* Show when editing */
}

.journal-note-edit-area textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

/*=====  End of Journal Section  ======*/ 