/* 基礎設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器設定 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 比賽資訊區域 */
.match-info {
    text-align: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.match-date {
    font-size: 1.2em;
    margin-bottom: 3px;
}

.venue-info {
    color: #666;
    margin-bottom: 10px;
}

.match-result {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

/* 隊伍資訊 */
.team {
    display: flex;
    align-items: center;
    gap: 15px;
}

.team-name {
    font-size: 1.2em;
}

.team-score {
    font-size: 1.8em;
    font-weight: bold;
    color: #fa363a;
}

.score-divider {
    font-size: 1.8em;
    font-weight: bold;
}

/* 比賽內容表格 */
.game-section {
    margin: 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.game-section h3 {
    display: inline-block;
    margin-right: 10px;
}

.game-section h4 {
    display: inline-block;
    margin: 0;
    font-weight: normal;
    color: #666;
}

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

.game-table th:first-child,
.game-table td:first-child {
    width: 30%;  /* 賽局欄位 */
}

.game-table th:nth-child(2),
.game-table td:nth-child(2),
.game-table th:nth-child(3),
.game-table td:nth-child(3) {
    width: 35%;  /* 主隊和客隊欄位 */
}

.game-table th,
.game-table td {
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #ddd;
}

.game-table th {
    background-color: #f8f8f8;
    font-weight: bold;
}

.game-type {
    background-color: #f8f8f8;
    font-weight: bold;
    padding: 6px 4px;
}

.game-detail {
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
    line-height: 1.3;
}

.score {
    font-weight: bold;
    color: #fa363a;
}

/* 調整多人賽局的文字換行 */
.game-table td {
    word-break: break-word;
    hyphens: auto;
}

/* 響應式設計 */
@media screen and (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .match-date {
        font-size: 1.2em;
    }

    .team-name {
        font-size: 1em;
    }

    .team-score {
        font-size: 1.5em;
    }

    .game-table th,
    .game-table td {
        padding: 6px 4px;
        font-size: 10pt;
    }

    .game-detail {
        font-size: 0.75em;
    }
}

/* 先攻標示 */
.first-attack {
    background-color: #fff7e6;
    text-align: center;
    vertical-align: middle;
}

/* 勝方標示 */
.winner {
    position: relative;
    text-align: center;
    vertical-align: middle;
    padding: 8px 6px 8px 38px !important; /* 左側添加空間以容納勝利圖標 */
}

/* 多人賽的勝方標示 - 使用特定的類別替代:has選擇器 */
.winner-multiline {
    padding-left: 42px !important; /* 有換行時增加左側間距 */
}

/* 勝利圖標 */
.winner-icon {
    position: absolute;
    top: 50%; /* 定位在垂直中間 */
    left: 4px; /* 左側位置 */
    width: 30px;
    height: 30px;
    transform: translateY(-50%); /* 垂直居中對齊 */
    background-image: url(../../images/winner.png);
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 5; /* 將圖標放在文字上方以確保可見 */
}

/* 表格基本樣式 */
.game-table td {
    position: relative;
    text-align: center;
    vertical-align: middle;
    padding: 8px 6px;
    min-height: 40px;
}

/* 遊戲類型單元格 */
.game-type {
    text-align: center;
    background-color: #f8f8f8;
    font-weight: bold;
}

/* 遊戲詳情 */
.game-detail {
    font-size: 8pt;
    color: #666;
    font-weight: normal;
}

/* 統計按鈕樣式 */
.stats-buttons {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
    min-width: 100px;
}

.stats-btn.active {
    background: #fa363a;
    color: white;
    border-color: #fa363a;
}

/* 統計表格樣式 */
.stats-table {
    width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

.stats-table th,
.stats-table td {
    padding: 6px 3px;
    font-size: 12px;
    text-align: center;
    min-width: 35px;
}

.stats-table .player-name {
    text-align: left;
    padding-left: 6px;
    min-width: 50px;
}

@media screen and (max-width: 480px) {
    .stats-table th,
    .stats-table td {
        padding: 6px 3px;
        font-size: 14px;
    }
    
    .stats-btn {
        padding: 6px 12px;
        min-width: 80px;
        font-size: 14px;
    }
}

.hidden {
    display: none;
}

/* 調整表格字體大小和間距 */
.stats-table th,
.stats-table td {
    padding: 6px 3px;
    font-size: 12px;
    text-align: center;
    min-width: 35px;
}

.stats-table .player-name {
    text-align: left;
    padding-left: 6px;
    min-width: 50px;
}

/* 調整按鈕大小 */
.stats-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 70px;
}

.score-details {
    margin: 15px auto;
    max-width: 85%;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.score-table th,
.score-table td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #eee;
}

.score-table th {
    background: #f5f5f5;
    font-weight: normal;
}

.score-table td:first-child {
    text-align: left;
    padding-left: 8px;
    background: #f9f9f9;
}

/* 最後一行（總分）特殊樣式 */
.score-table tr:last-child {
    font-weight: bold;
    background: #f5f5f5;
}

/* 交替行顏色 */
.score-table tr:nth-child(even) {
    background: #fafafa;
}

/* 為小屏幕設備調整勝利圖標 */
@media screen and (max-width: 480px) {
    .winner {
        padding: 8px 6px 8px 32px !important; /* 小屏幕上減少左側空間 */
    }
    
    .winner-multiline {
        padding-left: 36px !important; /* 小屏幕上的多行文字左側間距 */
    }
    
    .winner-icon {
        width: 24px; /* 小屏幕上縮小圖標 */
        height: 24px;
        left: 3px; /* 調整左側間距 */
    }
}

/* Banner 樣式 */
.banner-section {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.banner-container {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.banner-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

.banner-image:hover {
    transform: scale(1.02);
}

.banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 15px;
    color: white;
}

.banner-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.banner-description {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* 為iPhone 12 Pro等中等寬度設備設置特殊樣式 */
@media screen and (min-width: 375px) and (max-width: 390px) {
    .stats-btn {
        padding: 5px 8px;
        min-width: 60px;
        font-size: 11px;
    }
    
    .game-table th,
    .game-table td {
        padding: 5px 3px;
        font-size: 9pt;
    }
    
    .banner-container {
        height: 120px;
    }
    
    .banner-title {
        font-size: 14px;
    }
    
    .banner-description {
        font-size: 11px;
    }
}

/* 大屏幕設備的 Banner 樣式 */
@media screen and (min-width: 768px) {
    .banner-container {
        height: 180px;
    }
    
    .banner-title {
        font-size: 18px;
    }
    
    .banner-description {
        font-size: 14px;
    }
}