body { 
            background-color: #2b2522; 
            color: #f5eedf; 
            font-family: sans-serif; 
            margin: 0; 
        }

        * { box-sizing: border-box; }

        /* 상단 헤더 */
        header {
            display: flex;
            align-items: center;
            padding: 20px; 
            border-bottom: 1px solid #444;
            gap: 20px;
        }

        #back-btn {
            background-color: #a47a4f; 
            color: #fff; 
            padding: 15px 25px; 
            text-align: center;
            border-radius: 8px; 
            cursor: pointer; 
            font-weight: bold;
            font-size: 16px;
            border: none;
            transition: background-color 0.2s;
            white-space: nowrap;
        }

        #back-btn:hover { background-color: #8c653d; }

        .search-container { flex-grow: 1; display: flex; gap: 10px; }

        #search-input {
            width: 100%; padding: 15px; font-size: 16px;
            border: none; border-radius: 8px;
            background-color: rgba(255, 255, 255, 0.05);
            color: #f5eedf; outline: none; text-align: center;
            box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
        }

        #search-input::placeholder { color: #888; }
        #search-input:focus { background-color: rgba(255, 255, 255, 0.1); }

        /* 카드 리스트 영역 */
        main { width: 90%; margin: 30px auto; }

        #card-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 20px;
        }

        /* 개별 인격 카드 */
        .card {
            position: relative; aspect-ratio: 3 / 4; 
            background-color: #1a1614; border-radius: 10px; 
            overflow: hidden; cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
        }

        .card img {
            width: 100%; height: 100%; object-fit: cover;
            position: absolute; top: 0; left: 0;
        }

        .card .name {
            position: absolute; bottom: 0; right: 0;
            padding: 10px 15px; background-color: rgba(43, 37, 34, 0.9);
            color: #f5eedf; font-size: 14px; font-weight: bold;
            text-align: right; word-break: keep-all; max-width: 90%;
            border-top-left-radius: 10px; z-index: 10;
        }

        /* -------------------------------------
           모달(팝업창) CSS
        -------------------------------------- */
        .modal-overlay {
            display: none; /* 기본적으로 숨김 */
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            justify-content: center; align-items: center;
        }

        .modal-content {
            background-color: #2b2522;
            width: 90%; max-width: 600px; max-height: 90vh;
            border-radius: 10px; border: 2px solid #a47a4f;
            display: flex; flex-direction: column;
            overflow: hidden; /* 내부 스크롤을 위해 설정 */
            position: relative;
            box-shadow: 0 0 30px rgba(0,0,0,0.8);
        }

        .modal-header {
            padding: 20px;
            border-bottom: 2px solid #444;
            display: flex; gap: 20px; align-items: center;
            background-color: #1a1614;
        }

        .modal-header img {
            width: 100px; height: 100px; border-radius: 10px;
            object-fit: cover; border: 2px solid #a47a4f;
            background-color: #2b2522;
        }

        .modal-title h2 { margin: 0 0 10px 0; color: #fff; font-size: 22px; }
        .modal-title p { margin: 0; color: #ccc; font-size: 14px; margin-bottom: 5px; }
        .tag { 
            display: inline-block; background-color: #a47a4f; color: #fff;
            padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; margin-right: 5px;
        }

        .sim-tag { 
            display: inline-block; background-color: #ff0000; color: #fff;
            padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; margin-right: 5px;
        }

        .close-btn {
            position: absolute; top: 15px; right: 20px;
            font-size: 30px; font-weight: bold; color: #a47a4f;
            cursor: pointer; line-height: 1;
        }
        .close-btn:hover { color: #fff; }

        /* 모달창 내용 (스크롤 영역) */
        .modal-body {
            padding: 20px;
            overflow-y: auto; /* 내용이 길면 세로 스크롤 생성 */
        }

        .skill-section { margin-bottom: 25px; }
        .skill-section h3 { margin-top: 0; color: #e4c29f; border-bottom: 1px solid #444; padding-bottom: 5px; }

        /* 개별 스킬 박스 스타일 */
        .skill-box {
            background-color: rgba(0,0,0,0.3);
            border-left: 4px solid #a47a4f;
            padding: 12px; margin-bottom: 10px; border-radius: 4px;
        }
        .skill-header { display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: bold;}
        .skill-type { color: #aaa; font-size: 13px; }
        .skill-stats { color: #ffeb3b; font-size: 14px; } /* 위력 등 텍스트 강조 */

        .identity-serach-grid {
            display: flex;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            flex-direction: row;
        }

        .identity-serach-button {
            width: 45px;
            height: 45px;
            border-radius: 5px;
            background-color: #36302D;
            display: flex;
            align-content: center;
            justify-content: center;
            border: 2px solid #a47a4f;
        }

        .identity-serach-button-selected {
            width: 45px;
            height: 45px;
            border-radius: 5px;
            background-color: #a47a4f;
            display: flex;
            align-content: center;
            justify-content: center;
            border: 2px solid #a47a4f;
        }

        .identity-serach-button-img {
            width: 32px;
            height: 32px;
            object-fit: cover;
            display: block;
            margin: auto;
        }

        @media (max-width: 640px) {
            header {
                align-items: stretch;
                flex-direction: column;
                gap: 12px;
                padding: 14px;
            }

            #back-btn {
                order: 2;
                width: 100%;
                padding: 12px 16px;
            }

            .search-container {
                order: 1;
                flex-direction: column;
                gap: 12px;
                width: 100%;
            }

            #search-input {
                order: 1;
            }

            .identity-serach-grid {
                order: 2;
                flex-wrap: wrap;
                justify-content: center;
                gap: 8px;
            }

            .identity-serach-button,
            .identity-serach-button-selected {
                flex: 0 0 45px;
            }
        }
