/* Font Variables */
:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --gen-font-display: var(--font-display);
  --gen-panel: rgba(7, 9, 20, 0.96);
  --gen-panel-deep: rgba(10, 4, 24, 0.98);
  --gen-accent: #c77dff;
  --gen-accent-strong: #9d4edd;
  --gen-accent-soft: rgba(199, 125, 255, 0.28);
  --gen-text: rgba(245, 248, 255, 0.96);
  --gen-text-muted: rgba(160, 170, 200, 0.86);
}

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

[hidden] { display: none !important; }

html {
    -webkit-tap-highlight-color: transparent;
}

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid rgba(199, 125, 255, 0.6);
    outline-offset: 2px;
}

body { 
    font-family: var(--font-primary); 
    background: linear-gradient(135deg, #1a0029 0%, #2d1b4e 50%, #0a0015 100%); 
    height: 100vh; 
    overflow: hidden; 
    position: relative; 
    color: white;
}

/* Background */
.bg { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-size: cover; 
    background-position: center; 
    z-index: -1; 
    transition: all 0.5s ease; 
}

/* Sidebar */
.sidebar { 
    position: fixed; 
    left: -400px; 
    top: 0; 
    width: 400px; 
    height: 100vh; 
    background: rgba(16, 0, 32, 0.95); 
    backdrop-filter: blur(15px); 
    border-right: 1px solid rgba(199, 125, 255, 0.2);
    transition: left 0.3s ease; 
    z-index: 1000; 
    padding: 20px; 
    overflow-y: auto; 
}

.sidebar.open { 
    left: 0; 
}

.sidebar-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1002;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}



/* Control Buttons */
.home-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: transparent;
    backdrop-filter: none;
    border: none;
    color: white;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.home-btn:hover {
    background: transparent;
    transform: translateY(-2px);
    color: #c77dff;
}

.toggle { 
    position: fixed; 
    top: 20px; 
    left: 20px; 
    background: rgba(255,255,255,0.2); 
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(255,255,255,0.3); 
    color: white; 
    padding: 12px 16px; 
    border-radius: 12px; 
    cursor: pointer; 
    z-index: 1001; 
    transition: all 0.3s ease;
}

.toggle:hover { 
    background: rgba(255,255,255,0.3); 
    transform: translateY(-2px); 
}

/* Hide toggle and snap buttons when sidebar is open */
.sidebar.open ~ .toggle,
.sidebar.open ~ .snap-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

/* Snap toggle button - Updated for consistency */
.snap-toggle {
    position: fixed;
    top: 80px;
    left: 20px;
    background: rgba(0, 212, 255, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    font-size: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.snap-toggle:hover {
    background: rgba(0, 212, 255, 1);
    transform: scale(1.1);
}

.snap-toggle.disabled {
    background: rgba(150, 150, 150, 0.7);
    color: #999;
}

.wallet-btn { 
    position: fixed; 
    top: 20px; 
    right: 20px; 
    background: rgba(255,255,255,0.9); 
    backdrop-filter: blur(10px); 
    color: #333; 
    border: 1px solid rgba(255,255,255,0.3); 
    padding: 12px 20px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: bold; 
    z-index: 1001; 
    transition: all 0.3s ease; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
}

.wallet-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(0,0,0,0.3); 
    background: rgba(255,255,255,0.95); 
}

.wallet-btn.connected { 
    background: rgba(0,255,136,0.9); 
    color: white; 
    border-color: rgba(0,255,136,0.3); 
}

.save-btn { 
    position: fixed; 
    bottom: 20px; 
    right: 140px; 
    background: linear-gradient(135deg, #00d4ff, #0099cc); 
    color: white; 
    border: none; 
    padding: 12px 20px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: bold; 
    z-index: 1001; 
    transition: all 0.3s ease; 
}

.save-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 15px rgba(0,212,255,0.4); 
}

.save-btn.saved-state {
    background: linear-gradient(135deg, #00ff88, #00cc6a) !important;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.save-btn.saved-state:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 255, 136, 0.4);
}

.publish-btn { 
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    background: linear-gradient(135deg, #00ff88, #00cc6a); 
    color: white; 
    border: none; 
    padding: 12px 20px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: bold; 
    z-index: 1001; 
    transition: all 0.3s ease; 
}

.publish-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 15px rgba(0,255,136,0.4); 
}

/* Sidebar Content */
.section { 
    margin-bottom: 30px; 
}

.section h3 { 
    color: white; 
    font-family: var(--font-display);
    margin-bottom: 15px; 
    font-size: 18px; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: -0.01em;
}

.item { 
    background: rgba(255,255,255,0.1); 
    border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 10px; 
    padding: 15px; 
    margin-bottom: 10px; 
    cursor: grab; 
    color: white; 
    font-family: var(--font-display);
    font-weight: 700;
    transition: all 0.3s ease; 
    text-align: center; 
}

.item:hover { 
    background: rgba(255,255,255,0.2); 
    transform: translateY(-2px); 
}

/* Main Canvas */
.canvas { 
    position: relative; 
    width: 100%; 
    height: 100vh; 
    overflow: hidden; 
}

/* Widgets */
.widget { 
    position: absolute; 
    border: 2px solid #00d4ff; 
    border-radius: 15px; 
    min-width: 300px; 
    min-height: 200px; 
    backdrop-filter: blur(15px); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    resize: none; /* Disable default resize - we use custom handles */
    overflow: hidden; /* Remove scrollbars */
    background: rgba(255,255,255,0.1);
    -webkit-user-drag: none; /* Prevent dragging */
    user-select: none; /* Prevent text selection during drag */
    pointer-events: none; /* Prevent widget body from being interactive for dragging */
}

/* ENHANCED VIDEO WIDGET FIXES - MAINTAINS 16:9 ASPECT RATIO */
.widget[data-type="youtube"],
.widget[data-type="video"] {
    aspect-ratio: 16/9 !important;
    min-width: 320px;
    min-height: 180px;
    max-height: 80vh;
    overflow: hidden;
    resize: none !important; /* Disable resize handles to prevent aspect ratio breaking */
    background: transparent !important;
    border: 2px solid #00d4ff;
}

/* Force 16:9 aspect ratio when resizing */
.widget[data-type="youtube"]:resize,
.widget[data-type="video"]:resize {
    aspect-ratio: 16/9 !important;
}

/* Video widget content fills entire container */
.widget[data-type="youtube"] .content,
.widget[data-type="video"] .content {
    height: 100%;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: transparent !important;
}

/* Ensure iframes and videos maintain aspect ratio */
.widget[data-type="youtube"] iframe,
.widget[data-type="video"] video {
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 0;
    flex: 1;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: transparent !important;
}

/* Video loaded state - remove any red background */
.widget[data-type="youtube"].video-loaded,
.widget[data-type="video"].video-loaded {
    background: transparent !important;
    aspect-ratio: 16/9 !important;
}

.widget[data-type="youtube"].video-loaded .content,
.widget[data-type="video"].video-loaded .content {
    background: transparent !important;
    height: 100%;
    padding: 0;
}

.widget[data-type="youtube"].video-loaded iframe,
.widget[data-type="video"].video-loaded video {
    background: transparent !important;
    border-color: transparent !important;
}

.header { 
    background: linear-gradient(135deg, #00d4ff, #0099cc); 
    color: white; 
    padding: 10px 15px; 
    border-radius: 13px 13px 0 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-weight: bold; 
    cursor: move !important;
}

.header:hover {
    cursor: move !important;
}

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

.style-btn { 
    background: rgba(255,255,255,0.2); 
    border: none; 
    color: white; 
    width: 25px; 
    height: 25px; 
    border-radius: 50%; 
    cursor: pointer; 
    font-size: 12px; 
}

.style-btn:hover { 
    background: rgba(255,255,255,0.3); 
}

.close { 
    background: rgba(255, 255, 255, 0.2); 
    border: none; 
    color: rgb(255, 255, 255); 
    width: 25px; 
    height: 25px; 
    border-radius: 50%; 
    cursor: pointer; 
}

.content { 
    padding: 0; 
    height: calc(100% - 45px); 
    overflow: hidden; /* Remove scrollbars from content */
    color: white; 
    position: relative;
    pointer-events: auto; /* Ensure content can be interacted with */
    user-select: none; /* Prevent text selection during drag */
}

/* Allow interaction with form elements and content */
.content input, .content button, .content textarea, .content select, .content iframe, .content video {
    user-select: auto;
    pointer-events: auto !important;
    -webkit-user-drag: none;
}

/* Ensure content is interactive */
.content {
    pointer-events: auto !important;
}

/* Ensure all interactive elements work */
.content .input, .content .btn, .content .youtube-load-btn, .content .video-upload-btn {
    pointer-events: auto !important;
    user-select: auto;
}

/* But prevent the content from being draggable */
.content * {
    -webkit-user-drag: none;
}

.style-panel.show { 
    display: block; 
}

.style-group { 
    margin-bottom: 15px; 
}

.style-group label { 
    display: block; 
    color: white; 
    margin-bottom: 5px; 
    font-size: 12px; 
}

.style-slider { 
    width: 100%; 
    margin-bottom: 5px; 
}

.style-color { 
    width: 40px; 
    height: 25px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
}

.style-row { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}

/* Form Elements */
.input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #00d4ff; 
    border-radius: 5px; 
    background: rgba(255,255,255,0.1); 
    color: white; 
    margin-bottom: 10px; 
}

.input::placeholder { 
    color: rgba(255,255,255,0.7); 
}

.btn { 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    width: 100%; 
    margin-bottom: 10px; 
    transition: all 0.3s ease; 
}

.btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3); 
}

/* YouTube Load Button - More Visible */
.youtube-load-btn {
    background: linear-gradient(135deg, #ff4757, #ff3742) !important;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.youtube-load-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 71, 87, 0.4);
    background: linear-gradient(135deg, #ff3742, #ff2f3a) !important;
}

/* Crypto Widget Content */
.crypto-content {
    text-align: center;
    padding: 15px;
    background: transparent;
    height: 100%;
}

/* Simple Tip Widget */
.simple-tip-widget {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    color: #333;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tip-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    text-align: center;
    font-weight: 600;
}

.tip-amounts {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.tip-amount-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #495057;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 60px;
}

.tip-amount-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.tip-amount-btn.selected {
    background: #00d4ff;
    border-color: #00d4ff;
    color: white;
    transform: scale(1.05);
}

.tip-message {
    position: relative;
}

.tip-message textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    height: 80px;
    font-family: inherit;
    background: white;
    color: #333;
}

.tip-message textarea:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border-radius: 4px;
}

.send-tip-btn {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.send-tip-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00cc6a, #00b85c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.send-tip-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tip-result {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 10px;
}

.tip-result.success {
    background: rgba(0, 255, 136, 0.1);
    color: #00cc6a;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.tip-result.error {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

/* Social Widgets */
.social { 
    background: rgba(255,255,255,0.95); 
    border-radius: 10px; 
    padding: 0; 
    height: 100%; 
    overflow-y: auto; /* Keep scrollbar for social widgets */
    color: #333; 
}

/* Style Panel */
.style-panel { 
    position: absolute; 
    top: 45px; 
    right: 10px; 
    background: rgba(0,0,0,0.9); 
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 10px; 
    padding: 15px; 
    min-width: 250px; 
    z-index: 1002; 
    display: none; 
}

.style-panel.show { 
    display: block; 
}

.style-group { 
    margin-bottom: 15px; 
}

.style-group label { 
    display: block; 
    color: white; 
    margin-bottom: 5px; 
    font-size: 12px; 
}

.style-slider { 
    width: 100%; 
    margin-bottom: 5px; 
}

.style-color { 
    width: 40px; 
    height: 25px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
}

.style-row { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}

/* Floating controls for clean mode */
.floating-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
    gap: 5px;
    z-index: 1003;
}

.widget.clean-mode:hover .floating-controls {
    display: flex;
}

.floating-btn {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.floating-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* CLEAN MODE WITH 16:9 ASPECT RATIO */
.widget.clean-mode {
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding-top: 0;
}

.widget.clean-mode[data-type="youtube"],
.widget.clean-mode[data-type="video"] {
    aspect-ratio: 16/9 !important;
    background: transparent !important;
    border: none;
    box-shadow: none;
    padding: 0;
}

.widget.clean-mode .header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    margin-bottom: 5px;
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 10;
    width: auto;
    min-width: 80px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.widget.clean-mode .header-controls {
    gap: 5px;
}

.widget.clean-mode .style-btn,
.widget.clean-mode .close,
.widget.clean-mode .clean-toggle {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

.widget.clean-mode .content {
    padding: 0;
    background: transparent;
    height: 100%;
}

.widget.clean-mode .social {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
    height: 100%;
}

.widget.clean-mode .crypto-donation {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    height: 100%;
}

/* Video widgets in clean mode with perfect 16:9 */
.widget.clean-mode.video-loaded {
    padding: 0;
    aspect-ratio: 16/9 !important;
    background: transparent !important;
}

.widget.clean-mode.video-loaded .header {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    background: rgba(0, 0, 0, 0.8);
}

.widget.clean-mode.video-loaded .content {
    height: 100%;
    padding: 0;
    background: transparent !important;
}

.widget.clean-mode.video-loaded iframe,
.widget.clean-mode.video-loaded video {
    height: 100%;
    border-radius: 8px;
    aspect-ratio: 16/9 !important;
    background: transparent !important;
}

/* Toggle for clean mode */
.clean-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}

/* MAIN VIDEO/IFRAME RULES WITH 16:9 ENFORCEMENT */
iframe, video { 
    width: 100% !important; 
    height: 100% !important; 
    min-height: 180px;
    border: none; 
    border-radius: 8px; 
    aspect-ratio: 16/9 !important;
    object-fit: cover;
    background: transparent !important;
}

/* Video loaded content adjustments */
.video-loaded .content {
    padding: 0;
    background: transparent !important;
}

.video-loaded iframe,
.video-loaded video {
    height: calc(100% - 45px);
    border-radius: 0 0 13px 13px;
    aspect-ratio: 16/9 !important;
    background: transparent !important;
}

/* Clean mode video loaded content */
.widget.clean-mode.video-loaded .content {
    height: 100%;
}

.widget.clean-mode.video-loaded iframe,
.widget.clean-mode.video-loaded video {
    height: 100%;
    border-radius: 8px;
}

/* File Upload */
.file-upload { 
    position: relative; 
    width: 100%; 
    margin-bottom: 10px; 
}

.file-upload input { 
    position: absolute; 
    opacity: 0; 
    width: 100%; 
    height: 100%; 
    cursor: pointer; 
}

.file-btn { 
    background: linear-gradient(135deg, #00d4ff, #0099cc); 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    width: 100%; 
    text-align: center; 
    display: block; 
}

/* Video Upload Section - Centered */
.video-upload-section {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 150px;
    padding: 20px;
}

.centered-upload {
    max-width: 200px;
    margin: 0 auto;
}

.video-upload-btn {
    background: linear-gradient(135deg, #00ff88, #00cc6a) !important;
    color: white !important;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    display: block;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.video-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 255, 136, 0.4);
    background: linear-gradient(135deg, #00cc6a, #00b85c) !important;
}

/* Background Presets - SIMPLIFIED */
.background-section {
    margin-bottom: 30px;
}

.background-upload {
    margin-bottom: 20px;
}

.presets { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    margin-top: 10px; 
}

.preset { 
    height: 60px; 
    border-radius: 8px; 
    cursor: pointer; 
    border: 2px solid transparent; 
    transition: all 0.3s ease; 
}

.preset:hover { 
    border-color: #00d4ff; 
    transform: scale(1.05); 
}

/* Enhanced Background Controls */
.bg-type-selector {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 3px;
}

.bg-type-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.bg-type-btn.active {
    background: #00d4ff;
    color: white;
    font-weight: 600;
}

.bg-type-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.bg-options {
    margin-bottom: 20px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.color-picker-wrapper input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.color-picker-wrapper label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

.gradient-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gradient-direction {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gradient-direction label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

.gradient-direction select {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
}

.gradient-direction select option {
    background: #1a1a1a;
    color: white;
}

.presets-section h4 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 10px;
    margin-top: 0;
}

.radial-position, .radial-size, .image-resize, .image-position, .image-repeat {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.radial-position label, .radial-size label, 
.image-resize label, .image-position label, .image-repeat label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 60px;
}

.radial-position select, .radial-size select,
.image-resize select, .image-position select, .image-repeat select {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
}

.radial-position select option, .radial-size select option,
.image-resize select option, .image-position select option, .image-repeat select option {
    background: #1a1a1a;
    color: white;
}

.image-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Video Controls */
.video-overlay { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    background: rgba(0,0,0,0.7); 
    border: none; 
    color: white; 
    width: 30px; 
    height: 30px; 
    border-radius: 50%; 
    cursor: pointer; 
    font-size: 18px; 
    display: none; 
    z-index: 10; 
}

.video-loaded .video-overlay { 
    display: block; 
}

.video-loaded .upload-section { 
    display: none; 
}

/* Success Messages */
.success { 
    background: rgba(0,255,136,0.2); 
    border: 1px solid #00ff88; 
    color: #00ff88; 
    padding: 10px; 
    border-radius: 8px; 
    margin-top: 10px; 
    text-align: center; 
}

/* Loading States */
.loading { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
    color: #666; 
}

.spinner { 
    width: 20px; 
    height: 20px; 
    border: 2px solid #f3f3f3; 
    border-top: 2px solid #1da1f2; 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
    margin-right: 10px; 
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* Glow Effect */
.glow { 
    animation: glow 2s ease-in-out infinite alternate; 
}

@keyframes glow { 
    from { box-shadow: 0 0 0px rgba(0,212,255,0.5); } 
    to { box-shadow: 0 0 0px rgba(0,212,255,0.8); } 
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .widget {
        min-width: 250px;
        min-height: 150px;
    }
    
    .widget[data-type="youtube"],
    .widget[data-type="video"] {
        min-width: 280px;
        min-height: 158px; /* 280 * 9/16 = 157.5 */
        aspect-ratio: 16/9 !important;
    }
    
    .toggle, .wallet-btn, .save-btn, .snap-toggle {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Widget Wrapper and Header (for external header controls) */
.widget-wrapper {
    position: absolute;
    display: inline-block;
    -webkit-user-drag: none; /* Prevent dragging */
    user-select: none; /* Prevent text selection during drag */
}

.widget-header {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    border-radius: 15px 15px 0 0;
    padding: 8px 12px;
    color: #fff;
    box-sizing: border-box;
    gap: 12px;
    cursor: move !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-height: 40px;
    border: 2px solid #0099cc;
    border-bottom: none;
    pointer-events: auto; /* Ensure header is interactive for dragging */
    -webkit-user-drag: none; /* Prevent native drag */
}

.widget-header:hover {
    cursor: move !important;
}

.widget-header * {
    cursor: move;
}

/* Layer and Snap Toggle Buttons */
.snap-toggle, .layer-toggle {
    position: fixed;
    left: 20px;
    background: rgba(0, 212, 255, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.snap-toggle {
    top: 80px; /* Align with the existing pattern */
}

.layer-toggle {
    top: 140px; /* Proper spacing from snap toggle */
}

.safe-area-toggle {
    top: 200px; /* Proper spacing from layer toggle */
}

.snap-toggle:hover, .layer-toggle:hover, .safe-area-toggle:hover {
    background: rgba(0, 212, 255, 1);
    transform: scale(1.1);
}

/* Safe Area Warning System */
.safe-area-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    display: none;
}

.safe-area-overlay.active {
    display: block;
}

.safe-area-bounds {
    position: absolute;
    border: 2px dashed rgba(255, 193, 7, 0.8);
    background: rgba(255, 193, 7, 0.05);
    box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.3);
}

.safe-area-warning {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.95);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    z-index: 10;
}

.safe-area-warning::before {
    content: "⚠️ ";
}

.out-of-bounds-warning {
    position: absolute;
    background: rgba(255, 71, 87, 0.95);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: warning-pulse 2s infinite;
}

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

.snap-toggle.disabled {
    background: rgba(150, 150, 150, 0.7);
    color: #999;
}

/* Layer Panel Styling */
.layer-panel .layer-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 212, 255, 0.1);
}

.layer-panel .layer-header h3 {
    margin: 0;
    font-size: 16px;
    color: #00d4ff;
}

.layer-panel .layer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.layer-panel .layer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.layer-panel .layer-type {
    font-weight: bold;
    color: #00d4ff;
}

.layer-panel .layer-z {
    font-size: 12px;
    color: #aaa;
}

/* Draggable Layer Items */
.layer-panel .layer-item {
    user-select: none;
    border-radius: 4px;
    margin: 2px 0;
}

.layer-panel .layer-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.layer-panel .layer-item.dragging {
    background: rgba(0, 212, 255, 0.3) !important;
    transform: rotate(2deg);
}

.layer-panel .layer-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: grab;
    transition: all 0.2s ease;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.layer-panel .layer-drag-handle:hover {
    color: #00d4ff;
    transform: scale(1.1);
    background: rgba(0, 212, 255, 0.1);
}

.layer-panel .layer-drag-handle:active {
    cursor: grabbing;
    background: rgba(0, 212, 255, 0.2);
}

.layer-panel .hamburger-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.layer-panel .layer-actions {
    display: flex;
    gap: 4px;
}

.layer-panel .layer-actions button {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    min-width: 30px;
}

.layer-panel .layer-actions button:hover {
    background: rgba(0, 212, 255, 0.4);
    transform: scale(1.05);
}

/* Drop zone feedback */
.layer-panel .layer-item.drop-zone {
    background: rgba(0, 212, 255, 0.2) !important;
    border: 2px dashed rgba(0, 212, 255, 0.5);
}


/* External Style Panel */
.external-style-panel .style-panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 212, 255, 0.1);
    border-radius: 12px 12px 0 0;
    position: relative;
}

.external-style-panel .style-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #00d4ff;
    font-weight: bold;
}

.external-style-panel .style-panel-close {
    position: absolute;
    top: 12px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.external-style-panel .style-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.external-style-panel .style-panel-content {
    padding: 20px;
}

.external-style-panel .style-group {
    margin-bottom: 20px;
}

.external-style-panel .style-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ccc;
    font-weight: 500;
}

.external-style-panel .style-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.external-style-panel .style-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    appearance: none;
    cursor: pointer;
}

.external-style-panel .style-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.external-style-panel .style-color {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.external-style-panel .style-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.external-style-panel .style-color::-webkit-color-swatch-wrapper {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

.widget-header .style-btn,
.widget-header .close {
    cursor: pointer !important;
}

.widget {
    border-radius: 0 0 15px 15px;
}

/* Enhanced header visibility */
.widget-header span {
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.5px;
}

/* FINAL 16:9 ASPECT RATIO ENFORCEMENT */
.widget[data-type="youtube"],
.widget[data-type="video"] {
    aspect-ratio: 16/9 !important;
    min-width: 320px;
    min-height: 180px;
    max-width: 100vw;
    max-height: 80vh;
    resize: both;
    overflow: hidden;
}

/* Ensure resize maintains 16:9 */
.widget[data-type="youtube"][style*="width"],
.widget[data-type="video"][style*="width"] {
    aspect-ratio: 16/9 !important;
}

/* Twitter Feed Styles */
.twitter-feed {
    padding: 0;
    background: #fff;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    max-height: 100%;
    overflow-y: auto; /* Keep scrollbar for Twitter feeds */
}

.twitter-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e8ed;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.twitter-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.twitter-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1da1f2, #0d8bd9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.twitter-user-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #14171a;
    line-height: 1.2;
}

.twitter-username {
    color: #657786;
    font-size: 14px;
    margin: 2px 0 0 0;
}

.twitter-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.twitter-input:focus {
    border-color: #1da1f2;
    box-shadow: 0 0 0 1px #1da1f2;
}

.twitter-load-btn {
    background: #1da1f2;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 12px;
    transition: background-color 0.2s;
}

.twitter-load-btn:hover {
    background: #0d8bd9;
}

/* Tweet Styles */
.tweet {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e8ed;
    transition: background-color 0.2s;
    cursor: pointer;
}

.tweet:hover {
    background: #f7f9fa;
}

.tweet:last-child {
    border-bottom: none;
}

.tweet-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.tweet-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1da1f2, #0d8bd9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

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

.tweet-user-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #14171a;
    line-height: 1.2;
}

.tweet-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.tweet-username {
    color: #657786;
    font-size: 14px;
}

.tweet-time {
    color: #657786;
    font-size: 14px;
}

.tweet-separator {
    color: #657786;
    font-size: 14px;
}

.tweet-content {
    margin: 8px 0 12px 52px;
    font-size: 15px;
    line-height: 1.4;
    color: #14171a;
    word-wrap: break-word;
}

.tweet-stats {
    display: flex;
    gap: 20px;
    margin-left: 52px;
    padding-top: 4px;
}

.tweet-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #657786;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.tweet-stat:hover {
    color: #1da1f2;
}

.tweet-stat-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading and Error States */
.twitter-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #657786;
    font-size: 14px;
}

.twitter-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e1e8ed;
    border-top: 2px solid #1da1f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

.twitter-error {
    padding: 20px;
    text-align: center;
    color: #e0245e;
    font-size: 14px;
    background: #fef7f7;
    border: 1px solid #fad9d9;
    border-radius: 8px;
    margin: 16px;
}

.twitter-empty {
    padding: 40px 20px;
    text-align: center;
    color: #657786;
    font-size: 14px;
}

/* Snap functionality CSS */
.widget-wrapper.dragging {
    opacity: 0.9;
    transform: scale(1.02);
    transition: none;
}

/* Keep style panel visible during dragging */
.widget-wrapper.dragging .style-panel.show {
    display: block !important;
    z-index: 1003;
}

.widget-wrapper {
    transition: transform 0.1s ease;
}

/* Snap indicator animations */
#snap-vertical, #snap-horizontal {
    animation: snapPulse 0.3s ease-in-out;
}

@keyframes snapPulse {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 0.8; transform: scale(1); }
}

/* Resize handle styles */
.resize-handle {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: linear-gradient(-45deg, transparent 0%, transparent 30%, #00d4ff 30%, #00d4ff 40%, transparent 40%, transparent 60%, #00d4ff 60%, #00d4ff 70%, transparent 70%);
    cursor: se-resize;
    opacity: 0.7;
    z-index: 15;
    transition: opacity 0.2s ease;
    border-radius: 0 0 12px 0;
    pointer-events: auto;
}

.resize-handle:hover {
    opacity: 1;
}

/* Widget resize handles for all widget types */
.video-resize-handle {
    transition: all 0.2s ease;
    opacity: 0.8;
}

.video-resize-handle:hover {
    background: rgba(0, 212, 255, 1) !important;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
    opacity: 1;
}

.widget-wrapper.resizing {
    transition: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .tweet-header {
        gap: 8px;
    }
    
    .tweet-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .tweet-content {
        margin-left: 40px;
    }
    
    .tweet-stats {
        margin-left: 40px;
        gap: 16px;
    }
}

/* User Dropdown Styles */
.user-dropdown {
    position: fixed;
    top: 80px;
    right: 30px;
    z-index: 1000;
    background: rgba(99, 102, 241, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid #22c55e;
    border-radius: 20px;
    min-width: 320px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.2s ease;
    overflow: hidden;
}

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

.dropdown-content {
    padding: 0;
}

/* Wallet Connected Header */
.wallet-connected-header {
    background: rgba(99, 102, 241, 1);
    padding: 20px;
    text-align: center;
    color: white;
}

.connection-status {
    margin-bottom: 8px;
}

.status-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.wallet-address {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    margin-bottom: 4px;
}

.network-info {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* Username Display */
.username-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.username-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0;
}

.dropdown-menu {
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.95);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.dropdown-item.danger {
    color: #ef4444;
}

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

.item-icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.item-text {
    font-weight: 500;
}

/* Shared GENESIS header */
:root {
    --gen-header-height: 64px;
    --gen-header-padding-x: 22px;
    --gen-header-text: rgba(255, 255, 255, 0.96);
    --gen-header-muted: rgba(255, 255, 255, 0.72);
    --gen-header-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    --gen-dd-bg: #0b0f1f;
    --gen-header-weight: 700;
}

.gen-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--gen-header-height);
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
    padding: 0 var(--gen-header-padding-x);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.gen-header-inner {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.gen-left {
    grid-column: 1;
    justify-self: start;
    display: flex;
    align-items: center;
}

.gen-center {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
}

.gen-search {
    display: none;
}

.gen-right {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.gen-brand {
    justify-self: start;
}

.gen-brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.gen-brand-text {
    margin: 0;
    font-family: var(--font-display);
    font-weight: var(--gen-header-weight);
    letter-spacing: -0.03em;
    font-size: 22px;
    color: var(--gen-header-text);
    text-shadow: var(--gen-header-shadow);
}

.gen-nav {
    justify-self: center;
    display: none;
    align-items: center;
    gap: 18px;
    font-family: var(--font-display);
}

.gen-nav-link {
    text-decoration: none;
    color: var(--gen-header-text);
    font-weight: var(--gen-header-weight);
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    text-shadow: var(--gen-header-shadow);
    transition: background 0.12s ease, transform 0.12s ease;
}

.gen-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.gen-nav-link.is-active {
    background: rgba(199, 125, 255, 0.22);
}

body.dashboard-page.dashboard-nav .gen-nav {
    display: flex;
}

body.subscriptions-page .gen-nav {
    display: none;
}

body:not(.dashboard-page) .gen-nav {
    display: none;
}

.gen-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gen-create-btn {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: none;
    background: rgba(5, 6, 20, 0.45);
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: transform 0.12s ease, color 0.12s ease;
    font-family: var(--font-display);
    font-weight: var(--gen-header-weight);
}

.gen-create-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.gen-create-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gen-create-text {
    font-size: 12px;
    letter-spacing: 0.12em;
    line-height: 1;
}

.gen-user {
    position: relative;
    display: flex;
    align-items: center;
}

.gen-user-btn {
    appearance: none;
    border: none;
    background: rgba(5, 6, 20, 0.45);
    color: var(--gen-header-text);
    border-radius: 999px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    outline: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-family: var(--font-display);
    font-weight: var(--gen-header-weight);
}

.gen-user-btn.gen-signin-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--gen-font-display) !important;
  font-weight: var(--gen-header-weight);
  font-size: .9rem;
  line-height: 1;
  padding: 5px 10px;           /* match .gen-user-btn padding */
  min-height: 36px;            /* ensures same pill height feel */
  text-decoration: none !important;
  color: rgba(255,255,255,.98) !important;
}

.gen-signin-btn{
  font-family: var(--gen-font-display) !important;
  text-decoration: none !important;
}

.gen-signin-btn *{
  font-family: inherit !important;
  text-decoration: none !important;
}

.gen-signin-btn .gen-user-name{
  text-decoration: none !important;
}

.gen-signin-btn:link,
.gen-signin-btn:visited{
  text-decoration: none !important;
  color: rgba(255,255,255,.98) !important;
}

.gen-user-btn.gen-signin-btn,
.gen-user-btn.gen-signin-btn:hover,
.gen-user-btn.gen-signin-btn:visited,
.gen-user-btn.gen-signin-btn:active,
.gen-user-btn.gen-signin-btn:focus{
  text-decoration: none !important;
  color: rgba(255,255,255,.98) !important;
}

.gen-user-btn {
    text-decoration: none;
}

.gen-user-btn:visited,
.gen-user-btn:hover,
.gen-user-btn:active,
.gen-user-btn:focus {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.98);
}

.gen-user-btn:hover {
    background: rgba(5, 6, 20, 0.65);
}

.gen-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 30%, rgba(199, 125, 255, 0.9), rgba(70, 60, 190, 0.35));
    font-weight: 900;
    font-size: 0.95rem;
    line-height: 1;
    flex: 0 0 auto;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    color: rgba(255, 255, 255, 0.95);
}

.gen-user-avatar.has-image {
    color: transparent;
}

.creator-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, rgba(199, 125, 255, 0.9), rgba(70, 60, 190, 0.35));
    border: 0;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 0.02em;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-clip: padding-box;
    background-origin: padding-box;
    color: rgba(255, 255, 255, 0.92);
    flex: 0 0 auto;
    position: relative;
}

.creator-avatar.has-image {
    color: transparent;
}

.creator-avatar.is-live::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    border: 2px solid rgba(220, 48, 60, 0.95);
    box-shadow: 0 8px 18px rgba(180, 40, 50, 0.35);
    pointer-events: none;
}

.creator-avatar.is-live::after {
    content: "LIVE";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 50%);
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
    background: rgba(220, 48, 60, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 6px 14px rgba(180, 40, 50, 0.35);
    pointer-events: none;
}

.creator-avatar.is-large.is-live::before {
    inset: -3px;
    border-width: 3px;
}

.creator-avatar.is-large.is-live::after {
    font-size: 11px;
    padding: 3px 8px;
    bottom: 0;
    letter-spacing: 0.12em;
}

.gen-user-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.gen-user-name {
    font-weight: var(--gen-header-weight);
    font-size: 0.88rem;
    text-shadow: var(--gen-header-shadow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.gen-user-sub {
    font-size: 0.72rem;
    color: var(--gen-header-muted);
    text-shadow: var(--gen-header-shadow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.gen-user-caret {
    font-size: 0.85rem;
    opacity: 0.85;
    text-shadow: var(--gen-header-shadow);
}

.gen-dd {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 220px;
    border-radius: 14px;
    background: var(--gen-dd-bg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    z-index: 9999;
    font-family: var(--font-display);
    color: #fff;
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.gen-dd.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.gen-dd-top {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gen-dd-passport {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gen-dd-passport-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.7);
}

.gen-dd-overall-row{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.gen-dd-overall-level{
    font-size: 0.95rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
}

.gen-dd-overall-xp{
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
}

.gen-dd-passport-list {
    display: grid;
    gap: 6px;
}

.gen-dd-passport-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
}

.gen-dd-passport-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

.gen-dd-passport-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gen-dd-passport-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gen-dd-passport-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
}

.gen-dd-passport-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.gen-dd-passport-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: rgba(199, 125, 255, 0.7);
}

.gen-dd-passport-level {
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
}

.gen-dd-passport-link {
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.gen-dd-passport-link:hover {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

.gen-dd-name {
    font-weight: 900;
    font-size: 0.95rem;
    line-height: 1.1;
}

.gen-dd-mini {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gen-dd-list {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gen-dd-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.12s ease, opacity 0.12s ease;
    font-weight: 700;
    font-size: 13px;
    font-family: var(--font-display);
}

.gen-dd-item:hover {
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

.gen-dd-primary {
    color: #fff;
}

.gen-dd-primary:hover {
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

.gen-dd-danger {
    color: #fff;
}

.gen-dd-danger:hover {
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

@media (max-width: 920px) {
    .gen-create-btn {
        min-width: 36px;
        width: 36px;
        padding: 0;
    }

    .gen-create-text {
        display: none;
    }
}

@media (max-width: 780px) {
    .gen-header-inner {
        grid-template-columns: auto 1fr auto;
    }

    body.dashboard-page.dashboard-nav .gen-nav {
        gap: 10px;
    }

    .gen-nav-link {
        font-size: 12px;
        padding: 6px 8px;
    }

    .gen-user-sub {
        display: none;
    }

    .gen-user-name {
        max-width: 140px;
    }
}

/* Share modal */
.share-overlay{
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 20, 0.7);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2000;
}

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

.share-card{
    width: min(540px, 92vw);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(10,12,26,0.95);
    box-shadow: 0 30px 90px rgba(0,0,0,0.6);
    padding: 18px;
    color: rgba(255,255,255,0.95);
}

.post-publish-card{
    width: min(600px, 92vw);
    border: 1px solid rgba(199,125,255,0.24);
    background: linear-gradient(180deg, rgba(14,16,30,0.98) 0%, rgba(8,9,18,0.98) 100%);
    box-shadow: 0 30px 90px rgba(0,0,0,0.65), 0 0 26px rgba(140,100,255,0.22);
    text-align: center;
}

.post-publish-card .share-header{
    justify-content: center;
    position: relative;
}

.post-publish-card .share-close{
    position: absolute;
    right: 0;
    top: -2px;
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    padding: 4px;
    border-radius: 0;
}

.post-share-heading{
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.post-share-title{
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff, var(--gen-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.post-share-world{
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: rgba(255,255,255,0.92);
    letter-spacing: 0.02em;
}

.post-publish-subtitle{
    margin-top: -4px;
    margin-bottom: 10px;
    color: rgba(160,170,200,0.86);
    font-size: 12px;
}

.post-link-preview{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: min(520px, 84vw);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.32);
    color: rgba(255,255,255,0.82);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-link-input-hidden{
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.post-embed-input-hidden{
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.post-link-row{
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.post-link-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.post-share-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.post-share-icon{
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .12s ease, text-shadow .12s ease, color .12s ease;
}

.post-share-icon:hover{
    transform: translateY(-1px);
    color: #fff;
    text-shadow: 0 0 12px rgba(160,120,255,0.6);
}

.post-share-icon svg{
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.post-publish-card .share-section{
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.share-title{
    font-weight: 900;
    font-size: 18px;
    font-family: var(--font-display);
}

.share-close{
    border: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.share-section{
    margin-top: 12px;
}

.share-label{
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    display: block;
    margin-bottom: 6px;
}

.share-row{
    display: flex;
    gap: 8px;
}

.share-input,
.share-textarea{
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.9);
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
}

.share-textarea{
    min-height: 90px;
    resize: vertical;
    margin-top: 6px;
}

.share-copy-btn{
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    padding: 9px 14px;
    color: rgba(255,255,255,0.95);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.share-copy-btn.primary{
    border: none;
    color: #120318;
    background: linear-gradient(135deg, #ff8bff, #c46bff 50%, #8b5dff);
    box-shadow: 0 12px 26px rgba(152,71,255,0.4);
}

.share-status{
    min-height: 16px;
    font-size: 12px;
    color: rgba(186,230,253,0.9);
    margin-top: 8px;
}

.watch-party-section{
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.watch-party-title{
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    font-family: var(--font-display);
    color: rgba(255,255,255,0.92);
    margin-bottom: 6px;
}

.watch-party-subtitle{
    font-size: 12px;
    color: rgba(170,185,215,0.82);
    margin-bottom: 8px;
}

.watch-party-row{
    align-items: center;
}

.watch-party-actions{
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.watch-party-status{
    margin-top: 8px;
    min-height: 16px;
    font-size: 12px;
    color: rgba(186,230,253,0.9);
}

.watch-party-panel{
    position: fixed;
    right: 16px;
    top: calc(var(--gen-header-height, 64px) + 16px);
    z-index: 1600;
    width: min(320px, 92vw);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(10,12,26,0.92);
    box-shadow: 0 22px 60px rgba(0,0,0,0.55);
    padding: 12px;
    color: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: var(--font-display);
}

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

.wp-title-row{
    display: flex;
    align-items: center;
    gap: 6px;
}

.wp-title{
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.wp-pill{
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 9px;
    letter-spacing: 0.08em;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}

.wp-pill.muted{
    border-color: rgba(255,120,120,0.5);
    color: rgba(255,200,200,0.95);
}

.wp-connection{
    margin-top: 6px;
    font-size: 12px;
    color: rgba(170,185,215,0.86);
}

.wp-controls{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.wp-btn{
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.95);
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-display);
}

.wp-btn.ghost{
    background: rgba(0,0,0,0.35);
}

.wp-btn.tiny{
    padding: 4px 8px;
    font-size: 10px;
}

.wp-btn.danger{
    border-color: rgba(255,120,120,0.5);
    color: rgba(255,200,200,0.95);
}

.wp-muted-banner{
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,120,120,0.5);
    background: rgba(255,80,80,0.14);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.wp-hint{
    margin-top: 6px;
    font-size: 10px;
    color: rgba(160,175,205,0.7);
}

.wp-participants{
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
}

.wp-participant{
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.28);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wp-name{
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
}

.wp-badges{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.wp-actions{
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wp-volume{
    width: 120px;
}

@media (max-width: 620px) {
    .watch-party-panel{
        right: 10px;
        left: 10px;
        width: auto;
    }
}

.gen-share-btn{
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.28);
    color: rgba(255,255,255,0.95);
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    cursor: pointer;
    font-family: var(--font-display);
}

.gen-share-btn svg{
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.world3d-page #shareWorldBtn{
    border: none;
    color: #120318;
    background: linear-gradient(135deg, #ff8bff, #c46bff 50%, #8b5dff);
    box-shadow: 0 12px 26px rgba(152,71,255,0.4);
}

.gen-menu{
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    z-index: 1;
}

.gen-menu.open{
    z-index: 10000;
}

.gen-menu-btn{
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: color .12s ease, transform .12s ease;
}

.gen-menu-btn:hover{
    color: rgba(255,255,255,1);
    transform: translateY(-1px);
}

.gen-menu-dot{
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
    display: inline-block;
}

.gen-menu-panel{
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(10,12,26,0.96);
    box-shadow: 0 20px 45px rgba(0,0,0,0.55);
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
    z-index: 10001;
}

.gen-menu.open .gen-menu-panel{
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.gen-menu-item{
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.92);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    text-align: left;
    transition: color .12s ease, text-decoration-color .12s ease;
}

.gen-menu-item:focus-visible{
    outline: none;
    text-decoration: underline;
    text-decoration-color: rgba(199,125,255,0.8);
}

.gen-menu-item:hover{
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(199,125,255,0.8);
}

body.embed-mode #siteHeader{
    display: none;
}

body.embed-mode{
    --gen-header-height: 0px;
}

body.embed-mode #modeSwitch,
body.embed-mode #worldShare,
body.embed-mode #statusHud,
body.embed-mode .comments-panel{
    display: none;
}

body.world3d-page #app{
    z-index: 0;
}

body.world3d-page .comments-panel{
    position: fixed;
    right: 16px;
    bottom: 78px;
    width: min(340px, 90vw);
    max-height: 52vh;
    background: var(--gen-panel);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

body.world3d-page .comments-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(90deg, rgba(199,125,255,0.15), rgba(10,12,26,0.9));
}

body.world3d-page .comments-title{
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.82);
    font-weight: 700;
}

body.world3d-page .comments-close{
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    cursor: pointer;
}

body.world3d-page .comments-list{
    padding: 10px 12px 4px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
}

body.world3d-page .comment-item{
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.world3d-page .comment-name{
    font-size: 11px;
    font-weight: 700;
    color: var(--gen-accent);
}

body.world3d-page .comment-message{
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    line-height: 1.35;
    word-break: break-word;
}

body.world3d-page .comments-form{
    display: flex;
    gap: 8px;
    padding: 8px 12px 6px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

body.world3d-page .comments-input{
    flex: 1;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    outline: none;
}

body.world3d-page .comments-send{
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

body.world3d-page .comments-status{
    padding: 0 12px 10px 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    min-height: 16px;
}

body.world3d-page #siteHeader{
    position: relative;
    z-index: 12000;
    pointer-events: auto;
}

body.world3d-page .gen-header{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12000;
}

body.xr-active{
    --gen-header-height: 64px;
}

body.xr-active #siteHeader{
    display: block;
}

body.xr-active .gen-header{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12000;
    pointer-events: auto;
}

body.xr-active #commentsPanel3d{
    display: none;
}
