/* ── Tournament Manager Front CSS ── */
/* 色はすべてCSS変数（:root）で定義 → PHPから動的に上書きされます */

.tm-group-block { margin-bottom: 2.5em; }

.tm-group-title {
    font-size: 1.1em;
    font-weight: bold;
    border-left: 4px solid var(--tm-group-accent, #2271b1);
    padding-left: .6em;
    margin-bottom: .6em;
}

.tm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tm-league-table {
    border-collapse: collapse;
    width: 100%;
    font-size: .92em;
    background: var(--tm-even-row, #fff);
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    border-radius: 6px;
    overflow: hidden;
    table-layout: auto;
}

/* ヘッダー */
.tm-league-table thead {
    background: var(--tm-header-bg, #1d4e89);
    color: var(--tm-header-text, #fff);
}

.tm-league-table thead th {
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    font-size: .85em;
    white-space: normal;
    word-break: break-all;
    vertical-align: bottom;
    min-width: 56px;
}

/* 左端（チーム名ラベル）は折り返しなし */
.tm-league-table thead th:first-child {
    text-align: left;
    white-space: nowrap;
    word-break: keep-all;
    min-width: 120px;
}

/* 右側の集計列（勝ち点・得失点・総得点・順位）は折り返しなし */
.tm-league-table thead th:nth-last-child(-n+4) {
    white-space: nowrap;
    word-break: keep-all;
}

/* ボディ */
.tm-league-table tbody tr:nth-child(odd)  { background: var(--tm-odd-row,  #f7f9fc); }
.tm-league-table tbody tr:nth-child(even) { background: var(--tm-even-row, #ffffff); }
.tm-league-table tbody tr:hover           { background: var(--tm-hover,    #eaf2ff); }

.tm-league-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--tm-border, #e5e9ee);
    vertical-align: middle;
}

.tm-team-name {
    text-align: left !important;
    font-weight: 600;
    white-space: nowrap;
    min-width: 120px;
}

.tm-self { background: #e9ecef; color: #aaa; }

/* スコア */
.tm-score {
    display: inline-block;
    font-weight: 700;
    font-size: 1em;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}
.tm-score.tm-win  { color: var(--tm-win-text,  #155724); background: var(--tm-win-bg,  #d4edda); }
.tm-score.tm-lose { color: var(--tm-lose-text, #721c24); background: var(--tm-lose-bg, #f8d7da); }
.tm-score.tm-draw { color: var(--tm-draw-text, #856404); background: var(--tm-draw-bg, #fff3cd); }

.tm-halftime {
    display: block;
    color: #666;
    font-size: .78em;
    margin-top: 1px;
    white-space: nowrap;
}

.tm-pk {
    display: inline-block;
    color: #5a3e8a;
    background: #ede7f6;
    font-size: .78em;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 2px;
    white-space: nowrap;
}

.tm-bracket-pk {
    font-size: .75em;
    color: #5a3e8a;
    background: #ede7f6;
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 2px;
}

.tm-pending { color: #bbb; }

.tm-pts  { font-weight: 700; color: var(--tm-pts-color, #1d4e89); }
.tm-gd   { font-weight: 600; }
.tm-rank { font-weight: 700; font-size: 1.1em; }

/* ── トーナメントブラケット ── */
.tm-bracket {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

.tm-bracket-round {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 220px;
}

.tm-round-title {
    text-align: center;
    font-weight: 700;
    font-size: .95em;
    background: var(--tm-header-bg, #1d4e89);
    color: var(--tm-header-text, #fff);
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.tm-bracket-match {
    border: 1px solid var(--tm-border, #cdd4db);
    border-radius: 6px;
    overflow: hidden;
    background: var(--tm-even-row, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.tm-bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tm-border, #e9ecef);
    font-size: .9em;
}

.tm-bracket-team:last-of-type { border-bottom: none; }

.tm-bracket-team.tm-bracket-winner {
    background: var(--tm-winner-bg, #d4edda);
    font-weight: 700;
}

.tm-bracket-name  { flex: 1; margin-right: 10px; }

.tm-bracket-score {
    font-weight: 700;
    font-size: 1.1em;
    min-width: 24px;
    text-align: right;
    color: var(--tm-pts-color, #1d4e89);
    white-space: nowrap;
}

.tm-bracket-label {
    font-size: .75em;
    color: #888;
    text-align: right;
    padding: 2px 10px;
    background: var(--tm-odd-row, #f7f9fc);
}

/* ── 会場表示 ── */
.tm-venue {
    font-size: .88em;
    color: #555;
    margin: 0 0 .5em 0;
}

.tm-bracket-venue {
    font-size: .75em;
    color: #666;
    padding: 3px 10px 4px;
    background: var(--tm-odd-row, #f7f9fc);
    border-top: 1px solid var(--tm-border, #e9ecef);
}

/* ── 日時表示 ── */
.tm-match-dt {
    display: block;
    font-size: .75em;
    color: #666;
    margin-top: 2px;
    white-space: nowrap;
}

.tm-bracket-datetime {
    font-size: .78em;
    color: #555;
    padding: 3px 10px;
    background: var(--tm-odd-row, #f7f9fc);
    border-bottom: 1px solid var(--tm-border, #e9ecef);
}
