
        * { box-sizing: border-box; }
        body, html { margin: 0; padding: 0; height: 100%; overflow: hidden; font-family: sans-serif; background: #111; color: white; }

        #game-container {
            width: 100vw; height: 100vh; display: flex; flex-direction: column; overflow: hidden; position: relative;
        }

        #ui-header {
            width: 100%; background: rgba(0,0,0,0.9); color: white; padding: 10px 15px;
            display: flex; justify-content: space-between; align-items: center; z-index: 1001;
            box-shadow: 0 2px 10px rgba(0,0,0,0.5); flex-wrap: wrap; gap: 10px; flex-shrink: 0;
        }

        .header-info-group { display: flex; align-items: center; gap: 15px; }
        .header-info-group h2 { margin: 0; font-size: 18px; color: #ffca28; letter-spacing: 1px; }

        .header-btn-group { display: flex; align-items: center; gap: 6px; }
        .menu-icon-btn { background: transparent; border: none; color: white; font-size: 20px; cursor: pointer; padding: 2px 6px; }

        .toggle-3d-btn {
            background: #28a745; color: white; border: none; padding: 6px 12px;
            border-radius: 20px; font-size: 12px; font-weight: bold; cursor: pointer;
            transition: background 0.2s ease; display: flex; align-items: center; gap: 4px;
        }
        .toggle-3d-btn.off { background: #6c757d; }

        #mmap-wrapper {
            flex: 1; width: 100%; position: relative; min-height: 0; overflow: hidden;
        }
        #mmap { width: 100%; height: 100%; position: relative; z-index: 1; }

        /* コンパス UI */
        #compass-container {
            position: absolute; top: 15px; right: 15px; z-index: 1000;
            width: 50px; height: 50px; background: rgba(0, 0, 0, 0.7);
            border: 2px solid #ffca28; border-radius: 50%;
            display: flex; justify-content: center; align-items: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.6); pointer-events: none;
        }
        #compass-arrow {
            width: 0; height: 0;
            border-left: 6px solid transparent;
            border-right: 6px solid transparent;
            border-bottom: 22px solid #e74c3c;
            transform-origin: 50% 100%;
            transition: transform 0.1s linear;
        }
        #compass-text {
            position: absolute; bottom: -18px; font-size: 10px; font-weight: bold;
            color: #ffca28; text-shadow: 0 1px 3px rgba(0,0,0,0.9);
        }

        #open-map-btn {
            position: absolute; bottom: 25px; left: 20px; z-index: 1000;
            padding: 12px 20px; background: #ffca28; color: #111; font-size: 16px; font-weight: bold;
            border: none; border-radius: 30px; cursor: pointer;
            box-shadow: 0 4px 12px rgba(0,0,0,0.6); display: flex; align-items: center; gap: 8px;
            transition: transform 0.2s ease, background 0.2s ease;
        }
        #open-map-btn:hover { background: #ffb300; transform: scale(1.05); }

        #map-container {
            position: absolute; bottom: 20px; left: 20px; z-index: 1001;
            display: none; flex-direction: column; align-items: flex-start;
            background: rgba(0,0,0,0.85); padding: 10px; border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.8);
        }
        #map-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
        #map-header span { font-size: 14px; font-weight: bold; color: #ffca28; }
        .close-map-btn { background: transparent; border: none; color: #ccc; font-size: 18px; cursor: pointer; }

        #map { width: 340px; height: 240px; border: 2px solid #fff; border-radius: 8px; background: #ccc; }

        #guess-btn {
            margin-top: 10px; width: 100%; padding: 12px;
            background: #28a745; color: white; font-size: 16px; font-weight: bold;
            border: none; border-radius: 6px; cursor: pointer;
        }

        /* 画面下部 忍者AdMax 広告エリア (表示サイズの最適化) */
        #bottom-ad-container {
            width: 100%; z-index: 1002; background: rgba(0, 0, 0, 0.95);
            display: flex; justify-content: center; align-items: center;
            padding: 4px 0; border-top: 1px solid #333; flex-shrink: 0; min-height: auto;
        }
        .ad-pc { display: block; }
        .ad-sp { display: none; }

        #loading {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            z-index: 2000; color: white; font-size: 18px; background: rgba(0,0,0,0.85);
            padding: 20px 30px; border-radius: 8px; text-align: center; display: none;
        }

        .modal {
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.8); z-index: 3000; justify-content: center; align-items: center;
        }
        .modal-content {
            background: #222; color: #ffffff; padding: 25px; border-radius: 12px;
            width: 420px; text-align: center; box-shadow: 0 0 20px rgba(255,202,40,0.3);
            max-height: 80vh; overflow-y: auto; position: relative; z-index: 3001;
        }
        .modal-content h3 { color: #ffca28; margin-top: 0; }
        .modal-content input, .modal-content select {
            width: 85%; padding: 10px; margin: 8px 0; border-radius: 6px;
            border: 1px solid #555; background: #333; color: white; font-size: 15px; text-align: center;
        }
        .modal-btn {
            padding: 8px 14px; background: #28a745; color: white; border: none;
            border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: bold; margin: 4px;
        }
        .modal-btn.cancel { background: #dc3545; }

        .policy-box {
            text-align: left; font-size: 12px; line-height: 1.5; color: #ccc;
            background: #111; padding: 12px; border-radius: 6px; max-height: 140px; overflow-y: auto; margin-top: 10px;
        }
        
        .ranking-list { list-style: none; padding: 0; text-align: left; margin: 15px 0; }
        .ranking-list li {
            padding: 8px 12px; background: #333; color: #fff; border-bottom: 1px solid #444; border-radius: 4px; margin-bottom: 5px;
            display: flex; justify-content: space-between; align-items: center;
        }

        @media (max-width: 768px) {
            #ui-header { padding: 6px 10px; font-size: 12px; }
            .header-info-group h2 { font-size: 15px; }
            .header-info-group { gap: 8px; }
            .header-btn-group { gap: 4px; }
            .modal-btn { padding: 6px 8px; font-size: 11px; }

            #user-info { display: none; }
            
            #open-map-btn { bottom: 25px; left: 15px; padding: 10px 16px; font-size: 14px; }
            #map-container { bottom: 15px; left: 10px; right: 10px; width: auto; max-height: 70vh; }
            #map { width: 100%; height: 180px; }
            #guess-btn { padding: 10px; font-size: 14px; margin-top: 6px; }

            #bottom-ad-container { padding: 2px 0; }
            .ad-pc { display: none; }
            .ad-sp { display: block; }

            .modal-content { width: 92%; padding: 15px; }
        }
    
