        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        html, body { width: 100%; height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: white; overflow: hidden; overscroll-behavior: none; overscroll-behavior-y: none; }
        body { display: flex; flex-direction: column; touch-action: manipulation; }
        .topbar { display: flex; align-items: center; justify-content: center; padding: 12px 8px; gap: 4px; background: #f5f5f5; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; flex-wrap: wrap; }
        .topbar > .spacer { display: none; }
        .icon-btn { width: 44px; height: 44px; border-radius: 50%; background: white; border: 2px solid #999; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: transform 0.2s; color: #333; }
        .icon-btn:active { transform: scale(0.95); }
        .icon-btn.scribble { background: #2a2a2a; color: white; border: 2px solid #2a2a2a; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; line-height: 1.1; letter-spacing: -0.5px; }
        .brand-button-label { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; letter-spacing: 0; }
        .icon-btn.color .color-drop { width: 20px; height: 24px; }
        .spacer { flex: 1; }
        .menu-btn { width: 44px; height: 44px; border-radius: 50%; background: white; border: 2px solid #999; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
        .menu-dot { width: 3px; height: 3px; background: #333; border-radius: 50%; }
        .canvas-area { flex: 1; width: 100vw; height: 100dvh; display: flex; justify-content: center; align-items: center; background: #f9f9f9; overflow: hidden; overscroll-behavior: none; touch-action: none; padding: 10px; position: relative; }
        canvas { border: 2px solid #ccc; background: white; cursor: crosshair; touch-action: none; display: block; position: relative; }
        #imageOverlayCanvas { position: fixed; pointer-events: none; z-index: 20; border: none; background: transparent; }
        .symbol-stamp-preview { position: fixed; z-index: 21; box-sizing: border-box; border: 2px dashed #ff1744; pointer-events: none; background: transparent; }
        .symbol-stamp-preview canvas { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
        body.home-mode .canvas-area > canvas,
        body.home-sheet-open .canvas-area > canvas,
        body.home-shell-open .canvas-area > canvas { opacity: 0; pointer-events: none; }
        .home-screen {
            position: absolute;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 18px;
            z-index: 24;
            pointer-events: auto;
            touch-action: manipulation;
        }
        body.home-mode .home-screen,
        body.home-sheet-open .home-screen,
        body.home-shell-open .home-screen { display: flex; }
        .home-layout {
            width: min(1040px, calc(100vw - 144px));
            height: min(680px, calc(100dvh - 72px));
            display: grid;
            grid-template-columns: minmax(228px, 300px) minmax(0, 1fr);
            gap: 22px;
            align-items: stretch;
            justify-items: stretch;
            margin: 0 auto;
        }
        .home-actions {
            display: flex;
            flex-direction: column;
            gap: 16px;
            min-width: 0;
        }
        .home-tile {
            min-height: 112px;
            width: 100%;
            border: none;
            border-radius: 26px;
            background: rgba(255,255,255,0.86);
            box-shadow: 0 18px 44px rgba(0,0,0,0.08);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            padding: 16px 18px;
            text-align: left;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 14px;
            transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
        }
        .home-tile:hover { transform: translateY(-1px); box-shadow: 0 22px 50px rgba(0,0,0,0.11); background: rgba(255,255,255,0.94); }
        .home-tile:active { transform: translateY(0) scale(0.99); }
        .home-tile-icon {
            width: 46px;
            height: 46px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(42,42,42,0.95);
            color: white;
            font-size: 24px;
            line-height: 1;
            flex: 0 0 auto;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
        }
        .home-tile-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
        .home-tile-title {
            font-size: 18px;
            font-weight: 650;
            letter-spacing: -0.02em;
            color: #111;
        }
        .home-tile-subtitle {
            font-size: 12px;
            color: #666;
            line-height: 1.35;
        }
        .home-preview-card {
            border-radius: 30px;
            background: rgba(255,255,255,0.84);
            box-shadow: 0 20px 56px rgba(0,0,0,0.09);
            backdrop-filter: blur(22px);
            -webkit-backdrop-filter: blur(22px);
            padding: 18px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            min-width: 0;
            min-height: 0;
            cursor: pointer;
            transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
            outline: none;
            user-select: none;
        }
        .home-preview-card:hover {
            transform: translateY(-1px);
            background: rgba(255,255,255,0.92);
            box-shadow: 0 24px 64px rgba(0,0,0,0.11);
        }
        .home-preview-card:active {
            transform: translateY(0) scale(0.995);
        }
        .home-preview-card:focus-visible {
            box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25), 0 20px 56px rgba(0,0,0,0.09);
        }
        .home-preview-copy {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 2px 2px 0;
        }
        .home-preview-kicker {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #7f7f7f;
        }
        .home-preview-title {
            font-size: clamp(24px, 2.4vw, 38px);
            line-height: 1.04;
            font-weight: 700;
            letter-spacing: -0.04em;
            color: #111;
        }
        .home-preview-subtitle {
            font-size: 14px;
            line-height: 1.4;
            color: #666;
        }
        .home-preview-frame {
            flex: 1;
            min-height: 0;
            border-radius: 26px;
            background: linear-gradient(180deg, rgba(248,248,248,0.95), rgba(243,243,243,0.9));
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 18px;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
        }
        .home-preview-frame img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
            border-radius: 22px;
        }
        .canvas-zoom-controls { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 180; width: 64px; max-height: calc(100dvh - 40px); overflow: visible; padding: 2px 10px; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y; isolation: isolate; transform: translateZ(0); backface-visibility: hidden; }
        .canvas-zoom-controls::-webkit-scrollbar { display: none; }
        .canvas-zoom-controls.collapsed { top: auto !important; bottom: 20px !important; max-height: 44px; overflow: visible; }
        .canvas-zoom-controls.collapsed > :not(#canvasToolsToggle) { display: none !important; }
        .canvas-tool-scroll { display: flex; flex-direction: column; gap: 8px; width: 64px; margin: 0 -10px; align-items: center; max-height: calc(100dvh - 88px); overflow-y: auto; overflow-x: visible; overscroll-behavior: contain; scrollbar-width: none; padding: 2px 10px 10px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
        .canvas-tool-scroll::-webkit-scrollbar { display: none; }
        .canvas-tools-toggle { position: relative; z-index: 4; background: rgba(255, 255, 255, 0.98); }
        .canvas-zoom-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; flex: 0 0 40px; aspect-ratio: 1 / 1; border-radius: 50%; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; color: #333; transition: all 0.2s; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
        .canvas-zoom-btn:active { transform: scale(0.9); }
        .canvas-zoom-btn:hover { background: rgba(255, 255, 255, 1); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
        .canvas-zoom-btn.active { background: rgba(42, 42, 42, 0.95) !important; color: white !important; border-color: rgba(42, 42, 42, 0.95) !important; }
        .grid-size-btn { width: 40px; height: 40px !important; border-radius: 50% !important; text-align: center; border: 1px solid rgba(0, 0, 0, 0.2) !important; }
        .grid-size-btn::-webkit-outer-spin-button, .grid-size-btn::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        .grid-size-btn[type=number] { -moz-appearance: textfield; }
        .mobile-history-controls { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 185; display: none; gap: 10px; align-items: center; pointer-events: auto; }
        .mobile-history-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; flex: 0 0 40px; aspect-ratio: 1 / 1; border-radius: 50%; background: rgba(255,255,255,0.9); border: 1px solid rgba(0,0,0,0.2); color: #333; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.1); cursor: pointer; transition: transform 0.2s, opacity 0.2s; }
        .mobile-history-btn:active { transform: scale(0.92); }
        .polyline-controls { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 186; display: none; gap: 8px; align-items: center; padding: 6px; border-radius: 999px; background: rgba(255,255,255,0.94); border: 1px solid rgba(0,0,0,0.14); box-shadow: 0 8px 24px rgba(0,0,0,0.14); pointer-events: auto; }
        .polyline-controls.active { display: flex; }
        .polyline-control-btn { min-width: 54px; height: 34px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.18); background: #fff; color: #2a2a2a; font-size: 12px; font-weight: 700; padding: 0 12px; }
        .polyline-control-btn.active { background: rgba(42,42,42,0.95); color: #fff; border-color: rgba(42,42,42,0.95); }
        .bottom-sheet { position: fixed; bottom: 0; left: 0; right: 0; background: white; border-radius: 16px 16px 0 0; padding: 16px; box-shadow: 0 -2px 16px rgba(0,0,0,0.1); z-index: 220; max-height: 80vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.3s ease-out; display: none; }
        .bottom-sheet.active { display: block; transform: translateY(0); }
        body.large-canvas-ui .bottom-sheet { display: block; visibility: hidden; pointer-events: none; transition: none !important; }
        body.large-canvas-ui .bottom-sheet.active { visibility: visible; pointer-events: auto; }
        .sheet-header { text-align: center; margin-bottom: 16px; font-size: 16px; font-weight: 600; color: #333; }
        .lighting-sheet { z-index: 230; }
        .lighting-minimized-toggle { position: fixed; left: max(12px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); z-index: 231; border: 1px solid rgba(0,0,0,0.18); border-radius: 999px; background: rgba(42,42,42,0.96); color: #fff; cursor: pointer; font-size: 12px; font-weight: 700; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
        .lighting-minimized-toggle:active { transform: translateY(-50%) scale(0.96); }
        .lighting-stage-note { background: #f5f6fa; border-radius: 10px; color: #5c6068; font-size: 14px; line-height: 1.45; padding: 12px; margin-bottom: 14px; }
        .lighting-panel-section { border-bottom: 1px solid #ececec; }
        .lighting-section-title { align-items: center; color: #666; cursor: pointer; display: flex; font-size: 12px; font-weight: 700; justify-content: space-between; letter-spacing: 1.4px; list-style: none; margin: 0; padding: 13px 4px 10px; text-transform: uppercase; }
        .lighting-section-title::-webkit-details-marker { display: none; }
        .lighting-section-title::after { color: #777; content: '+'; font-size: 17px; font-weight: 400; line-height: 1; }
        .lighting-panel-section[open] > .lighting-section-title::after { content: '\2212'; }
        .lighting-section-content { padding-bottom: 4px; }
        .lighting-panel-section:not([open]) .lighting-section-content { display: none; }
        .lighting-stage-list { border-top: 1px solid #ececec; color: #333; font-size: 14px; }
        .lighting-stage-list div { border-bottom: 1px solid #ececec; padding: 11px 4px; }
        .lighting-layer-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; }
        .lighting-stage-list > .lighting-layer-controls { border-bottom: 0; padding: 10px 0; }
        .lighting-layer-controls .lighting-layer-control { align-items: center; background: #fafbfc; border: 1px solid #dfe3e8; border-radius: 8px; box-sizing: border-box; color: #252a30; display: flex; min-height: 42px; padding: 8px 10px; }
        .lighting-layer-controls .lighting-layer-toggle { cursor: pointer; font-weight: 600; gap: 10px; }
        .lighting-layer-controls .lighting-layer-toggle input[type="checkbox"] { flex: 0 0 18px; height: 18px; margin: 0; width: 18px; }
        .lighting-layer-controls .lighting-range-control { display: grid; gap: 10px; grid-template-columns: minmax(94px, 1fr) minmax(90px, 1.5fr) 44px; }
        .lighting-layer-controls .lighting-range-control span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .lighting-layer-controls .lighting-range-control input[type="range"] { min-width: 0; width: 100%; }
        .lighting-layer-controls .lighting-range-control output { flex: none; width: auto; }
        .lighting-primary-action, .lighting-secondary-action, .lighting-close-btn { appearance: none; box-sizing: border-box; cursor: pointer; display: block; min-height: 44px; text-align: center; transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease; width: 100%; }
        .lighting-primary-action { background: #2b2b2b; border: 1px solid #2b2b2b; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.16); color: #fff; font-size: 14px; font-weight: 700; padding: 11px 14px; }
        .lighting-secondary-action { background: #fff; border: 1px solid #aeb5bd; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); color: #252a30; font-size: 13px; font-weight: 700; margin-top: 10px; padding: 9px 12px; }
        .lighting-primary-action:hover, .lighting-secondary-action:hover, .lighting-close-btn:hover { border-color: #1769e0; box-shadow: 0 3px 8px rgba(23,105,224,0.18); }
        .lighting-primary-action:hover { background: #1f1f1f; }
        .lighting-secondary-action:hover { background: #f7faff; }
        .lighting-primary-action:focus-visible, .lighting-secondary-action:focus-visible, .lighting-close-btn:focus-visible { outline: 3px solid rgba(23,105,224,0.28); outline-offset: 2px; }
        .lighting-primary-action:active, .lighting-secondary-action:active, .lighting-close-btn:active { box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); transform: translateY(1px); }
        .lighting-status { border: 1px solid #e1e2e5; border-radius: 8px; color: #5c6068; font-size: 13px; line-height: 1.4; margin-top: 10px; padding: 10px; }
        .lighting-fields { border-top: 1px solid #ececec; margin-top: 10px; }
        .lighting-fields label { align-items: center; border-bottom: 1px solid #ececec; color: #333; display: flex; font-size: 13px; gap: 10px; justify-content: space-between; padding: 9px 4px; }
        .lighting-fields input, .lighting-fields select { border: 1px solid #d5d7db; border-radius: 6px; box-sizing: border-box; font-size: 13px; padding: 7px 8px; width: 118px; }
        .lighting-fields input[type="text"] { flex: 1 1 170px; max-width: min(280px, 62vw); min-width: 0; width: auto; }
        .lighting-fields select { flex: 1 1 220px; max-width: min(280px, 62vw); min-width: 0; }
        .lighting-fixture-scope { border-bottom: 1px solid #ececec; padding: 8px 4px 10px; }
        .lighting-scope-status { color: #666; font-size: 12px; line-height: 1.35; margin-top: 7px; }
        .lighting-secondary-action:disabled { cursor: default; opacity: 0.45; }
        .lighting-stage-list label { align-items: center; display: flex; gap: 8px; }
        .lighting-stage-list input[type="checkbox"] { accent-color: #1677d2; height: 16px; margin: 0; width: 16px; }
        .lighting-stage-list .lighting-range-control { gap: 8px; }
        .lighting-range-control span { flex: 1 1 auto; min-width: 0; }
        .lighting-range-control input[type="range"] { accent-color: #1677d2; flex: 1 1 100px; min-width: 78px; width: auto; }
        .lighting-range-control output { color: #666; flex: 0 0 38px; font-size: 12px; text-align: right; }
        .lighting-close-btn { background: #2b2b2b; border: 1px solid #2b2b2b; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.16); color: #fff; font-size: 14px; font-weight: 700; margin-top: 16px; padding: 11px 14px; }
        [data-lighting-entry].active { outline: 2px solid #1769e0; outline-offset: -2px; }
        .sheet-close { width: 36px; height: 4px; background: #ccc; border-radius: 2px; margin: 0 auto 12px; }
        .color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 20px 10px; }
        .color-option { width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer; transition: transform 0.2s; margin: 0 auto; }
        .color-option:active { transform: scale(0.9); }
        .size-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 20px; justify-items: center; }
        .size-option { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: none; border: none; padding: 10px; }
        .size-preview { width: 80px; height: 80px; background: #f0f0f0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
        .size-dot { background: #333; border-radius: 50%; }
        .size-label { font-size: 12px; color: #666; }
        .brush-edge-control { padding: 4px 20px 16px; }
        .brush-edge-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; color: #333; font-weight: 600; }
        #brushSoftnessLabel { color: #666; font-weight: 500; }
        #brushSoftnessSlider { width: 100%; accent-color: #2a2a2a; }
        .select-opacity-control { padding: 10px 16px 14px; border-bottom: 1px solid #f0f0f0; }
        .select-opacity-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; color: #333; font-weight: 600; }
        #selectionOpacityLabel { color: #666; font-weight: 500; }
        #selectionOpacitySlider { width: 100%; accent-color: #2a2a2a; }
        #selectionOpacitySlider:disabled { opacity: 0.35; }
        .menu-list { display: flex; flex-direction: column; gap: 0; }
        .menu-item { padding: 16px; border-bottom: 1px solid #f0f0f0; background: none; border: none; text-align: left; cursor: pointer; font-size: 16px; color: #333; }
        .menu-item:last-child { border-bottom: none; }
        .menu-item:active { background: #f5f5f5; }
        .choice-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 10px; }
        .choice-item {
            width: 100%;
            min-height: 62px;
            display: flex;
            align-items: center;
            gap: 12px;
            border: none;
            border-radius: 10px;
            background: #f5f5f5;
            color: #222;
            padding: 12px 14px;
            cursor: pointer;
            text-align: left;
            font: inherit;
        }
        .choice-item:active { background: #ececec; }
        .choice-icon {
            width: 34px;
            height: 34px;
            border-radius: 9px;
            background: white;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 34px;
            font-size: 18px;
            box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        }
        .choice-item strong {
            display: block;
            font-size: 16px;
            line-height: 1.15;
        }
        .choice-item small {
            display: block;
            margin-top: 3px;
            color: #666;
            font-size: 12px;
            line-height: 1.3;
        }
        .choice-note {
            margin: 4px 16px 0;
            padding: 10px 12px;
            border-radius: 8px;
            background: #f6f6f6;
            color: #666;
            font-size: 12px;
            line-height: 1.4;
        }
        .shortcut-hint { float: right; color: #999; font-size: 13px; font-weight: 500; margin-left: 12px; }
        .overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); z-index: 99; display: none; pointer-events: none; }
        .overlay.active { display: block; pointer-events: auto; }
        .app-notice {
            position: fixed;
            left: 50%;
            bottom: 88px;
            transform: translateX(-50%) translateY(12px);
            max-width: min(560px, calc(100vw - 32px));
            padding: 10px 14px;
            border-radius: 12px;
            background: rgba(42, 42, 42, 0.94);
            color: white;
            font-size: 13px;
            font-weight: 600;
            line-height: 1.35;
            white-space: pre-line;
            box-shadow: 0 10px 28px rgba(0,0,0,0.22);
            opacity: 0;
            pointer-events: none;
            z-index: 240;
            transition: opacity 0.16s ease, transform 0.16s ease;
        }
        .app-notice.visible {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        .dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 24px; border-radius: 12px; z-index: 101; min-width: 80%; max-width: 400px; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 24px rgba(0,0,0,0.2); display: none; }
        .dialog.active { display: block; }
        .dialog h2 { margin-bottom: 16px; font-size: 18px; }
        .dialog input { width: 100%; padding: 10px; margin-bottom: 16px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
        .dialog-buttons { display: flex; gap: 8px; }
        .dialog-btn { flex: 1; padding: 12px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; }
        .btn-ok { background: #2a2a2a; color: white; }
        .btn-cancel { background: #f0f0f0; color: #333; }
        .canvas-context-menu { position: fixed; width: 220px; min-width: 0; max-width: calc(100vw - 16px); box-sizing: border-box; background: rgba(255,255,255,0.98); border: 1px solid rgba(0,0,0,0.14); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); padding: 5px; z-index: 120; display: none; }
        .canvas-context-menu.active { display: block; }
        .canvas-context-item { width: 100%; padding: 7px 9px; border: none; background: transparent; border-radius: 5px; text-align: left; font-size: 13px; line-height: 1.25; color: #222; cursor: pointer; }
        .canvas-context-item:hover, .canvas-context-item:active { background: #f0f0f0; }
        .canvas-context-item:disabled { color: #aaa; cursor: default; background: transparent; }
        .canvas-options { display: grid; grid-template-columns: 1fr; gap: 0; }
        .canvas-option { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; background: none; border: none; text-align: left; cursor: pointer; font-size: 15px; color: #333; }
        .canvas-option:last-child { border-bottom: none; }
        .folder-btn { padding: 12px 16px; background: #f5f5f5; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 8px; text-align: left; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
        .folder-btn:hover { background: #efefef; }
        .folder-btn.active { background: #2a2a2a; color: white; border-color: #2a2a2a; }
        .grid-controls { position: fixed; bottom: 140px; left: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
        .grid-input { padding: 4px 6px; border: 1px solid #ccc; border-radius: 3px; font-size: 11px; width: 50px; text-align: center; }
        .menu-section { padding: 14px 16px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #777; background: #fafafa; border-bottom: 1px solid #f0f0f0; }
        .manual-sheet { max-height: 86vh; }
        .manual-content { display: flex; flex-direction: column; gap: 14px; padding: 0 4px 8px; color: #333; }
        .manual-section { border-bottom: 1px solid #eee; padding: 0 4px 12px; }
        .manual-section:last-child { border-bottom: none; padding-bottom: 0; }
        .manual-section h3 { font-size: 15px; margin-bottom: 8px; color: #222; }
        .manual-section p { font-size: 14px; line-height: 1.45; margin-bottom: 8px; color: #444; }
        .manual-section ul { margin-left: 18px; display: flex; flex-direction: column; gap: 6px; }
        .manual-section li { font-size: 14px; line-height: 1.4; }
        .manual-table { width: 100%; border-collapse: collapse; font-size: 13px; }
        .manual-table th, .manual-table td { border: 1px solid #e5e5e5; padding: 8px 10px; text-align: left; vertical-align: top; line-height: 1.35; }
        .manual-table th { background: #fafafa; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #444; }
        .manual-table tr:nth-child(even) td { background: #fcfcfc; }
        .manual-note { font-size: 13px; line-height: 1.4; color: #666; margin-top: 8px; }
        .desktop-toolkit, .desktop-only-menu { display: none; }
        @media (min-width: 900px), (orientation: landscape) {
            body { display: block; }
            .topbar { display: none; }
            .desktop-toolkit {
                display: flex;
                position: fixed;
                left: 14px;
                top: 14px;
                flex-direction: column;
                gap: 8px;
                z-index: 180;
                overflow: visible;
                max-height: none;
                isolation: isolate;
                transform: translateZ(0);
                backface-visibility: hidden;
            }
            .desktop-toolkit > .desktop-tool-btn:not(.desktop-tool-extra) {
                position: relative;
                z-index: 3;
                opacity: 1 !important;
                visibility: visible !important;
                flex: 0 0 58px;
            }
            .desktop-tool-scroll {
                display: flex;
                flex-direction: column;
                gap: 8px;
                width: 86px;
                margin-left: -14px;
                padding: 0 14px 14px;
                align-items: center;
                max-height: calc(100vh - 226px);
                max-height: calc(100dvh - 226px);
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                position: relative;
                z-index: 1;
            }
            .desktop-tool-scroll::-webkit-scrollbar { display: none; }
            .desktop-tool-btn {
                width: 58px;
                height: 58px;
                min-width: 58px;
                min-height: 58px;
                max-width: 58px;
                max-height: 58px;
                flex: 0 0 58px;
                aspect-ratio: 1 / 1;
                border: 1px solid rgba(0,0,0,0.16);
                border-radius: 50%;
                background: rgba(255,255,255,0.96);
                box-shadow: 0 4px 16px rgba(0,0,0,0.12);
                color: #222;
                cursor: pointer;
                font-size: 8px;
                font-weight: 700;
                letter-spacing: 0;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 3px;
                padding: 4px;
                text-align: center;
                line-height: 1.05;
            }
            .desktop-tool-btn.scribble { background: #2a2a2a; color: white; border-color: #2a2a2a; font-size: 10px; }
            .desktop-tool-btn:hover, .desktop-tool-btn.active { background: rgba(42,42,42,0.96); color: white; border-color: rgba(42,42,42,0.96); }
            .desktop-tool-btn .tool-icon { font-size: 16px; line-height: 1; }
            .desktop-toolkit-divider { width: 58px; height: 1px; min-height: 1px; flex: 0 0 1px; background: rgba(0,0,0,0.12); margin: 2px 0; }
            .desktop-toolkit:not(.expanded) .desktop-tool-extra { display: none; }
            .desktop-toolkit:not(.expanded) .desktop-tool-scroll { display: none; }
            .desktop-toolkit.expanded #desktopToolsToggleBtn { background: rgba(42,42,42,0.96); color: white; border-color: rgba(42,42,42,0.96); }
            .desktop-only-menu { display: block; }
            .desktop-tools-extra { display: none; }
            .canvas-zoom-controls { bottom: 20px; right: 20px; left: auto; top: auto; width: 64px; padding: 2px 10px; background: transparent; border: none; border-radius: 0; box-shadow: none; overflow: visible; max-height: calc(100dvh - 40px); }
            .canvas-tool-scroll { max-height: calc(100dvh - 88px); overflow-x: visible; }
            .canvas-zoom-btn { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
            .grid-size-btn { width: 40px; height: 40px !important; border-radius: 50% !important; }
            .canvas-area {
                width: 100vw;
                height: 100dvh;
                padding: 18px 18px 18px 104px;
                align-items: center;
                justify-content: center;
            }
            #pdfBar {
                position: static;
                border: none;
                box-shadow: none;
            }
            .bottom-sheet {
                left: 100px;
                right: auto;
                top: 14px;
                bottom: auto;
                width: min(340px, calc(100vw - 122px));
                max-height: calc(100vh - 28px);
                border-radius: 12px;
                padding: 10px;
                box-shadow: 0 12px 32px rgba(0,0,0,0.18);
                transform: translateX(-12px);
                transition: opacity 0.16s ease, transform 0.16s ease;
                opacity: 0;
                border: 1px solid rgba(0,0,0,0.12);
            }
            .bottom-sheet.active { transform: translateX(0); opacity: 1; }
            .manual-sheet { width: min(520px, calc(100vw - 122px)); }
            .sheet-close { width: 28px; height: 3px; margin-bottom: 10px; }
            .sheet-header { text-align: left; margin: 2px 6px 10px; font-size: 14px; }
            .lighting-sheet { width: min(360px, calc(100vw - 122px)); left: 0; right: auto; bottom: 12px; border-radius: 14px; max-height: calc(100dvh - 24px); transform: translateX(calc(-100% - 18px)); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease; }
            .lighting-sheet.active { transform: translateX(0); opacity: 1; }
            .menu-item { padding: 11px 12px; font-size: 14px; border-radius: 7px; border-bottom: none; }
            .menu-item:hover { background: #f5f5f5; }
            .menu-list { gap: 2px; }
            .color-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; padding: 10px 6px; }
            .color-option { width: 42px; height: 42px; }
            .size-options { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px 6px; }
            .size-preview { width: 54px; height: 54px; }
            .overlay.active { background: transparent; pointer-events: none; }
            #scaleDisplay { left: 104px !important; bottom: 18px !important; }
            .app-notice { bottom: 18px; left: calc(50% + 22px); }
        }
        @media (max-width: 899px) and (orientation: portrait) {
            .topbar { display: none; }
            .desktop-toolkit {
                display: flex;
                position: fixed;
                top: 8px;
                left: 8px;
                right: 8px;
                z-index: 180;
                gap: 8px;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 2px 0 8px;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
                touch-action: pan-x;
                scrollbar-width: none;
                isolation: isolate;
                transform: translateZ(0);
                backface-visibility: hidden;
            }
            .home-screen {
                padding: 74px 8px 8px;
            }
            .home-layout {
                width: calc(100vw - 16px);
                height: calc(100dvh - 84px);
                grid-template-columns: 1fr;
                grid-template-rows: minmax(0, 1fr) auto;
                grid-template-areas:
                    "preview"
                    "actions";
                gap: 12px;
            }
            .home-actions {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 10px;
                grid-area: actions;
            }
            .home-tile {
                min-height: 84px;
                border-radius: 22px;
                padding: 12px 10px;
                flex-direction: column;
                align-items: flex-start;
                justify-content: flex-start;
                gap: 10px;
            }
            .home-tile-icon {
                width: 36px;
                height: 36px;
                border-radius: 12px;
                font-size: 20px;
            }
            .home-tile-title {
                font-size: 14px;
                line-height: 1.1;
            }
            .home-tile-subtitle {
                font-size: 11px;
            }
            .home-preview-card {
                padding: 14px;
                border-radius: 24px;
                gap: 10px;
                grid-area: preview;
            }
            .home-preview-title {
                font-size: clamp(20px, 6vw, 30px);
            }
            .home-preview-subtitle {
                font-size: 13px;
            }
            .home-preview-frame {
                padding: 12px;
                border-radius: 20px;
            }
            .desktop-toolkit > .desktop-tool-btn:not(.desktop-tool-extra) {
                position: relative;
                z-index: 3;
                opacity: 1 !important;
                visibility: visible !important;
                flex: 0 0 54px;
            }
            .desktop-toolkit::-webkit-scrollbar { display: none; }
            .desktop-tool-scroll {
                display: flex;
                gap: 8px;
                width: auto;
                margin: 0;
                padding: 0;
                align-items: stretch;
                overflow: visible;
                max-height: none;
                scrollbar-width: none;
            }
            .desktop-tool-scroll::-webkit-scrollbar { display: none; }
            .desktop-tool-btn {
                width: 54px;
                height: 54px;
                min-width: 54px;
                min-height: 54px;
                max-width: 54px;
                max-height: 54px;
                flex: 0 0 54px;
                aspect-ratio: 1 / 1;
                border: 1px solid rgba(0,0,0,0.16);
                border-radius: 50%;
                background: rgba(255,255,255,0.96);
                box-shadow: 0 4px 16px rgba(0,0,0,0.12);
                color: #222;
                cursor: pointer;
                font-size: 7px;
                font-weight: 700;
                letter-spacing: 0;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 3px;
                padding: 4px;
                text-align: center;
                line-height: 1.05;
            }
            .desktop-tool-btn.scribble { background: #2a2a2a; color: white; border-color: #2a2a2a; font-size: 9px; }
            .desktop-tool-btn .tool-icon { font-size: 15px; line-height: 1; }
            .desktop-toolkit:not(.expanded) .desktop-tool-extra { display: none; }
            .desktop-toolkit:not(.expanded) .desktop-tool-scroll { display: none; }
            .desktop-toolkit.expanded #desktopToolsToggleBtn { background: rgba(42,42,42,0.96); color: white; border-color: rgba(42,42,42,0.96); }
            .desktop-toolkit-divider { display: none; }
            .desktop-only-menu { display: block; }
            .canvas-area {
                padding: 74px 8px 8px;
            }
            body.home-mode .canvas-area > canvas { display: none; }
            .canvas-zoom-controls {
                top: 72px;
                bottom: auto;
                right: 8px;
                width: 64px;
                max-height: calc(100dvh - 84px);
                overflow: visible;
            }
            .canvas-zoom-controls.collapsed {
                top: auto !important;
                bottom: 20px !important;
                right: 8px !important;
                max-height: 44px;
                overflow: visible;
            }
            .canvas-tool-scroll { max-height: calc(100dvh - 132px); }
            .bottom-sheet {
                left: 0;
                right: 0;
                top: auto;
                bottom: 0;
                width: auto;
                max-height: 78vh;
                border-radius: 16px 16px 0 0;
                transform: translateY(100%);
                opacity: 1;
            }
            .bottom-sheet.active { transform: translateY(0); opacity: 1; }
            .lighting-minimized-toggle { top: 112px; transform: none; }
            .lighting-minimized-toggle:active { transform: scale(0.96); }
        }
        @media (max-width: 600px) {
            .topbar { padding: 10px 6px; gap: 6px; }
            .icon-btn { width: 40px; height: 40px; font-size: 18px; }
            .canvas-area { padding: 74px 8px 8px; }
            .bottom-sheet { padding: 12px; }
            .lighting-sheet { width: calc(100vw - 24px); left: 12px; bottom: 12px; transform: translateY(calc(100% + 18px)); }
            .lighting-sheet.active { transform: translateY(0); }
            .color-grid { gap: 20px; padding: 16px 8px; }
            .size-options { padding: 16px; gap: 16px; }
            .size-preview { width: 70px; height: 70px; }
            .home-tile-subtitle { display: none; }
            .canvas-context-menu { width: 210px; }
            .canvas-context-item { font-size: 12px; padding: 7px 8px; }
        }
        @media (max-width: 899px) {
            .mobile-history-controls { display: flex; }
            body.home-mode .mobile-history-controls,
            body.home-sheet-open .mobile-history-controls,
            body.home-shell-open .mobile-history-controls { display: none; }
            #scaleDisplay { bottom: max(72px, calc(env(safe-area-inset-bottom) + 72px)) !important; }
        }
        @media (pointer: coarse) and (min-width: 900px) {
            .mobile-history-controls { display: flex; left: max(92px, calc(env(safe-area-inset-left) + 80px)); }
            body.home-mode .mobile-history-controls,
            body.home-sheet-open .mobile-history-controls,
            body.home-shell-open .mobile-history-controls { display: none; }
        }
        @media (pointer: coarse), (max-width: 899px) {
            #scaleDisplay {
                bottom: calc(max(12px, env(safe-area-inset-bottom)) + 56px) !important;
                left: max(12px, env(safe-area-inset-left)) !important;
                max-width: min(56vw, 300px);
                font-size: 11px !important;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                z-index: 240 !important;
            }
            body.app-notice-active #scaleDisplay { display: none !important; }
            .app-notice {
                bottom: calc(max(12px, env(safe-area-inset-bottom)) + 56px);
                left: max(96px, 10vw);
                right: max(84px, 12vw);
                max-width: none;
                max-height: min(30dvh, 220px);
                overflow-y: auto;
                overflow-wrap: anywhere;
                font-size: 11px;
                line-height: 1.3;
                padding: 8px 10px;
                transform: translateY(12px);
                z-index: 241;
            }
            .app-notice.visible { transform: translateY(0); }
        }
        @media (max-height: 700px), (max-width: 899px) {
            .canvas-zoom-controls {
                top: max(8px, env(safe-area-inset-top));
                bottom: auto;
                right: max(8px, env(safe-area-inset-right));
                width: 64px;
                max-height: calc(100dvh - 16px);
                overflow: visible;
            }
            .canvas-zoom-controls.collapsed {
                top: auto !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                right: max(8px, env(safe-area-inset-right)) !important;
                max-height: 44px;
                overflow: visible;
            }
            .canvas-tool-scroll {
                max-height: calc(100dvh - 64px);
                padding-bottom: max(10px, env(safe-area-inset-bottom));
            }
        }
        @media (max-width: 899px) and (orientation: portrait) {
            .canvas-zoom-controls {
                top: 72px;
                bottom: auto;
                right: 8px;
                width: 64px;
                max-height: calc(100dvh - 84px);
                overflow: visible;
            }
            .canvas-zoom-controls.collapsed {
                top: auto !important;
                bottom: max(12px, env(safe-area-inset-bottom)) !important;
                right: 8px !important;
                max-height: 44px;
                overflow: visible;
            }
            .canvas-tool-scroll { max-height: calc(100dvh - 132px); }
            .app-notice { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 56px); }
        }
        body.pdf-rendering .desktop-toolkit,
        body.pdf-rendering .canvas-zoom-controls {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateZ(0);
        }
        body.pdf-rendering .desktop-tool-btn,
        body.pdf-rendering .canvas-zoom-btn {
            transition: none !important;
        }
