.viewer-page {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
    min-height: 100vh;
}

body.is-resizing-sidebar {
    cursor: col-resize;
    user-select: none;
}

.viewer-shell {
    min-height: 100vh;
}

.viewer-stage {
    min-height: 60vh;
}

.viewer-sidebar {
    --viewer-sidebar-width: 320px;
    position: relative;
    width: var(--viewer-sidebar-width);
    min-width: 260px;
    max-width: 540px;
    transition: transform 0.25s ease, max-height 0.25s ease, opacity 0.25s ease;
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 100%;
    border: none;
    padding: 0;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.18) 18%, rgba(148, 163, 184, 0.18) 82%, rgba(148, 163, 184, 0) 100%);
    cursor: col-resize;
    z-index: 3;
}

.sidebar-resize-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 44px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.8);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.92);
}

.sidebar-resize-handle:hover::before,
.sidebar-resize-handle:focus-visible::before {
    background: #2563eb;
}

.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    backdrop-filter: blur(16px);
}

.mobile-topbar-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 12px;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-topbar-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.mobile-topbar-btn svg {
    width: 22px;
    height: 22px;
}

.mobile-topbar-btn.is-active {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.mobile-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(6px);
}

.mobile-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    padding: 12px 16px 24px;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.985) 0%, rgba(246,249,252,0.99) 100%);
    box-shadow: 0 -24px 60px rgba(15, 23, 42, 0.22);
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    backdrop-filter: blur(18px);
}

.mobile-menu-handle {
    width: 62px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 100%);
    margin: 0 auto 14px;
}

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

.mobile-menu-close {
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    padding: 8px 0;
}

.mobile-menu-item {
    width: 100%;
    text-align: start;
    border: none;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    padding: 14px 16px;
    border-radius: 16px;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.18);
}

.mobile-menu-item:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}

.mobile-menu-section {
    padding: 2px 2px 8px;
}

.mobile-menu-section + .mobile-menu-section {
    margin-top: 4px;
}

.mobile-menu-section-title {
    margin: 2px 8px 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.mobile-menu-chip-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.mobile-menu-chip-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-chip-btn {
    min-height: 40px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 10px;
    transition: all 0.2s ease;
}

.mobile-chip-btn.is-active {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.mobile-info-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    padding: 12px 16px 26px;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.985) 0%, rgba(246,249,252,0.99) 100%);
    box-shadow: 0 -24px 60px rgba(15, 23, 42, 0.22);
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    backdrop-filter: blur(18px);
    direction: ltr;
}

.mobile-info-handle {
    width: 62px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 100%);
    margin: 0 auto 14px;
}

.mobile-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    direction: ltr;
}

.mobile-info-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.82));
    color: #fff;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
}

.mobile-info-kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
    margin-bottom: 6px;
}

.mobile-info-hero strong {
    font-size: 17px;
    line-height: 1.3;
}

.mobile-info-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
    font-size: 12px;
    font-weight: 800;
}

.mobile-info-close {
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    padding: 8px 0;
}

.mobile-info-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(226,232,240,0.9);
    border-radius: 22px;
    padding: 10px 12px;
}

.mobile-info-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    min-height: 88px;
    padding: 14px 4px;
    border-bottom: none;
    border-radius: 14px;
    background: rgba(255,255,255,0.88);
    box-shadow: inset 0 0 0 1px rgba(226,232,240,0.85);
    direction: ltr;
}

.mobile-info-row span {
    color: #64748b;
    font-size: 14px;
    text-align: left;
}

.mobile-info-row strong {
    color: #111827;
    font-size: 14px;
    text-align: left;
    line-height: 1.4;
    word-break: break-word;
}

.mobile-info-row-primary {
    background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.55);
}

.mobile-info-row-primary span {
    color: #2563eb;
    font-weight: 700;
}

.mobile-info-row-primary strong {
    color: #0f172a;
    font-size: 15px;
}

.mobile-info-legend {
    margin-top: 12px;
    padding: 14px 12px 0;
    border-top: 1px solid rgba(226, 232, 240, 0.88);
}

.mobile-info-subheading {
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-color-legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.mobile-color-legend-empty {
    grid-column: 1 / -1;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: #64748b;
    font-size: 13px;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.72);
}

.mobile-color-card {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.68);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-color-card .color-legend-swatch {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.mobile-color-meta {
    min-width: 0;
}

.mobile-color-card strong {
    color: #0f172a;
    font-size: 12px;
    line-height: 1.2;
}

.mobile-color-stitches {
    display: block;
    color: #64748b;
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
}

.color-legend-panel {
    padding: 16px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.78);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.04);
}

.color-legend-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.color-legend-header h4 {
    margin: 0;
    color: #0f172a;
    font-size: 15px;
    font-weight: 800;
}

.color-legend-summary {
    color: #64748b;
    font-size: 12px;
    text-align: right;
}

.color-legend-list {
    display: grid;
    gap: 8px;
}

.color-legend-layout {
    display: grid;
    gap: 12px;
    align-items: start;
}

.color-editor-slot {
    display: none;
    min-width: 0;
}

.color-legend-panel.has-editor .color-editor-slot {
    display: block;
}

.color-legend-empty {
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    border: 1px dashed rgba(203, 213, 225, 0.9);
}

.color-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(226, 232, 240, 0.68);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 46px;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.color-legend-item:hover,
.mobile-color-card:hover {
    transform: translateY(-1px);
    border-color: rgba(147, 197, 253, 0.9);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.06);
}

.color-legend-item.is-selected,
.mobile-color-card.is-selected {
    border-color: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
}

.color-legend-swatch {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.color-legend-meta {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.color-legend-seq {
    display: block;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-legend-stitches {
    display: block;
    color: #64748b;
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
    flex: 0 0 auto;
}

.color-editor-panel {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(18px);
    box-sizing: border-box;
    overflow: hidden;
}

.color-editor-slot .color-editor-panel {
    position: sticky;
    top: 12px;
}

.color-editor-panel.is-inline-mobile {
    margin-top: 10px;
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .color-legend-panel.has-editor .color-legend-layout {
        grid-template-columns: minmax(0, 1fr) 284px;
        align-items: start;
    }
}

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

.color-editor-close {
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 12px;
}

.color-editor-body {
    display: grid;
    gap: 12px;
}

.color-editor-wheel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 0;
}

.color-editor-input {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    border: none;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.color-editor-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-editor-input::-webkit-color-swatch {
    border: 3px solid rgba(255,255,255,0.88);
    border-radius: 999px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.color-editor-meta {
    display: grid;
    gap: 4px;
}

.color-editor-seq {
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
}

.color-editor-value {
    color: #64748b;
    font-size: 13px;
    font-family: Consolas, "Courier New", monospace;
}

.color-editor-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.color-harmony-panel {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.color-harmony-header {
    display: grid;
    gap: 3px;
}

.color-harmony-header strong {
    font-size: 13px;
    color: #0f172a;
}

.color-harmony-header span {
    font-size: 11px;
    line-height: 1.45;
    color: #64748b;
}

.color-harmony-list {
    display: grid;
    gap: 8px;
}

.color-harmony-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(248, 250, 252, 0.86);
}

.color-harmony-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.color-harmony-name {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b;
}

.color-harmony-angles {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

.color-harmony-swatches {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.color-harmony-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255,255,255,0.92);
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.10);
    cursor: pointer;
}

.color-harmony-swatch:hover,
.color-harmony-swatch:focus-visible {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
}

.color-harmony-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.color-harmony-apply {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.color-harmony-note {
    font-size: 11px;
    color: #64748b;
}

.color-editor-action-btn {
    min-height: 40px;
    border: 1px solid rgba(219, 228, 240, 0.9);
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.color-editor-action-btn:hover {
    border-color: rgba(147, 197, 253, 0.9);
    background: #eff6ff;
    color: #1d4ed8;
}

.color-editor-action-btn-primary {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.14);
}

@media (min-width: 768px) {
    .color-editor-panel {
        padding: 14px;
    }

    .color-editor-actions {
        grid-template-columns: 1fr;
    }
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: #2563eb;
    background-color: #eff6ff;
    transform: scale(1.01);
}

#canvas-container {
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.72), rgba(255,255,255,0) 42%),
        repeating-linear-gradient(0deg, rgba(161, 173, 190, 0.06), rgba(161, 173, 190, 0.06) 1px, transparent 1px, transparent 8px),
        repeating-linear-gradient(90deg, rgba(161, 173, 190, 0.04), rgba(161, 173, 190, 0.04) 1px, transparent 1px, transparent 8px),
        linear-gradient(180deg, #ebeef2 0%, #dde4ea 100%);
    cursor: grab;
    touch-action: pan-y;
    overflow: hidden;
}

#canvas-container::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#canvas-container.bg-linen {
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.82), rgba(255,255,255,0) 40%),
        repeating-linear-gradient(0deg, rgba(124, 96, 62, 0.045), rgba(124, 96, 62, 0.045) 1px, transparent 1px, transparent 9px),
        repeating-linear-gradient(90deg, rgba(124, 96, 62, 0.03), rgba(124, 96, 62, 0.03) 1px, transparent 1px, transparent 9px),
        linear-gradient(180deg, #f3ede2 0%, #e8ddce 100%);
}

#canvas-container.bg-canvas {
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.72), rgba(255,255,255,0) 36%),
        linear-gradient(180deg, rgba(123, 92, 49, 0.06), rgba(123, 92, 49, 0.02)),
        linear-gradient(135deg, #ddd0bd 0%, #cbb69a 100%);
}

#canvas-container.bg-canvas::before {
    opacity: 1;
    background:
        repeating-linear-gradient(45deg, rgba(95, 71, 34, 0.035), rgba(95, 71, 34, 0.035) 2px, transparent 2px, transparent 12px),
        repeating-linear-gradient(-45deg, rgba(255,255,255,0.05), rgba(255,255,255,0.05) 2px, transparent 2px, transparent 14px);
}

#canvas-container.bg-plain {
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.72), rgba(255,255,255,0) 40%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

#canvas-container.bg-dark {
    background:
        radial-gradient(circle at top, rgba(96, 165, 250, 0.12), rgba(96, 165, 250, 0) 28%),
        linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

.grid-overlay {
    position: absolute;
    inset: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    border-radius: 20px;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: center center;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.grid-overlay.is-visible {
    opacity: 1;
}

#canvas-container.is-flat {
    background-image: none;
}

#embroideryCanvas {
    max-width: 100%;
    max-height: 100%;
}

.viewer-action-btn {
    min-height: 42px;
    padding: 10px 14px;
    font-weight: 600;
}

.background-preset,
.export-mode-btn,
.format-mode-btn,
.render-mode-btn {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.background-preset:hover,
.export-mode-btn:hover,
.format-mode-btn:hover,
.render-mode-btn:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.background-preset.is-active,
.export-mode-btn.is-active,
.format-mode-btn.is-active,
.render-mode-btn.is-active {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.viewer-zoom-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    min-width: 72px;
    text-align: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    color: #0f172a;
    font-weight: 700;
}

.mobile-bottom-toolbar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 42;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-radius: 24px;
    background: rgba(10, 15, 25, 0.88);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
}

.mobile-toolbar-btn {
    flex: 1;
    min-height: 52px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.06));
    color: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.mobile-toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.mobile-toolbar-btn:active {
    transform: translateY(1px);
}

.absolute.bottom-6.left-6 {
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
}

.absolute.bottom-6.left-6 button {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.absolute.bottom-6.left-6 button svg {
    width: 24px;
    height: 24px;
}

.canvas-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 24px;
}

.canvas-empty-state.is-hidden {
    display: none;
}

.canvas-empty-card {
    max-width: 360px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    text-align: center;
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.canvas-empty-card strong {
    color: #0f172a;
    font-size: 1rem;
}

.sample-note {
    line-height: 1.6;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

html[dir="rtl"] .mobile-topbar-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .mobile-menu {
    direction: rtl;
}

html[dir="rtl"] .viewer-zoom-badge {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .mobile-info-header,
html[dir="rtl"] .mobile-info-row {
    direction: rtl;
}

html[dir="ltr"] .mobile-info-sheet,
html[dir="ltr"] .mobile-info-header,
html[dir="ltr"] .mobile-info-row {
    direction: ltr;
}

html[dir="ltr"] .mobile-menu,
html[dir="ltr"] .mobile-menu-header,
html[dir="ltr"] .mobile-color-card,
html[dir="ltr"] .color-legend-item {
    direction: ltr;
}

@media (max-width: 767px) {
    .viewer-sidebar {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .sidebar-resize-handle {
        display: none;
    }

    .viewer-page {
        overflow-y: auto;
    }

    .viewer-shell {
        min-height: 100vh;
    }

    .viewer-stage {
        min-height: 100vh;
    }

    #canvas-container {
        min-height: 100vh;
        padding-top: 56px;
        padding-bottom: 92px;
    }

    .viewer-action-btn {
        min-height: 52px;
        font-size: 15px;
    }

    .viewer-zoom-badge {
        top: 12px;
        left: 12px;
        min-width: 66px;
        padding: 10px 14px;
        font-size: 14px;
    }

    .absolute.bottom-6.left-6 {
        display: none;
    }

    .mobile-bottom-toolbar {
        display: flex;
    }

    html[dir="rtl"] .viewer-zoom-badge {
        left: auto;
        right: 12px;
    }

    .viewer-actions-grid {
        grid-template-columns: 1fr;
    }

    .mobile-menu-item {
        padding: 14px 12px;
        font-size: 15px;
    }

    .mobile-menu {
        max-height: calc(100vh - 86px);
        overflow-y: auto;
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }

    .mobile-info-sheet {
        max-height: calc(100vh - 86px);
        overflow-y: auto;
        padding-bottom: 104px;
    }

    .mobile-info-close {
        font-size: 15px;
    }

    .mobile-info-row span,
    .mobile-info-row strong {
        font-size: 15px;
    }

    .mobile-color-legend {
        grid-template-columns: 1fr;
    }

    .color-editor-panel {
        margin-top: 10px;
        border-radius: 24px;
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
    }

    .color-editor-wheel-wrap {
        justify-content: space-between;
    }

    .color-harmony-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-overlay {
        inset: 14px;
        border-radius: 16px;
        background-size: 24px 24px;
    }
}
