/* 編成構築ツール /database/team-builder/ */
.isa-tb-page {
	--tb-primary: var(--primary, #0B72D6);
	--tb-accent: var(--accent, #6D28D9);
	--tb-border: var(--border, #D3DDEB);
	--tb-text: #16202e;
	--tb-muted: #64748b;
	--tb-bg: #f5f8fc;
	background: var(--tb-bg);
	padding: 24px 0 56px;
}

.isa-tb-wrap {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 16px;
}

.isa-tb-crumb {
	font-size: 12px;
	color: var(--tb-muted);
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}
.isa-tb-crumb a {
	color: var(--tb-primary);
	text-decoration: none;
}
.isa-tb-crumb em {
	font-style: normal;
	color: var(--tb-text);
}

.isa-tb-head {
	margin-bottom: 18px;
}
.isa-tb-title {
	font-size: 26px;
	line-height: 1.2;
	margin: 0 0 8px;
	color: var(--tb-text);
	display: flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
}
.isa-tb-title span {
	font-family: "Share Tech Mono", monospace;
	font-size: 12px;
	letter-spacing: 0.14em;
	color: var(--tb-primary);
	border: 1px solid var(--tb-primary);
	border-radius: 3px;
	padding: 2px 6px;
}
.isa-tb-lead {
	margin: 0;
	font-size: 13px;
	line-height: 1.8;
	color: var(--tb-muted);
}

/* タブ */
.isa-tb-tabs {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.isa-tb-tab {
	appearance: none;
	cursor: pointer;
	background: #fff;
	border: 1px solid var(--tb-border);
	border-radius: 4px;
	padding: 10px 16px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--tb-text);
	display: flex;
	align-items: baseline;
	gap: 8px;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.isa-tb-tab small {
	font-size: 11px;
	font-weight: 500;
	color: var(--tb-muted);
}
.isa-tb-tab:hover {
	border-color: var(--tb-primary);
	color: var(--tb-primary);
}
.isa-tb-tab.is-active {
	background: var(--tb-primary);
	border-color: var(--tb-primary);
	color: #fff;
	box-shadow: 0 4px 12px rgba(11, 114, 214, 0.24);
}
.isa-tb-tab.is-active small {
	color: rgba(255, 255, 255, 0.85);
}

/* ツールバー */
.isa-tb-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}
.isa-tb-hint {
	margin: 0;
	font-size: 12px;
	line-height: 1.7;
	color: var(--tb-muted);
}
.isa-tb-hint strong {
	color: var(--tb-text);
}

.isa-tb-btn {
	appearance: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	border-radius: 4px;
	padding: 10px 20px;
	border: 1px solid var(--tb-border);
	background: #fff;
	color: var(--tb-text);
	transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.isa-tb-btn:hover {
	transform: translateY(-1px);
}
.isa-tb-btn.is-primary {
	background: var(--tb-primary);
	border-color: var(--tb-primary);
	color: #fff;
	box-shadow: 0 4px 14px rgba(11, 114, 214, 0.28);
}
.isa-tb-btn.is-ghost:hover {
	border-color: var(--tb-primary);
	color: var(--tb-primary);
}

/* ボード（1ユニット＝1行） */
.isa-tb-board {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.isa-tb-squad {
	border: 1px solid var(--tb-border);
	border-left: 4px solid var(--tb-primary);
	border-radius: 4px;
	background: #fff;
	padding: 12px;
}
.isa-tb-squad-head {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 700;
	color: var(--tb-text);
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px dashed var(--tb-border);
}
.isa-tb-squad-head em {
	font-style: normal;
	font-size: 11px;
	font-weight: 500;
	color: var(--tb-muted);
}

.isa-tb-units {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.isa-tb-unit {
	border: 1px solid var(--tb-border);
	border-radius: 6px;
	background: #fbfdff;
	overflow: hidden;
}
.isa-tb-unit-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: linear-gradient(90deg, rgba(11, 114, 214, 0.10), rgba(11, 114, 214, 0));
	border-bottom: 1px solid var(--tb-border);
}
.isa-tb-unit-no {
	font-family: "Share Tech Mono", monospace;
	font-size: 13px;
	font-weight: 700;
	color: #fff;
	background: var(--tb-primary);
	border-radius: 3px;
	padding: 2px 9px;
	flex: 0 0 auto;
}
.isa-tb-unit-name {
	flex: 1;
	font-size: 14px;
	font-weight: 700;
	color: var(--tb-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.isa-tb-clear {
	appearance: none;
	cursor: pointer;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 12px;
	color: var(--tb-muted);
	padding: 2px 6px;
	flex: 0 0 auto;
}
.isa-tb-clear:hover {
	color: #b91c1c;
}

/* 上段: 立ち絵 + 基本入力 */
.isa-tb-unit-body {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 16px;
	padding: 14px;
	align-items: start;
}
.isa-tb-visual {
	display: flex;
	gap: 14px;
	align-items: flex-end;
}
.isa-tb-mechbig,
.isa-tb-pilotbig {
	position: relative;
	border: 1px solid var(--tb-border);
	border-radius: 6px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.isa-tb-mechbig {
	width: 190px;
	height: 190px;
}
.isa-tb-pilotbig {
	width: 146px;
	height: 146px;
	border-radius: 6px;
}
.isa-tb-mechbig img,
.isa-tb-pilotbig img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: none;
}
.isa-tb-mechbig.is-set img,
.isa-tb-pilotbig.is-set img {
	display: block;
}
.isa-tb-ph {
	font-size: 12px;
	color: #9aa8bb;
	letter-spacing: 0.10em;
}
.isa-tb-mechbig.is-set .isa-tb-ph,
.isa-tb-pilotbig.is-set .isa-tb-ph {
	display: none;
}

.isa-tb-basic {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 12px;
	align-content: start;
}
.isa-tb-f {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.isa-tb-lbl {
	font-size: 12px;
	font-weight: 700;
	color: var(--tb-muted);
	line-height: 1.2;
}
.isa-tb-in {
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	font-size: 14px;
	color: var(--tb-text);
	background: #fff;
	border: 1px solid var(--tb-border);
	border-radius: 4px;
	padding: 9px 10px;
}
.isa-tb-in:focus {
	outline: none;
	border-color: var(--tb-primary);
	box-shadow: 0 0 0 2px rgba(11, 114, 214, 0.16);
}
.isa-tb-in.is-invalid {
	border-color: #dc2626;
	background: #fff5f5;
}

/* 下段: 装備スロット（横一列・大アイコン） */
.isa-tb-slots {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 10px;
	padding: 14px;
	border-top: 1px dashed var(--tb-border);
	background: #fff;
}
.isa-tb-slot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	min-width: 0;
}
.isa-tb-ic {
	width: 100%;
	max-width: 96px;
	aspect-ratio: 1 / 1;
	border: 1px dashed #cbd7e6;
	border-radius: 6px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.isa-tb-ic img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: none;
}
.isa-tb-ic.is-set {
	border-style: solid;
	border-color: var(--tb-border);
	background: #f4f8fd;
}
.isa-tb-ic.is-set img {
	display: block;
}
.isa-tb-slot .isa-tb-in {
	font-size: 12px;
	padding: 5px 6px;
	text-align: center;
}
.isa-tb-slot .isa-tb-lbl {
	font-size: 12px;
	text-align: center;
}

/* 出力 */
.isa-tb-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	margin: 20px 0 8px;
	padding: 14px;
	background: #fff;
	border: 1px solid var(--tb-border);
	border-left: 4px solid var(--tb-accent);
	border-radius: 4px;
}
.isa-tb-note {
	font-size: 12px;
	color: var(--tb-muted);
	flex: 1 1 260px;
}
.isa-tb-btn.is-share {
	background: #fff;
	border-color: var(--tb-border);
}
.isa-tb-btn.is-share:hover {
	border-color: var(--tb-accent);
	color: var(--tb-accent);
}
.isa-tb-btn.is-x:hover {
	border-color: #0f1419;
	color: #0f1419;
}
.isa-tb-btn.is-discord:hover {
	border-color: #5865F2;
	color: #5865F2;
}
.isa-tb-btn:disabled {
	opacity: 0.6;
	cursor: progress;
	transform: none;
}
.isa-tb-status {
	flex: 1 1 100%;
	font-size: 12px;
	font-weight: 600;
	color: var(--tb-muted);
	min-height: 18px;
}
.isa-tb-status.is-ok {
	color: #15803d;
}
.isa-tb-status.is-warn {
	color: #b45309;
}
.isa-tb-status.is-error {
	color: #b91c1c;
}

.isa-tb-preview-wrap {
	margin-top: 16px;
}
.isa-tb-preview-title {
	font-size: 14px;
	margin: 0 0 8px;
	color: var(--tb-text);
}
.isa-tb-preview-frame {
	background: #fff;
	border: 1px solid var(--tb-border);
	border-radius: 4px;
	padding: 8px;
	overflow: auto;
	max-height: 78vh;
}
#isa-tb-preview {
	display: block;
	width: 100%;
	height: auto;
	max-width: 1240px;
}

.isa-tb-foot-note {
	font-size: 11px;
	color: var(--tb-muted);
	line-height: 1.8;
	margin-top: 20px;
}

@media (max-width: 900px) {
	.isa-tb-unit-body {
		grid-template-columns: minmax(0, 1fr);
	}
	.isa-tb-slots {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
@media (max-width: 560px) {
	.isa-tb-mechbig {
		width: 130px;
		height: 130px;
	}
	.isa-tb-pilotbig {
		width: 110px;
		height: 110px;
	}
	.isa-tb-slots {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
