/* ===============================================
   VELUM NOCTIS - D&D Fantasy Game UI Styles
   =============================================== */

/* ===============================================
   INTEGRATED TITLE & LOADING SCREEN
   =============================================== */

/* Wrapper contains title + card */
.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: min(600px, 92vw);
    padding-top: 40px;
}

/* Epic animated title (outside card) */
.game-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(28px, 9vw, 80px);
    font-weight: bold;
    letter-spacing: clamp(0.05em, 1.5vw, 0.15em);
    margin: 0;
    padding: 0 20px;
    text-align: center;
    background: linear-gradient(
        135deg,
        #F2E8C9 0%,
        #C8A46B 25%,
        #8B7355 50%,
        #C8A46B 75%,
        #F2E8C9 100%
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShine 4s ease-in-out infinite, titlePulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(200, 164, 107, 0.4)) drop-shadow(0 4px 8px rgba(0,0,0,0.6));
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    word-wrap: break-word;
}

.game-title::before {
    content: 'VELUM NOCTIS';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0 20px;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(255,255,255,0.3) 45%,
        rgba(255,255,255,0.5) 50%,
        rgba(255,255,255,0.3) 55%,
        transparent 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleSweep 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes titleShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes titleSweep {
    0% { background-position: -200% 0; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { background-position: 200% 0; opacity: 0; }
}

.title-subtitle {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(10px, 2vw, 16px);
    color: #B8B0A6;
    letter-spacing: clamp(0.05em, 1vw, 0.15em);
    margin-bottom: 0;
    padding: 0 20px;
    text-align: center;
    text-transform: uppercase;
    animation: subtitleFade 2s ease-in-out infinite;
    width: 100%;
    max-width: 100%;
}

@keyframes subtitleFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ===============================================
   WINDOW TOGGLE BUTTONS (Bottom-Left)
   =============================================== */

#window-toggles {
    position: fixed;
    top: 16px;
    left: 16px;
    display: flex;
    gap: 12px;
    z-index: 1500;
}

.window-toggle-btn {
    width: 48px;
    height: 48px;
    background: var(--dnd-bg-primary);
    border: 2px solid var(--dnd-border-gold);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px var(--dnd-shadow-deep), inset 0 0 0 1px rgba(255,255,255,0.05);
    backdrop-filter: blur(4px);
}

.window-toggle-btn:hover {
    border-color: var(--dnd-border-gold-bright);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px var(--dnd-shadow-deep), 0 0 20px var(--dnd-glow-gold);
}

.window-toggle-btn.active {
    background: linear-gradient(180deg, rgba(200,164,107,0.2), rgba(169,130,69,0.3));
    border-color: var(--dnd-accent-gold);
}

.window-toggle-icon {
    font-size: 24px;
    line-height: 1;
}

.window-toggle-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.window-toggle-label {
    font-size: 9px;
    color: var(--dnd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.window-toggle-btn:hover .window-toggle-label {
    color: var(--dnd-text-title);
}

@media (max-width: 768px) {
    #window-toggles {
        top: 12px;
        left: 10px;
        gap: 8px;
    }
    
    .window-toggle-btn {
        width: 42px;
        height: 42px;
        border-radius: 8px;
    }
    
    .window-toggle-icon {
        font-size: 20px;
    }
    .window-toggle-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .window-toggle-label {
        font-size: 8px;
    }
}

/* CSS Variables - D&D Theme Colors */
:root {
    --dnd-bg-primary: linear-gradient(180deg, rgba(28,26,30,0.92), rgba(16,16,18,0.95));
    --dnd-bg-secondary: linear-gradient(180deg, rgba(25,23,26,0.88), rgba(12,11,13,0.92));
    --dnd-border-gold: rgba(229, 215, 187, 0.35);
    --dnd-border-gold-bright: rgba(242, 232, 201, 0.6);
    --dnd-text-primary: #E6E2DF;
    --dnd-text-title: #F2E8C9;
    --dnd-text-secondary: #B8B0A6;
    --dnd-text-muted: #8A8278;
    --dnd-accent-gold: #C8A46B;
    --dnd-accent-gold-dark: #A98245;
    --dnd-accent-gold-hover: #D4B077;
    --dnd-shadow-deep: rgba(0,0,0,0.6);
    --dnd-shadow-medium: rgba(0,0,0,0.4);
    --dnd-shadow-light: rgba(0,0,0,0.2);
    --dnd-glow-gold: rgba(200, 164, 107, 0.3);
    --dnd-overlay: rgba(0,0,0,0.75);
}

/* ===============================================
   GEAR BUTTON (Settings Icon)
   =============================================== */

#gear-button {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: var(--dnd-bg-primary);
    border: 2px solid var(--dnd-border-gold);
    border-radius: 8px;
    cursor: pointer;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px var(--dnd-shadow-deep), inset 0 0 0 1px rgba(255,255,255,0.05);
    backdrop-filter: blur(4px);
}

#gear-button:hover {
    border-color: var(--dnd-border-gold-bright);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--dnd-shadow-deep), 0 0 20px var(--dnd-glow-gold);
}

#gear-button svg {
    width: 28px;
    height: 28px;
    fill: var(--dnd-accent-gold);
    transition: transform 0.3s ease;
}

#gear-button:hover svg {
    transform: rotate(45deg);
    fill: var(--dnd-accent-gold-hover);
}

/* ===============================================
   SETTINGS MENU MODAL
   =============================================== */

#settings-overlay {
    position: fixed;
    inset: 0;
    background: var(--dnd-overlay);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

#settings-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#settings-menu {
    width: min(720px, 90vw);
    height: 85vh;
    max-height: 85vh;
    background: var(--dnd-bg-primary);
    border: 2px solid var(--dnd-border-gold);
    border-radius: 16px;
    box-shadow: 0 20px 60px var(--dnd-shadow-deep), inset 0 0 0 1px rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Settings Header */
.settings-header {
    padding: 20px 24px;
    background: linear-gradient(180deg, rgba(40,38,42,0.8), rgba(28,26,30,0.9));
    border-bottom: 1px solid var(--dnd-border-gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 24px;
    color: var(--dnd-text-title);
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px var(--dnd-shadow-medium);
}

.settings-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--dnd-border-gold);
    border-radius: 6px;
    color: var(--dnd-text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: rgba(200, 164, 107, 0.15);
    border-color: var(--dnd-border-gold-bright);
    color: var(--dnd-text-title);
}

/* Tab Navigation */
.settings-tabs {
    display: flex;
    padding: 0 24px;
    background: linear-gradient(180deg, rgba(20,19,22,0.6), rgba(16,15,18,0.8));
    border-bottom: 1px solid var(--dnd-border-gold);
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.settings-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.settings-tab {
    padding: 14px 24px;
    background: transparent;
    border: none;
    color: var(--dnd-text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.settings-tab:hover {
    color: var(--dnd-text-primary);
    background: rgba(255,255,255,0.03);
}

.settings-tab.active {
    color: var(--dnd-text-title);
    background: rgba(200, 164, 107, 0.1);
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--dnd-accent-gold);
    box-shadow: 0 0 8px var(--dnd-glow-gold);
}

/* Tab Content */
.settings-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    min-height: 0;
}

.settings-content::-webkit-scrollbar {
    width: 8px;
}

.settings-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--dnd-accent-gold);
    border-radius: 4px;
}

.settings-content::-webkit-scrollbar-thumb:hover {
    background: var(--dnd-accent-gold-hover);
}

.tab-panel {
    display: none;
    min-height: 100%;
}

.tab-panel.active {
    display: block;
    animation: fadeInContent 0.3s ease;
    min-height: 100%;
}

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

/* Settings Sections */
.settings-section {
    margin-bottom: 28px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    color: var(--dnd-accent-gold);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(229, 215, 187, 0.15);
    letter-spacing: 0.3px;
}

/* Control Row */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.control-row:last-child {
    border-bottom: none;
}

.control-label {
    color: var(--dnd-text-primary);
    font-size: 14px;
    flex: 1;
}

.control-input {
    flex: 0 0 200px;
}

/* Slider Control */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    border: 1px solid rgba(229, 215, 187, 0.2);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--dnd-accent-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--dnd-shadow-medium);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: var(--dnd-accent-gold-hover);
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--dnd-accent-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px var(--dnd-shadow-medium);
}

.slider-value {
    min-width: 45px;
    text-align: right;
    color: var(--dnd-text-secondary);
    font-size: 13px;
    font-family: monospace;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--dnd-text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: var(--dnd-accent-gold-dark);
    border-color: var(--dnd-accent-gold);
}

.toggle-switch.active::after {
    left: 26px;
    background: var(--dnd-accent-gold);
}

/* Dropdown Select */
.select-dropdown {
    padding: 8px 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 6px;
    color: var(--dnd-text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.select-dropdown:hover {
    border-color: var(--dnd-border-gold-bright);
    background: rgba(0,0,0,0.5);
}

.select-dropdown:focus {
    border-color: var(--dnd-accent-gold);
    box-shadow: 0 0 8px var(--dnd-glow-gold);
}

/* Button */
.dnd-button {
    padding: 10px 20px;
    background: linear-gradient(180deg, var(--dnd-accent-gold), var(--dnd-accent-gold-dark));
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #201d1a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px var(--dnd-shadow-medium);
}

.dnd-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--dnd-shadow-deep);
}

.dnd-button:active {
    transform: translateY(0);
}

.dnd-button.secondary {
    background: rgba(255,255,255,0.08);
    color: var(--dnd-text-primary);
    border-color: var(--dnd-border-gold);
}

/* ===============================================
   DRAGGABLE WINDOWS
   =============================================== */

.game-window {
    position: fixed;
    box-sizing: border-box;
    background: var(--dnd-bg-primary);
    border: 2px solid var(--dnd-border-gold);
    border-radius: 12px;
    box-shadow: 0 16px 48px var(--dnd-shadow-deep), inset 0 0 0 1px rgba(255,255,255,0.05);
    display: none;
    flex-direction: column;
    z-index: 1000;
    backdrop-filter: blur(6px);
    overflow: hidden;
}

.game-window.active {
    display: flex;
}

.game-window.focused {
    z-index: 1100;
    border-color: var(--dnd-border-gold-bright);
    box-shadow: 0 20px 60px var(--dnd-shadow-deep), 0 0 30px var(--dnd-glow-gold);
}

/* Window Header */
.window-header {
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(40,38,42,0.9), rgba(28,26,30,0.95));
    border-bottom: 1px solid var(--dnd-border-gold);
    border-radius: 10px 10px 0 0;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    touch-action: none;
}

.window-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18px;
    color: var(--dnd-text-title);
    letter-spacing: 0.4px;
    text-shadow: 0 1px 3px var(--dnd-shadow-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.window-button {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 4px;
    color: var(--dnd-text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.window-button:hover {
    background: rgba(200, 164, 107, 0.15);
    border-color: var(--dnd-border-gold-bright);
    color: var(--dnd-text-title);
}

/* Window Content */
.window-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
    color: var(--dnd-text-primary);
}

.window-content::-webkit-scrollbar {
    width: 8px;
}

.window-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.window-content::-webkit-scrollbar-thumb {
    background: var(--dnd-accent-gold);
    border-radius: 4px;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    z-index: 10;
    touch-action: none;
}

.resize-n { top: 0; left: 0; right: 0; height: 8px; cursor: ns-resize; }
.resize-s { bottom: 0; left: 0; right: 0; height: 8px; cursor: ns-resize; }
.resize-e { right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.resize-w { left: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.resize-ne { top: 0; right: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.resize-nw { top: 0; left: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.resize-se { bottom: 0; right: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.resize-sw { bottom: 0; left: 0; width: 16px; height: 16px; cursor: nesw-resize; }

/* ===============================================
   MAP WINDOW
   =============================================== */





.map-player-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--dnd-accent-gold);
    border: 2px solid var(--dnd-text-title);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px var(--dnd-glow-gold);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.2); }
}

/* ===============================================
   INVENTORY WINDOW
   =============================================== */

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--dnd-border-gold);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.inventory-slot:hover {
    border-color: var(--dnd-border-gold-bright);
    background: rgba(200, 164, 107, 0.1);
    transform: translateY(-2px);
}

.inventory-slot.filled {
    background: rgba(200, 164, 107, 0.08);
}

.inventory-icon {
    font-size: 32px;
    opacity: 0.7;
}

.inventory-slot.filled .inventory-icon {
    opacity: 1;
}

/* Strong visual highlight for the currently selected inventory item */
.inventory-slot.selected {
    border-color: var(--dnd-accent-gold);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.9), 0 0 12px var(--dnd-glow-gold);
    transform: translateY(-2px);
}

.inventory-slot.filled.selected {
    background: rgba(200, 164, 107, 0.16);
}

.inventory-stats {
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 6px;
    font-size: 13px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: var(--dnd-text-secondary);
}

.stat-label {
    color: var(--dnd-text-primary);
}

/* ===============================================
   CHARACTER WINDOW
   =============================================== */

.character-portrait {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    background: radial-gradient(circle, rgba(40,38,42,0.8), rgba(20,19,22,0.9));
    border: 3px solid var(--dnd-border-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: 0 8px 24px var(--dnd-shadow-deep), inset 0 0 20px rgba(0,0,0,0.5);
}

.character-name {
    text-align: center;
    font-family: Georgia, serif;
    font-size: 22px;
    color: var(--dnd-text-title);
    margin-bottom: 8px;
}

.character-level {
    text-align: center;
    color: var(--dnd-accent-gold);
    font-size: 14px;
    margin-bottom: 20px;
}

.character-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 6px;
    text-align: center;
}

.stat-name {
    font-size: 11px;
    color: var(--dnd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--dnd-text-title);
    font-family: Georgia, serif;
}

.progress-bar {
    height: 24px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--dnd-accent-gold-dark), var(--dnd-accent-gold));
    transition: width 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

.progress-fill.health {
    background: linear-gradient(90deg, #8B0000, #DC143C);
}

.progress-fill.mana {
    background: linear-gradient(90deg, #00008B, #4169E1);
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--dnd-text-title);
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 3px var(--dnd-shadow-deep);
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

@media (max-width: 768px) {
    #gear-button {
        width: 42px;
        height: 42px;
        top: 12px;
        right: 12px;
    }
    
    #gear-button svg {
        width: 24px;
        height: 24px;
    }
    
    #settings-menu {
        width: 95vw;
        max-height: 90vh;
    }
    
    .settings-header {
        padding: 16px 18px;
    }
    
    .settings-title {
        font-size: 20px;
    }
    
    .settings-tabs {
        padding: 0 12px;
        overflow-x: auto;
    }
    
    .settings-tab {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .settings-content {
        padding: 16px;
    }
    
    .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .control-input {
        flex: 1;
        width: 100%;
    }
    
    .character-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===============================================
   UTILITY CLASSES
   =============================================== */

.hidden {
    display: none !important;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}
/* Mobile: enlarge resize handle hit areas for better touch usability */
@media (max-width: 768px) {
  /* Increase edge/corner drag target sizes for better touch usability */
  .resize-n, .resize-s { height: 16px; }
  .resize-e, .resize-w { width: 16px; }
  .resize-ne, .resize-nw, .resize-se, .resize-sw { width: 24px; height: 24px; }
}
/* Themed Select for Settings (dark D&amp;D style) */
.select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.select-dropdown.select-themed {
    width: 100%;
    padding: 8px 36px 8px 12px; /* extra right padding for chevron */
    background: linear-gradient(180deg, rgba(28,26,30,0.92), rgba(16,16,18,0.95));
    color: var(--dnd-text-primary);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.select-dropdown.select-themed:hover {
    border-color: var(--dnd-border-gold-bright);
}

.select-dropdown.select-themed:focus {
    border-color: var(--dnd-accent-gold);
    box-shadow: 0 0 8px var(--dnd-glow-gold), inset 0 0 0 1px rgba(255,255,255,0.06);
    outline: none;
}

/* Dark dropdown options (browser support varies) */
.select-dropdown.select-themed option {
    background: rgba(16,16,18,0.98);
    color: var(--dnd-text-primary);
}

/* Chevron icon overlay */
.select-chevron {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}
/* Themed select option states (gold highlight) */
.select-dropdown.select-themed option:hover {
    background: rgba(200, 164, 107, 0.22) !important;
    color: var(--dnd-text-title);
}
.select-dropdown.select-themed option:checked,
.select-dropdown.select-themed option:focus,
.select-dropdown.select-themed option:active {
    background: rgba(200, 164, 107, 0.34) !important;
    color: var(--dnd-text-title);
}
/* Ensure optgroup inherits dark theme */
.select-dropdown.select-themed optgroup {
    background: rgba(16,16,18,0.98);
    color: var(--dnd-text-secondary);
}
/* Custom Select (dark theme, gold highlight) */
.custom-select {
    position: relative;
    width: 100%;
}
.custom-select-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    padding-right: 36px; /* space for chevron */
    background: linear-gradient(180deg, rgba(28,26,30,0.92), rgba(16,16,18,0.95));
    color: var(--dnd-text-primary);
    border: 1px solid var(--dnd-border-gold);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
    cursor: pointer;
    text-align: left;
}
.custom-select-button:hover {
    border-color: var(--dnd-border-gold-bright);
}
.custom-select.open .custom-select-button,
.custom-select-button:focus {
    border-color: var(--dnd-accent-gold);
    box-shadow: 0 0 8px var(--dnd-glow-gold), inset 0 0 0 1px rgba(255,255,255,0.06);
    outline: none;
}
.custom-select-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.custom-select-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}
.custom-select-list {
    display: none;
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: linear-gradient(180deg, rgba(28,26,30,0.98), rgba(16,16,18,0.98));
    border: 1px solid var(--dnd-border-gold);
    border-radius: 10px;
    box-shadow: 0 16px 40px var(--dnd-shadow-deep), 0 0 0 1px rgba(255,255,255,0.04) inset;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}
.custom-select.open .custom-select-list {
    display: block;
}
.custom-select-option {
    padding: 8px 12px;
    color: var(--dnd-text-primary);
    background: transparent;
    cursor: pointer;
    user-select: none;
}
.custom-select-option:hover,
.custom-select-option.hover {
    background: rgba(200, 164, 107, 0.18);
    color: var(--dnd-text-title);
}
.custom-select-option.selected {
    background: rgba(200, 164, 107, 0.28);
    color: var(--dnd-text-title);
}
.custom-select-list::-webkit-scrollbar {
    width: 8px;
}
.custom-select-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}
.custom-select-list::-webkit-scrollbar-thumb {
    background: var(--dnd-accent-gold);
    border-radius: 4px;
}

