/* ==========================================================================
       1. 주기율표 레이아웃 및 폰트 세팅 (선명도 및 시인성 극대화 버전)
       ========================================================================== */
.pt-container {
    max-width: 760px;
    margin: 10px auto;
    text-align: center;
    /* 글자 뭉개짐 방지 및 크로스 브라우징 폰트 세팅 */
    font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", helvetica, sans-serif;
    box-sizing: border-box;
    /* 텍스트 렌더링 엔진 선명도 최적화 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.pt-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
}

.pt-table {
    border-collapse: separate;
    border-spacing: 4px;
    margin: 0 auto;
}

    .pt-table td {
        width: 44px;
        height: 48px;
        border: 1px solid #adb5bd; /* 테두리를 조금 더 짙게 하여 경계선 명확화 */
        border-radius: 4px;
        text-align: center;
        position: relative;
        background: #ffffff; /* 배경을 순백색으로 변경하여 내부 글자 대비 확보 */
        vertical-align: middle;
        box-sizing: border-box;
    }

        .pt-table td.empty-space {
            border: none;
            background: transparent;
            cursor: default;
        }

/* 원소 셀 내부 텍스트 배치 디자인 */
.el-no {
    position: absolute;
    top: 3px;
    left: 4px;
    font-size: 9px; /* 크기를 살짝 키우고 색상을 진하게 변경 */
    color: #495057;
    font-weight: 700;
    line-height: 1;
}

.el-sym {
    font-size: 15px; /* 기호 크기 확대 */
    font-weight: 800;
    color: #111111; /* 완전한 블랙에 가깝게 변경하여 가독성 확보 */
    line-height: 1;
    display: block;
    margin-top: 6px; /* 번호와 겹치지 않도록 여백 조정 */
}

.el-name {
    font-size: 9px; /* scale 축소를 제거하고 고정 폰트 크기 사용 (번짐 방지) */
    font-weight: 500;
    color: #212529; /* 글자색 선명하게 조정 */
    display: block;
    margin-top: 2px;
}

/* 상태별 셀 배경색 (시인성 극대화) */
.pt-cell-fixed {
    background-color: #f1f3f5; /* 기본 고정 셀은 연한 회색 */
    color: #495057;
}

.pt-cell-quiz {
    background-color: #ffffff;
    border: 2px dashed #3182ce; /* 대시 테두리 색상을 더 짙은 파란색으로 */
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}

    .pt-cell-quiz:hover {
        background-color: #ebf8ff;
    }

    /* 정답을 맞춘 셀 - 색상 대비를 더 명확하게 변경 */
    .pt-cell-quiz.matched {
        background-color: #d4edda !important; /* 선명하고 밝은 연두색 */
        border: 2px solid #28a745; /* 단단한 초록색 실선 테두리 */
    }

        .pt-cell-quiz.matched .el-sym {
            color: #155724; /* 글자도 짙은 초록색으로 변경하여 통일감 및 선명도 상승 */
        }

        .pt-cell-quiz.matched .el-name {
            color: #155724;
            font-weight: 700;
        }

/* 하단 원소 기호 드래그 패드 */
.pt-palette {
    display: flex;
    justify-content: center;
    gap: 8px;
    row-gap: 10px; /* 줄바꿈 시 붙지 않도록 세로 여백 보완 */
    margin: 20px 0;
    flex-wrap: wrap;
}

.pt-drag-item {
    padding: 8px 14px;
    background: #1a252f;
    color: #ffffff;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    transition: background 0.15s, transform 0.15s;
    text-align: center;
    min-width: 36px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15); /* 그림자를 조금 더 주어 공중에 뜬 느낌(드래그용) 강조 */
}

    .pt-drag-item:hover {
        background: #0f171e;
        transform: translateY(-2px);
    }

/* 모던 가로형 타이머 구조 */
.time {
    margin: 15px auto !important;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 8px;
    max-width: 760px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.btn_maru2 {
    padding: 6px 12px;
    background: #212529;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    pointer-events: none;
}

.btn_maru {
    padding: 6px 14px;
    background: #3182ce;
    color: #ffffff;
    border: 1px solid #3182ce;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: background 0.15s;
}

    .btn_maru:hover {
        background: #2b6cb0;
        border-color: #2b6cb0;
    }

#counter {
    font-size: 26px !important;
    font-weight: 700;
    color: #2b6cb0 !important;
    font-family: 'Courier New', Courier, monospace;
    min-width: 50px;
    text-align: right;
}

    #counter::after {
        content: "초";
        font-size: 13px;
        font-weight: 700;
        color: #495057;
        margin-left: 3px;
    }

.pt-msg-box {
    min-height: 24px;
    font-size: 15px;
    font-weight: 700;
    margin: 10px 0;
    line-height: 24px;
    text-align: center;
}

    .pt-msg-box.success {
        color: #1e7e34;
    }

    .pt-msg-box.error {
        color: #bd2130;
    }

/* ==========================================================================
       2. 🚨 모바일 터치 및 화면 자동 스크롤 방지 잠금 (핵심 세팅)
       ========================================================================== */
.pt-drag-item, .pt-cell-quiz {
    touch-action: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

html.game-dragging, body.game-dragging {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    overscroll-behavior: none !important;
}

.btn_maru, .pt-drag-item {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
}

    .btn_maru:active, .pt-drag-item:active {
        transform: scale(0.95);
    }

/* ==========================================================================
       3. ⚡ 모바일 화면 (600px 이하) 스마트폰 한 화면 모드 자동 축소 압축
       ========================================================================== */
@media (max-width: 600px) {
    .pt-table {
        border-spacing: 2px;
    }

        .pt-table td {
            width: 29px; /* 아주 미세하게 키워 모바일 글자 공간 확보 */
            height: 36px;
        }

    .el-no {
        font-size: 7px;
        top: 1px;
        left: 2px;
    }

    .el-sym {
        font-size: 11px;
        margin-top: 4px;
    }

    .el-name {
        font-size: 7px; /* 모바일에서도 scale을 없애고 7px 고정으로 흐림 현상 방지 */
        margin-top: 1px;
        font-weight: 700; /* 모바일 작은 글씨는 두껍게 해야 잘 보임 */
    }

    .pt-drag-item {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 26px;
    }

    .time {
        padding: 8px 12px;
    }

    #counter {
        font-size: 22px !important;
    }
}
