        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        h1 {
            font-weight: 500;
        }
        
        body {
            font-family: 'Ubuntu', system-ui, -apple-system, sans-serif;
            background: none;
            min-height: 100svh;
            overflow-x: hidden;
        }

        /* UA 既定で button はフォントを継承しないことが多い */
        button,
        input,
        select,
        textarea {
            font-family: inherit;
        }
        
        .controls {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            justify-content: center;
            padding: 15px 20px;
            background: none;
        }
        
        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            color: white;
        }
        
        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        input[type="file"] {
            display: none;
        }
        
        .canvas-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
        }
        
        #collageCanvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: block;
        }

        #collageRockTitle {
            position: fixed;
            inset: 0;
            z-index: 5;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0;
            padding: 0;
            font-size: 10vw;
            color: #000;
            line-height: 1;
            pointer-events: none;
            visibility: hidden;
        }

        #collageRockTitle.visible {
            visibility: visible;
        }

        @media (orientation: landscape) {
            #collageRockTitle {
                font-size: 5vw;
            }
        }
        
        .bottom-panel {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 10;
            display: flex;
            flex-direction: column;
            background: none;
            overflow: visible;
        }

        #resetBtn {
            position: fixed;
            top: 12px;
            left: 12px;
            z-index: 20;
            width: 44px;
            height: 44px;
            padding: 0;
            border: none;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.4);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 0;
            visibility: hidden;
            pointer-events: none;
        }

        #resetBtn.visible {
            visibility: visible;
            pointer-events: auto;
        }

        #resetBtn .material-symbols-outlined {
            font-size: 24px;
            color: #000;
            font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
        }

        #downloadBtn {
            position: fixed;
            top: 12px;
            right: 12px;
            z-index: 20;
            width: 44px;
            height: 44px;
            padding: 0;
            border: none;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.4);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 0;
            visibility: hidden;
            pointer-events: none;
        }

        #downloadBtn.visible {
            visibility: visible;
            pointer-events: auto;
        }

        #downloadBtn .material-symbols-outlined {
            font-size: 24px;
            color: #1f1f1f;
            font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
        }

        .fab {
            width: 100%;
            height: 56px;
            border: none;
            border-radius: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
        }

        #addBtn {
            background: #000;
        }

        .fab .material-symbols-outlined {
            font-size: 28px;
            line-height: 1;
            display: inline-block;
            font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
            transition: transform 0.2s ease;
        }

        #fabMenu[data-open="true"] ~ #addBtn .material-symbols-outlined {
            transform: rotate(45deg);
        }

        .fab-menu {
            position: absolute;
            left: 0;
            bottom: 56px;
            width: 100%;
            z-index: 30;
            border-radius: 0.3em 0.3em 0 0;
            background: #000;
            color: #fff;
            overflow: hidden;
            box-shadow: 0 18px 40px rgba(0,0,0,0.35);
            padding-top: 20px;
            padding-bottom: 20px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px);
            pointer-events: none;
            transition:
                opacity 0.32s ease,
                transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0.36s;
        }

        .fab-menu[data-open="true"] {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            pointer-events: auto;
            transition:
                opacity 0.32s ease,
                transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s;
        }

        .fab-menu button {
            width: 100%;
            border: none;
            background: transparent;
            color: inherit;
            padding: 12px 14px;
            cursor: pointer;
            text-align: left;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 14px;
        }

        .fab-menu button:hover {
            background: #2a2a2a;
        }

        .fab-menu .material-symbols-outlined {
            font-size: 20px;
            opacity: 0.95;
            font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
        }

        @media (min-width: 768px) {
            #menuCamera {
                display: none;
            }
        }
        
        .preview-container {
            display: flex;
            flex-direction: row;
            gap: 12px;
            padding: 15px 20px;
            overflow-x: auto;
            overflow-y: hidden;
            flex-shrink: 0;
            scroll-snap-type: x mandatory;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
            scrollbar-color: rgba(140, 140, 140, 0.85) rgba(0, 0, 0, 0.06);
        }
        
        .preview-container::-webkit-scrollbar {
            height: 6px;
        }

        .preview-container::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.06);
            border-radius: 3px;
        }
        
        .preview-container::-webkit-scrollbar-thumb {
            background: rgba(140, 140, 140, 0.85);
            border-radius: 3px;
        }

        .preview-container::-webkit-scrollbar-thumb:hover {
            background: rgba(110, 110, 110, 0.9);
        }
        
        .preview-item {
            position: relative;
            flex-shrink: 0;
            width: 80px;
            height: 80px;
            overflow: hidden;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            scroll-snap-align: start;
        }
        
        .preview-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .preview-remove {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 22px;
            height: 22px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 80, 80, 0.9);
            color: white;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            padding: 0;
        }
        
        .preview-remove:hover {
            background: rgba(255, 50, 50, 1);
        }

        /* ===== 再生/停止ボタン ===== */
        .playback-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 15;
            /* オーバーレイ自体はクリック透過 → 表示時のみボタンが受け付ける */
            pointer-events: none;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.5s ease, visibility 0s linear 0.5s;
        }
        .playback-overlay.visible {
            opacity: 1;
            visibility: visible;
            transition: opacity 0.5s ease, visibility 0s;
        }

        .playback-btn {
            width: 88px;
            height: 88px;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.25s ease;
            background: #fff;
            box-shadow: 0 6px 30px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(0,0,0,0.06);
            pointer-events: none;
        }
        .playback-overlay.visible .playback-btn {
            pointer-events: auto;
        }
        .playback-btn:active {
            transform: scale(0.96);
        }

        .playback-btn .material-symbols-outlined {
            font-size: 42px;
            color: #000;
            font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
        }

        /* ===== Loading overlay (image load + draw) ===== */
        .loading-overlay {
            position: fixed;
            inset: 0;
            z-index: 40;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1.25rem;
            background: rgba(255, 255, 255, 0.82);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
            pointer-events: auto;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.28s ease, visibility 0s linear 0.28s;
        }

        .loading-overlay.visible {
            opacity: 1;
            visibility: visible;
            transition: opacity 0.28s ease, visibility 0s;
        }

        .loading-overlay__spinner {
            width: 44px;
            height: 44px;
            border: 3px solid rgba(102, 126, 234, 0.25);
            border-top-color: #667eea;
            border-radius: 50%;
            animation: loading-spin 0.75s linear infinite;
        }

        @keyframes loading-spin {
            to { transform: rotate(360deg); }
        }

        .loading-overlay__text {
            margin: 0;
            font-size: 0.95rem;
            font-weight: 500;
            color: #333;
            letter-spacing: 0.02em;
        }
