/* ========================================
   CSS Variables & Reset
======================================== */
:root {
    /* Colors - Dark, sleek, professional */
    --bg-primary: #1f2937;
    --bg-secondary: #10151d;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --bg-hover: #27272a;
    
    --border-subtle: #27272a;
    --border-default: #3f3f46;
    --border-strong: #52525b;
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;
    
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-secondary: #6366f1;
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-hover: #f59e0b;
    
    --hp-high: #22c55e;
    --hp-mid: #f59e0b;
    --hp-low: #ef4444;
    --hp-temp: #3b82f6;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --header-height: 60px;
    --tab-bar-height: 64px;
    --max-width: 600px;
}

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

/* ========================================
    Styles for Index.html (Login Page)
======================================== */

        .login-container {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            background: var(--bg-primary);
        }
        
        .login-header {
            padding: var(--space-xl) var(--space-md) var(--space-lg);
            text-align: center;
            border-bottom: 1px solid var(--border-subtle);
        }
        
        .login-header h1 {
            font-family: 'Playfair Display', serif;
            font-size: 28px;
            font-weight: 700;
            margin-bottom: var(--space-xs);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-sm);
        }

        .login-logo {
            height: 36px;
            width: auto;
            filter: brightness(0) invert(1);
        }

        @media (min-width: 640px) {
            .login-header h1 {
                font-size: 40px;
            }

            .login-logo {
                height: 48px;
            }
        }

        .login-header p {
            color: var(--text-secondary);
            font-size: 14px;
            font-family: 'DM Sans', sans-serif;
        }
        
        .login-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: var(--space-md);
        }
        
        .login-card {
            width: 100%;
            max-width: 400px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            box-shadow: var(--shadow-lg);
        }
        
        .login-tabs {
            display: flex;
            margin-bottom: var(--space-lg);
            border-bottom: 1px solid var(--border-subtle);
        }
        
        .login-tab {
            flex: 1;
            padding: var(--space-md);
            background: none;
            border: none;
            color: var(--text-secondary);
            font-family: var(--font-sans);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all var(--transition-fast);
            border-bottom: 2px solid transparent;
        }
        
        .login-tab:hover {
            color: var(--text-primary);
        }
        
        .login-tab.active {
            color: var(--accent-primary);
            border-bottom-color: var(--accent-primary);
        }
        
        .login-form {
            display: none;
            animation: fadeIn 0.3s ease;
        }
        
        .login-form.active {
            display: block;
        }
        
        .role-selector {
            display: flex;
            gap: var(--space-sm);
            margin-bottom: var(--space-lg);
        }
        
        .role-option {
            flex: 1;
            padding: var(--space-md);
            background: var(--bg-tertiary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            color: var(--text-secondary);
            font-family: var(--font-sans);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all var(--transition-fast);
            text-align: center;
        }
        
        .role-option:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
        }
        
        .role-option.active {
            background: var(--accent-primary);
            border-color: var(--accent-primary);
            color: white;
        }
        
        .role-option.dm {
            border-color: var(--warning);
        }
        
        .role-option.dm.active {
            background: var(--warning);
        }
        
        .pin-inputs {
            display: flex;
            gap: var(--space-sm);
            margin-bottom: var(--space-md);
        }
        
        .pin-input {
            flex: 1;
            height: 56px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            color: var(--text-primary);
            font-family: var(--font-mono);
            font-size: 24px;
            font-weight: 600;
            text-align: center;
            transition: all var(--transition-fast);
            min-width: 0;
            min-height: 0;
        }
        
        .pin-input:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }
        
        .pin-input.error {
            border-color: var(--danger);
        }
        
        .remember-me {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            margin: var(--space-lg) 0;
            color: var(--text-secondary);
            font-size: 14px;
        }
        
        .remember-checkbox {
            width: 18px;
            height: 18px;
            border-radius: var(--radius-sm);
            border: 2px solid var(--border-default);
            background: var(--bg-tertiary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all var(--transition-fast);
        }
        
        .remember-checkbox.checked {
            background: var(--accent-primary);
            border-color: var(--accent-primary);
        }
        
        .remember-checkbox.checked::after {
            content: '✓';
            color: white;
            font-size: 12px;
            font-weight: bold;
        }
        
        .form-error {
            padding: var(--space-md);
            background: var(--danger-bg);
            border: 1px solid var(--danger);
            border-radius: var(--radius-md);
            color: var(--danger);
            font-size: 14px;
            margin-bottom: var(--space-md);
            display: none;
        }
        
        .form-hint {
            font-size: 12px;
            color: var(--text-tertiary);
            margin-bottom: 8px;
            font-style: italic;
        }
        
        .form-error.show {
            display: block;
            animation: slideIn 0.3s ease;
        }
        
        .game-world-list {
            max-height: 300px;
            overflow-y: auto;
            margin-bottom: var(--space-md);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
        }
        
        .game-world-item {
            padding: var(--space-md);
            border-bottom: 1px solid var(--border-subtle);
            cursor: pointer;
            transition: all var(--transition-fast);
        }
        
        .game-world-item:hover {
            background: var(--bg-hover);
        }
        
        .game-world-item:last-child {
            border-bottom: none;
        }
        
        .game-world-name {
            font-weight: 600;
            margin-bottom: 2px;
        }
        
        .game-world-description {
            font-size: 13px;
            color: var(--text-secondary);
        }
        
        .create-hint {
            text-align: center;
            color: var(--text-tertiary);
            font-size: 13px;
            margin-top: var(--space-md);
        }
        
        .create-hint a {
            color: var(--accent-primary);
            text-decoration: none;
            cursor: pointer;
        }
        
        .create-hint a:hover {
            text-decoration: underline;
        }

        #pin-text{
            padding-top: 5px;
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .login-footer {
            padding: var(--space-lg);
            text-align: center;
            color: var(--text-tertiary);
            font-size: 12px;
            border-top: 1px solid var(--border-subtle);
        }

/* ========================================
    Styles for Character.html
======================================== */

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('taphou5e.png') center / contain no-repeat;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
}

.header-actions {
    display: flex;
    gap: var(--space-xs);
}


/* ========================================
   Utility Classes
======================================== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========================================
   Loading Screen
======================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: 14px;
}

.loader-small {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Page Layout
======================================== */
.page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Header
======================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: playfair display;
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
    white-space: nowrap;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.char-header-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.char-header-info h1 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-header-info p {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: DM Sans;
}

/* ========================================
   Buttons
======================================== */
.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 6px 10px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    z-index: 50;
}

.fab:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.05);
}

/* ========================================
   Main Content
======================================== */
.main-content {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: var(--space-md);
    padding-bottom: var(--space-xl);
}

.main-content.with-tabs {
    padding-bottom: calc(var(--tab-bar-height) + var(--space-lg));
}

/* ========================================
   Home Page - Party Roster
======================================== */
.party-roster {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.character-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.character-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-info h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    font-family: Playfair Display, serif;
}

.card-info .card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-info .card-player {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.card-level {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

/* HP Bar */
.hp-bar-section {
    margin-bottom: var(--space-md);
}

.hp-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.hp-bar-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hp-bar-value {
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.hp-bar-value .temp {
    color: var(--hp-temp);
}

.hp-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-normal), background var(--transition-normal);
}

.hp-bar-fill.high { background: var(--hp-high); }
.hp-bar-fill.mid { background: var(--hp-mid); }
.hp-bar-fill.low { background: var(--hp-low); }

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.quick-stat {
    text-align: center;
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.quick-stat-value {
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.quick-stat-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}

.empty-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-lg);
    color: var(--text-tertiary);
}

.empty-state h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   Create Character Page
======================================== */
.create-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
}

.section-header .section-title {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));;
    gap: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all var(--transition-fast);

}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    cursor: pointer;
}

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

.helper-text {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Ability Scores Grid */
.ability-scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

@media (min-width: 400px) {
    .ability-scores-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.ability-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.ability-input label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ability-input input {
    width: 100%;
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.ability-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.ability-mod {
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-md);
}

.form-actions button {
    flex: 1;
}

/* ========================================
   Character Detail Page
======================================== */
.tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

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

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

/* Tab Bar */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-sm);
    z-index: 100;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

/* Stats Tab */
.stats-section {
    margin-bottom: var(--space-lg);
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

/* HP Section in Stats */
.hp-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.hp-display-with-level {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.hp-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 40px; 
}

.level-display:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.level-value {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.level-label {
    font-size: 7px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.hp-current {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.hp-max {
    font-size: 18px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.hp-temp {
    font-size: 14px;
    color: var(--hp-temp);
    font-family: var(--font-mono);
}

.hp-bar-large {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.hp-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.hp-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hp-btn:hover {
    background: var(--bg-hover);
}


#hp-delta {
    width: 40px;
}

.hp-btn.damage {
    color: var(--danger);
}

.hp-btn.damage:hover {
    background: var(--danger-bg);
}

.hp-btn.heal {
    color: var(--success);
}

.hp-btn.heal:hover {
    background: var(--success-bg);
}

.hp-input {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 16px;
    text-align: center;
}

.hp-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Temp HP & Death Saves Row */
.hp-extras {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.temp-hp-section {
    flex: 1;
}

.temp-hp-section label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.temp-hp-input {
    width: 100%;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--hp-temp);
    font-family: var(--font-mono);
    font-size: 14px;
    text-align: center;
}

.temp-hp-input:focus {
    outline: none;
    border-color: var(--hp-temp);
}

/* Death Saves */
.death-saves-section {
    flex: 1;
    display: none;
}

.death-saves-section.visible {
    display: block;
}

.death-saves-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.death-saves-row span {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    width: 40px;
}

.death-save-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.death-save-marker.success {
    border-color: var(--success);
}

.death-save-marker.success.filled {
    background: var(--success);
}

.death-save-marker.failure {
    border-color: var(--danger);
}

.death-save-marker.failure.filled {
    background: var(--danger);
}

/* Ability Scores Display */
.ability-scores-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

@media (min-width: 400px) {
    .ability-scores-display {
        grid-template-columns: repeat(6, 1fr);
    }
}

.ability-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.ability-score-box .label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.ability-score-box .score {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.ability-score-box .modifier {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Stats Edit Mode */
.stat-edit-input {
    width: 100%;
    max-width: 56px;
    padding: 2px 4px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.stat-edit-input::-webkit-inner-spin-button,
.stat-edit-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stat-edit-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ability-score-box.editing,
.combat-stat.editing {
    border-color: var(--accent);
}

.ability-score-box.editing .stat-edit-input {
    max-width: 48px;
    font-size: 16px;
}

.stats-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

/* Combat Stats */
.combat-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.combat-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.combat-stat .value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.combat-stat .label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Saving Throws */
.saving-throws-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-xs);
}

.save-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.save-row:hover {
    background: var(--bg-tertiary);
}

.save-row.proficient {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.save-row .name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 13px;
    font-weight: 500;
}

.save-row .prof-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
}

.save-row.proficient .prof-indicator {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.save-row .modifier {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Conditions */
.conditions-section {
    margin-top: var(--space-md);
}

.conditions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.condition-tag {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.condition-tag:hover {
    background: var(--bg-tertiary);
}

.condition-tag.active {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

/* ========================================
   Skills Tab
======================================== */
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.skill-row:hover {
    background: var(--bg-tertiary);
}

.skill-row.proficient {
    background: rgba(59, 130, 246, 0.05);
}

.skill-row.expertise {
    background: rgba(99, 102, 241, 0.08);
}

.skill-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.skill-prof-markers {
    display: flex;
    gap: 2px;
}

.skill-prof-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
}

.skill-row.proficient .skill-prof-marker:first-child {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.skill-row.expertise .skill-prof-marker {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.skill-name {
    font-size: 14px;
    font-weight: 500;
}

.skill-ability {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-left: var(--space-xs);
}

.skill-modifier {
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ========================================
   Actions Tab (Weapons & Spells)
======================================== */
.actions-section {
    margin-bottom: var(--space-lg);
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.add-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 8px;
    background: transparent;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.add-btn svg {
    width: 14px;
    height: 14px;
}

/* Weapons List */
.weapons-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.weapon-card {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    position: relative;
}

.weapon-info {
    min-width: 0; /* Allow text truncation */
}

.weapon-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.weapon-info p {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weapon-stats {
    display: flex;
    gap: var(--space-md);
    text-align: right;
    flex-shrink: 0;
}

.weapon-stat {
    display: flex;
    flex-direction: column;
    min-width: 40px; /* Ensure consistent width */
}

.weapon-stat .value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.weapon-stat .label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.weapon-delete {
    padding: 4px;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.weapon-delete:hover {
    color: var(--danger-hover);
}

/* Spell Slots */
.spell-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.spell-slot-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    min-width: 60px;
}

.spell-slot-group .level {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.spell-slot-markers {
    display: flex;
    gap: 4px;
}

.spell-slot-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--accent-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.spell-slot-marker.used {
    background: var(--accent-secondary);
}

/* Spells List */
.spells-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.spell-level-group {
    margin-bottom: var(--space-md);
}

.spell-level-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-sm);
}

.spell-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.spell-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.spell-prepared-toggle {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--border-default);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.spell-prepared-toggle.prepared {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.spell-name {
    font-size: 14px;
    font-weight: 500;
}

.spell-school {
    font-size: 11px;
    color: var(--text-tertiary);
}

.spell-delete {
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.spell-delete:hover {
    color: var(--danger);
}

/* Empty states for lists */
.empty-list {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-tertiary);
    font-size: 13px;
}

/* ========================================
   Inventory Tab
======================================== */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.currency-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.currency-item label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.currency-item input {
    width: 100%;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    text-align: center;
}

.currency-item input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-info h3 {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info p {
    font-size: 12px;
    color: var(--text-tertiary);
}

.item-quantity {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-right: var(--space-md);
}

.item-quantity button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.item-quantity button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.item-quantity span {
    font-family: var(--font-mono);
    font-size: 14px;
    min-width: 24px;
    text-align: center;
}

.item-delete {
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.item-delete:hover {
    color: var(--danger);
}

/* ========================================
   Notes Tab
======================================== */
.notes-section {
    margin-bottom: var(--space-lg);
}

.notes-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.feature-card {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.feature-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.feature-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.feature-source {
    font-size: 11px;
    color: var(--accent-primary);
    text-transform: capitalize;
}

.feature-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.feature-delete {
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.feature-delete:hover {
    color: var(--danger);
}

/* Character Details */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.detail-item input {
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.detail-item input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Textarea fields */
.notes-textarea {
    width: 100%;
    min-height: 120px;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.notes-textarea::placeholder {
    color: var(--text-muted);
}

/* ========================================
   Modals
======================================== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: var(--space-md);
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    animation: modalIn 0.2s ease;
}

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

.modal-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.modal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
}

.modal-actions button {
    flex: 1;
}

/* Starting Equipment Modal */
.starting-equipment-modal {
    max-width: 450px;
}

.starting-equipment-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.starting-equipment-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.starting-equipment-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.starting-equipment-option:active {
    transform: scale(0.98);
}

.starting-equipment-option .option-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
}

.starting-equipment-option .option-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.starting-equipment-option .option-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

#add-modal-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

#add-modal-fields .form-group {
    margin-bottom: 0;
}

/* Ensure modal form inputs match overall design */
#add-modal-fields input,
#add-modal-fields select,
#add-modal-fields textarea {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all var(--transition-fast);
    width: 100%;
}

#add-modal-fields input:focus,
#add-modal-fields select:focus,
#add-modal-fields textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#add-modal-fields input::placeholder,
#add-modal-fields textarea::placeholder {
    color: var(--text-muted);
}

#add-modal-fields select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

#add-modal-fields label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

/* ========================================
   API Search Autocomplete
======================================== */
.api-search-container {
    position: relative;
}

.api-search-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.api-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.api-search-input::placeholder {
    color: var(--text-muted);
}

.api-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-top: 4px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

/* Custom scrollbar for search results */
.api-search-results::-webkit-scrollbar {
    width: 6px;
}

.api-search-results::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.api-search-results::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}

.api-search-results::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.api-search-result {
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.api-search-result:last-child {
    border-bottom: none;
}

.api-search-result:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.api-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    color: var(--text-secondary);
    font-size: 13px;
}

.api-search-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.api-search-empty {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    font-style: italic;
}

/* ========================================
   Responsive Adjustments
======================================== */
@media (max-width: 380px) {
    .combat-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .currency-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tab-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
    }
    
    .main-content.with-tabs {
        padding-bottom: calc(var(--tab-bar-height) + var(--space-lg) + env(safe-area-inset-bottom));
    }
    
    .fab {
        bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
    }
}

/* ========================================
   Character Card Conditions
======================================== */
.card-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 var(--space-md);
    margin-bottom: var(--space-sm);
}

.card-condition-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: var(--radius-full);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========================================
   Clickable Cards
======================================== */
.clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clickable:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.weapon-card.clickable:hover,
.spell-card.clickable:hover,
.item-card.clickable:hover,
.feature-card.clickable:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Detail Modal
======================================== */
.detail-modal-content {
    max-width: 500px;
}

.detail-modal-content h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.detail-row {
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-row strong {
    color: var(--text-primary);
    margin-right: var(--space-xs);
}

.detail-source {
    font-size: 12px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

/* ========================================
   Search Result Badges
======================================== */
.api-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.search-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: var(--space-sm);
}

.search-badge.special {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.search-badge.feature {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.search-badge.trait {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.search-badge.feat {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border: 1px solid #8b5cf6;
}

/* ========================================
   Top Skill Indicator (White Dot)
======================================== */
.top-skill-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    margin-left: var(--space-xs);
    flex-shrink: 0;
}

/* ========================================
   Rest Buttons
======================================== */
.rest-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

.btn-rest {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-rest:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-rest.short {
    border-color: var(--warning);
}

.btn-rest.short:hover {
    background: var(--warning-bg);
    color: var(--warning);
}

.btn-rest.long {
    border-color: var(--accent-primary);
}

.btn-rest.long:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
}

/* ========================================
   Bonus Actions Section
======================================== */
.bonus-actions-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.action-info {
    flex: 1;
    min-width: 0;
}

.action-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.action-info p {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.action-source {
    color: var(--accent-primary);
}

.action-rest-type {
    color: var(--text-tertiary);
    font-size: 11px;
}

.action-uses {
    display: flex;
    gap: 4px;
    margin-left: var(--space-md);
}

.action-use-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--accent-primary);
}

.action-use-marker.used {
    background: transparent;
}

/* ========================================
   Special Options (Unarmed Strike, etc.)
======================================== */
.detail-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.detail-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.special-option {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.special-option:last-child {
    margin-bottom: 0;
}

.special-option-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
}

.special-option-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.special-option-dc {
    margin-top: var(--space-xs);
    font-size: 12px;
    color: var(--warning);
}

/* ========================================
   Detail Modal Usage Display
======================================== */
.detail-usage {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 14px;
}

.usage-rest-type {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-left: var(--space-sm);
}

/* ========================================
   DM Panel
======================================== */
.dm-panel-content {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-md);
}

.dm-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.dm-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.dm-section-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.btn-large {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.dm-character-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.dm-character-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.dm-character-item:hover {
    background: var(--bg-hover);
}

.dm-character-info {
    flex: 1;
}

.dm-character-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dm-character-details {
    font-size: 13px;
    color: var(--text-tertiary);
}

.dm-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: var(--space-sm);
}

.dm-grant-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* ========================================
   Leveling Mode Toggle (Login + DM Panel)
======================================== */
.leveling-mode-toggle,
.dm-leveling-toggle {
    display: flex;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.leveling-mode-btn,
.dm-leveling-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leveling-mode-btn.active,
.dm-leveling-btn.active {
    background: var(--accent-primary);
    color: white;
}

.leveling-mode-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.dm-leveling-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.dm-leveling-toggle {
    min-width: 200px;
}

/* ========================================
   EXP Mode - DM Panel
======================================== */
.dm-party-exp-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.dm-exp-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    padding: var(--space-sm) var(--space-md);
    width: 100px;
    -moz-appearance: textfield;
}

.dm-exp-input::-webkit-outer-spin-button,
.dm-exp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dm-exp-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.dm-party-exp-input {
    flex: 1;
    width: auto;
}

.dm-character-item-exp {
    flex-wrap: wrap;
}

.dm-exp-grant {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.dm-exp-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: var(--space-xs);
    overflow: hidden;
}

.dm-exp-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.dm-exp-text {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* EXP on character detail level display */
.level-exp-text {
    font-size: 10px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ========================================
   Yellow Level Indicator (Pending Level-Up)
======================================== */
.level-display.pending-levelup {
    background: var(--warning);
    border-color: var(--warning);
    animation: pulse 2s ease-in-out infinite;
    cursor: pointer;
    position: relative;
}

.level-display.pending-levelup:hover {
    transform: scale(1.05);
}

.level-display.pending-levelup::after {
    content: '↑';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========================================
   Level-Up Wizard Modal
======================================== */
.levelup-wizard {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.levelup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.levelup-progress {
    margin-bottom: var(--space-xl);
}

.levelup-progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.levelup-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

.levelup-progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.levelup-step-content {
    min-height: 300px;
    margin-bottom: var(--space-xl);
    overflow-x: hidden;
}

.levelup-step-content h3 {
    font-size: 20px;
    margin-bottom: var(--space-md);
}

.step-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.levelup-nav {
    display: flex;
    gap: var(--space-md);
    justify-content: space-between;
}

.levelup-nav button {
    flex: 1;
}

/* HP Step */
.hp-batch-actions {
    margin-bottom: var(--space-md);
}

.hp-average-all-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
}

.hp-level-block {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.hp-level-label {
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hp-total-summary {
    font-weight: 700;
    margin-top: var(--space-md);
    font-size: 16px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.hp-level-block-single {
    border: none;
    padding: 0;
    margin-bottom: 0;
}

.hp-choice-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.hp-choice-option {
    position: relative;
    cursor: pointer;
}

.hp-choice-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.hp-choice-option label {
    display: block;
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hp-choice-option input:checked + label {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.hp-choice-option:hover label {
    border-color: var(--accent-primary);
}

.hp-choice-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.hp-choice-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
}

.hp-choice-desc {
    font-size: 13px;
    color: var(--text-tertiary);
}

.hp-roll-result {
    text-align: center;
    margin-top: var(--space-lg);
}

.hp-roll-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.hp-roll-input {
    width: 120px;
    padding: var(--space-sm) var(--space-md);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.hp-roll-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.hp-roll-input::placeholder {
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 400;
}

.hp-roll-display {
    margin-top: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.roll-animation .roll-result {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent-primary);
}

.roll-animation .roll-modifier {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

.roll-animation .roll-total {
    font-size: 24px;
    font-weight: 600;
    margin-top: var(--space-md);
    color: var(--text-primary);
}

/* ASI Step */
.asi-choice-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.asi-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.asi-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.asi-instructions {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.asi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.asi-ability {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-xs);
    text-align: center;
    min-width: 0;
}

.asi-ability-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asi-ability-score {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.asi-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.asi-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.asi-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.asi-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.asi-value {
    font-size: 16px;
    font-weight: 600;
    min-width: 30px;
    display: inline-block;
}

.asi-points-remaining {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Feat List */
.feat-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.feat-option {
    position: relative;
}

.feat-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.feat-option label {
    display: block;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.feat-option input:checked + label {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.feat-option:hover label {
    border-color: var(--accent-primary);
}

.feat-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feat-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Subclass Step */
.subclass-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

.subclass-option {
    position: relative;
}

.subclass-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.subclass-option label {
    display: block;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.subclass-option input:checked + label {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.subclass-option:hover label {
    border-color: var(--accent-primary);
}

.subclass-name {
    font-size: 16px;
    font-weight: 600;
}

/* Spell Selection Step */
.spell-level-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.filter-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.spell-selection-list {
    max-height: 300px;
    overflow-y: auto;
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.spell-select-option {
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.spell-select-option:hover {
    background: var(--bg-hover);
}

.spell-select-option input[type="checkbox"] {
    cursor: pointer;
}

.spells-selected {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Feature Review Step */
.feature-review-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.feature-review-item {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.feature-review-item h4 {
    font-size: 16px;
    margin-bottom: var(--space-xs);
    color: var(--accent-primary);
}

.feature-review-item p {
    font-size: 14px;
    color: var(--text-secondary);
}

.levelup-summary {
    padding: var(--space-lg);
    background: var(--bg-elevated);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-md);
}

.levelup-summary h4 {
    font-size: 16px;
    margin-bottom: var(--space-md);
}

.levelup-summary ul {
    list-style: none;
    padding: 0;
}

.levelup-summary li {
    padding: var(--space-xs) 0;
    font-size: 14px;
}

/* ========================================
   Tools / Search Tab
======================================== */
.tools-tab {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.tools-search-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding-bottom: var(--space-sm);
}

.tools-search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    transition: border-color var(--transition-fast);
}

.tools-search-bar:focus-within {
    border-color: var(--accent-primary);
}

.tools-search-bar svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.tools-search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-sans);
    outline: none;
}

.tools-search-bar input::placeholder {
    color: var(--text-tertiary);
}

.tools-search-bar .tools-search-clear {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.tools-search-bar .tools-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tools-category-filters {
    padding: var(--space-sm) 0 0;
}

.tools-category-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.tools-category-select:focus {
    border-color: var(--accent-primary);
}

.tools-category-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.tools-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tools-result-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tools-result-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.tools-result-card:active {
    transform: scale(0.99);
}

.tools-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.tools-result-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.tools-result-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.tools-result-badge.spell {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.tools-result-badge.weapon {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.tools-result-badge.armor {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.tools-result-badge.item {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.tools-result-badge.monster {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.tools-result-badge.feature {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.tools-result-badge.condition {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
}

.tools-result-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.tools-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-md);
    text-align: center;
    color: var(--text-tertiary);
}

.tools-empty-state svg {
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.tools-empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.tools-empty-state p {
    font-size: 14px;
    max-width: 280px;
}

.tools-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.tools-loading .loader {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

/* Tools Detail View */
.tools-detail-view {
    animation: fadeIn 0.2s ease;
}

.tools-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.tools-add-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.tools-add-btn.added {
    background: var(--accent-success);
    border-color: var(--accent-success);
    pointer-events: none;
    opacity: 0.9;
}

.tools-detail-back {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-xs) 0;
    margin-bottom: 0;
}

.tools-detail-back:hover {
    text-decoration: underline;
}

.tools-detail-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-family: 'Playfair Display', serif;
}

.tools-detail-type {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-lg);
}

.tools-detail-section {
    margin-bottom: var(--space-lg);
}

.tools-detail-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.tools-detail-props {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.tools-detail-prop {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
}

.tools-detail-prop-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tools-detail-prop-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 2px;
}

.tools-detail-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.tools-detail-description p {
    margin-bottom: var(--space-sm);
}

.tools-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tools-detail-table th {
    text-align: left;
    padding: var(--space-sm);
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-default);
}

.tools-detail-table td {
    padding: var(--space-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.tools-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tools-detail-tag {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* ========================================
   Side Menu
   ======================================== */

.side-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.side-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 201;
    display: flex;
    flex-direction: column;
}

.side-menu-overlay.open .side-menu {
    transform: translateX(0);
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.side-menu-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.side-menu-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.side-menu-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.side-menu-nav {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.side-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 15px;
    font-weight: 500;
}

.side-menu-item:hover {
    background: var(--bg-hover);
}

.side-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.side-menu-item-danger {
    color: var(--accent-danger, #ef4444);
}

.side-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.side-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 20px;
}

        /* ========================================
           Monster Tracker Specific Styles
           (extends dnd-players/styles.css)
        ======================================== */

        /* Page container */
        .mt-container {
            max-width: var(--max-width);
            margin: 0 auto;
            padding: var(--space-md);
        }

        /* Settings panel */
        #settingsPanel {
            background: var(--bg-secondary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-lg);
            padding: var(--space-md);
            box-shadow: var(--shadow-lg);
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
            margin-bottom: var(--space-md);
        }

        #settingsPanel .settings-inner {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }

        /* Mode toggle */
        .mode-toggle,
        .compact-toggle {
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            color: var(--text-primary);
            user-select: none;
            font-family: var(--font-sans);
        }

        .mode-toggle .simple-label,
        .compact-toggle .full-label {
            opacity: 1;
            transition: opacity 0.3s;
        }

        .mode-toggle .advanced-label,
        .compact-toggle .compact-label {
            opacity: 0.5;
            transition: opacity 0.3s;
        }

        .mode-toggle.advanced .simple-label,
        .compact-toggle.compact .full-label {
            opacity: 0.5;
        }

        .mode-toggle.advanced .advanced-label,
        .compact-toggle.compact .compact-label {
            opacity: 1;
        }

        .mode-toggle:hover .simple-label,
        .mode-toggle:hover .advanced-label,
        .compact-toggle:hover .full-label,
        .compact-toggle:hover .compact-label {
            opacity: 0.8;
        }

        /* Add Monster Form Container */
        .mt-add-form {
            background: var(--bg-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-md);
            box-shadow: var(--shadow-md);
            margin-bottom: var(--space-lg);
        }

        .mt-add-form-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .mt-add-form-header h2 {
            font-size: 16px;
            font-weight: 600;
            font-family: 'Playfair Display', serif;
        }

        .mt-add-form-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: var(--space-xs);
            transition: color var(--transition-fast);
        }

        .mt-add-form-close:hover {
            color: var(--text-primary);
        }

        .mt-add-form-close svg {
            width: 24px;
            height: 24px;
        }

        .mt-add-form-body {
            margin-top: var(--space-md);
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }

        .mt-form-row {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }

        .mt-form-row-wrap {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }

        @media (min-width: 640px) {
            .mt-form-row-wrap {
                flex-direction: row;
            }
        }

        .mt-form-row label {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            font-size: 14px;
            color: var(--text-primary);
        }

        .mt-form-row label span {
            font-size: 14px;
            color: var(--text-secondary);
        }

        /* Generic form inputs (monster tracker specific) */
        .mt-input {
            padding: 8px 12px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            color: var(--text-primary);
            font-family: var(--font-sans);
            font-size: 14px;
            transition: all var(--transition-fast);
        }

        .mt-input:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .mt-input::placeholder {
            color: var(--text-muted);
        }

        .mt-input-full {
            width: 100%;
        }

        .mt-input-small {
            width: 96px;
        }

        .mt-input-color {
            width: 40px;
            height: 36px;
            padding: 2px;
            cursor: pointer;
        }

        .mt-select {
            padding: 8px 12px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            color: var(--text-primary);
            font-family: var(--font-sans);
            font-size: 14px;
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        .mt-select:focus {
            outline: none;
            border-color: var(--accent-primary);
        }

        .mt-checkbox {
            margin-right: var(--space-sm);
        }

        .mt-relative {
            position: relative;
            flex: 1;
        }

        .mt-add-btn-row {
            display: flex;
            justify-content: flex-end;
            gap: var(--space-sm);
        }

        /* Individual inputs for multiple monsters */
        .mt-individual-inputs {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
        }

        .mt-individual-row {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: var(--space-sm);
        }

        @media (min-width: 640px) {
            .mt-individual-row {
                flex-direction: row;
            }
        }

        .mt-individual-label {
            width: 128px;
            font-size: 14px;
            color: var(--text-secondary);
        }

        /* Monster suggestions dropdown */
        #monsterSuggestions {
            position: absolute;
            background: var(--bg-secondary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            max-height: 200px;
            overflow-y: auto;
            width: 100%;
            z-index: 10;
            box-shadow: var(--shadow-lg);
        }

        #monsterSuggestions div {
            padding: var(--space-sm) var(--space-md);
            cursor: pointer;
            font-size: 14px;
            color: var(--text-primary);
            transition: background var(--transition-fast);
        }

        #monsterSuggestions div:hover {
            background-color: var(--bg-hover);
            color: var(--accent-primary);
        }

        /* Monster list */
        .mt-monster-list {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }

        /* Monster card */
        .mt-monster-card {
            background: var(--bg-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-md);
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
            transition: all var(--transition-fast);
        }

        .mt-monster-card.dead {
            opacity: 0.5;
            filter: grayscale(1);
        }

        .mt-monster-card.player-border {
            border: 2px solid var(--accent-primary);
        }

        .mt-monster-card.npc-border {
            border: 2px solid var(--warning);
        }

        .mt-monster-card.custom-border {
            border: 2px solid var(--custom-border-color, transparent);
        }

        .mt-card-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }

        /* Monster header */
        .monster-header {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            position: relative;
        }

        @media (min-width: 640px) {
            .monster-header {
                flex-direction: row;
                align-items: center;
            }
        }

        .monster-name-container {
            display: inline-flex;
            align-items: center;
        }

        .monster-name {
            font-size: 16px;
            font-weight: 600;
            font-family: 'Playfair Display', serif;
            cursor: pointer;
            transition: color var(--transition-fast);
        }

        .monster-name:hover {
            color: var(--accent-primary);
        }

        .details-icon {
            width: 16px;
            height: 16px;
            margin-left: 4px;
            vertical-align: middle;
            cursor: pointer;
            opacity: 0.5;
            color: var(--text-secondary);
            transition: all var(--transition-fast);
        }

        .details-icon:hover {
            opacity: 1;
            color: var(--accent-primary);
        }

        .ac-initiative {
            display: flex;
            flex-direction: row;
            gap: var(--space-sm);
        }

        .ac-display,
        .initiative-display {
            cursor: pointer;
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            padding: 2px 8px;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-sm);
            font-size: 13px;
            font-family: var(--font-mono);
            transition: background-color var(--transition-fast);
        }

        .ac-display:hover,
        .initiative-display:hover {
            background-color: var(--bg-hover);
        }

        /* Remove button */
        .remove-button {
            background: none;
            border: none;
            color: var(--danger);
            cursor: pointer;
            padding: var(--space-xs);
            transition: color var(--transition-fast);
        }

        .remove-button:hover {
            color: #b91c1c;
        }

        .remove-button svg {
            width: 24px;
            height: 24px;
        }

        /* HP controls row */
        .mt-hp-row {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }

        .mt-hp-btn-minus {
            padding: 8px 12px;
            background: var(--danger);
            color: white;
            border: none;
            border-radius: var(--radius-md);
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background var(--transition-fast);
        }

        .mt-hp-btn-minus:hover {
            background: #dc2626;
        }

        .mt-hp-btn-plus {
            padding: 8px 12px;
            background: var(--success);
            color: white;
            border: none;
            border-radius: var(--radius-md);
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background var(--transition-fast);
        }

        .mt-hp-btn-plus:hover {
            background: #16a34a;
        }

        /* HP display badge */
        .hp-display {
            cursor: pointer;
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            padding: 2px 8px;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-sm);
            font-size: 13px;
            font-family: var(--font-mono);
            transition: background-color var(--transition-fast);
            position: relative;
        }

        .hp-display:hover {
            background-color: var(--bg-hover);
        }

        .hp-display input {
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-sm);
            padding: 1px 4px;
            width: 64px;
            font-family: var(--font-mono);
            font-size: 13px;
        }

        /* Health bar */
        .health-bar {
            display: flex;
            height: 20px;
            background-color: var(--bg-tertiary);
            border-radius: var(--radius-sm);
            overflow: hidden;
        }

        .health-segment {
            flex: 1;
            background-color: var(--success);
            border-right: 1px solid var(--bg-tertiary);
        }

        .health-segment:last-child {
            border-right: none;
        }

        .empty-segment {
            background-color: var(--bg-tertiary);
        }

        /* Status & notes row */
        .mt-status-row {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
            align-items: flex-start;
        }

        @media (min-width: 640px) {
            .mt-status-row {
                flex-direction: row;
            }
        }

        .mt-status {
            font-weight: 500;
            font-size: 14px;
        }

        .mt-status.healthy { color: var(--success); }
        .mt-status.injured { color: var(--warning); }
        .mt-status.bloodied { color: var(--warning); }
        .mt-status.critical { color: var(--danger); }
        .mt-status.dead { color: var(--text-muted); }

        .mt-notes-field {
            flex: 1;
        }

        /* Notes textarea (overrides dnd-players .notes-textarea for monster-tracker context) */
        .mt-notes-textarea {
            resize: vertical;
            min-height: 40px;
            max-height: 100px;
            width: 100%;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            padding: var(--space-sm);
            font-family: 'DM Sans', sans-serif;
            font-size: 14px;
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            line-height: 1.5;
        }

        .mt-notes-textarea:focus {
            outline: none;
            border-color: var(--accent-primary);
        }

        .mt-notes-textarea::placeholder {
            color: var(--text-muted);
        }

        /* HP Popup */
        .hp-popup {
            display: none;
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            background-color: var(--bg-secondary);
            padding: var(--space-md);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border-default);
            z-index: 50;
            width: 240px;
            font-family: 'DM Sans', sans-serif;
        }

        .hp-popup .hp-input {
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            padding: 4px 8px;
            width: 60px;
            text-align: center;
            margin: 4px auto;
            display: block;
            font-size: 13px;
            font-family: var(--font-mono);
        }

        .hp-popup .hp-buttons {
            display: flex;
            flex-wrap: nowrap;
            gap: 4px;
            justify-content: center;
        }

        .hp-popup .hp-buttons button {
            padding: 6px 8px;
            border-radius: var(--radius-md);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color var(--transition-fast);
            border: none;
            font-family: var(--font-sans);
        }

        .hp-popup .hp-buttons .decrement {
            background-color: var(--danger);
            color: white;
        }

        .hp-popup .hp-buttons .decrement:hover {
            background-color: #b91c1c;
        }

        .hp-popup .hp-buttons .increment {
            background-color: var(--success);
            color: white;
        }

        .hp-popup .hp-buttons .increment:hover {
            background-color: #16a34a;
        }

        .hp-popup .hp-buttons .set {
            background-color: var(--accent-primary);
            color: white;
        }

        .hp-popup .hp-buttons .set:hover {
            background-color: var(--accent-primary-hover);
        }

        /* Monster Details Popup */
        .details-popup {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background-color: var(--bg-secondary);
            padding: var(--space-md);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border-default);
            z-index: 50;
            width: 300px;
            max-height: 400px;
            overflow-y: auto;
        }

        .details-popup .details-content {
            font-size: 13px;
            line-height: 1.5;
            color: var(--text-secondary);
        }

        .details-popup .details-content h4 {
            font-weight: 600;
            margin-top: var(--space-sm);
            margin-bottom: var(--space-xs);
            color: var(--text-primary);
            font-family: 'Playfair Display', serif;
        }

        .details-popup .details-content p {
            margin-bottom: var(--space-xs);
            font-family: 'DM Sans', sans-serif;
        }

        .details-popup .details-content ul {
            list-style-type: disc;
            margin-left: var(--space-md);
            margin-bottom: var(--space-xs);
        }

        .details-popup .details-content li {
            margin-bottom: 2px;
            font-family: 'DM Sans', sans-serif;
        }

        .details-popup .details-content .dice {
            text-decoration: underline;
            color: var(--accent-primary);
        }

        /* Encounter groups */
        .encounter-group {
            margin-bottom: var(--space-md);
            background-color: var(--bg-tertiary);
            border-radius: var(--radius-lg);
            padding: var(--space-md);
            border: 1px solid var(--border-subtle);
        }

        .encounter-group h2 {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: var(--space-sm);
            color: var(--text-primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            font-family: 'Playfair Display', serif;
        }

        .encounter-group.ungrouped h2 {
            display: none;
        }

        .encounter-group.collapsed .encounter-monsters {
            display: none;
        }

        .encounter-monsters {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }

        .encounter-toggle-icon {
            width: 20px;
            height: 20px;
            transition: transform var(--transition-fast);
        }

        .encounter-group.collapsed .encounter-toggle-icon {
            transform: rotate(-90deg);
        }

        /* Floating add button - reuse dnd-players fab pattern */
        .floating-add-button {
            position: fixed;
            bottom: var(--space-lg);
            right: var(--space-lg);
            background-color: var(--accent-primary);
            color: white;
            width: 56px;
            height: 56px;
            border-radius: var(--radius-full);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-lg);
            cursor: pointer;
            z-index: 30;
            transition: all var(--transition-fast);
            border: none;
        }

        .floating-add-button:hover {
            background-color: var(--accent-primary-hover);
            transform: scale(1.05);
        }

        .floating-add-button svg {
            width: 32px;
            height: 32px;
        }

        /* Modal overlays */
        .mt-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            justify-content: center;
            align-items: center;
            z-index: 100;
            font-family: 'DM Sans', sans-serif;
        }

        .mt-modal-box {
            background-color: var(--bg-secondary);
            padding: var(--space-xl);
            border-radius: var(--radius-lg);
            text-align: center;
            max-width: 400px;
            width: 90%;
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border-default);
        }

        .mt-modal-form-box {
            background-color: var(--bg-secondary);
            padding: var(--space-md);
            border-radius: var(--radius-lg);
            max-width: 500px;
            width: 90%;
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border-default);
        }

        .mt-modal-box h2 {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: var(--space-md);
            font-family: 'Playfair Display', serif;
            color: var(--text-primary);
        }

        .mt-modal-box .mode-option {
            margin-bottom: var(--space-md);
            text-align: left;
        }

        .mt-modal-box .mode-option label {
            display: block;
            margin-bottom: var(--space-sm);
            cursor: pointer;
            font-family: 'Playfair Display', serif;
            color: var(--text-primary);
            font-size: 16px;
        }

        .mt-modal-box .mode-option input[type="radio"] {
            margin-right: var(--space-sm);
        }

        .mt-modal-box .mode-option p {
            font-size: 14px;
            color: var(--text-secondary);
            line-height: 1.5;
        }

        .mt-modal-box .never-show {
            margin-top: var(--space-lg);
            margin-bottom: var(--space-lg);
            text-align: left;
            font-size: 14px;
            color: var(--text-secondary);
        }

        .mt-modal-box .never-show label {
            cursor: pointer;
        }

        .mt-modal-box .never-show input[type="checkbox"] {
            margin-right: var(--space-sm);
        }

        /* Seed code textarea */
        #seedCodeTextarea {
            width: 100%;
            height: 150px;
            padding: var(--space-md);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            margin-bottom: var(--space-md);
            resize: vertical;
            font-family: 'DM Sans', sans-serif;
            font-size: 13px;
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
        }

        #seedCodeTextarea:focus {
            outline: none;
            border-color: var(--accent-primary);
        }

        .mt-modal-buttons {
            display: flex;
            justify-content: space-between;
            gap: var(--space-sm);
            margin-top: var(--space-sm);
        }

        /* Message content box */
        .mt-message-box {
            background-color: var(--bg-secondary);
            padding: var(--space-xl);
            border-radius: var(--radius-lg);
            text-align: center;
            max-width: 400px;
            width: 90%;
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border-default);
        }

        .mt-message-box h2 {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: var(--space-md);
            font-family: 'Playfair Display', serif;
            color: var(--text-primary);
        }

        .mt-message-box p {
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: var(--space-lg);
            line-height: 1.5;
        }

        /* Loading spinner - reuse dnd-players loader pattern */
        .mt-loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }

        .spinner {
            border: 4px solid var(--border-subtle);
            border-top: 4px solid var(--accent-primary);
            border-radius: 50%;
            width: 48px;
            height: 48px;
            animation: spin 0.8s linear infinite;
        }

        /* Inline edit inputs */
        .mt-inline-input {
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border-default);
            border-radius: var(--radius-sm);
            padding: 2px 4px;
            width: 64px;
            font-family: var(--font-mono);
            font-size: 13px;
        }

        .mt-inline-input:focus {
            outline: none;
            border-color: var(--accent-primary);
        }

        /* Version footer */
        .ver {
            opacity: 0.3;
            text-align: center;
            font-size: 12px;
            color: var(--text-secondary);
            padding: var(--space-lg) 0;
        }

        /* Compact mode overrides */
        body.compact .mt-container {
            max-width: 700px;
            padding: var(--space-xs);
        }

        body.compact .header-title {
            font-size: 18px;
        }

        body.compact .monster-name {
            font-size: 14px;
        }

        body.compact .mt-monster-card {
            padding: var(--space-sm);
        }

        body.compact .mt-modal-form-box {
            padding: var(--space-sm);
        }

        body.compact .encounter-group {
            padding: var(--space-sm);
            margin-bottom: var(--space-sm);
        }

        body.compact .mt-monster-list {
            gap: var(--space-sm);
        }

        body.compact .encounter-monsters {
            gap: var(--space-sm);
        }

        body.compact .health-bar {
            height: 10px;
        }

        body.compact .mt-notes-textarea {
            min-height: 20px;
            max-height: 48px;
            font-size: 12px;
            padding: 2px;
        }

        body.compact .settings-button svg,
        body.compact .remove-button svg {
            width: 20px;
            height: 20px;
        }

        body.compact .initiative-display,
        body.compact .ac-display,
        body.compact .hp-display {
            padding: 1px 4px;
            font-size: 12px;
        }

        body.compact .mt-input,
        body.compact .mt-select {
            padding: 2px 4px;
            font-size: 12px;
        }

        body.compact .mt-input-small {
            width: 56px;
        }

        body.compact .mt-status {
            font-size: 12px;
        }

        /* Character Picker */
        .mt-char-picker {
            background: var(--bg-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-md);
            box-shadow: var(--shadow-md);
            margin-bottom: var(--space-lg);
        }

        .mt-char-picker h2 {
            font-size: 16px;
            font-weight: 600;
            font-family: 'Playfair Display', serif;
            color: var(--text-primary);
            margin-bottom: var(--space-sm);
        }

        .mt-char-picker-row {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-sm);
            align-items: center;
        }

        .mt-char-picker-row select {
            flex: 1;
            min-width: 180px;
        }

        .mt-char-picker-status {
            font-size: 13px;
            color: var(--text-secondary);
            font-style: italic;
            margin-top: var(--space-xs);
            margin-bottom: 0;
        }

        .mt-char-picker-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .mt-char-picker-header h2 {
            margin-bottom: 0;
        }

        /* Add Selector Popup */
        .mt-add-selector {
            position: fixed;
            bottom: 80px;
            right: 20px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            z-index: 50;
        }

        .mt-add-selector-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 20px;
            color: var(--text-primary);
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            white-space: nowrap;
            transition: background var(--transition-fast);
        }

        .mt-add-selector-item:hover {
            background: var(--bg-hover);
        }

        .mt-add-selector-item + .mt-add-selector-item {
            border-top: 1px solid var(--border-subtle);
        }

        .mt-add-selector-item svg {
            opacity: 0.7;
            flex-shrink: 0;
        }