        :root {
            --tabs-bar-height: 48px;
        }

        html,
        body {
            height: 100%;
            width: 100%;
            overflow: hidden;
            position: fixed;
            /* Prevents bouncing on mobile */
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-page);
            margin: 0;
            overscroll-behavior: none;
            display: flex;
            flex-direction: column;
        }

        /* --- GLOBAL & SCROLLBAR STYLES --- */
        * {
            box-sizing: border-box;
            scrollbar-width: thin;
            scrollbar-color: var(--border-color) transparent;
        }

        iconify-icon {
            display: inline-block;
            vertical-align: middle;
        }

        ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background-color: var(--border-color);
            border-radius: 10px;
            border: 2px solid transparent;
            background-clip: content-box;
        }

        ::-webkit-scrollbar-thumb:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }

        /* --- TABS SYSTEM STYLES --- */
        #tabs-bar {
            width: 100%;
            height: var(--tabs-bar-height);
            background: rgba(13, 13, 13, 0.8);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            padding: 0 8px;
            flex-shrink: 0;
            gap: 4px;
        }

        .tab-add-btn {
            background-color: transparent;
            border: 1px solid transparent;
            border-radius: 0.5rem;
            padding: 0.5rem;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text-color-light);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tab-add-btn:hover {
            background-color: var(--bg-ui-hover);
            color: var(--text-color);
        }

        .tabs-list-container {
            position: relative;
            flex-grow: 1;
            overflow: hidden;
            display: flex;
            align-items: center;
        }

        .tabs-list {
            display: flex;
            height: 100%;
            flex-grow: 1;
            align-items: flex-end;
            overflow-x: auto;
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        .tabs-list::-webkit-scrollbar {
            display: none;
        }

        .scroll-indicator {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 40px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease-in-out;
            z-index: 10;
        }

        .scroll-indicator.visible {
            opacity: 1;
        }

        .scroll-indicator.left {
            left: 0;
            background: linear-gradient(to right, rgba(13, 13, 13, 1), transparent);
        }

        .scroll-indicator.right {
            right: 0;
            background: linear-gradient(to left, rgba(13, 13, 13, 1), transparent);
        }

        .tab-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0 12px;
            height: var(--tabs-bar-height);
            border: 1px solid transparent;
            border-bottom: none;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            cursor: pointer;
            color: var(--text-color-light);
            background-color: transparent;
            font-size: 0.875rem;
            white-space: nowrap;
        }

        .tab-item:hover {
            background-color: var(--bg-ui-hover);
            color: var(--text-color);
        }

        .tab-item.active {
            background-color: var(--bg-page);
            color: var(--text-color-active-tab);
            border-color: var(--border-color);
        }

        .tab-item.dragging {
            opacity: 0.4;
        }

        .tab-name {
            background: transparent;
            border: none;
            color: inherit;
            font-family: inherit;
            font-size: inherit;
            outline: none;
            padding: 2px 4px;
            border-radius: 4px;
            user-select: none;
            display: inline;
        }

        .tab-name-input {
            background: transparent;
            border: none;
            color: inherit;
            font-family: inherit;
            font-size: inherit;
            outline: none;
            padding: 2px 4px;
            border-radius: 4px;
            display: none;
        }

        .tab-name-input:focus {
            background-color: rgba(0, 0, 0, 0.3);
            box-shadow: 0 0 0 1px var(--switch-bg-checked);
        }

        .tab-close-btn {
            background: transparent;
            border: none;
            color: var(--text-color-light);
            border-radius: 50%;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 0;
            font-size: 14px;
        }

        .tab-close-btn:hover {
            background-color: rgba(255, 255, 255, 0.2);
            color: #fff;
        }

        /* --- CONTENT AREA & TABS --- */
        #content-area {
            flex-grow: 1;
            position: relative;
            overflow: hidden;
        }

        .tab-content {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }

        /* --- MOODPROMPT STYLES --- */
        #moodprompt-container {
            background-color: var(--bg-page);
            color: var(--text-color);
            padding: 2rem 1rem 8rem 1rem;
            /* Adjusted padding for mobile */
            box-sizing: border-box;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .prompt-list {
            width: 100%;
            max-width: 1900px;
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: center;
            gap: 1.5rem;
        }

        .prompt-card {
            background: var(--bg-ui);
            border: 1px solid var(--border-color);
            border-radius: 1rem;
            padding: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            transition: opacity 0.2s ease;
            width: 100%;
            max-width: 850px;
            /* Changed from fixed width to responsive */
        }

        .prompt-card.dragging {
            opacity: 0.5;
        }

        .prompt-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }

        .prompt-number {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text-color-light);
            margin-right: 0.5rem;
            user-select: none;
        }

        .prompt-title-input {
            font-size: 1.25rem;
            font-weight: 700;
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--text-color-strong);
            padding: 0.25rem 0;
            outline: none;
            width: 100%;
            transition: border-color 0.2s;
        }

        .prompt-title-input:focus {
            border-bottom-color: var(--switch-bg-checked);
        }

        .prompt-controls {
            display: flex;
            gap: 0.75rem;
            align-items: center;
            flex-shrink: 0;
            flex-wrap: wrap;
        }

        .prompt-delete-btn:hover {
            color: #ef4444;
        }

        .platform-select-wrapper {
            position: relative;
        }

        .platform-select {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background: var(--bg-ui-hover);
            border: 1px solid var(--border-color);
            border-radius: 0.5rem;
            color: var(--text-color);
            padding: 0.5rem 2.5rem 0.5rem 2.2rem;
            cursor: pointer;
            font-size: 0.875rem;
        }

        .platform-select-wrapper::before {
            content: '';
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            width: 16px;
            height: 16px;
            background-color: var(--text-color);
            mask-image: var(--icon-url);
            mask-size: contain;
            mask-repeat: no-repeat;
            mask-position: center;
            pointer-events: none;
        }

        .platform-select-wrapper::after {
            content: '▼';
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            font-size: 10px;
            color: var(--text-color-light);
            pointer-events: none;
        }

        .media-type-toggle {
            display: flex;
            background: var(--bg-ui-hover);
            border-radius: 0.5rem;
            border: 1px solid var(--border-color);
            overflow: hidden;
        }

        .media-type-btn {
            padding: 0.5rem 1rem;
            border: none;
            background: transparent;
            color: var(--text-color-light);
            cursor: pointer;
        }

        .media-type-btn.active {
            background: var(--switch-bg-checked);
            color: white;
            font-weight: 600;
        }

        .prompt-body {
            display: flex;
            gap: 1rem;
        }

        .prompt-images {
            display: flex;
            gap: 1rem;
            flex-direction: column;
        }

        .image-upload-slot {
            width: 150px;
            height: 150px;
            border: 2px dashed var(--border-color);
            border-radius: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: rgba(0, 0, 0, 0.1);
            cursor: pointer;
            transition: border-color 0.2s;
            position: relative;
            overflow: hidden;
        }

        .image-upload-slot:hover {
            border-color: var(--switch-bg-checked);
        }

        .image-upload-slot .placeholder {
            color: var(--text-color-light);
            font-size: 0.8rem;
            text-align: center;
            padding: 4px;
        }

        .image-upload-slot img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .prompt-text-area {
            flex-grow: 1;
            background-color: rgba(0, 0, 0, 0.2);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            padding: 1rem;
            color: var(--text-color);
            font-family: 'Source Code Pro', monospace;
            font-size: 0.9rem;
            resize: vertical;
            min-height: 150px;
            outline: none;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .prompt-text-area:focus {
            border-color: var(--switch-bg-checked);
            box-shadow: 0 0 0 1px var(--switch-bg-checked);
        }

        #add-prompt-btn {
            position: fixed;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%);
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            width: auto;
            padding: 0.75rem 1.5rem;
            border: 2px dashed var(--contrast-color-light);
            border-radius: 1rem;
            background: var(--bg-ui);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            color: var(--contrast-color-light);
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        #add-prompt-btn:hover {
            border-color: var(--switch-bg-checked);
            color: var(--switch-bg-checked);
            background: rgba(66, 158, 255, 0.1);
        }

        /* --- MOODINFINITE CANVAS & UI --- */
        #moodinfinite-container {
            position: relative;
            width: 100%;
            height: 100%;
        }

        canvas {
            display: block;
            width: 100%;
            height: 100%;
            background-color: var(--bg-canvas);
            cursor: grab;
        }

        canvas.grabbing {
            cursor: grabbing;
        }

        canvas.eyedropper-active {
            cursor: crosshair;
        }

        #left-bar {
            position: absolute;
            top: 50%;
            left: 1rem;
            transform: translateY(-50%);
            z-index: 50;
            background: var(--bg-ui);
            padding: 0.5rem;
            border-radius: 0.75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            border: 1px solid var(--border-color);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }

        #context-menu,
        #confirmation-modal-overlay,
        #help-modal-overlay,
        #toast-container,
        #tab-context-menu {
            position: fixed;
        }

        #tab-context-menu {
            z-index: 2200;
            background: var(--bg-ui);
            border: 1px solid var(--border-color);
            border-radius: .75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            padding: .5rem;
            display: none;
            width: 180px;
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }

        #context-menu {
            z-index: 2100;
        }

        #confirmation-modal-overlay {
            z-index: 2000;
        }

        #input-modal-overlay {
            z-index: 2500;
        }

        #help-modal-overlay {
            z-index: 3000;
        }

        #toast-container {
            z-index: 5000;
        }

        #context-menu {
            position: absolute;
            z-index: 2100;
            background: var(--bg-ui);
            border: 1px solid var(--border-color);
            border-radius: .75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            padding: .75rem;
            display: none;
            width: 240px;
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px)
        }

        .menu-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: .4rem .5rem;
            border-radius: .375rem;
            cursor: pointer;
            transition: background-color .2s;
            color: var(--text-color)
        }

        .menu-item .text-red-500 {
            color: #ef4444;
            text-shadow: 0 1px 2px rgba(0, 0, 0, .4)
        }

        .menu-item:hover {
            background-color: var(--bg-ui-hover)
        }

        .menu-label {
            font-size: .875rem
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 38px;
            height: 22px
        }

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

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--border-color);
            transition: .4s;
            border-radius: 22px
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 3px;
            bottom: 3px;
            background-color: #fff;
            transition: .4s;
            border-radius: 50%;
            box-shadow: 0 1px 3px rgba(0, 0, 0, .3)
        }

        input:checked+.slider {
            background-color: var(--switch-bg-checked)
        }

        input:checked+.slider:before {
            transform: translateX(16px)
        }

        .tool-button {
            background-color: transparent;
            border: 1px solid transparent;
            border-radius: .5rem;
            padding: .5rem;
            cursor: pointer;
            transition: all .2s;
            color: var(--text-color)
        }

        .tool-button:hover {
            background-color: var(--bg-ui-hover)
        }

        .tool-button:disabled {
            opacity: .4;
            cursor: not-allowed;
            background-color: var(--bg-ui)
        }

        .tool-button.active {
            background-color: var(--bg-ui-hover);
            color: var(--switch-bg-checked)
        }

        .separator {
            height: 1px;
            background-color: var(--border-color);
            margin: .25rem
        }

        .slider-input {
            -webkit-appearance: none;
            appearance: none;
            width: 100%;
            flex-grow: 1;
            height: 8px;
            background: var(--border-color);
            border-radius: 9999px;
            cursor: pointer
        }

        .slider-input::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 1rem;
            height: 1rem;
            background: var(--switch-bg-checked);
            cursor: pointer;
            border-radius: 50%
        }

        .slider-value-box {
            background-color: var(--bg-ui-hover);
            color: var(--text-color);
            font-size: .75rem;
            padding: .25rem .5rem;
            border-radius: .375rem;
            min-width: 50px;
            text-align: center
        }

        .color-picker-input {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            width: 2rem;
            height: 2rem;
            background-color: transparent;
            border: none;
            cursor: pointer;
            padding: 0;
            border-radius: .375rem;
            overflow: hidden
        }

        .color-picker-input::-webkit-color-swatch {
            border-radius: .375rem;
            border: 1px solid var(--border-color)
        }

        .color-picker-input::-moz-color-swatch {
            border-radius: .375rem;
            border: 1px solid var(--border-color)
        }

        #selection-toolbar {
            position: absolute;
            z-index: 1001;
            background: var(--bg-ui);
            padding: .35rem;
            border-radius: .75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            display: none;
            gap: .35rem;
            border: 1px solid var(--border-color);
            transform: translate(-50%, 10px);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px)
        }

        .selection-tool-btn {
            background-color: transparent;
            border: none;
            border-radius: .375rem;
            padding: .4rem;
            cursor: pointer;
            color: var(--text-color);
            transition: all .2s;
            display: flex;
            align-items: center;
            justify-content: center
        }

        .selection-tool-btn:hover {
            background-color: var(--bg-ui-hover)
        }

        .selection-tool-btn.active {
            background-color: var(--bg-ui-hover);
            color: var(--switch-bg-checked)
        }

        .selection-tool-btn.pinned {
            color: #f59e0b
        }

        .selection-tool-btn .text-red-500 {
            color: #ef4444
        }

        .selection-tool-select {
            background-color: transparent;
            border: none;
            border-radius: .375rem;
            padding: .4rem;
            cursor: pointer;
            color: var(--text-color);
            font-family: 'Inter', sans-serif;
            font-size: .8rem;
            outline: 0;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none
        }

        .selection-tool-select:hover {
            background-color: var(--bg-ui-hover)
        }

        .selection-tool-select option {
            background-color: var(--bg-ui);
            color: var(--text-color);
            font-weight: 400;
            font-style: normal
        }

        #text-tools-container,
        #grid-tools-container,
        #measure-tools-container {
            display: none;
            align-items: center;
            gap: .35rem;
            border-right: 1px solid var(--border-color);
            padding-right: .35rem;
            margin-right: .35rem
        }

        #grid-tools-container .grid-input {
            background-color: transparent;
            border: 1px solid transparent;
            color: var(--text-color);
            width: 45px;
            font-size: .8rem;
            border-radius: .25rem;
            padding: .2rem;
            text-align: center
        }

        #grid-tools-container .grid-input:hover {
            background-color: var(--bg-ui-hover)
        }

        #text-editor {
            position: absolute;
            z-index: 1002;
            border: none;
            outline: 0;
            padding: 10px;
            margin: 0;
            font-family: 'Inter', sans-serif;
            resize: none;
            overflow: hidden;
            box-sizing: border-box;
            line-height: 1.4
        }

        .flex {
            display: flex
        }

        .items-center {
            align-items: center
        }

        .gap-2 {
            gap: .5rem
        }

        .border-t {
            border-top-width: 1px
        }

        .my-2 {
            margin-top: .5rem;
            margin-bottom: .5rem
        }

        .modal-overlay {
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background-color: rgba(0, 0, 0, .45);
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            z-index: 4000;
        }

        #confirmation-modal-overlay {
            z-index: 4001;
        }

        .glass-modal {
            background: var(--bg-ui);
            color: var(--text-color);
            padding: 2.5rem 2rem;
            border-radius: 1.25rem;
            border: 1px solid var(--border-color);
            box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
            text-align: center;
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            max-width: 340px;
            width: 90%;
            animation: modalScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

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

        .glass-modal h2 {
            margin: 0 0 .5rem;
            font-size: 1.25rem;
            color: var(--text-color-strong);
            font-weight: 700;
        }

        .glass-modal p {
            margin: 0 0 1.5rem;
            font-size: .95rem;
            color: var(--text-color-light);
            line-height: 1.4;
        }

        .modal-buttons {
            display: flex;
            gap: .75rem;
            justify-content: center
        }

        .modal-button {
            padding: .5rem 1rem;
            border: 1px solid transparent;
            border-radius: .375rem;
            font-size: .875rem;
            font-weight: 500;
            cursor: pointer;
            transition: all .2s ease
        }

        .modal-button.confirm {
            background-color: #ef4444;
            color: #fff;
            border-color: transparent
        }

        .modal-button.confirm:hover {
            background-color: #dc2626
        }

        .modal-button.cancel {
            background-color: var(--bg-ui-hover);
            color: var(--text-color);
            border-color: var(--border-color)
        }

        .modal-button.cancel:hover {
            opacity: .8
        }

        #project-name-input {
            background: transparent;
            border: none;
            color: var(--text-color);
            font-size: .8rem;
            font-weight: 900;
            padding: .5rem;
            width: 160px;
            text-align: right;
            border-radius: .375rem;
            outline: 0;
            transition: all .2s
        }

        #project-name-input:hover {
            background-color: var(--bg-ui-hover)
        }

        #project-name-input:focus {
            color: var(--text-color-strong);
            background-color: var(--bg-ui-hover);
            box-shadow: 0 0 0 1px var(--switch-bg-checked)
        }

        #palette-panel {
            position: fixed;
            z-index: 51;
            background: var(--bg-ui);
            border: 1px solid var(--border-color);
            border-radius: .75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            padding: .5rem;
            display: flex;
            flex-direction: column;
            gap: .5rem;
            transform: translateY(-20px);
            opacity: 0;
            transition: transform .3s ease-out, opacity .3s ease-out;
            pointer-events: none
        }

        #palette-panel.open {
            transform: translateY(0);
            opacity: 1;
            pointer-events: auto
        }

        #icon-picker-panel {
            position: fixed;
            z-index: 51;
            background: var(--bg-ui);
            border: 1px solid var(--border-color);
            border-radius: .75rem;
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            padding: .5rem;
            display: none;
            flex-direction: row;
            gap: .5rem;
        }

        .icon-picker-btn {
            background: 0 0;
            border: none;
            color: var(--text-color);
            cursor: pointer;
            padding: .4rem;
            font-size: 14px;
            font-family: inherit;
            font-weight: 500;
            border-radius: .375rem;
            transition: all .2s ease-out;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .icon-picker-btn:hover {
            color: var(--text-color-strong);
            background: var(--contrast-color-light);
            transform: translateY(-2px);
        }

        .palette-option {
            cursor: pointer;
            border-radius: .5rem;
            padding: 4px;
            border: 2px solid transparent;
            transition: border-color .2s;
            display: flex;
            gap: 4px
        }

        .palette-option:hover {
            border-color: var(--switch-bg-checked)
        }

        .palette-color {
            width: 24px;
            height: 24px;
            border-radius: .375rem;
            border: 1px solid rgba(0, 0, 0, .2)
        }

        .set-default-btn {
            margin-top: 0.25rem;
            padding: 0.6rem;
            background: var(--switch-bg-checked);
            color: #fff;
            border: none;
            border-radius: 0.5rem;
            cursor: pointer;
            font-size: 0.75rem;
            font-weight: 600;
            transition: all 0.2s ease;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .set-default-btn:hover {
            filter: brightness(1.1);
            transform: translateY(-1px);
        }

        .set-default-btn:active {
            transform: translateY(0);
        }

        #toolbar-color-picker-container {
            padding: .25rem 0;
            display: flex;
            justify-content: center
        }

        #toolbar-accent-color-picker {
            width: 28px;
            height: 28px;
            border-radius: 50%
        }

        #help-modal-overlay {
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, .6);
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px)
        }

        #help-modal {
            background: var(--bg-ui);
            color: var(--text-color);
            padding: 2rem 3rem;
            border-radius: 1rem;
            border: 1px solid var(--border-color);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            width: 90%;
            max-width: 800px;
            height: 80vh;
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column
        }

        #close-help-btn {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: transparent;
            border: none;
            color: var(--text-color-light);
            font-size: 2rem;
            cursor: pointer;
            line-height: 1
        }

        #help-modal h2 {
            margin: 0 0 1rem;
            font-size: 1.5rem;
            color: var(--text-color-strong);
            text-align: center
        }

        .help-content {
            overflow-y: auto;
            padding-right: 1rem
        }

        .help-content h3 {
            color: var(--text-color-strong);
            margin-top: 1.5rem;
            margin-bottom: .5rem;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: .25rem
        }

        .help-content p,
        .help-content li {
            color: var(--text-color);
            font-size: .9rem;
            line-height: 1.6
        }

        .help-content ul {
            list-style-type: none;
            padding-left: 0
        }

        .help-content li {
            padding-left: 1.5rem;
            position: relative;
            margin-bottom: .5rem
        }

        .help-content li::before {
            content: '•';
            color: var(--switch-bg-checked);
            position: absolute;
            left: 0
        }

        .help-content strong {
            color: var(--text-color-strong);
            font-weight: 700
        }

        .footer-btn {
            background-color: var(--bg-ui);
            color: var(--text-color);
            width: 25px;
            height: 25px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border-color);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            transition: all .3s ease;
            text-decoration: none
        }

        .footer-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 12px 40px 0 rgba(0, 0, 0, .45);
            color: var(--switch-bg-checked)
        }

        #toast-container {
            bottom: 1.5rem;
            right: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: .75rem;
            align-items: flex-end;
            pointer-events: none;
        }

        .toast-notification {
            background: var(--bg-ui);
            color: var(--text-color);
            padding: .75rem 1.25rem;
            border-radius: .75rem;
            border: 1px solid var(--border-color);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            opacity: 0;
            transform: translateX(100%);
            animation: toastInOut 3s ease-in-out forwards;
            display: flex;
            align-items: center;
            gap: .5rem;
            pointer-events: auto;
        }

        .toast-notification.success .icon {
            color: #4ade80
        }

        .toast-notification.error .icon {
            color: #f87171
        }

        .toast-notification .icon {
            width: 20px;
            height: 20px
        }

        @keyframes toastInOut {
            0% {
                opacity: 0;
                transform: translateX(100%);
            }
            10% {
                opacity: 1;
                transform: translateX(0);
            }
            90% {
                opacity: 1;
                transform: translateX(0);
            }
            100% {
                opacity: 0;
                transform: translateX(100%);
            }
        }

        /* --- MOBILE TABS POPUP --- */
        #mobile-tabs-btn,
        #mobile-context-btn {
            display: none;
            /* Hidden by default */
            margin-left: 4px;
        }

        #mobile-tabs-popup {
            display: none;
            position: absolute;
            top: var(--tabs-bar-height);
            left: 0;
            right: 0;
            z-index: 2300;
            /* Higher than other UI */
            background: rgba(25, 28, 41, 0.9);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border-color);
            max-height: 50vh;
            overflow-y: auto;
        }

        .mobile-tab-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 1rem 1.5rem;
            color: var(--text-color-light);
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
        }

        .mobile-tab-item:last-child {
            border-bottom: none;
        }

        .mobile-tab-item:hover {
            background: var(--bg-ui-hover);
            color: var(--text-color);
        }

        .mobile-tab-item.active {
            color: var(--text-color-active-tab);
            font-weight: 700;
            background: rgba(66, 158, 255, 0.1);
        }

        .mobile-tab-item svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }

        /* --- MOBILE & TABLET RESPONSIVENESS --- */
        @media (max-width: 768px) {

            /* Hide desktop tabs and show mobile button */
            .tabs-list-container {
                display: none;
            }

            #mobile-tabs-btn,
            #mobile-context-btn {
                display: flex;
            }

            #left-bar {
                flex-direction: row;
                top: auto;
                bottom: 1rem;
                left: 50%;
                transform: translateX(-50%);
                width: auto;
                max-width: 95vw;
                overflow-x: auto;
                padding: 0.5rem;
                gap: 0.5rem;
            }

            #left-bar .tool-button {
                padding: .75rem;
            }

            #left-bar svg {
                width: 20px;
                height: 20px;
            }

            .separator {
                margin: .1rem .25rem;
            }

            #context-menu {
                width: 220px;
                padding: .5rem;
            }

            .menu-label {
                font-size: .8rem;
            }

            #selection-toolbar {
                padding: .5rem;
                gap: .25rem;
                max-width: 95vw;
                overflow-x: auto;
                flex-wrap: wrap;
                /* Allow wrapping */
                justify-content: center;
                transform: translate(-50%, 15px);
                /* Add more space from item */
            }

            .selection-tool-btn {
                padding: .5rem;
            }

            #help-modal {
                padding: 1.5rem;
                width: 95%;
                height: 85vh;
            }

            #help-modal h2 {
                font-size: 1.25rem;
            }

            .help-content p,
            .help-content li {
                font-size: .85rem;
            }

            #footer-container {
                /* Adjust footer to not overlap with the bottom toolbar */
                bottom: calc(4.5rem + var(--safe-area-inset-bottom, 0rem));
                right: 1rem;
                gap: .5rem;
            }

            #version-info {
                display: none;
            }

            #toast-container {
                /* Adjust toasts to not overlap with the bottom toolbar */
                bottom: calc(5rem + var(--safe-area-inset-bottom, 0rem));
                right: 1rem;
                width: calc(100% - 2rem);
                align-items: center;
            }

            .toast-notification {
                width: 100%;
                max-width: 400px;
            }

            /* Responsive prompt cards */
            .prompt-card {
                padding: 1rem;
            }

            .prompt-header {
                flex-direction: column;
                align-items: stretch;
                gap: 1rem;
            }

            .prompt-title-input {
                font-size: 1.1rem;
            }

            .prompt-controls {
                justify-content: space-between;
            }

            .prompt-body {
                flex-direction: column;
            }

            .prompt-images {
                flex-direction: row;
                justify-content: center;
            }

            .image-upload-slot {
                width: 120px;
                height: 120px;
            }

            #add-prompt-btn {
                padding: 0.5rem 1rem;
                font-size: 0.9rem;
                bottom: calc(5rem + var(--safe-area-inset-bottom, 0rem));
            }
        }

        /* --- SHORT HEIGHT / LANDSCAPE RESPONSIVENESS --- */
        @media (max-height: 768px) and (min-width: 769px) {
            #left-bar {
                top: calc(var(--tabs-bar-height) + 1rem);
                /* Space from top tab bar */
                bottom: 1rem;
                left: 0;
                transform: none;
                /* remove translateY(-50%) */
                height: auto;
                max-height: calc(100vh - var(--tabs-bar-height) - 2rem);
                border-radius: 0 0.75rem 0.75rem 0;
                /* sticky to left edge */
                border-left: none;
                overflow-y: auto;
                overflow-x: hidden;
                /* scroll/drag styling */
                -ms-overflow-style: auto;
                /* IE and Edge */
                scrollbar-width: thin;
                /* Firefox */
                scrollbar-color: var(--border-color) transparent;
            }

            #left-bar::-webkit-scrollbar {
                width: 6px;
            }

            #left-bar::-webkit-scrollbar-track {
                background: transparent;
            }

            #left-bar::-webkit-scrollbar-thumb {
                background-color: var(--border-color);
                border-radius: 10px;
            }

            #left-bar::-webkit-scrollbar-thumb:hover {
                background-color: var(--text-color-light);
            }
        }

        #input-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, .8);
            display: none;
            align-items: center;
            justify-content: center;
        }

        #input-modal {
            background: var(--bg-color-dark);
            padding: 2rem;
            border-radius: 12px;
            width: 90%;
            max-width: 400px;
            border: 1px solid var(--border-color);
            box-shadow: 0 10px 25px rgba(0, 0, 0, .5);
        }

        #input-modal h2 {
            margin-top: 0;
            margin-bottom: 1.5rem;
            font-size: 1.5rem;
            color: var(--text-color);
        }

        .input-modal-group {
            margin-bottom: 1.25rem;
        }

        .input-modal-group label {
            display: block;
            margin-bottom: .5rem;
            font-size: .85rem;
            color: var(--text-color-light);
        }

        .input-modal-group input {
            width: 100%;
            padding: .75rem;
            background: rgba(255, 255, 255, .05);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-color);
            font-size: .95rem;
            box-sizing: border-box;
        }

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

        /* --- NOTE EDITOR MODAL --- */
        #note-editor-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 3100;
        }

        #note-editor-modal {
            background: var(--bg-ui);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.04);
            width: 90%;
            max-width: 620px;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            animation: noteModalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

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

        #note-editor-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 1rem 1.25rem 0.75rem;
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        #note-title-input {
            flex: 1;
            background: transparent;
            border: none;
            outline: none;
            color: var(--text-color-strong);
            font-size: 1.15rem;
            font-weight: 700;
            font-family: 'Inter', sans-serif;
        }

        #note-title-input::placeholder {
            color: rgba(148, 163, 184, 0.5);
            font-weight: 400;
        }

        #note-editor-toolbar {
            display: flex;
            gap: 2px;
            flex-shrink: 0;
        }

        .note-fmt-btn {
            background: transparent;
            border: 1px solid transparent;
            border-radius: 6px;
            color: var(--text-color-light);
            cursor: pointer;
            padding: 4px 8px;
            font-size: 0.78rem;
            font-family: 'Inter', sans-serif;
            font-weight: 600;
            transition: all 0.15s;
            line-height: 1;
        }

        .note-fmt-btn:hover {
            background: var(--bg-ui-hover);
            color: var(--text-color-strong);
            border-color: var(--border-color);
        }

        #note-body-input {
            flex: 1;
            background: transparent;
            border: none;
            outline: none;
            color: var(--text-color);
            font-family: 'Inter', sans-serif;
            font-size: 0.9rem;
            line-height: 1.7;
            padding: 1rem 1.25rem;
            resize: none;
            min-height: 240px;
            max-height: 55vh;
        }

        #note-body-input::placeholder {
            color: rgba(148, 163, 184, 0.4);
            line-height: 1.7;
        }

        #note-editor-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.75rem 1.25rem;
            border-top: 1px solid var(--border-color);
            gap: 1rem;
            flex-shrink: 0;
        }

        #note-md-hint {
            font-size: 0.72rem;
            color: rgba(148, 163, 184, 0.5);
            font-family: 'Source Code Pro', monospace;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .note-color-picker-wrapper {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 6px;
            border: 1px solid var(--border-color);
            overflow: hidden;
            cursor: pointer;
            flex-shrink: 0;
        }

        .note-color-picker-wrapper input[type="color"] {
            border: none;
            width: 140%;
            height: 140%;
            cursor: pointer;
            padding: 0;
            background: none;
        }

        /* Confirm / Done button — use accent blue, not red */
        #confirm-note-btn.modal-button.confirm,
        #confirm-input-btn.modal-button.confirm {
            background-color: var(--switch-bg-checked);
            color: #fff;
        }

        #confirm-note-btn.modal-button.confirm:hover,
        #confirm-input-btn.modal-button.confirm:hover {
            filter: brightness(1.15);
            background-color: var(--switch-bg-checked);
        }

        @media (max-width: 768px) {
            #note-editor-modal {
                width: 97%;
                max-height: 92vh;
                border-radius: 12px;
            }
            #note-editor-header {
                flex-direction: column;
                align-items: stretch;
                gap: 0.5rem;
            }
            #note-md-hint { display: none; }
        }