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

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

/* ===== Header ===== */
.header {
    background: linear-gradient(90deg, #0f3460 0%, #16213e 100%);
    padding: 0.75rem 2rem;
    text-align: center;
    border-bottom: 3px solid #e94560;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 200;
}

.header h1 {
    font-size: 1.4rem;
    color: #e94560;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0;
}

.header p {
    color: #a8b2d1;
    font-style: italic;
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* ===== Password Gate ===== */
.password-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-content {
    max-width: 400px;
    padding: 2rem;
    background: #16213e;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 2px solid #e94560;
}

.password-content h2 {
    color: #e94560;
    margin-bottom: 1rem;
}

.password-content input {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    background: #0f3460;
    border: 2px solid #e94560;
    border-radius: 5px;
    color: #e4e4e4;
    font-size: 1rem;
}

.password-content button {
    width: 100%;
    padding: 0.75rem;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 0.5rem;
}

.password-content button:hover {
    background: #c73b52;
}

.password-content button.cancel-btn {
    background: #0f3460;
    border: 2px solid #a8b2d1;
}

.password-content button.cancel-btn:hover {
    background: #16213e;
}

.error-message {
    color: #e94560;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    background: #0f3460;
    border-right: 2px solid #e94560;
    padding: 1.5rem 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 2px solid #e94560;
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    color: #e94560;
    font-size: 1.2rem;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #a8b2d1;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-menu a:hover {
    background: #16213e;
    color: #e94560;
    border-left-color: #e94560;
}

.nav-menu a.active {
    background: #16213e;
    color: #e94560;
    border-left-color: #e94560;
    font-weight: bold;
}

.nav-menu a.dm-only {
    color: #9b59b6;
}

.nav-menu a.dm-only:hover {
    color: #9b59b6;
    border-left-color: #9b59b6;
}

.nav-menu a.hidden-page {
    opacity: 0.5;
    font-style: italic;
}

/* ===== Sidebar Footer / Mode Toggle ===== */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 2px solid #e94560;
    margin-top: auto;
}

.mode-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.mode-label {
    font-size: 0.8rem;
    color: #a8b2d1;
    font-weight: bold;
    transition: color 0.3s ease;
}

.mode-label#mode-label-player {
    color: #5ba3d0;
}

.mode-label#mode-label-dm {
    color: #a8b2d1;
}

body.dm-active .mode-label#mode-label-player {
    color: #a8b2d1;
}

body.dm-active .mode-label#mode-label-dm {
    color: #9b59b6;
}

.mode-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #5ba3d0;
    border-radius: 24px;
    transition: all 0.3s ease;
}

.mode-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.mode-switch input:checked + .mode-slider {
    background: #9b59b6;
}

.mode-switch input:checked + .mode-slider::before {
    transform: translateX(20px);
}

/* ===== Index / Home Page ===== */
.index-hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    max-width: 600px;
    margin: 0 auto;
}

.index-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: flicker 3s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.85; filter: brightness(1.3); }
}

.index-title {
    color: #e94560 !important;
    font-size: 2.5rem !important;
    border-bottom: none !important;
    margin-bottom: 0.25rem !important;
    padding-bottom: 0 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.index-subtitle {
    color: #a8b2d1;
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.index-divider {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #e94560, transparent);
    margin: 0 auto 1.5rem;
}

.index-description {
    color: #a8b2d1;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.index-role-select {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.index-role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem 2rem;
    background: #16213e;
    border: 2px solid #0f3460;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.index-role-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.index-role-btn.player-btn:hover,
.index-role-btn.player-btn.active {
    border-color: #5ba3d0;
    background: rgba(91, 163, 208, 0.1);
}

.index-role-btn.dm-btn:hover,
.index-role-btn.dm-btn.active {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.1);
}

.index-role-icon {
    font-size: 2rem;
}

.index-role-name {
    color: #e4e4e4;
    font-size: 1.1rem;
    font-weight: bold;
}

.index-role-desc {
    color: #a8b2d1;
    font-size: 0.8rem;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.page-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-content h2 {
    color: #e94560;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e94560;
    padding-bottom: 0.5rem;
}

.intro-text {
    background: #16213e;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #5ba3d0;
}

/* ===== Common Traits ===== */
.common-traits {
    background: #0f3460;
    border-left: 4px solid #5ba3d0;
    padding: 1rem;
    margin: 2rem 0;
    border-radius: 5px;
}

.common-traits h3 {
    color: #5ba3d0;
    margin-bottom: 0.5rem;
}

.common-traits ul {
    margin-left: 2rem;
}

/* ===== Demon Grid ===== */
.demon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.demon-card {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #e94560;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    position: relative;
}

.demon-card.hidden {
    opacity: 0.3;
    filter: blur(5px);
    pointer-events: none;
}

/* DM visibility checkbox on demon cards */
.demon-visibility-toggle {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.demon-visibility-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.demon-visibility-toggle input[type="checkbox"]:hover {
    border-color: #5ba3d0;
    background: #16213e;
}

.demon-visibility-toggle input[type="checkbox"]:checked {
    background: #9b59b6;
    border-color: #9b59b6;
}

.demon-visibility-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

body.dm-active .demon-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(233, 69, 96, 0.3);
}

.demon-card h3 {
    color: #e94560;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.demon-card .cr-badge {
    display: inline-block;
    background: #e94560;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.demon-card ul {
    list-style: none;
    margin-top: 1rem;
}

.demon-card li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #a8b2d1;
}

.demon-card li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #e94560;
}

.demon-card .dm-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #0f3460;
    font-style: italic;
    color: #5ba3d0;
    font-size: 0.9rem;
}

/* ===== Rune Category Filters ===== */
.rune-category-filters {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.rune-filter-btn {
    padding: 0.5rem 1.2rem;
    border: 2px solid #1a2940;
    background: #16213e;
    color: #a8b2d1;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.rune-filter-btn:hover {
    border-color: #9b59b6;
    color: #fff;
}

.rune-filter-btn.active {
    background: #9b59b6;
    border-color: #9b59b6;
    color: #fff;
    font-weight: bold;
}

.rune-filter-btn.filter-action.active {
    background: #e94560;
    border-color: #e94560;
}

.rune-filter-btn.filter-element.active {
    background: #5ba3d0;
    border-color: #5ba3d0;
}

.rune-filter-btn.filter-special.active {
    background: #f39c12;
    border-color: #f39c12;
}

/* ===== Rune Grid & Cards ===== */
.rune-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.rune-card {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #9b59b6;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    position: relative;
    text-align: center;
}

.rune-card.hidden {
    opacity: 0.3;
    filter: blur(5px);
    pointer-events: none;
}

body.dm-active .rune-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(155, 89, 182, 0.3);
}

.rune-card:not(.hidden) {
    cursor: pointer;
}

.rune-visibility-toggle {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.rune-visibility-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.rune-visibility-toggle input[type="checkbox"]:checked {
    background: #9b59b6;
    border-color: #9b59b6;
}

.rune-visibility-toggle input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

.rune-card-symbol {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.rune-card h3 {
    color: #9b59b6;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.rune-category-badge {
    display: inline-block;
    color: white;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.75rem;
}

.rune-card-description {
    color: #a8b2d1;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-align: left;
}

.rune-card-traits {
    list-style: none;
    text-align: left;
    margin-bottom: 0.75rem;
}

.rune-card-traits li {
    color: #a8b2d1;
    padding: 0.2rem 0;
    font-size: 0.85rem;
}

.rune-card-traits li::before {
    content: '\25C6 ';
    color: #9b59b6;
    font-size: 0.7rem;
    margin-right: 0.4rem;
}

.rune-card-traits .rune-more {
    color: #5ba3d0;
    font-style: italic;
}

.rune-card-traits .rune-more::before {
    content: '';
}

.rune-card-combos {
    color: #5ba3d0;
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #0f3460;
}

.rune-card .dm-notes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #0f3460;
    font-style: italic;
    color: #5ba3d0;
    font-size: 0.85rem;
    text-align: left;
}

/* ===== Rune Detail Popup ===== */
.rune-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.rune-detail {
    background: linear-gradient(180deg, #1e1e2e 0%, #16213e 100%);
    border: 2px solid #9b59b6;
    border-radius: 8px;
    max-width: 600px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    animation: popupSlideIn 0.3s ease;
}

.rune-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: #a8b2d1;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 2;
}

.rune-detail-close:hover {
    color: #e94560;
}

.rune-detail-header {
    text-align: center;
    margin-bottom: 1rem;
}

.rune-detail-symbol {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.rune-detail-header h2 {
    color: #9b59b6;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.rune-detail-category {
    display: inline-block;
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
}

.rune-cat-action {
    background: #e94560;
}

.rune-cat-element {
    background: #5ba3d0;
}

.rune-cat-special {
    background: #f39c12;
}

.rune-detail-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #9b59b6, transparent);
    margin: 1.25rem 0;
}

.rune-detail-description {
    color: #a8b2d1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.rune-detail-traits h3,
.rune-detail-combos h3 {
    color: #9b59b6;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.rune-detail-traits ul {
    list-style: none;
    padding: 0;
}

.rune-detail-traits li {
    color: #a8b2d1;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.rune-detail-traits li::before {
    content: '\25C6 ';
    color: #9b59b6;
    margin-right: 0.5rem;
}

/* Combination entries */
.combo-entry {
    background: #0f3460;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid #9b59b6;
}

.combo-entry.combo-partial {
    border-left-color: #555;
}

.combo-runes {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.combo-plus {
    color: #9b59b6;
    font-size: 1rem;
    font-weight: bold;
}

.combo-rune-known {
    cursor: default;
}

.combo-rune-unknown {
    color: #555;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.combo-name {
    color: #e94560;
    font-weight: bold;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}

.combo-effect {
    color: #a8b2d1;
    font-size: 0.9rem;
    line-height: 1.5;
}

.combo-entry.combo-partial .combo-name {
    color: #777;
}

.combo-entry.combo-partial .combo-effect {
    color: #666;
}

.no-combos {
    color: #666;
    font-style: italic;
}

/* DM section in rune detail */
.rune-detail-dm-section h3 {
    color: #5ba3d0;
}

.rune-detail-dm-section p {
    color: #5ba3d0;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Rune Rules Summary ===== */
.rune-rules-summary {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(91, 163, 208, 0.08);
    border: 1px solid rgba(91, 163, 208, 0.2);
    border-radius: 8px;
}

.rune-rules-summary h3 {
    color: #5ba3d0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.rune-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.rune-rule-card {
    background: rgba(10, 25, 47, 0.6);
    border: 1px solid rgba(91, 163, 208, 0.15);
    border-radius: 6px;
    padding: 1rem;
}

.rune-rule-card h4 {
    color: #e94560;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.rune-rule-card p {
    color: #a8b2d1;
    font-size: 0.85rem;
    line-height: 1.5;
}

.rune-rule-card ul {
    list-style: none;
    padding: 0;
}

.rune-rule-card ul li {
    color: #a8b2d1;
    font-size: 0.85rem;
    line-height: 1.6;
    padding-left: 0.8rem;
    position: relative;
}

.rune-rule-card ul li::before {
    content: '•';
    color: #5ba3d0;
    position: absolute;
    left: 0;
}

/* ===== Combo Metadata Badges ===== */
.combo-meta {
    display: inline-flex;
    gap: 0.4rem;
    margin-left: 0.6rem;
    vertical-align: middle;
}

.combo-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.combo-badge-active {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.4);
}

.combo-badge-passive {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.combo-badge-cost {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.combo-badge-durability {
    background: rgba(91, 163, 208, 0.12);
    color: #5ba3d0;
    border: 1px solid rgba(91, 163, 208, 0.25);
}

.combo-badge-applies-to {
    background: rgba(155, 89, 182, 0.15);
    color: #bb86fc;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.combo-badge-tier {
    background: rgba(243, 156, 18, 0.12);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.combo-badge-requires-core {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* ===== NPC Grid & Cards ===== */
.npc-dm-actions {
    margin-bottom: 1rem;
}

.npc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.npc-card {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #5ba3d0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    position: relative;
}

.npc-card.hidden {
    opacity: 0.3;
    filter: blur(5px);
    pointer-events: none;
}

.npc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(91, 163, 208, 0.3);
}

.npc-card h3 {
    color: #5ba3d0;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.npc-description {
    color: #a8b2d1;
    line-height: 1.6;
}

.npc-card .dm-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #0f3460;
    font-style: italic;
    color: #9b59b6;
    font-size: 0.9rem;
}

/* NPC card DM controls */
.npc-card-controls {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 2;
}

.npc-visibility-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.npc-visibility-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.npc-visibility-toggle input[type="checkbox"]:hover {
    border-color: #5ba3d0;
    background: #16213e;
}

.npc-visibility-toggle input[type="checkbox"]:checked {
    background: #9b59b6;
    border-color: #9b59b6;
}

.npc-visibility-toggle input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

.npc-control-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    opacity: 0.7;
}

.npc-control-btn:hover {
    opacity: 1;
}

.npc-control-btn.edit-btn {
    background: #5ba3d0;
}

.npc-control-btn.delete-btn {
    background: #e94560;
}

/* ===== Rules Grid & Cards ===== */
.rules-dm-actions {
    margin-bottom: 1rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.rule-card {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #5ba3d0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    position: relative;
}

.rule-card.hidden {
    opacity: 0.3;
    filter: blur(5px);
    pointer-events: none;
}

.rule-card h3 {
    color: #5ba3d0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-right: 5rem;
}

.rule-card .dm-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #0f3460;
    font-style: italic;
    color: #9b59b6;
    font-size: 0.9rem;
}

/* Rule card DM controls */
.rule-card-controls {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 2;
}

.rule-visibility-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.rule-visibility-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.rule-visibility-toggle input[type="checkbox"]:hover {
    border-color: #5ba3d0;
    background: #16213e;
}

.rule-visibility-toggle input[type="checkbox"]:checked {
    background: #9b59b6;
    border-color: #9b59b6;
}

.rule-visibility-toggle input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

.rule-control-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    opacity: 0.7;
}

.rule-control-btn:hover {
    opacity: 1;
}

.rule-control-btn.edit-btn {
    background: #5ba3d0;
}

.rule-control-btn.delete-btn {
    background: #e94560;
}

/* Rich content styling inside rule cards */
.rule-content {
    color: #a8b2d1;
    line-height: 1.7;
    font-size: 0.95rem;
}

.rule-content h4 {
    color: #e94560;
    font-size: 1.15rem;
    margin: 1rem 0 0.5rem;
}

.rule-content h4:first-child {
    margin-top: 0;
}

.rule-content h5 {
    color: #5ba3d0;
    font-size: 1rem;
    margin: 0.75rem 0 0.4rem;
}

.rule-content p {
    margin-bottom: 0.5rem;
}

.rule-content ul,
.rule-content ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.rule-content li {
    margin-bottom: 0.3rem;
}

.rule-content strong {
    color: #e4e4e4;
}

.rule-content em {
    color: #5ba3d0;
}

.rule-content blockquote {
    border-left: 3px solid #e94560;
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: rgba(233, 69, 96, 0.05);
    font-style: italic;
}

.rule-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.rule-content th {
    background: #0f3460;
    color: #e94560;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border: 1px solid #1a2940;
}

.rule-content td {
    padding: 0.4rem 0.75rem;
    border: 1px solid #1a2940;
    color: #a8b2d1;
}

.rule-content tr:nth-child(even) td {
    background: rgba(15, 52, 96, 0.3);
}

.rule-content tr:hover td {
    background: rgba(91, 163, 208, 0.1);
}

/* ===== Info Sections ===== */
.info-section {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.info-section h3 {
    color: #5ba3d0;
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.info-section h4 {
    color: #a8b2d1;
    font-size: 1.2rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.info-section p, .info-section li {
    color: #a8b2d1;
    margin-bottom: 0.5rem;
}

.info-section ul {
    margin-left: 2rem;
}

/* ===== Jongleur Page ===== */
.jongleur-intro {
    border-left-color: #d4a017;
}

.jongleur-section {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #d4a017;
}

.jongleur-section h3 {
    color: #d4a017;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.jongleur-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.jongleur-table th {
    background: #0f3460;
    color: #d4a017;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border: 1px solid #1a2940;
}

.jongleur-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #1a2940;
    color: #a8b2d1;
}

.jongleur-table tr:nth-child(even) td {
    background: rgba(15, 52, 96, 0.3);
}

.jongleur-table tr:hover td {
    background: rgba(212, 160, 23, 0.1);
}

.jongleur-level-table td:first-child {
    color: #d4a017;
    font-weight: bold;
    text-align: center;
    width: 60px;
}

.jongleur-level-table td:nth-child(3),
.jongleur-level-table td:nth-child(4),
.jongleur-level-table td:nth-child(5) {
    text-align: center;
    width: 80px;
}

.jongleur-feature {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
}

.jongleur-feature:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.jongleur-feature h4 {
    color: #d4a017;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.jongleur-feature p {
    color: #a8b2d1;
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.jongleur-feature ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    color: #a8b2d1;
}

.jongleur-feature li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.jongleur-note {
    padding: 0.75rem 1rem;
    background: rgba(212, 160, 23, 0.08);
    border-left: 3px solid #d4a017;
    border-radius: 3px;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #a8b2d1;
}

.jongleur-note strong {
    color: #d4a017;
}

.jongleur-subclass {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(212, 160, 23, 0.3);
    border-left: 4px solid #d4a017;
}

.jongleur-subclass h3 {
    color: #d4a017;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.jongleur-subclass-intro {
    color: #a8b2d1;
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
}

/* ===== Wardwright Class Page ===== */
.wardwright-intro {
    border-left-color: #c0392b;
}

.wardwright-section {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #c0392b;
}

.wardwright-section h3 {
    color: #c0392b;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.wardwright-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.wardwright-table th {
    background: #0f3460;
    color: #c0392b;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border: 1px solid #1a2940;
}

.wardwright-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #1a2940;
    color: #a8b2d1;
}

.wardwright-table tr:nth-child(even) td {
    background: rgba(15, 52, 96, 0.3);
}

.wardwright-table tr:hover td {
    background: rgba(192, 57, 43, 0.1);
}

.wardwright-level-table td:first-child {
    color: #c0392b;
    font-weight: bold;
    text-align: center;
    width: 60px;
}

.wardwright-level-table td:nth-child(3),
.wardwright-level-table td:nth-child(4),
.wardwright-level-table td:nth-child(5) {
    text-align: center;
    width: 80px;
}

.wardwright-feature {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(192, 57, 43, 0.15);
}

.wardwright-feature:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wardwright-feature h4 {
    color: #c0392b;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.wardwright-feature p {
    color: #a8b2d1;
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.wardwright-feature ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    color: #a8b2d1;
}

.wardwright-feature li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.wardwright-note {
    padding: 0.75rem 1rem;
    background: rgba(192, 57, 43, 0.08);
    border-left: 3px solid #c0392b;
    border-radius: 3px;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #a8b2d1;
}

.wardwright-note strong {
    color: #c0392b;
}

.wardwright-subclass {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(192, 57, 43, 0.3);
    border-left: 4px solid #c0392b;
}

.wardwright-subclass h3 {
    color: #c0392b;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.wardwright-subclass-intro {
    color: #a8b2d1;
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(192, 57, 43, 0.15);
}

/* ===== Courier Class ===== */
.courier-intro {
    border-left-color: #5a7d9a;
}

.courier-section {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #5a7d9a;
}

.courier-section h3 {
    color: #5a7d9a;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.courier-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.courier-table th {
    background: #0f3460;
    color: #5a7d9a;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border: 1px solid #1a2940;
}

.courier-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #1a2940;
    color: #a8b2d1;
}

.courier-table tr:nth-child(even) td {
    background: rgba(15, 52, 96, 0.3);
}

.courier-table tr:hover td {
    background: rgba(90, 125, 154, 0.1);
}

.courier-level-table td:first-child {
    color: #5a7d9a;
    font-weight: bold;
    text-align: center;
    width: 60px;
}

.courier-level-table td:nth-child(3),
.courier-level-table td:nth-child(4) {
    text-align: center;
    width: 80px;
}

.courier-feature {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(90, 125, 154, 0.15);
}

.courier-feature:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.courier-feature h4 {
    color: #5a7d9a;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.courier-feature p {
    color: #a8b2d1;
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.courier-feature ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    color: #a8b2d1;
}

.courier-feature li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.courier-note {
    padding: 0.75rem 1rem;
    background: rgba(90, 125, 154, 0.08);
    border-left: 3px solid #5a7d9a;
    border-radius: 3px;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #a8b2d1;
}

.courier-note strong {
    color: #5a7d9a;
}

.courier-subclass {
    background: #16213e;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(90, 125, 154, 0.3);
    border-left: 4px solid #5a7d9a;
}

.courier-subclass h3 {
    color: #5a7d9a;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.courier-subclass-intro {
    color: #a8b2d1;
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(90, 125, 154, 0.15);
}

/* ===== Placeholder Content ===== */
.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
    background: #16213e;
    border-radius: 10px;
    margin-top: 2rem;
}

.placeholder-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.placeholder-content h3 {
    color: #e94560;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.placeholder-content p {
    color: #a8b2d1;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.placeholder-hint {
    font-style: italic;
    font-size: 0.95rem !important;
    color: #5ba3d0 !important;
}

/* ===== DM Controls ===== */
.dm-controls {
    background: #2d1b2e;
    border: 2px solid #9b59b6;
    border-radius: 10px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.dm-controls h3 {
    color: #9b59b6;
    margin-bottom: 0.5rem;
}

.dm-hint {
    color: #a8b2d1;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.dm-control-section {
    margin: 1rem 0;
}

.dm-btn {
    padding: 0.5rem 1rem;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    transition: background 0.3s ease;
}

.dm-btn:hover {
    background: #7d3c98;
}

.dm-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #16213e;
    border-radius: 5px;
    margin: 0.5rem 0;
}

.dm-toggle-item label {
    color: #a8b2d1;
    cursor: pointer;
    flex: 1;
}

.dm-toggle-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ===== Modal Forms ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #16213e;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #9b59b6;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #9b59b6;
}

.modal-header h2 {
    color: #9b59b6;
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: #a8b2d1;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e94560;
}

.modal form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #5ba3d0;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 5px;
    color: #e4e4e4;
    font-size: 1rem;
    font-family: 'Georgia', serif;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #5ba3d0;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #0f3460;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #9b59b6;
    color: white;
}

.btn-primary:hover {
    background: #7d3c98;
}

.btn-secondary {
    background: #0f3460;
    color: #a8b2d1;
    border: 2px solid #a8b2d1;
}

.btn-secondary:hover {
    background: #16213e;
    border-color: #5ba3d0;
    color: #5ba3d0;
}

/* DM Notes styling in lists */
.dm-notes-section {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(155, 89, 182, 0.1);
    border-left: 3px solid #9b59b6;
    border-radius: 3px;
}

.dm-notes-section strong {
    color: #9b59b6;
    font-size: 0.85rem;
}

.dm-notes-section p {
    color: #a8b2d1;
    font-size: 0.85rem;
    margin: 0.25rem 0 0 0;
    font-style: italic;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: #e94560;
    border: none;
    border-radius: 50%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    z-index: 150;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .header p {
        font-size: 0.75rem;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 250;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding: 1rem;
    }

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

    .index-hero {
        padding: 2rem 1rem;
    }

    .index-title {
        font-size: 1.8rem !important;
    }

    .index-role-select {
        flex-direction: column;
        align-items: center;
    }

    .index-role-btn {
        width: 100%;
        max-width: 250px;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

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

::-webkit-scrollbar-track {
    background: #0f3460;
}

::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 5px;
}

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

/* ===== Map Styles ===== */
.map-container {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.map-placeholder {
    text-align: center;
    padding: 4rem 2rem;
}

.map-wrapper {
    position: relative;
}

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(15, 52, 96, 0.9);
    border: 2px solid #e94560;
    border-radius: 5px;
    color: #e4e4e4;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-control-btn:hover {
    background: #e94560;
    transform: scale(1.1);
}

.map-viewport {
    width: 100%;
    height: 600px;
    overflow: hidden;
    border: 2px solid #0f3460;
    border-radius: 5px;
    background: #0f3460;
    position: relative;
    cursor: grab;
}

.map-viewport.panning {
    cursor: grabbing;
}

.map-image-container {
    position: relative;
    display: inline-block;
    min-width: 100%;
    min-height: 100%;
    transform-origin: center center;
    transition: none;
    will-change: transform;
}

.map-image-container.add-pin-mode {
    cursor: crosshair;
}

#map-image {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

#map-pins-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Enable pointer events when in add-pin mode */
.map-image-container.add-pin-mode #map-pins-overlay {
    pointer-events: auto;
}

.map-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: all;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.map-pin.dragging {
    opacity: 0.7;
    z-index: 20;
    cursor: grabbing;
}

.map-pin.hidden {
    opacity: 0.5;
    filter: grayscale(100%);
}

.map-pin.undiscovered .map-pin-icon {
    opacity: 0.55;
    filter: grayscale(100%);
}

.map-pin.undiscovered {
    cursor: default;
}

.map-pin-icon {
    font-size: 2rem;
    text-shadow:
        -2px -2px 3px rgba(0, 0, 0, 0.8),
        2px -2px 3px rgba(0, 0, 0, 0.8),
        -2px 2px 3px rgba(0, 0, 0, 0.8),
        2px 2px 3px rgba(0, 0, 0, 0.8);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
}

.map-pin:hover .map-pin-icon {
    transform: scale(1.2);
}

.map-pin-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 52, 96, 0.95);
    border: 2px solid #e94560;
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 30;
}

.map-pin:hover .map-pin-tooltip {
    opacity: 1;
}

.map-pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #e94560;
}

.map-pin-name {
    color: #e94560;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Map Legend */
.map-legend {
    background: #16213e;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.map-legend h3 {
    color: #5ba3d0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

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

.legend-icon {
    font-size: 1.3rem;
}

/* Select dropdown styling */
select {
    width: 100%;
    padding: 0.75rem;
    background: #0f3460;
    border: 2px solid #9b59b6;
    border-radius: 5px;
    color: #e4e4e4;
    font-size: 1rem;
    font-family: 'Georgia', serif;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #5ba3d0;
}

select option {
    background: #0f3460;
    color: #e4e4e4;
    padding: 0.5rem;
}

/* Checkbox in form groups */
.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Map pin list in DM controls */
.map-pin-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.75rem;
    background: #16213e;
    border-radius: 5px;
    margin: 0.5rem 0;
    border-left: 4px solid #5ba3d0;
}

.map-pin-list-info {
    flex: 1;
}

.map-pin-list-name {
    color: #5ba3d0;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.map-pin-list-type {
    color: #a8b2d1;
    font-size: 0.85rem;
}

.map-pin-list-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ===== Enemy Stat Block Popup ===== */
.stat-block-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.stat-block {
    background: linear-gradient(180deg, #1e1e2e 0%, #16213e 100%);
    border: 2px solid #e94560;
    border-radius: 4px;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow:
        0 0 40px rgba(233, 69, 96, 0.15),
        0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popupSlideIn 0.35s ease;
    padding: 0;
}

.stat-block-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #a8b2d1;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 2;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.stat-block-close:hover {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.stat-block-header {
    padding: 1rem 1.25rem 0.5rem;
    border-bottom: 3px solid #e94560;
}

.stat-block-header h2 {
    color: #e94560;
    font-size: 1.6rem;
    margin: 0;
    padding: 0;
    border: none;
    font-family: 'Georgia', serif;
    line-height: 1.2;
}

.stat-block-header p {
    color: #a8b2d1;
    font-style: italic;
    font-size: 0.85rem;
    margin: 0.2rem 0 0.5rem;
}

.stat-block-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #e94560, transparent);
    margin: 0;
}

.stat-block-props {
    padding: 0.5rem 1.25rem;
}

.stat-block-props p {
    margin: 0.15rem 0;
    color: #e4e4e4;
    font-size: 0.9rem;
}

.stat-block-props strong {
    color: #e94560;
    margin-right: 0.4rem;
}

.stat-block-abilities {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    text-align: center;
    padding: 0.6rem 1.25rem;
    gap: 0.25rem;
}

.stat-block-abilities .ability {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.stat-block-abilities .ability-label {
    color: #e94560;
    font-weight: bold;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.stat-block-abilities .ability-score {
    color: #e4e4e4;
    font-size: 0.9rem;
    font-weight: bold;
}

.stat-block-details {
    padding: 0.5rem 1.25rem;
}

.stat-block-details p {
    margin: 0.15rem 0;
    color: #e4e4e4;
    font-size: 0.85rem;
}

.stat-block-details strong {
    color: #e94560;
    margin-right: 0.4rem;
}

.stat-block-section {
    padding: 0.5rem 1.25rem 0.75rem;
}

.stat-block-section h3 {
    color: #e94560;
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    border-bottom: 1px solid rgba(233, 69, 96, 0.3);
    padding-bottom: 0.25rem;
}

.stat-block-trait {
    margin-bottom: 0.5rem;
}

.stat-block-trait-name {
    color: #e4e4e4;
    font-weight: bold;
    font-style: italic;
}

.stat-block-trait-desc {
    color: #a8b2d1;
    font-size: 0.88rem;
    line-height: 1.5;
}

.stat-block-dm-section {
    background: rgba(155, 89, 182, 0.08);
    border-top: 2px solid #9b59b6;
    margin-top: 0.25rem;
}

.stat-block-dm-section h3 {
    color: #9b59b6;
    border-bottom-color: rgba(155, 89, 182, 0.3);
}

.stat-block-dm-section p {
    color: #a8b2d1;
    font-style: italic;
    font-size: 0.88rem;
    line-height: 1.5;
}

.stat-block-cr {
    display: inline-block;
    background: #e94560;
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Stat block tabs */
.stat-block-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.sb-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #1a1a2e;
    background: #1a1a2e;
    color: #a8b2d1;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sb-tab:hover {
    background: #16213e;
    color: #e0e0e0;
}

.sb-tab.active {
    background: #e94560;
    color: white;
    border-color: #e94560;
}

.sb-tab:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Stat block scrollbar */
.stat-block::-webkit-scrollbar {
    width: 6px;
}

.stat-block::-webkit-scrollbar-track {
    background: #16213e;
}

.stat-block::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .stat-block {
        max-height: 90vh;
        width: 95%;
    }

    .stat-block-abilities {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-block-header h2 {
        font-size: 1.3rem;
    }
}

/* ===== Player Pin Info Popup ===== */
.pin-info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.pin-info-popup {
    background: linear-gradient(145deg, #16213e 0%, #1a2940 100%);
    border: 2px solid #e94560;
    border-radius: 15px;
    padding: 2.5rem 2rem 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow:
        0 0 30px rgba(233, 69, 96, 0.2),
        0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popupSlideIn 0.35s ease;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pin-info-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #a8b2d1;
    font-size: 1.8rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pin-info-close:hover {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.pin-info-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.pin-info-type {
    display: inline-block;
    background: rgba(233, 69, 96, 0.15);
    color: #e94560;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.pin-info-name {
    color: #e4e4e4;
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}

.pin-info-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e94560, transparent);
    margin: 0 auto 1rem;
}

.pin-info-description {
    color: #a8b2d1;
    font-size: 1rem;
    line-height: 1.7;
}

/* Responsive map styles */
@media (max-width: 768px) {
    .map-viewport {
        height: 400px;
    }

    .map-controls {
        top: 0.5rem;
        right: 0.5rem;
    }

    .map-control-btn {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    .legend-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .map-pin-icon {
        font-size: 1.5rem;
    }
}

/* ==================== LEVEL GATING ==================== */

/* Level-gated content: blurred and non-interactive for players */
.level-gated {
    filter: blur(6px);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
    position: relative;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Prevent level-gated table rows from leaking text */
tr.level-gated td {
    filter: blur(6px);
    opacity: 0.4;
}

/* Class Level Control (DM-only, displayed on class pages) */
.class-level-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.class-level-control label {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.class-level-control input[type="number"] {
    width: 58px;
    padding: 5px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
    -moz-appearance: textfield;
}

.class-level-control input[type="number"]::-webkit-inner-spin-button,
.class-level-control input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

.class-level-control input[type="number"]:focus {
    outline: none;
    border-color: #d4a017;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.3);
}
