* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #00BCD4;
    font-size: 1.2rem;
}

.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

button {
    padding: 8px 15px;
    background-color: #00BCD4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0097A7;
}

.loading {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    color: #d32f2f;
    text-align: center;
    margin: 10px 0;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
}

.search-results {
    margin-top: 20px;
}

.tournament-section {
    margin-bottom: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tournament-title {
    padding: 10px;
    background-color: #f5f5f5;
    color: #333;
    font-size: 0.9rem;
    margin: 0;
}

.events-list {
    padding: 10px;
}

.event-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.event-item:last-child {
    border-bottom: none;
}

.event-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.event-name {
    font-weight: 500;
    color: #333;
    min-width: 90px;
    font-size: 0.85rem;
}

.players-info {
    flex: 1;
    color: #333;
    font-size: 0.85rem;
}

.highlight-player {
    color: #333;
    font-weight: 600;
    background-color: #E0F7FA;
    padding: 1px 3px;
    border-radius: 3px;
}

.ranking {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 10px;
}

.ranking-1 {
    background-color: #fff8e1;
    color: #ff8f00;
}

.ranking-2 {
    background-color: #f5f5f5;
    color: #757575;
}

.ranking-3 {
    background-color: #fff3e0;
    color: #e65100;
}

.event-content button {
    padding: 4px 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: 45px;
}

.result-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item h3 {
    margin-bottom: 10px;
    color: #1976d2;
    font-size: 1.1rem;
}

.result-item .player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

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

.result-item .player-name {
    font-weight: 500;
    color: #1976d2;
}

.result-item .team-name {
    color: #666;
    font-size: 0.9rem;
}

.result-item .tournament-info {
    margin: 10px 0;
    color: #666;
    font-size: 0.9rem;
}

.result-item .ranking {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 8px;
}

.result-item .ranking-1 {
    background-color: #ffd700;
    color: #000;
}

.result-item .ranking-2 {
    background-color: #c0c0c0;
    color: #000;
}

.result-item .ranking-3 {
    background-color: #cd7f32;
    color: #fff;
}

.result-item button {
    width: 100%;
    margin-top: 10px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background-color: white;
    margin: 20px auto;
    padding: 20px;
    width: 95%;
    max-width: 800px;
    border-radius: 4px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: #00BCD4;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-container {
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
    margin-top: 0;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto;
}

.table-container th {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    background-color: #f5f5f5;
}

.table-container td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
    word-break: break-all;
}

.table-container th:nth-child(1) { width: 12%; }  /* 시간 */
.table-container th:nth-child(2) { width: 20%; } /* 경기 */
.table-container th:nth-child(3) { width: 45%; } /* 상대 */
.table-container th:nth-child(4) { width: 8%; }  /* 결과 */
.table-container th:nth-child(5) { width: 15%; } /* 스코어 */

.match-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 0.75rem;
}

.court-info {
    font-size: 0.7rem;
    color: #666;
}

.vs-team {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.vs-team-club {
    font-size: 0.7rem;
    color: #666;
}

.walkover {
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
}

.result-cell {
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.result-cell.win {
    color: #2e7d32;
}

.result-cell.lose {
    color: #c62828;
}

.filter-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-box input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.player-info-table {
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.player-info-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto;
}

.player-info-table th,
.player-info-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.player-info-table th {
    width: 70px;
    background-color: #E0F7FA;
    color: #00BCD4;
    font-weight: 500;
}

.player-info-table .team-info {
    color: #666;
    font-size: 0.8rem;
}

.win-row {
    background-color: #f1f8e9;
}

.lose-row {
    background-color: #ffebee;
}

.modal .tournament-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1976d2;
    margin-bottom: 10px;
    padding: 6px;
    background-color: #e3f2fd;
    border-radius: 4px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-actions button {
    padding: 6px 12px;
    font-size: 0.85rem;
}

#imageContainer {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

.image-header {
    margin-bottom: 20px;
    text-align: center;
    background-color: white;
    z-index: 1;
}

.image-header h3 {
    font-size: 1.2rem;
    color: #00BCD4;
    margin-bottom: 8px;
}

.filter-info {
    color: #666;
    font-size: 0.9rem;
}

#imageContainer table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    min-width: 800px;
}

#imageContainer th,
#imageContainer td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    white-space: nowrap;
}

#imageContainer th {
    background-color: #f5f5f5;
    font-weight: 500;
    text-align: center;
}

#imageContainer tr:nth-child(even) {
    background-color: #f9f9f9;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    h1 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .search-box {
        flex-direction: column;
        gap: 6px;
    }

    .filter-box {
        flex-direction: column;
        gap: 6px;
    }

    button {
        width: 100%;
    }

    .event-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .event-name {
        min-width: auto;
    }

    .players-info {
        width: 100%;
    }

    .event-content button {
        width: 100%;
    }

    .modal-content {
        margin: 8px;
        padding: 10px;
        width: calc(100% - 16px);
    }

    .table-container th,
    .table-container td {
        padding: 3px 4px;
        font-size: 0.75rem;
    }

    .table-container th:nth-child(1) { width: 15%; }  /* 시간 */
    .table-container th:nth-child(2) { width: 25%; } /* 경기 */
    .table-container th:nth-child(3) { width: 40%; } /* 상대 */
    .table-container th:nth-child(4) { width: 10%; } /* 결과 */
    .table-container th:nth-child(5) { width: 10%; } /* 스코어 */

    .match-info {
        font-size: 0.7rem;
    }

    .court-info {
        font-size: 0.65rem;
    }

    .vs-team-club {
        font-size: 0.65rem;
    }

    .walkover {
        font-size: 0.7rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 4px;
    }

    .modal-actions button {
        width: 100%;
    }

    #imageContainer {
        padding: 10px;
    }

    .image-header h3 {
        font-size: 1.1rem;
    }

    .filter-info {
        font-size: 0.8rem;
    }

    #imageContainer th,
    #imageContainer td {
        padding: 6px;
        font-size: 0.8rem;
    }
}

/* 이미지 모달 스타일 */
.image-modal .modal-content {
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    margin: 20px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.image-modal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.image-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#imageContainer {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.image-content {
    display: flex;
    flex-direction: column;
}

.image-header {
    margin-bottom: 20px;
    text-align: center;
    background-color: white;
    z-index: 1;
}

.image-header h3 {
    font-size: 1.2rem;
    color: #00BCD4;
    margin-bottom: 8px;
}

.image-header .filter-info {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.image-table-container {
    padding: 20px;
}

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

.image-table-container th {
    background: #E0F7FA;
    color: #00BCD4;
    padding: 12px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.image-table-container td {
    padding: 12px;
    text-align: center;
    border: 1px solid #e0e0e0;
    font-size: 14px;
}

header {
    background-color: #00BCD4;
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

header h1 {
    color: white;
    margin: 0;
    font-size: 1.8rem;
    text-align: center;
}

.home-btn {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.home-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.home-btn::before {
    content: "🏠";
    font-size: 1rem;
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .home-btn {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.8rem;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .home-btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

footer {
    text-align: center;
    margin-top: 1.5rem;
    padding: 0.8rem;
    background-color: #333;
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
}

.creator-info {
    margin-top: 0.5rem;
    font-style: italic;
    opacity: 0.8;
}

@media (max-width: 480px) {
    footer {
        margin-top: 1rem;
        padding: 0.6rem;
        font-size: 0.8rem;
    }
} 