@charset "utf-8";
/* CSS Document */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            min-height: 100svh;
            display: flex;
            justify-content: center;
            padding: 0px;
        }

        .container {
            background: white;
            border-radius: 0px;
            padding: 0px;
            padding-top: 60px;
            padding-bottom: 120px;
            max-width: 1400px;
            width: 100%;
        }

        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
            font-size: 40px; height: 60px; line-height: 60px;font-family: "Jolly Lodger", system-ui; font-weight: 400;
        }

        .video-container {
            display: flex;
            gap: 30px;
            flex-wrap: wrap;
            justify-content: center;
            margin-bottom: 30px;
        }

        .video-wrapper {
            flex: 0 0 auto;
            min-width: 300px;
            max-width: 500px;
        }

        video {
            width: 100%;
            height: auto;
            border-radius: 0px;
            background: #000;
            display: block;
            position: fixed;
            top: 50%;
            left: 0;
            transform: translateY(-50%);
        }

        .grid-wrapper {
            flex: 1;
            min-width: 300px;
        }

        .canvas-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            width: 100%;
        }

        .canvas-grid.fixed-bottom {
            position: fixed;
            bottom: 160px;
            left: 0;
            right: 0;
            display: flex;
            flex-direction: row;
            grid-template-columns: none;
            gap: 10px;
            padding: 0 20px;
            z-index: 999;
            max-width: 1400px;
            margin: 0 auto;
        }

        .canvas-grid.fixed-bottom .canvas-cell {
            flex: 1;
            min-width: 0;
            max-width: 25%;
        }

        .canvas-grid.fullscreen-overlay {
            position: fixed;
            top: 60px;
            left: 0;
            right: 0;
            bottom: 150px;
            width: 100%;
            height: calc(100% - 210px);
            display: block;
            padding: 10px;
            background: #FFF;
            z-index: 2000;
            margin: 0;
            max-width: none;
            overflow: hidden;
        }

        .canvas-grid.fullscreen-overlay .canvas-cell {
            position: absolute;
            border: 3px solid #000;
            background: white;
        }

        .canvas-cell {
            position: relative;
            border-radius: 0px;
            overflow: visible;
            background: #f0f0f0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            aspect-ratio: var(--video-aspect-ratio, 16 / 9);
            border: 2px solid #000;
        }

        .canvas-cell::before {
            content: '';
            display: block;
            padding-top: var(--cell-padding-top, 56.25%);
        }

        .canvas-cell-content {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .canvas-cell.empty .canvas-cell-content::after {
            content: attr(data-number);
            font-size: 48px;
            color: #ccc;
            font-weight: bold;
        }

        .canvas-cell.empty {
            background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
        }

        .canvas-stack {
            position: relative;
            width: 100%;
            height: 100%;
        }

        .canvas-stack canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: contain;
            aspect-ratio: var(--video-aspect-ratio, 16 / 9);
        }

        .label {
            text-align: center;
            margin-top: 10px;
            font-weight: 600;
            color: #555;
            font-size: 14px;
        }

        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
           
            padding: 0 0px;
            background: white;
            z-index: 3000;
        }

        .controls {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            display: flex;
            gap: 15px;
            justify-content: center;
            flex-wrap: wrap;
            padding: 40px;
            
            z-index: 1000;
        }

        button {
            padding: 12px 30px;
            font-size: 16px;
            font-weight: 600;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .capture-btn {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background:#ff3333;
            border: 8px solid #000;
            color: #667eea;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            line-height: 1.2;
            text-align: center; text-indent: -9999px; position: relative;
        }
        .capture-btn:after { width:64px; height:64px; border:2px solid #FFF; box-sizing: border-box; position: absolute; top:50%; left: 50%; content: ""; display: block; border-radius: 50%; transform: translate(-50%,-50%);}

        .capture-btn:hover:not(:disabled) {
            opacity: 0.8;
        }

        .capture-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .reset-btn {
            background: none;
            color: white;
            padding: 0;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center; position: absolute; left:0; top:50%; transform: translateY(-50%);
        }

        .reset-btn:hover {
            
        }

        .reset-btn .material-symbols-outlined {
            font-size: 22px;
            color: #000;
        }

        .download-btn {
            background: none;
            color: white;
            padding: 0;
            width: 48px;
            height: 48px;
            margin-right: 10px;
            display: none;
            align-items: center;
            justify-content: center; position: absolute; right:0; top:50%; transform: translateY(-50%);
        }

        .download-btn.visible {
            display: flex;
        }

        .download-btn:hover:not(:disabled) {
            opacity: 0.8;
        }

        .download-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .download-btn .material-symbols-outlined {
            font-size: 22px;
            color: #000;
        }

        button:active:not(:disabled) {
           
        }

        .status {
            text-align: center;
            margin-top: 20px;
            color: #666;
            font-size: 14px;
            display: none;
        }

        .counter {
            text-align: center;
            margin-bottom: 15px;
            font-size: 18px;
            font-weight: 600;
            color: #667eea; display: none;
        }

        .grid-wrapper {
            display: none;
        }

        .grid-wrapper.visible {
            display: flex;
            flex-direction: column;
        }

        .reset-btn {
            display: none;
        }

        .reset-btn.visible {
            display: flex;
        }

        .header .reset-btn.visible {
            display: flex;
        }

        .video-wrapper.hidden {
            display: none;
        }

        /* オノマトペ的テキストのスタイル */
        .manga-text {
            position: absolute;
            font-family: 'Jolly Lodger', cursive;
            font-weight: 400;
            color: #000;
            text-shadow: 
                2px 2px 0 #fff,
                -2px -2px 0 #fff,
                2px -2px 0 #fff,
                -2px 2px 0 #fff,
                3px 3px 0 #fff,
                -3px -3px 0 #fff,
                3px -3px 0 #fff,
                -3px 3px 0 #fff;
            z-index: 15;
            pointer-events: none;
            white-space: nowrap;
            letter-spacing: 2px;
        }

        /* 変数名スタイル */
        .manga-text.variable {
            font-family: 'Courier New', monospace;
            font-size: 10px;
            background: rgba(255, 255, 255, 0.9);
            border: 1px solid #333;
            padding: 3px 6px;
            color: #222;
            letter-spacing: 0;
            text-shadow: none;
            line-height: 1.3;
        }

        /* 音楽再生ボタンエリア */
        .music-controls {
            position: fixed;
            bottom: 0px;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.0);
            border-top: 0px solid #ff6b6b;
            z-index: 2400;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 40px; z-index:2600;
        }

        .music-controls.active {
            display: flex;
        }

        .play-btn {
            padding: 0;
            width: 48px;
            height: 48px;
            background: none;
            color: white;
            border: none;
            border-radius: 0;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 10px;
        }
        .play-btn:hover:not(:disabled) {
            opacity: 0.8;
            transform: scale(1.05);
        }
        .play-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .play-btn .material-symbols-outlined {
            font-size: 68px;
            color: white;
        }

        /* ログコンソールエリア */
        .log-console {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 150px;
            background: #000;
            border-top: 3px solid #33ff33;
            z-index: 2500;
            display: none;
            overflow-y: auto;
            padding: 15px 20px;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            line-height: 1.6;
        }

        .log-console.active {
            display: block;
        }

        .log-line {
            color: #33ff33;
            margin-bottom: 4px;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .log-line.processing {
            color: #ffff33;
        }

        .log-line.complete {
            color: #33ffff;
        }

        .log-line.error {
            color: #ff3333;
        }

        .log-line span.timestamp {
            color: #888;
            margin-right: 10px;
        }

        @media (max-width: 768px) {
            .container {
                padding: 0px;
                padding-top: 60px;
            }

            .video-container {
                flex-direction: column;
            }

            .video-wrapper,
            .grid-wrapper {
                max-width: 100%;
            }

            .canvas-cell {
                margin-bottom: 10px;
            }

            .log-console {
                height: 120px;
                font-size: 11px;
            }
        }

