:root {
    --pxf-nav-h: 68px;
    --pxf-panel-w: 300px;
}

.pxf-body {
    overflow: hidden !important;
    touch-action: none;
}

.pxf-body>footer {
    display: none !important;
}

.pxf-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 490;
    touch-action: auto;
}

.pxf-backdrop.visible {
    display: block;
}

.pxf-backdrop.transparent {
    opacity: 0;
    pointer-events: none;
}

.pxf-panel {
    position: fixed;
    top: var(--pxf-nav-h);
    left: 0;
    bottom: 0;
    width: var(--pxf-panel-w);
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 9;
    overflow: hidden;
}

.pxf-panel__inner {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.pxf-panel__inner::-webkit-scrollbar {
    width: 3px;
}

.pxf-panel__inner::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.pxf-panel__mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pxf-panel__close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    font-family: var(--font);
    transition: color 0.2s;
    cursor: none;
}

.pxf-panel__close:hover {
    color: var(--accent);
}

.pxf-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.pxf-section:last-child {
    border-bottom: none;
}

.pxf-section>.cs-info-label:first-child {
    display: block;
    margin-bottom: 14px;
}

.pxf-btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.pxf-btn {
    padding: 9px 8px;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    min-height: 38px;
    touch-action: manipulation;
    cursor: none;
}

.pxf-btn:last-child {
    border-right: none;
}

.pxf-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--fg);
}

.pxf-btn--active,
.pxf-btn.active {
    background: var(--accent);
    color: #fff;
}

.pxf-upload {
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    touch-action: manipulation;
}

.pxf-upload:hover {
    border-color: var(--accent);
    background: rgba(255, 77, 0, 0.04);
}

input[type="file"] {
    display: none;
}

.pxf-upload__btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 500px;
    background: transparent;
    color: var(--fg);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    touch-action: manipulation;
    cursor: none;
}

.pxf-upload__btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pxf-upload__btn--block {
    display: block;
    text-align: center;
    width: 100%;
    margin-top: 6px;
    box-sizing: border-box;
}

.pxf-upload__hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pxf-param {
    margin-bottom: 18px;
}

.pxf-param:last-child {
    margin-bottom: 0;
}

.pxf-param__label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.42);
    margin-bottom: 8px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.pxf-param__val {
    font-weight: 700;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.pxf-panel input[type="range"] {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 2px;
    display: block;
    cursor: none;
}

.pxf-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent);
    cursor: none;
}

.pxf-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg);
    cursor: none;
}

.pxf-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--fg);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    min-height: 40px;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s;
    cursor: none;
}

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

.pxf-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.pxf-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    transition: border-color 0.2s;
    cursor: none;
}

.pxf-checkbox:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.pxf-checkbox input[type="checkbox"] {
    display: block;
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    flex-shrink: 0;
    cursor: none;
}

.pxf-export-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border-radius: 500px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: opacity 0.2s;
    min-height: 40px;
    touch-action: manipulation;
    cursor: none;
}

.pxf-export-btn:hover {
    opacity: 0.82;
}

.pxf-export-btn--ghost {
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
}

.pxf-export-btn--ghost:hover {
    opacity: 1;
    border-color: var(--accent);
    color: var(--accent);
}

.pxf-svg-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 77, 0, 0.06);
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
}

.pxf-pattern-lib {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 4px;
}

.pattern-item {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    cursor: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
    position: relative;
    min-height: 44px;
    overflow: hidden;
    touch-action: manipulation;
}

.pattern-item:hover,
.pattern-item.active {
    border-color: var(--accent);
}

.pattern-item canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.pattern-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.72);
    color: var(--muted);
    font-size: 9px;
    padding: 2px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: var(--font);
}

.pattern-item.active .pattern-name {
    color: var(--accent);
}

.pxf-pattern-preview,
#patternPreview {
    width: 100%;
    height: 100px;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.pxf-pattern-preview canvas,
#patternPreview canvas {
    image-rendering: pixelated;
}

.pattern-preview-text {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.06em;
    font-family: var(--font);
}

.rotation-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.rotation-btn {
    padding: 8px;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    min-height: 34px;
    touch-action: manipulation;
    cursor: none;
}

.rotation-btn:last-child {
    border-right: none;
}

.rotation-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--fg);
}

.rotation-btn.active {
    background: var(--accent);
    color: #fff;
}

.pxf-shell {
    position: fixed;
    top: var(--pxf-nav-h);
    right: 0;
    bottom: 0;
    left: var(--pxf-panel-w);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.pxf-app-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 16px;
    pointer-events: none;
}

.pxf-app-header>* {
    pointer-events: auto;
}

.pxf-app-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pxf-dim-info {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.preview-notice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 77, 0, 0.1);
    border: 1px solid rgba(255, 77, 0, 0.3);
    border-radius: 500px;
    padding: 3px 10px;
    font-size: 11px;
    color: var(--accent);
    white-space: nowrap;
}

.preview-notice-icon {
    font-weight: 700;
}

.pxf-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--fg);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
    transition: background 0.15s, color 0.15s;
    cursor: none;
    font-size: 14px;
}

.pxf-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.panel-open .pxf-app-header__right {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.pxf-canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.pxf-viewport {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #060606;
    cursor: none;
    touch-action: none;
}

.pxf-canvas-area.grabbing .pxf-viewport {
    cursor: none;
}

.pxf-canvas-area.crop-mode .pxf-viewport {
    cursor: none;
}

.pxf-canvas-area.processing {
    pointer-events: none;
}

.pxf-wrapper {
    position: relative;
    display: inline-block;
    will-change: transform;
    backface-visibility: hidden;
    min-width: 100px;
    min-height: 100px;
}

canvas {
    display: block;
    image-rendering: pixelated;
    backface-visibility: hidden;
}

.pxf-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    display: none;
}

.pxf-grid-overlay.visible {
    display: block;
}

.pxf-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 48px 40px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    cursor: none;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 220px;
    user-select: none;
    touch-action: manipulation;
}

.pxf-placeholder:hover {
    border-color: var(--accent);
    background: rgba(255, 77, 0, 0.04);
    transform: translate(-50%, -50%) scale(1.02);
}

.pxf-placeholder:active {
    transform: translate(-50%, -50%) scale(0.97);
}

.pxf-placeholder__icon {
    font-size: clamp(2rem, 6vw, 3.2rem);
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.pxf-placeholder:hover .pxf-placeholder__icon {
    color: var(--accent);
}

.pxf-placeholder p {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--fg);
}

.pxf-placeholder__sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.pxf-crop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 50;
}

.pxf-crop-overlay.active {
    display: block;
    pointer-events: all;
}

.crop-selection {
    position: absolute;
    border: 1px solid var(--accent);
    background: rgba(255, 77, 0, 0.05);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
}

.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
    touch-action: none;
}

.crop-handle.nw {
    top: -7px;
    left: -7px;
    cursor: nw-resize;
}

.crop-handle.ne {
    top: -7px;
    right: -7px;
    cursor: ne-resize;
}

.crop-handle.sw {
    bottom: -7px;
    left: -7px;
    cursor: sw-resize;
}

.crop-handle.se {
    bottom: -7px;
    right: -7px;
    cursor: se-resize;
}

.pxf-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.88);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 100;
    max-width: calc(100% - 32px);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pxf-tool-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    transition: background 0.15s, color 0.15s;
    min-height: 30px;
    white-space: nowrap;
    touch-action: manipulation;
    cursor: none;
}

.pxf-tool-btn:hover:not(:disabled),
.pxf-tool-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
}

.pxf-tool-btn.active {
    background: var(--accent);
    color: #fff;
}

.pxf-tool-btn:disabled {
    opacity: 0.2;
}

.pxf-live-tool {
    color: var(--accent) !important;
    font-weight: 700 !important;
}

.pxf-live-tool:hover,
.pxf-live-tool.active {
    background: var(--accent) !important;
    color: #fff !important;
}

.pxf-toolbar__divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

.pxf-desktop-only {
    display: flex;
}

.pxf-mobile-only {
    display: none !important;
}

.pxf-zoom-info {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(10, 10, 10, 0.75);
    color: var(--muted);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    border: 1px solid var(--border);
    border-radius: 500px;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pxf-shortcuts {
    position: absolute;
    bottom: 76px;
    right: 16px;
    background: rgba(10, 10, 10, 0.96);
    color: var(--fg);
    padding: 16px 18px;
    font-size: 12px;
    line-height: 1.9;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 220px;
    display: none;
    z-index: 110;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pxf-shortcuts.visible {
    display: block;
}

.pxf-shortcuts h4 {
    color: var(--accent);
    margin-bottom: 8px;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.pxf-shortcuts kbd {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 11px;
    border: 1px solid var(--border);
}

.pxf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 10, 0.92);
    color: var(--accent);
    padding: 14px 32px;
    border: 1px solid rgba(255, 77, 0, 0.3);
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 200;
    display: none;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.pxf-loading.visible {
    display: block;
}

.pxf-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 600;
    touch-action: auto;
}

.pxf-sheet-backdrop.visible {
    display: block;
}

.pxf-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    z-index: 610;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    max-height: 72vh;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    touch-action: auto;
}

.pxf-sheet.open {
    transform: translateY(0);
}

.pxf-sheet__handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 12px auto 6px;
    flex-shrink: 0;
}

.pxf-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pxf-sheet__close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    font-family: var(--font);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    cursor: none;
}

.pxf-sheet__close:hover {
    background: var(--accent);
    color: #fff;
}

.pxf-sheet__body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px 8px;
    gap: 10px;
}

.pxf-live-canvas {
    max-width: 100%;
    max-height: calc(62vh - 90px);
    image-rendering: pixelated;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: block;
}

.pxf-sheet__info {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    flex-shrink: 0;
}

.pxf-toast {
    position: fixed;
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(10, 10, 10, 0.95);
    color: var(--fg);
    padding: 9px 20px;
    border: 1px solid var(--border);
    border-radius: 500px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.pxf-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

body:has(.pxf-canvas-area.grabbing) .cursor {
    transform: translate(-50%, -50%) scale(1.5);
    transition: transform 0.15s ease;
}

body:has(.pxf-canvas-area.crop-mode) .cursor {
    width: 4px !important;
    height: 4px !important;
    border: 1.5px solid var(--accent);
    background: transparent;
    border-radius: 0;
    transform: translate(-50%, -50%);
}

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --pxf-panel-w: 250px;
    }

    .pxf-section {
        padding: 16px 18px;
    }

    .pxf-pattern-lib {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1400px) {
    :root {
        --pxf-panel-w: 340px;
    }

    .pxf-section {
        padding: 22px 28px;
    }
}

@media (max-width: 768px) {

    .pxf-shell {
        top: 0;
        left: 0;
    }

    .pxf-panel {
        top: 0;
        width: min(82vw, 280px);
        z-index: 500;
        transform: translateX(-110%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border);
    }

    .pxf-panel.open {
        transform: translateX(0);
        box-shadow: 24px 0 48px rgba(0, 0, 0, 0.7);
    }

    .pxf-panel.transparent {
        opacity: 0.08;
        pointer-events: none;
    }

    .pxf-panel.transparent .pxf-panel__inner {
        pointer-events: auto;
    }

    .pxf-panel__inner {
        padding-top: max(28px, env(safe-area-inset-top));
        padding-bottom: max(100px, env(safe-area-inset-bottom));
        scrollbar-width: none;
    }

    .pxf-panel__inner::-webkit-scrollbar {
        display: none;
    }

    .pxf-panel__mobile-header {
        display: flex;
    }

    .pxf-section {
        padding: 12px 18px;
    }

    .pxf-app-header {
        padding: max(72px, calc(60px + env(safe-area-inset-top))) 14px 10px;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
    }

    .pxf-menu-toggle {
        display: flex;
        flex-shrink: 0;
        align-self: flex-start;
    }

    .pxf-app-header__right {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        flex: 1;
        min-width: 0;
    }

    .pxf-dim-info {
        font-size: 10px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .preview-notice {
        font-size: 10px;
        padding: 2px 8px;
    }

    .pxf-toolbar {
        position: fixed;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        transform: none;
        max-width: none;
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
        border-radius: 10px;
        padding: 4px;
        gap: 2px;
    }

    .pxf-toolbar::-webkit-scrollbar {
        display: none;
    }

    .pxf-tool-btn {
        font-size: 11px;
        padding: 8px 12px;
        min-height: 36px;
        flex-shrink: 0;
    }

    .pxf-desktop-only {
        display: none !important;
    }

    .pxf-mobile-only {
        display: flex !important;
    }

    .pxf-toolbar__divider {
        display: none;
    }

    .pxf-zoom-info {
        top: 10px;
        right: 10px;
        font-size: 10px;
    }

    .pxf-toast {
        bottom: 70px;
    }

    .pxf-placeholder {
        padding: 28px 20px;
        min-width: 170px;
        max-width: 78%;
    }

    .crop-handle {
        width: 20px;
        height: 20px;
    }

    .crop-handle.nw {
        top: -10px;
        left: -10px;
    }

    .crop-handle.ne {
        top: -10px;
        right: -10px;
    }

    .crop-handle.sw {
        bottom: -10px;
        left: -10px;
    }

    .crop-handle.se {
        bottom: -10px;
        right: -10px;
    }

}

@media (max-height: 500px) and (orientation: landscape) {
    .pxf-panel__inner {
        padding-top: max(46px, env(safe-area-inset-top));
        padding-bottom: max(60px, env(safe-area-inset-bottom));
    }

    .pxf-toolbar {
        position: fixed;
        bottom: max(4px, env(safe-area-inset-bottom));
        left: max(4px, env(safe-area-inset-left));
        right: max(4px, env(safe-area-inset-right));
        transform: none;
        max-width: none;
        overflow-x: auto;
        scrollbar-width: none;
        padding: 3px;
        gap: 2px;
    }

    .pxf-toolbar::-webkit-scrollbar {
        display: none;
    }

    .pxf-tool-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-height: 26px;
        flex-shrink: 0;
    }

    .pxf-zoom-info {
        top: 4px;
        right: 4px;
    }

    .pxf-sheet {
        max-height: 88vh;
    }

    .pxf-live-canvas {
        max-height: calc(80vh - 70px);
    }
}