/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}



/* Sidebar Styles */
.sidebar {
    width: 350px;
    flex-shrink: 0;
    background: #2d2d2d;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 150;
}



.sidebar-header {
    padding: 20px;
    background: #3d3d3d;
    border-bottom: 1px solid #444;
}

.sidebar-header h2 {
    color: #ffd700;
    font-size: 1.5rem;
    text-align: center;
}

.build-info {
    margin-top: 5px;
    text-align: center;
}

.build-info small {
    color: #888;
    font-size: 0.8rem;
}

.sidebar-section {
    border-bottom: 1px solid #444;
}

/* Collapsible section styles */
.section-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 0;
    background: #3a3a3a;
    border-bottom: 1px solid #444;
    transition: background-color 0.2s ease;
    color: #ffd700;
    font-size: 1.1rem;
}

.section-header:hover {
    background: #4a4a4a;
}

.section-toggle {
    transition: transform 0.2s ease;
    font-size: 0.8em;
    color: #888;
}

.section-header.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section-content {
    padding: 12px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

/* Subsection Styles */
.subsection-header {
    cursor: pointer;
    padding: 8px 0;
    margin: 10px 0 5px 0;
    border-bottom: 1px solid #444;
    transition: background-color 0.2s ease;
}

.subsection-header:hover {
    background: #4a4a4a;
}

.subsection-header h4 {
    color: #ccc;
    margin: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.subsection-toggle {
    transition: transform 0.2s ease;
    font-size: 0.7em;
    color: #888;
}

.subsection-header.collapsed .subsection-toggle {
    transform: rotate(-90deg);
}

.subsection-content {
    padding: 8px 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.subsection-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.sidebar-section h3 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Map Controls */
.map-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.map-buttons .btn {
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
}

/* Map Tabs */
.map-tabs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.map-tab {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-tab:hover {
    background: #3a3a3a;
    border-color: #666;
}

.map-tab.active {
    border-color: #4CAF50;
    background: #1a3a1a;
}

.map-tab.viewing {
    border-color: #2196F3;
    background: #1a2a3a;
}

.map-tab.active.viewing {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #1a3a1a 0%, #1a2a3a 100%);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.map-tab-name {
    font-weight: 500;
    color: #fff;
}

.map-tab-actions {
    display: flex;
    gap: 5px;
}

.map-tab-actions button {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.map-tab-actions button:hover {
    background: #444;
    color: #fff;
}

.map-tab-actions button.active-btn {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.map-tab-actions button.active-btn:hover {
    background: rgba(76, 175, 80, 0.3);
}

/* Tool Controls */
.tool-group {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #555;
    background: #3d3d3d;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #4d4d4d;
    border-color: #666;
}

.tool-btn.active {
    background: #007bff;
    border-color: #0056b3;
    color: white;
}

/* Color and Size Controls */
.color-controls, .size-controls {
    margin-bottom: 8px;
}

.color-controls label, .size-controls label {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    color: #ccc;
}

.color-controls input[type="color"] {
    width: 100%;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.color-controls input[type="range"], .size-controls input[type="range"] {
    width: 100%;
    margin-bottom: 3px;
}

.color-controls span, .size-controls span {
    font-size: 12px;
    color: #ccc;
    float: right;
    margin-top: -20px;
    margin-bottom: 5px;
}

/* Layer List */
.layer-list {
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 4px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-item:hover {
    background: #4d4d4d;
}

.layer-item.selected {
    background: #007bff;
    border-color: #0056b3;
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.layer-visibility {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
}

.layer-visibility:hover {
    color: white;
}

.layer-measurements,
.layer-grid {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
}

.layer-measurements:hover,
.layer-grid:hover {
    color: white;
}

.layer-actions {
    display: flex;
    gap: 4px;
}

.layer-actions button {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
}

.layer-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Layer Drag and Drop Styles */
.layer-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #888;
    cursor: grab;
    margin-right: 8px;
    user-select: none;
}

.layer-drag-handle:hover {
    color: #ccc;
}

.layer-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    z-index: 1000;
}

.layer-item.drag-over {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.layer-item.drag-placeholder {
    background: rgba(0, 123, 255, 0.2);
    border: 2px dashed #007bff;
    opacity: 0.7;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-content {
    color: #007bff;
    font-style: italic;
}

/* Players Management */
.players-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.initiative-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.initiative-controls .btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
}

.combat-controls {
    margin: 15px 0;
    text-align: center;
}

.combat-controls .btn {
    width: 100%;
    margin-bottom: 10px;
}

.add-player-form {
    background: #3d3d3d;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #555;
}

.add-player-form .form-group {
    margin-bottom: 10px;
}

.add-player-form label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
    font-size: 0.9rem;
}

.add-player-form input[type="text"] {
    width: 100%;
    padding: 8px;
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
}

.add-player-form input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
}

.add-player-form input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.add-player-form span {
    font-size: 12px;
    color: #ccc;
}

.players-list {
    max-height: 500px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.player-item:hover {
    background: #4d4d4d;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.player-name {
    font-weight: 500;
    color: #fff;
}

.player-orientation {
    font-size: 0.8rem;
    color: #ccc;
    background: #2d2d2d;
    padding: 2px 6px;
    border-radius: 3px;
}

.player-actions {
    display: flex;
    gap: 4px;
}

.player-actions button {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.player-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.player-actions .edit-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.player-actions .delete-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.player-item.active {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.5);
}

.player-item.next {
    border-color: rgba(255, 193, 7, 0.5);
}

.player-initiative {
    width: 40px;
    padding: 2px 4px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #2d2d2d;
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.player-initiative:focus {
    outline: none;
    border-color: #007bff;
    background: #3d3d3d;
}

/* Remove spinner buttons from number inputs */
.player-initiative::-webkit-outer-spin-button,
.player-initiative::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.player-initiative[type=number] {
    -moz-appearance: textfield;
}

/* Player Names Overlay */
.player-names-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
}

.player-name-tag {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.3s ease;
}

.player-name-tag:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.player-name-tag.active {
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    border-color: rgba(255, 193, 7, 1);
    font-weight: bold;
}

.player-name-tag.next {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-color: rgba(255, 193, 7, 1);
    font-weight: bold;
}

/* Border-specific player name tag styles - now handled by JavaScript transform */
.player-name-tag.border-top,
.player-name-tag.border-bottom,
.player-name-tag.border-left,
.player-name-tag.border-right {
    /* Transform is now handled dynamically in JavaScript */
}



/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}



.canvas-container {
    flex: 1;
    position: relative;
    background: #1a1a1a;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

canvas {
    display: block;
    background: #2d2d2d;
}

/* Canvas Overlay */
.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: auto;
}

.fog-controls-overlay {
    position: absolute;
    top: 20px;
    right: 80px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: auto;
}

.fog-btn {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    color: white;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fog-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #666;
}

.fog-btn.active {
    background: #007bff;
    border-color: #0056b3;
    color: white;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    color: white;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #666;
}

.status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.status-bar span {
    font-size: 14px;
    color: #ccc;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #2d2d2d;
    margin: 2% auto;
    padding: 0;
    border: 1px solid #555;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #ffd700;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #555;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3d3d3d;
    color: white;
    font-size: 14px;
}

 .form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.form-group span {
    font-size: 12px;
    color: #ccc;
    float: right;
    margin-top: -20px;
    margin-bottom: 5px;
}

/* Token Vault Modal Styles */
.token-search-section,
.token-upload-section {
    margin-bottom: 20px;
}

.token-search-section h4,
.token-upload-section h4 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2d2d2d;
    margin-top: 10px;
}

/* Clipboard Paste Styles */
.clipboard-paste-section {
    margin-bottom: 20px;
}

.clipboard-paste-section h5 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clipboard-paste-area {
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #2d2d2d;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clipboard-paste-area:hover {
    border-color: #007bff;
    background: #3a3a3a;
}

.clipboard-paste-area.paste-ready {
    border-color: #28a745;
    background: #2a3a2a;
}

.clipboard-paste-area.paste-ready:hover {
    border-color: #28a745;
    background: #3a4a3a;
}

.clipboard-paste-area:focus {
    outline: none;
    border-color: #007bff;
    background: #3a3a3a;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.paste-placeholder {
    color: #888;
}

.paste-placeholder i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.paste-placeholder p {
    margin: 0;
    font-size: 0.9rem;
}

.clipboard-preview {
    margin-top: 15px;
    text-align: center;
}

.clipboard-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    border: 1px solid #555;
}

.upload-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.upload-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #555;
}

.upload-separator span {
    background: #2d2d2d;
    padding: 0 15px;
    color: #888;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.token-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.token-result-item:hover {
    background: #3d3d3d;
}

.token-result-item:last-child {
    border-bottom: none;
}

.token-result-item.selected {
    background: #007bff;
    color: white;
}

.token-result-preview {
    width: 40px;
    height: 40px;
    border: 1px solid #555;
    border-radius: 4px;
    margin-right: 10px;
    object-fit: cover;
    background: #1a1a1a;
}

.token-result-info {
    flex: 1;
}

.token-result-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.token-result-meta {
    font-size: 0.8rem;
    color: #888;
}

.token-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.token-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #555;
}

.token-separator span {
    background: #2d2d2d;
    padding: 0 15px;
    color: #888;
    font-size: 0.9rem;
}

/* Map Vault Modal Styles */
.map-search-section,
.map-upload-section {
    margin-bottom: 20px;
}

.map-search-section h4,
.map-upload-section h4 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2d2d2d;
    margin-top: 10px;
}

.map-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-result-item:hover {
    background: #3d3d3d;
}

.map-result-item:last-child {
    border-bottom: none;
}

.map-result-item.selected {
    background: #007bff;
    color: white;
}

.map-result-preview {
    width: 60px;
    height: 40px;
    border: 1px solid #555;
    border-radius: 4px;
    margin-right: 10px;
    object-fit: cover;
    background: #1a1a1a;
}

.map-result-info {
    flex: 1;
}

.map-result-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.map-result-meta {
    font-size: 0.8rem;
    color: #888;
}

.map-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.map-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #555;
}

.map-separator span {
    background: #2d2d2d;
    padding: 0 15px;
    color: #888;
    font-size: 0.9rem;
}

/* Custom Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ccc;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #555;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
    background: #2d2d2d;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #007bff;
    border-color: #007bff;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label:hover .checkmark {
    border-color: #007bff;
}

/* Custom Radio Button Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ccc;
}

.radio-label input[type="radio"] {
    display: none;
}

.radiomark {
    width: 18px;
    height: 18px;
    border: 2px solid #555;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    background: #3d3d3d;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radiomark {
    background: #007bff;
    border-color: #007bff;
}

.radio-label input[type="radio"]:checked + .radiomark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.radio-label:hover .radiomark {
    border-color: #007bff;
}

/* Player View Styles */
.player-view {
    background: #1a1a1a;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.player-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

.player-container .canvas-container {
    flex: 1;
    position: relative;
    background: #1a1a1a;
    overflow: hidden;
}

.player-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #2d2d2d;
}

/* Loading and No Map Screens */
.loading-screen, .no-map-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content, .no-map-content {
    text-align: center;
    color: #ccc;
}

.loading-content i, .no-map-content i {
    font-size: 3rem;
    color: #ffd700;
    margin-bottom: 20px;
}

.loading-content h2, .no-map-content h2 {
    color: #ffd700;
    margin-bottom: 10px;
}

.loading-content p, .no-map-content p {
    color: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.p-10 {
    padding: 10px;
} 

/* Fog of War Controls */
.fog-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fog-tool-group {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.fog-tool-group .tool-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #555;
    background: #3d3d3d;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fog-tool-group .tool-btn:hover {
    background: #4d4d4d;
    border-color: #666;
}

.fog-tool-group .tool-btn.active {
    background: #007bff;
    border-color: #0056b3;
    color: white;
}

.fog-opacity-controls, .fog-size-controls {
    margin-bottom: 8px;
}

.fog-opacity-controls label, .fog-size-controls label {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    color: #ccc;
}

.fog-opacity-controls input[type="range"], .fog-size-controls input[type="range"] {
    width: 100%;
    margin-bottom: 3px;
}

.fog-opacity-controls span, .fog-size-controls span {
    font-size: 12px;
    color: #ccc;
    float: right;
    margin-top: -20px;
    margin-bottom: 5px;
}

.fog-brush-controls {
    margin-top: 10px;
}

.fog-brush-controls label {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    color: #ccc;
}

.fog-brush-controls input[type="range"] {
    width: 100%;
    margin-bottom: 3px;
}

.fog-brush-controls span {
    font-size: 12px;
    color: #ccc;
    float: right;
    margin-top: -20px;
    margin-bottom: 5px;
}

/* Player View Controls */
.player-view-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.view-controls {
    margin-bottom: 8px;
}

.view-controls label {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    color: #ccc;
}

.view-controls input[type="range"] {
    width: 100%;
    margin-bottom: 3px;
}

.view-controls span {
    font-size: 12px;
    color: #ccc;
    float: right;
    margin-top: -20px;
    margin-bottom: 5px;
}

.view-buttons {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.view-buttons .btn {
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
}

/* Battlegrid Controls */
.battlegrid-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Adventure Selection Styles */
.adventure-selection-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 20px;
}

.adventure-header {
    text-align: center;
    margin-bottom: 40px;
}

.adventure-header h1 {
    color: #ffd700;
    font-size: 3rem;
    margin-bottom: 10px;
}

.adventure-header p {
    color: #ccc;
    font-size: 1.2rem;
}

.adventure-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.adventure-section {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 30px;
    border: 1px solid #444;
}

.adventure-section h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.adventure-list {
    max-height: 500px;
    overflow-y: auto;
}

.adventure-item {
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.adventure-item:hover {
    background: #4d4d4d;
    border-color: #666;
}

.adventure-info {
    margin-bottom: 15px;
}

.adventure-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.adventure-header h3 {
    color: #fff;
    font-size: 1.2rem;
    margin: 0;
}

.adventure-header i {
    color: #ffd700;
    font-size: 1.1rem;
}

.adventure-description {
    color: #ccc;
    margin-bottom: 10px;
    font-style: italic;
}

.adventure-meta {
    color: #888;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.adventure-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.adventure-actions .btn {
    flex: 1;
    min-width: 80px;
}

.no-adventures {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

.no-adventures i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #555;
}

.loading-message {
    text-align: center;
    color: #888;
    padding: 20px;
}

.loading-message i {
    margin-right: 10px;
}

.create-adventure-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.create-adventure-form .form-group {
    margin-bottom: 0;
}

.create-adventure-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3d3d3d;
    color: white;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.create-adventure-form textarea:focus {
    outline: none;
    border-color: #007bff;
}

.create-adventure-form small {
    color: #888;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

/* JSON Download Section */
.json-download-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.download-description {
    color: #ccc;
    font-style: italic;
    margin-bottom: 15px;
    text-align: center;
}

.download-item {
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 20px;
    transition: all 0.2s ease;
}

.download-item:hover {
    border-color: #666;
}

.download-item h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.download-status.success {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.5);
    color: #28a745;
}

.download-status.error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: #dc3545;
}

.download-status.loading {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #ffc107;
}

/* SRD 5e Controls */
.srd-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.srd-controls .btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
}

/* Spell and Monster Search Results */
.spell-search-results,
.monster-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2d2d2d;
    margin-top: 10px;
}

.spell-result-item,
.monster-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spell-result-item:hover,
.monster-result-item:hover {
    background: #3d3d3d;
}

.spell-result-item:last-child,
.monster-result-item:last-child {
    border-bottom: none;
}

.spell-result-item.selected,
.monster-result-item.selected {
    background: #007bff;
    color: white;
}

.spell-result-info,
.monster-result-info {
    flex: 1;
}

.spell-result-name,
.monster-result-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.spell-result-meta,
.monster-result-meta {
    font-size: 0.8rem;
    color: #888;
}

/* Spell and Monster Details Tables */
.spell-details-section,
.monster-details-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #555;
}

.spell-details-table,
.monster-details-table {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2d2d2d;
}

.spell-details-table table,
.monster-details-table table {
    width: 100%;
    border-collapse: collapse;
}

.spell-details-table th,
.spell-details-table td,
.monster-details-table th,
.monster-details-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.spell-details-table th,
.monster-details-table th {
    background: #3d3d3d;
    font-weight: 500;
    color: #ffd700;
}

.spell-details-table tr:hover,
.monster-details-table tr:hover {
    background: #3d3d3d;
}

/* Sticky Windows Container */
.sticky-windows-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 150;
}

/* Sticky Window */
.sticky-window {
    position: absolute;
    background: #2d2d2d;
    border: 2px solid #ffd700;
    border-radius: 8px;
    min-width: 300px;
    max-width: 500px;
    max-height: 600px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    pointer-events: auto;
    z-index: 160;
}

.sticky-window-header {
    background: #3d3d3d;
    padding: 10px 15px;
    border-bottom: 1px solid #555;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticky-window-title {
    color: #ffd700;
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    flex: 1;
}

.sticky-window-controls {
    display: flex;
    gap: 5px;
}

.sticky-window-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.sticky-window-btn:hover {
    background: #555;
    color: #fff;
}

.sticky-window-btn.close-btn:hover {
    background: #d32f2f;
}

.sticky-window-content {
    padding: 15px;
    max-height: 500px;
    overflow-y: auto;
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
}

.sticky-window-content h4 {
    color: #ffd700;
    margin: 0 0 10px 0;
    font-size: 13px;
}

.sticky-window-content p {
    margin: 5px 0;
}

.abilities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.abilities-grid div {
    background: #1a1a1a;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.sticky-window-content .meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background: #3d3d3d;
    border-radius: 4px;
}

.sticky-window-content .meta-info span {
    background: #555;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* Spell Overlay for Player Screen */
.spell-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    pointer-events: auto;
}

.spell-overlay-content {
    background: #2d2d2d;
    border: 2px solid #ffd700;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    width: 600px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.spell-overlay-header {
    background: #3d3d3d;
    padding: 20px;
    border-bottom: 1px solid #555;
}

.spell-overlay-header h3 {
    color: #ffd700;
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spell-overlay-meta {
    color: #ccc;
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.spell-overlay-meta span {
    background: #2d2d2d;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #555;
}

.spell-overlay-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    color: #fff;
    line-height: 1.6;
}

.spell-overlay-body h4 {
    color: #ffd700;
    margin: 15px 0 8px 0;
    font-size: 1.1rem;
}

.spell-overlay-body p {
    margin: 8px 0;
}

.spell-overlay-body ul {
    margin: 8px 0;
    padding-left: 20px;
}

.spell-overlay-body li {
    margin: 4px 0;
}

/* Responsive Design for Adventure Selection */
@media (max-width: 768px) {
    .adventure-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .adventure-header h1 {
        font-size: 2rem;
    }
    
    .adventure-actions {
        flex-direction: column;
    }
    
    .adventure-actions .btn {
        flex: none;
    }
}