/* 프리스타일 채점 시스템 CSS */

:root {
    --main-color: #2A4365;
    --accent-color: #F6AD55;
    --bg-color: #F7FAFC;
    --text-color: #2D3748;
    --primary-blue: #4a90e2;
    --primary-blue-hover: #357abd;
    --success-green: #28a745;
    --warning-orange: #ffc107;
    --danger-red: #dc3545;
    --light-gray: #f8f9fa;
    --border-gray: #dee2e6;
    --text-dark: #343a40;
    --text-muted: #6c757d;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 기본 스타일 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    padding-top: 80px; /* 헤더 높이만큼 상단 여백 추가 */
}

/* 모바일에서 body padding 조정 */
@media (max-width: 768px) {
    body {
        padding-top: 70px; /* 모바일 헤더 높이에 맞춤 */
    }
}

/* 개인프리스타일 T심판 모달 스타일 */
.individual-top-buttons {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}

/* 개인프리스타일 P심판 모달 스타일 */
.p-judge-info-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
}

.p-judge-info-section .judge-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.p-judge-info-section .judge-name {
    font-weight: 600;
    color: var(--main-color);
    font-size: 1.1rem;
}

.p-judge-info-section .record-time {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.p-judge-top-buttons {
    display: flex;
    gap: 1rem;
}

.p-judge-top-buttons .btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.p-judge-scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.penalty-column,
.bonus-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}

.penalty-column .score-button,
.bonus-column .score-button {
    flex: 1;
    min-height: 0;
}

.miss-column {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.score-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
    min-height: 80px;
    position: relative;
    user-select: none;
}

.score-button.penalty {
    background: var(--danger-red);
    color: white;
}

.score-button.penalty:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.score-button.bonus {
    background: var(--success-green);
    color: white;
}

.score-button.bonus:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.score-button.miss {
    background: var(--warning-orange);
    color: white;
    height: calc(100% / 3);
    min-height: 120px;
    font-size: 1.2rem;
}

.score-button.miss:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.score-button .button-text {
    margin-bottom: 0.5rem;
    text-align: center;
}

.score-button .counter {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
}

.score-button.clicked {
    animation: buttonClick 0.2s ease;
}

@keyframes buttonClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .p-judge-info-section {
        flex-direction: column;
        gap: 1rem;
    }
    
    .p-judge-top-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .p-judge-scores-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.5rem;
        height: calc(100vh - 200px);
        min-height: 400px;
    }
    
    .score-button {
        min-height: 50px;
        font-size: 0.9rem;
        padding: 0.8rem;
    }
    
    .score-button.miss {
        height: calc(100% / 3);
        min-height: 100px;
        font-size: 1.1rem;
    }
    
    .score-button .counter {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .p-judge-scores-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.3rem;
    }
    
    .score-button {
        min-height: 40px;
        font-size: 0.8rem;
        padding: 0.6rem;
    }
    
    .score-button.miss {
        height: calc(100% / 3);
        min-height: 80px;
        font-size: 1rem;
    }
    
    .score-button .counter {
        font-size: 1rem;
    }
}

.individual-top-buttons .left-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.individual-top-buttons .right-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.individual-top-buttons .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    position: relative;
}

.individual-top-buttons .btn-success {
    background: var(--success-green);
    color: white;
}

.individual-top-buttons .btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.individual-top-buttons .btn-danger {
    background: var(--danger-red);
    color: white;
}

.individual-top-buttons .btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.individual-top-buttons .btn-warning {
    background: var(--warning-orange);
    color: white;
}

.individual-top-buttons .btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#timer-display {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* 카운터 그리드 스타일 */
.individual-counters-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Space와 Time은 각각 한 줄 전체 차지 */
.individual-counters-grid .space-violations,
.individual-counters-grid .time-violations {
    width: 100%;
}

/* Miss와 Break를 감싸는 행 */
.miss-break-row {
    display: flex;
    gap: 1.5rem;
    width: 100%;
}

/* Miss와 Break는 각각 절반 크기 */
.miss-break-row .counter-block {
    flex: 1;
    width: calc(50% - 0.75rem);
}

.counter-block {
    background: var(--danger-red);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.counter-block.breaks {
    background: var(--warning-orange);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.counter-block.breaks:hover {
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.4);
}

.counter-block:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.4);
}

/* active 상태 제거 - 클릭 시 파란색으로 바뀌는 문제 해결 */

.counter-block h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.counter-block .counter-display {
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.counter-block.clicked {
    opacity: 0.7;
    transform: scale(0.98);
}

.counter-block.clicked .counter-display {
    transform: scale(1.05);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .individual-top-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .individual-top-buttons .left-buttons,
    .individual-top-buttons .right-buttons {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .individual-top-buttons .btn {
        flex: 1;
        min-width: auto;
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .counter-block .counter-display {
        font-size: 2.5rem;
    }
    
    /* 모바일에서 간격 조정 */
    .individual-counters-grid {
        gap: 1rem;
    }
    
    .counter-block {
        padding: 1.5rem;
    }
    
    .counter-block .counter-display {
        font-size: 2rem;
    }
    
    /* 모바일에서 Miss와 Break 간격 조정 */
    .miss-break-row {
        gap: 1rem;
    }
    
    .miss-break-row .counter-block {
        width: calc(50% - 0.5rem);
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 카운터 블록 active 상태 제거 - 파란색으로 바뀌는 문제 해결 */
    
    .individual-top-buttons .btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* 프리스타일 페이지 전용 헤더 스타일 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px; /* 고정 높이 설정 */
    padding: 0 2rem;
    background: rgba(42, 67, 101, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header .logo {
    max-width: 200px;
    width: 100%;
    height: auto;
    cursor: pointer;
}

.header .desktop-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header .desktop-nav a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s;
}

.header .desktop-nav a:hover {
    color: #F6AD55;
}

.header .admin-link {
    margin-left: 30px;
    color: #F6AD55 !important;
    font-weight: 700 !important;
}

/* 모바일 메뉴 버튼 */
.mobile-menu-btn {
    display: none;
    position: relative; /* fixed에서 relative로 변경 */
    z-index: 1002;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 30px;
    height: 3px;
    background: white;
    margin: 5px 0;
    transition: 0.3s;
}

/* 모바일 메뉴 */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    z-index: 1103;
    transition: 0.3s;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.mobile-menu-header h3 {
    color: var(--text-color);
    margin: 0;
}

.close-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}

.mobile-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    margin: 1rem 0;
}

.mobile-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: 0.3s;
}

.mobile-nav a:hover {
    color: var(--accent-color);
}

/* 프리스타일 페이지 전용 푸터 스타일 */
.footer {
    background: #2A4365;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.footer-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-logo {
    width: 200px;
}

.footer-section {
    width: 250px;
    margin-bottom: 1rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin: 0.5rem 0;
}

.footer-section a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #F6AD55;
}

.footer-section ul li a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: #F6AD55;
}

.footer-bottom {
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.footer-bottom a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-bottom a:hover {
    color: #F6AD55;
}

/* 소셜 아이콘 스타일 */
.social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-icons img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.social-icons img:hover {
    transform: scale(1.2);
}

/* 파일 형식 안내 토글 버튼 스타일 */
.format-toggle-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    margin-bottom: 15px;
}

.format-toggle-btn:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.format-content {
    background: var(--light-gray);
    border: 1px solid var(--border-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.format-content h4 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 16px;
}

.format-content pre {
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    margin: 15px 0;
}

.format-rules h5 {
    color: var(--text-dark);
    margin: 20px 0 10px 0;
    font-size: 14px;
}

.format-rules ul {
    margin: 0;
    padding-left: 20px;
}

.format-rules li {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-muted);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 유틸리티 클래스 */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* 전체화면 오버레이 */
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(42, 67, 101, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.overlay form {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 점수 요약 스타일 */
.score-summary {
    margin-top: 20px;
    text-align: left;
}

.score-summary ul {
    list-style: none;
    padding: 0;
}

.score-summary li {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

/* 버튼 스타일 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    line-height: 1;
    /* 빠른 터치 응답성 개선 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-start: enabled;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: var(--primary-blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-green);
    color: var(--white);
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: var(--warning-orange);
    color: var(--text-dark);
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: var(--danger-red);
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: var(--border-gray);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #c6c8ca;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 5px;
    display: flex;
}
.form-group select {
    text-align: center;
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-gray);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-group label {
    display: flex;
    margin-bottom: 8px;
    margin-right: 10px;
    font-weight: 600;
    width: auto;
    color: var(--text-dark);
    align-items: center;
    white-space: nowrap;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-gray);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
}

/* 알림 메시지 */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 로그인 페이지 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-form {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}
.login-form div{
    display: block;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.login-btn {
    width: 100%;
    margin-top: 20px;
}

/* 헤더 */
.scoring-header {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.scoring-header h1 {
    margin: 0;
    color: var(--text-dark);
    text-align: center;
}

.judge-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.judge-name {
    font-weight: bold;
    color: var(--primary-blue);
}

.judge-type {
    color: var(--text-muted);
    font-size: 14px;
}

.logout-btn {
    background: var(--danger-red);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    text-align: center;
}

.logout-btn:hover {
    background: #c82333;
}

/* QR 스캐너 섹션 */
.qr-scanner-section {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.qr-scanner-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-dark);
    text-align: center;
}

.input-methods {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.scan-btn {
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    width: -webkit-fill-available;
}

.scan-btn:hover {
    background: var(--primary-blue-hover);
}

.manual-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.manual-input input {
    width: auto;
    padding: 10px 12px;
    border: 2px solid var(--border-gray);
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

.load-btn {
    background: var(--success-green);
    color: var(--white);
    border: none;
    padding: 13px 16px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.load-btn:hover {
    background: #218838;
}

#qr-reader {
    width: 100%;
    max-width: 400px;
    margin: 20px auto 0;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* 선수 정보 표시 */
.player-info-section {
    background: var(--white);
    border: 3px solid var(--success-green);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
}

.player-info-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--success-green);
}

.player-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-item label {
    font-weight: bold;
    color: var(--text-muted);
    min-width: 70px;
}

.info-item span {
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 500;
}

/* 점수 입력 섹션 */
.scoring-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.score-input-group {
    display: grid;
    margin-bottom: 40px;
}

.score-item {
    text-align: center;
}

.score-item h4 {
    color: var(--text-dark);
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: 600;
}

.score-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.score-btn {
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 빠른 터치 응답성 개선 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-start: enabled;
    -webkit-user-drag: none;
}

.score-btn:hover {
    background: var(--primary-blue-hover);
    transform: scale(1.05);
}

.score-btn:active {
    transform: scale(0.95);
}

.score-display {
    background: var(--light-gray);
    border: 3px solid var(--primary-blue);
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 28px;
    font-weight: bold;
    color: var(--text-dark);
}

/* 지정프리스타일(A/B) 점수입력 모달 전용 스타일 */
#scoring-overlay .score-btn {
    font-size: 90px;
    transition: transform 0.1s ease, background-color 0.1s ease, box-shadow 0.1s ease;
}

#scoring-overlay .score-btn.decrease {
    background: var(--danger-red);
}

#scoring-overlay .score-btn.decrease:hover {
    background: #c82333;
    transform: scale(1.05);
}

#scoring-overlay .score-btn.decrease:active,
#scoring-overlay .score-btn.decrease:not(:disabled):active {
    background: #b21f2d !important;
    color: #ffffff !important;
    transform: scale(0.95) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* 터치 탭 피드백 애니메이션 */
@keyframes tapFeedback {
    0% { transform: scale(1); }
    100% { transform: scale(0.96); }
}

@media (hover: none) and (pointer: coarse) {
    #scoring-overlay .score-btn.decrease:active {
        background: #b21f2d !important;
    }
    #scoring-overlay .score-btn.decrease:not(:active) {
        background: var(--danger-red) !important;
    }
    /* 모바일 터치 시 짧은 축소 애니메이션 */
    #scoring-overlay .score-btn:active {
        animation: tapFeedback 0.08s ease-out forwards;
    }
    /* + 버튼 터치 시 약간 어두운 파란색 */
    #scoring-overlay .score-btn.increase:active {
        background: var(--primary-blue-hover) !important;
    }
}

/* 제출 섹션 */
.submit-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
}

.submit-btn {
    background: var(--warning-orange);
    color: var(--text-dark);
    border: none;
    padding: 15px 40px;
    border-radius: var(--border-radius);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.reset-btn {
    background: var(--border-gray);
    color: var(--text-dark);
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.reset-btn:hover {
    background: #c6c8ca;
}

/* 오버레이 헤더 */
.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-gray);
    background: var(--bg-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.overlay-header h3 {
    margin: 0;
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 600;
}

/* 오버레이 닫기 버튼 */
.close-btn {
    background: transparent;
    color: var(--text-dark);
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover:not(:disabled) {
    background: var(--border-gray);
    transform: scale(1.1);
}

.close-btn.duplicate-warning {
    background: var(--warning-orange) !important;
    color: var(--text-dark) !important;
    border: 2px solid var(--warning-orange);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* 업로드 섹션 */
.upload-container {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.upload-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
}

.sample-format {
    margin: 20px 0;
    padding: 15px;
    background: #f1f3f4;
    border-radius: 4px;
    border-left: 4px solid var(--primary-blue);
}

.sample-format h4 {
    margin-top: 0;
    color: var(--text-dark);
}

.sample-format pre {
    background: var(--white);
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* 기록 조회 테이블 */
.view-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.view-header {
    background: var(--primary-blue);
    color: var(--white);
    padding: 20px 30px;
    margin: 0;
}

.view-header h1 {
    margin: 0;
}

.filter-section {
    padding: 20px 30px;
    background: var(--light-gray);
    border-bottom: 1px solid var(--border-gray);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    justify-content: center;
}

.filter-item {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-item label {
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-dark);
}

.filter-item select,
.filter-item input {
    padding: 8px 12px;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 14px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-gray);
}

.table-header h3 {
    margin: 0;
    color: var(--text-dark);
}

/* 테이블 반응형 스타일 개선 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    background: var(--white);
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue-hover);
}

.records-table {
    width: 100%;
    min-width: 900px; /* 새로운 순서에 맞게 최소 너비 조정 */
    border-collapse: collapse;
    background: var(--white);
}

.records-table th,
.records-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-gray);
    font-size: 1.5rem;
    white-space: nowrap; /* 텍스트 줄바꿈 방지 */
}

.records-table th {
    background: var(--primary-blue);
    color: var(--white);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
    min-width: 80px; /* 헤더 최소 너비 */
}

.records-table tbody tr:hover {
    background: var(--light-gray);
}

.records-table tbody tr:nth-child(even) {
    background: #fbfbfb;
}

.records-table tbody tr:nth-child(even):hover {
    background: var(--light-gray);
}

/* 순위별 색상 */
.rank-1 { 
    background: #ffd700 !important;
    font-weight: bold;
}

.rank-2 { 
    background: #c0c0c0 !important;
    font-weight: bold;
}

.rank-3 { 
    background: #cd7f32 !important;
    font-weight: bold;
    color: var(--white);
}

/* 등위별 뱃지 */
.award-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 40px;
    color: #000000; /* 검정색으로 변경 */
    text-shadow: none; /* 텍스트 그림자 제거 */
    border: 1px solid #ddd;
}

.award-금상 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
    color: #000000;
}

.award-은상 {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    box-shadow: 0 2px 4px rgba(192, 192, 192, 0.3);
    color: #000000;
}

.award-동상 {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
    box-shadow: 0 2px 4px rgba(205, 127, 50, 0.3);
    color: #000000;
}

/* 기존 award 스타일과 호환성 유지 */
.award-gold { 
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000000;
}

.award-silver { 
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: #000000;
}

.award-bronze { 
    background: linear-gradient(135deg, #CD7F32, #B8860B);
    color: #000000;
}

/* 채점 상태 표시 */
.scoring-status {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.judge-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-gray);
}

.judge-status.completed {
    background: var(--success-green);
}

/* 정렬 가능한 헤더 */
.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.sortable:hover {
    background: var(--primary-blue-hover);
}

.sortable::after {
    content: '↕';
    position: absolute;
    right: 5px;
    opacity: 0.5;
}

/* 페이지네이션 */
.pagination-section {
    padding: 20px 30px;
    background: var(--light-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination {
    display: flex;
    gap: 5px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-gray);
    background: var(--white);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 4px;
    transition: var(--transition);
}

.page-btn:hover {
    background: var(--primary-blue);
    color: var(--white);
}

.page-btn.active {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

/* 반응형 디자인 - 기존 스타일 제거 (위에서 개선된 버전 사용) */

/* 로딩 스피너 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(74, 144, 226, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 성공/오류 상태 표시 */
.status-success {
    color: var(--success-green);
    font-weight: bold;
}

.status-error {
    color: var(--danger-red);
    font-weight: bold;
}

.status-pending {
    color: var(--warning-orange);
    font-weight: bold;
}

/* 확대/축소 애니메이션 */
.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 포커스 스타일 개선 */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 기록 조회 페이지 ===== */
.view-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.stats-section {
    background-color: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.stat-item label {
    font-weight: 500;
    color: var(--text-dark);
}

.stat-value {
    font-weight: bold;
    font-size: 1.1em;
}

.stat-value.success {
    color: var(--success-green);
}

.stat-value.warning {
    color: var(--warning-orange);
}

.filter-section {
    background-color: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-container {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th,
.records-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-gray);
}

.records-table th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--text-dark);
    position: sticky;
    top: 0;
    z-index: 1;
}

.records-table .sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.records-table .sortable:hover {
    background-color: var(--border-gray);
}

.sort-indicator {
    margin-left: 5px;
    color: var(--primary-blue);
}

.records-table tr.pending {
    background-color: #fff8dc;
}

.records-table tr.completed {
    background-color: #f0fff0;
}

.rank-cell {
    text-align: center;
    font-weight: bold;
}

.rank-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    color: white;
    font-size: 0.9em;
    font-weight: bold;
}

.rank-badge.rank-1 {
    background-color: #ffd700;
    color: #333;
}

.rank-badge.rank-2 {
    background-color: #c0c0c0;
    color: #333;
}

.rank-badge.rank-3 {
    background-color: #cd7f32;
    color: white;
}

.bib-number {
    font-weight: bold;
    color: var(--primary-blue);
}

.player-name {
    font-weight: 500;
}

.judge-score {
    font-size: 0.9em;
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.score-breakdown span {
    font-size: 0.8em;
    padding: 2px 6px;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.no-score {
    color: var(--text-muted);
    font-style: italic;
}

.miss-average {
    font-weight: 500;
    color: var(--danger-red);
    text-align: center;
}

.total-score {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-blue);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-badge.pending {
    background-color: var(--warning-orange);
    color: white;
}

.status-badge.completed {
    background-color: var(--success-green);
    color: white;
}

.actions {
    display: flex;
    gap: 5px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8em;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-gray);
    background-color: var(--white);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.page-btn:hover {
    background-color: var(--primary-blue);
    color: var(--white);
}

.page-btn.active {
    background-color: var(--primary-blue);
    color: var(--white);
}

/* ===== 모달 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    /* 점수입력 모달에서 터치 제스처 비활성화 */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* 배경 스크롤 방지 */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: none;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
    /* 점수입력 모달 터치 제어 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* 빠른 터치 응답성 개선 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-start: enabled;
    /* 모달 내부 스크롤 제어 */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-gray);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 20px;
}

.player-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-section {
    border: 1px solid var(--border-gray);
    border-radius: var(--border-radius);
    padding: 15px;
}

.detail-section h4 {
    margin: 0 0 15px 0;
    color: var(--primary-blue);
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 5px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.detail-item label {
    font-weight: 500;
    color: var(--text-dark);
}

.detail-item span {
    font-weight: bold;
}

.award {
    color: var(--warning-orange);
    font-size: 1.1em;
}

.miss-score {
    color: var(--danger-red);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

.calculation-detail {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: var(--border-radius);
}

.calculation-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.calculation-row.total-row {
    border-top: 2px solid var(--primary-blue);
    margin-top: 10px;
    padding-top: 10px;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary-blue);
}

/* ===== 수정 페이지 ===== */
.edit-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.player-info-section {
    background-color: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.player-info-card {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: var(--border-radius);
}

.player-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item label {
    font-weight: 500;
    color: var(--text-dark);
}

.edit-form-section {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.judge-section {
    border: 2px solid var(--border-gray);
    border-radius: var(--border-radius);
    padding: 20px;
}

.judge-section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.total-preview {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-blue);
}

.total-preview h3 {
    margin: 0 0 15px 0;
    color: var(--primary-blue);
}

.total-calculation {
    background-color: var(--white);
    padding: 15px;
    border-radius: var(--border-radius);
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-gray);
}

.calc-row.total-row {
    border-bottom: none;
    border-top: 2px solid var(--primary-blue);
    margin-top: 10px;
    padding-top: 15px;
    font-weight: bold;
    font-size: 1.2em;
    color: var(--primary-blue);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.history-section {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.history-section h3 {
    margin: 0 0 15px 0;
    color: var(--text-dark);
}

.history-info p {
    margin: 5px 0;
    color: var(--text-muted);
}

/* ===== 테이블 특별 스타일 ===== */
.records-table .rank-1 .bib-number {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.records-table .rank-2 .bib-number {
    background: linear-gradient(45deg, #c0c0c0, #e0e0e0);
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.records-table .rank-3 .bib-number {
    background: linear-gradient(45deg, #cd7f32, #daa520);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* ===== 추가 모바일 최적화 ===== */
@media (max-width: 768px) {
    .view-container,
    .edit-container {
        padding: 10px;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .score-breakdown {
        gap: 1px;
    }
    
    .score-breakdown span {
        font-size: 0.7em;
        padding: 1px 4px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    .detail-grid,
    .player-info-grid {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .calc-row {
        font-size: 0.9em;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    /* 테이블 스크롤 안내 */
    .table-responsive::before {
        content: "← 좌우로 스크롤하여 전체 내용을 확인하세요 →";
        display: block;
        background: var(--warning-orange);
        color: var(--text-dark);
        padding: 10px 12px;
        text-align: center;
        font-size: 13px;
        font-weight: 600;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        position: sticky;
        top: 0;
        z-index: 20;
    }

    /* 프리스타일 헤더 모바일 스타일 */
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 1rem;
        height: 70px; /* 모바일에서 헤더 높이 조정 */
    }

    .header .logo {
        max-width: 80px; 
        width: auto;
        height: auto;
    }

    .header .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* 프리스타일 푸터 모바일 스타일 */
    .footer .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 1rem;
    }

    .footer .footer-section {
        width: 100%;
        max-width: 300px;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .actions {
        flex-direction: column;
        gap: 2px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75em;
        margin-bottom:0.5rem;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
} 

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    
    
    .records-table th,
    .records-table td {
        padding: 12px 8px;/* 터치하기 쉽게 패딩 증가 */
        text-align: center;
    }
    
    .form-control,
    .filter-item select,
    .filter-item input {
        min-height: 44px;
        font-size: 16px; /* iOS 줌 방지 */
    }
}

/* 가로 모드 최적화 */
@media (max-width: 768px) and (orientation: landscape) {
    .scoring-header {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .player-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .score-controls {
        gap: 15px;
    }
    
    .table-responsive {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* ===== SCORING INPUT PAGE SPECIFIC STYLES ===== */

/* 기본 터치 최적화 */
.scoring-input-page * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    width: -webkit-fill-available;
}

/* 입력 필드는 텍스트 선택 허용 */
.scoring-input-page input[type="text"], 
.scoring-input-page input[type="number"], 
.scoring-input-page textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 점수 버튼 터치 최적화 */
.score-controls button{
    height:150px;
}
.scoring-input-page .score-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    outline: none;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    transition: all 0.1s ease !important;
    background-color: var(--primary-blue);
    color: var(--white);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.scoring-input-page .score-btn:active {
    transform: scale(0.95) !important;
    background-color: var(--primary-blue-hover) !important;
    color: var(--white) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.1s ease !important;
}

.scoring-input-page .score-btn:focus {
    outline: none;
    background-color: var(--primary-blue) !important;
    color: var(--white) !important;
    transform: scale(1);
    box-shadow: none;
}

/* 터치 디바이스에서 active 상태 강제 해제 */
@media (hover: none) and (pointer: coarse) {
    .scoring-input-page .score-btn:active {
        background-color: var(--primary-blue-hover) !important;
        color: var(--white) !important;
        transform: scale(0.95) !important;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
        transition: all 0.1s ease !important;
    }
    
    /* 터치 후 상태 복원 */
    .scoring-input-page .score-btn:not(:active) {
        background-color: var(--primary-blue) !important;
        color: var(--white) !important;
        transform: scale(1) !important;
        box-shadow: none !important;
        transition: all 0.1s ease !important;
    }
}

/* 오디오 안내 메시지 */
.audio-notice {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

/* 오디오 테스트 섹션 */
.audio-test-section {
    text-align: center;
    margin: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}



/* 피드백 토글 버튼 스타일 */

.feedback-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    width : auto;
    white-space: nowrap;
}

.feedback-btn .feedback-icon {
    font-size: 16px;
}

.feedback-btn .feedback-text {
    font-weight: 500;
}

.feedback-btn:hover {
    transform: scale(1.1);
}

.feedback-btn:active {
    transform: scale(0.95);
}

.feedback-btn.disabled {
    background: #6c757d;
    opacity: 0.6;
}

.feedback-btn.disabled:hover {
    transform: none;
}

/* iOS 전용 최적화 */
@supports (-webkit-touch-callout: none) {
    .scoring-input-page body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .scoring-input-page .score-btn {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 8px;
        background-clip: padding-box;
    }
    
    .scoring-input-page .feedback-btn {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-clip: padding-box;
    }
    
    /* iOS 사파리 주소창 대응 */
    .scoring-input-page .container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .scoring-input-page .feedback-btn {
        border: 2px solid white;
    }
    
    .scoring-input-page .score-btn {
        border: 1px solid #333;
    }
}

/* 모션 감소 모드 지원 */
@media (prefers-reduced-motion: reduce) {
    .scoring-input-page .score-btn, 
    .scoring-input-page .feedback-btn {
        transition: all 0.1s ease;
    }
    
    .scoring-input-page .score-btn:active {
        transform: scale(0.95);
    }
}

/* 다크 모드 지원 준비 */
@media (prefers-color-scheme: dark) {
    .audio-notice {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .test-audio-btn {
        background: #38a169;
    }
    
    .test-audio-btn:hover {
        background: #2f855a;
    }
}

/* 포커스 접근성 개선 */
.scoring-input-page .score-btn:focus,
.scoring-input-page .feedback-btn:focus,
.scoring-input-page .test-audio-btn:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
    background-color: var(--primary-blue) !important;
    color: var(--white) !important;
}

/* 터치 디바이스에서 호버 효과 제거 */
@media (hover: none) and (pointer: coarse) {
    .scoring-input-page .score-btn:hover,
    .scoring-input-page .feedback-btn:hover,
    .scoring-input-page .test-audio-btn:hover {
        background-color: inherit;
    }
    
    /* 점수 버튼 터치 후 상태 복원 */
    .scoring-input-page .score-btn {
        transition: all 0.1s ease;
    }
}

/* 에러 상태 스타일 */
.audio-notice.error {
    background: #fed7d7;
    border-color: #feb2b2;
    color: #c53030;
}

.audio-notice.success {
    background: #c6f6d5;
    border-color: #9ae6b4;
    color: #2f855a;
}

/* 로딩 상태 */
.test-audio-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.test-audio-btn.loading:before {
    content: "🔄 ";
    animation: spin 1s linear infinite;
}

/* 성공 애니메이션 */
.scoring-input-page .score-btn.success-flash {
    animation: successFlash 0.1s ease-in-out;
}

@keyframes successFlash {
    0% { background-color: var(--primary-blue); color: var(--white); }
    50% { background-color: #28a745; color: white; }
    100% { background-color: var(--primary-blue); color: var(--white); }
}

/* 진동 시뮬레이션 애니메이션 */
.scoring-input-page .vibrate-simulation {
    animation: vibrate 0.05s linear 2;
}

@keyframes vibrate {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
}

/* 점수 변경 시 시각적 피드백 */
.scoring-input-page .score-display.changed {
    animation: scoreChange 0.1s ease-out;
}

@keyframes scoreChange {
    0% { transform: scale(1); background-color: transparent; }
    50% { transform: scale(1.1); background-color: #e3f2fd; }
    100% { transform: scale(1); background-color: transparent; }
}

/* 버튼 활성화 상태 개선 */
.scoring-input-page .score-btn:not(:disabled):active,
.scoring-input-page .btn:not(:disabled):active {
    background-color: var(--primary-blue-hover) !important;
    color: var(--white) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    transform: scale(0.95) !important;
    transition: all 0.1s ease !important;
}

/* 스크린 리더 전용 텍스트 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .audio-test-section {
        flex-direction: row;
        gap: 8px;
    }
    
    .scoring-input-page .audio-notice {
        font-size: 12px;
    }
} 

/* ===== Overlay-specific tap feedback overrides (placed last to win cascade) ===== */
@media (hover: none) and (pointer: coarse) {
    #scoring-overlay .score-btn {
        transition: transform 0.08s ease, background-color 0.08s ease;
    }
    #scoring-overlay .score-btn:active {
        transform: scale(0.96) !important;
    }
    #scoring-overlay .score-btn.increase:active {
        background-color: var(--primary-blue-hover) !important;
    }
    #scoring-overlay .score-btn.decrease:active {
        background-color: #b21f2d !important;
    }
}

/* Programmatic touch feedback (more reliable on iOS Safari) */
#scoring-overlay .score-btn.touching {
    transform: scale(0.96) !important;
}
#scoring-overlay .score-btn.increase.touching {
    background-color: var(--primary-blue-hover) !important;
}
#scoring-overlay .score-btn.decrease.touching {
    background-color: #b21f2d !important;
}

/* ===============================================
   D 심판용 스타일 (DP/DM/DR)
   =============================================== */

/* D 심판 오버레이 기본 스타일 */
#d-judge-scoring-overlay {
    background-color: #f0f8ff;
}

/* D 심판 상단 컨트롤 */
.d-judge-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.d-judge-top-controls .left-controls,
.d-judge-top-controls .right-controls {
    display: flex;
    gap: 0.5rem;
}

/* Rep. Skill 및 Score 헤더 */
.d-judge-score-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    color: white;
    gap: 1rem;
}

.rep-skill-btn {
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    transition: var(--transition);
    cursor: pointer;
}

.rep-skill-btn:hover {
    background: #e55a2b;
    transform: translateY(-2px);
}

.rep-skill-btn:active {
    transform: translateY(0);
}

.rep-skill-btn .skill-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.rep-skill-btn .skill-count {
    font-size: 1.1rem;
    font-weight: bold;
}

.center-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}


.center-score .score-label {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.center-score .score-value {
    font-size: 1.5rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

/* 레벨 기술 버튼 그리드 */
.d-judge-level-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: -1.0rem;
}

.level-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.level-btn {
    flex: 1;
    padding: 2rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    /* 빠른 터치 응답성 개선 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-start: enabled;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 레벨별 색상 구분 */
.level-btn.level-basic {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.level-btn.level-advanced {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.level-btn.level-expert {
    background: linear-gradient(135deg, #007bff, #6f42c1);
}

.level-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.level-btn:active {
    transform: translateY(-1px);
}

.level-btn .level-text {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.level-btn .level-count {
    font-size: 1.5rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    min-width: 45px;
}

/* D 심판 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-gray);
    background: var(--primary-blue);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

.level-detail h5 {
    color: var(--primary-blue);
    margin: 0 0 1rem 0;
    font-size: 1.3rem;
}

.score-input-section {
    margin-bottom: 1.5rem;
}

.score-input-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.number-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.num-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background: var(--primary-blue-hover);
    transform: scale(1.05);
}

.num-btn:active {
    transform: scale(0.95);
}

.num-btn.decrease {
    background: var(--danger-red);
}

.num-btn.decrease:hover {
    background: #c82333;
}

.num-btn.increase {
    background: var(--success-green);
}

.num-btn.increase:hover {
    background: #218838;
}

#d-skill-count-input {
    width: 80px;
    padding: 0.75rem;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    background: var(--light-gray);
}

.level-info {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-blue);
}

.level-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-gray);
    background: var(--light-gray);
    border-radius: 0 0 12px 12px;
}

/* 모바일 최적화 - D 심판 */
@media (max-width: 768px) {
    .d-judge-score-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: 0.5rem;
        text-align: center;
        padding: 0.75rem;
    }
    
    .rep-skill-btn {
        min-width: 80px;
        padding: 0.5rem 0.75rem;
        margin-top: 2rem;
    }
    
    .level-row {
        gap: 0.5rem;
    }
    
    .level-btn {
        padding: 1rem 0.5rem;
        min-height: 150px;
        font-size: 1rem;
    }
    
    .level-btn .level-text {
        font-size: 0.9rem;
    }
    
    .level-btn .level-count {
        font-size: 1.1rem;
        padding: 0.2rem 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .number-input .num-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    #d-skill-count-input {
        width: 70px;
        font-size: 1.1rem;
    }
}

/* 터치 피드백 */
@media (hover: none) and (pointer: coarse) {
    .level-btn {
        transition: transform 0.08s ease;
    }
    
    .level-btn:active {
        transform: scale(0.96) !important;
    }
    
    .rep-skill-btn:active {
        transform: scale(0.96) !important;
    }
    
    .num-btn:active {
        transform: scale(0.9) !important;
    }
}