/**
 * スイス式トーナメント表ジェネレーター 専用スタイル
 */

/* ========================================
   オプション設定グリッド
   ======================================== */
.stm-options-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px 20px;
	padding: 16px 20px;
	border-top: 1px solid var(--color-border);
}

@media (max-width: 600px) {
	.stm-options-grid {
		grid-template-columns: 1fr;
	}
}

.stm-option {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.stm-option-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--color-text);
}

.stm-option-select {
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid var(--color-border);
	border-radius: 6px;
	background: var(--color-bg);
	font-family: inherit;
	cursor: pointer;
}

.stm-option-select:focus {
	outline: none;
	border-color: var(--color-primary, #C76A1F);
}

.stm-option-hint {
	font-size: 11.5px;
	color: var(--color-text-muted);
	line-height: 1.5;
}

/* ========================================
   ラウンドタブ
   ======================================== */
.stm-tournament-area {
	margin-top: 20px;
	padding: 16px 0 0;
	border-top: 1px solid var(--color-border);
}

.stm-round-tabs {
	display: flex;
	gap: 6px;
	padding: 0 20px;
	margin-bottom: 14px;
	overflow-x: auto;
	border-bottom: 1px solid var(--color-border);
}

.stm-round-tab {
	flex-shrink: 0;
	padding: 10px 14px;
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 700;
	color: var(--color-text-muted);
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s;
}

.stm-round-tab:hover {
	color: var(--color-text);
}

.stm-round-tab.active {
	color: #2E6FB5;
	border-bottom-color: #2E6FB5;
}

.stm-round-tab--completed::after {
	content: '✓';
	margin-left: 4px;
	color: #2E8B57;
}

/* ========================================
   ラウンドパネル（対戦カード）
   ======================================== */
.stm-round-panel {
	padding: 0 20px 14px;
}

.stm-round-title {
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 700;
	color: var(--color-text);
	margin: 0 0 10px;
	padding-left: 8px;
	border-left: 4px solid #2E6FB5;
}

.stm-match-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.stm-match {
	display: grid;
	grid-template-columns: 36px 1fr auto 1fr 36px;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 8px;
	font-size: 13.5px;
}

@media (max-width: 600px) {
	.stm-match {
		grid-template-columns: 28px 1fr auto 1fr 28px;
		gap: 6px;
		font-size: 12.5px;
		padding: 8px 10px;
	}
}

.stm-match-no {
	font-family: var(--font-display);
	font-size: 11px;
	font-weight: 700;
	color: var(--color-text-muted);
	text-align: center;
}

.stm-match-player {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

.stm-match-player-name {
	font-weight: 600;
	color: var(--color-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stm-match-player--right {
	flex-direction: row-reverse;
	text-align: right;
}

.stm-match-vs {
	font-family: var(--font-display);
	font-size: 12px;
	font-weight: 700;
	color: var(--color-text-muted);
	letter-spacing: 0.05em;
}

.stm-match-result-buttons {
	display: flex;
	gap: 4px;
	justify-content: center;
}

.stm-result-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid var(--color-border);
	border-radius: 5px;
	background: var(--color-white);
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	transition: all 0.15s ease;
	color: var(--color-text-muted);
}

.stm-result-btn:hover {
	background: var(--color-bg);
}

.stm-result-btn--win.active {
	background: #2E8B57;
	color: #FFFFFF;
	border-color: #1F6B40;
}

.stm-result-btn--draw.active {
	background: #DBA935;
	color: #FFFFFF;
	border-color: #B58A23;
}

.stm-result-btn--lose.active {
	background: #C0392B;
	color: #FFFFFF;
	border-color: #8E1F14;
}

.stm-match--bye {
	background: #F4F8FF;
	border-color: #B6CCE6;
}

.stm-match--bye .stm-match-result-buttons {
	display: none;
}

.stm-bye-label {
	grid-column: 3 / -1;
	font-size: 12px;
	color: #2E6FB5;
	font-weight: 600;
	text-align: center;
	padding-right: 12px;
}

.stm-rematch-warning {
	margin-top: 4px;
	padding: 8px 10px;
	background: #FFF8EC;
	border: 1px solid #F5DEAA;
	border-radius: 6px;
	font-size: 12px;
	color: #6B5520;
}

/* ========================================
   コントロールボタン
   ======================================== */
.stm-controls {
	display: flex;
	gap: 10px;
	justify-content: space-between;
	padding: 14px 20px;
	border-top: 1px solid var(--color-border);
	background: var(--color-bg);
}

@media (max-width: 600px) {
	.stm-controls {
		flex-direction: column;
	}
}

/* ========================================
   順位表
   ======================================== */
.stm-standings-section {
	padding: 14px 20px;
	border-top: 1px solid var(--color-border);
}

.stm-section-title {
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 700;
	color: var(--color-text);
	margin: 0 0 10px;
	padding-left: 8px;
	border-left: 4px solid #C76A1F;
}

.stm-standings-wrap {
	overflow-x: auto;
}

.stm-standings-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	background: var(--color-white);
	border: 1px solid var(--color-border);
	border-radius: 6px;
	overflow: hidden;
}

.stm-standings-table th,
.stm-standings-table td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--color-border-light, #EAE7E0);
}

.stm-standings-table thead th {
	background: #F0F5FB;
	font-weight: 600;
	font-size: 12px;
	color: var(--color-text-secondary);
	white-space: nowrap;
}

.stm-th-rank, .stm-th-num {
	text-align: right;
	width: 60px;
}

.stm-th-name {
	text-align: left;
}

.stm-standings-table tbody tr:last-child td {
	border-bottom: none;
}

.stm-standings-table tbody td {
	font-family: var(--font-display);
}

.stm-standings-table .stm-td-rank {
	text-align: right;
	font-weight: 700;
}

.stm-standings-table .stm-td-name {
	text-align: left;
	font-weight: 600;
	color: var(--color-text);
}

.stm-standings-table .stm-td-num {
	text-align: right;
	font-weight: 600;
}

.stm-standings-table tbody tr.stm-row-1 td {
	background: linear-gradient(90deg, #FFEFB8 0%, #FFF8E0 100%);
}

.stm-standings-table tbody tr.stm-row-2 td {
	background: linear-gradient(90deg, #E8E8E8 0%, #F5F5F5 100%);
}

.stm-standings-table tbody tr.stm-row-3 td {
	background: linear-gradient(90deg, #F5D4B8 0%, #FAEAD8 100%);
}

.stm-standings-table .stm-td-rank::before {
	content: '';
}

.stm-row-1 .stm-td-rank::before {
	content: '🥇 ';
}

.stm-row-2 .stm-td-rank::before {
	content: '🥈 ';
}

.stm-row-3 .stm-td-rank::before {
	content: '🥉 ';
}

/* ========================================
   アクションボタン
   ======================================== */
.stm-actions {
	display: flex;
	gap: 10px;
	justify-content: space-between;
	align-items: center;
	padding: 14px 20px;
	border-top: 1px solid var(--color-border);
}

@media (max-width: 600px) {
	.stm-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}
}
