/*
 * UNDER LAYERS — 資料室(tips.html)と、タイトル画面のモードボタンの並び
 * トークンと部品は kb.css のもの(--fg / --line / .btn / .band / .box / .kv / .tag / .rar)を使う。
 * ここで足すのは tp- / tips- 接頭辞のクラスと、タイトルの .mode-nav だけ。
 */

/* ============================================================ タイトル: [ チュートリアル | 作戦記録 ] [ 防壁構築 ] [ 侵入構築 ] [ 侵入 ] [ 資料室 ] [ マイページ ] */

.buttons.mode-nav {
	gap: 10px;
}

.mode-nav .btn {
	min-width: 0;
	padding: 6px 12px;
}

/* 主ボタン(1つ目)だけ反転させる(赤は使わない)。チュートリアルを終えるまではチュートリアル(はじめての入口)、
   終えたら作戦記録(チュートリアルはサイト内リンクの top の隣へ)。どちらにするかは <html data-tut="done">
   (assets/js/title-boot.js が描画の前に付ける。docs/ui-design.md §3) */
.mode-nav .mode-primary {
	color: var(--bg);
	background: var(--fg);
	border-color: var(--fg-hi);
}

a.btn.mode-primary:link,
a.btn.mode-primary:visited {
	color: var(--bg);
}

a.btn.mode-primary:hover,
a.btn.mode-primary:focus-visible {
	color: var(--fg);
	background: var(--bg);
}

.mode-nav .mode-ops {
	display: none;
}

html[data-tut="done"] .mode-nav .mode-tutorial,
html[data-tut="done"] .site-header .ops-strip {
	display: none;
}

html[data-tut="done"] .mode-nav .mode-ops {
	display: inline-block;
}

/* 作戦記録のボタンの札(要 当直照会 / 出撃可。auth/header.js が入れる。入るまでは出さない) */
.mode-ops-tag {
	margin-left: 8px;
	padding: 0 4px;
	color: var(--bg);
	background: var(--warn);
	font-size: var(--fs-xs);
	vertical-align: 1px;
}

.mode-ops-tag:empty {
	display: none;
}

.mode-ops[data-state="verified"] .mode-ops-tag {
	color: var(--fg-hi);
	background: var(--bg);
}

/* hover で地が反転したとき、出撃可の札は緑地に */
.mode-ops[data-state="verified"]:is(:hover, :focus-visible) .mode-ops-tag {
	color: var(--bg);
	background: var(--fg);
}

@media screen and (max-width: 560px) {
	/* 1段目にチュートリアル、その下に2列(押しやすい高さ 44px 以上) */
	.buttons.mode-nav {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		max-width: 420px;
		margin-inline: auto;
	}

	.mode-nav .btn {
		flex: none;
		max-width: none;
		min-height: 44px;
		padding: 10px 4px;
		font-size: 14px;
	}

	/* どのボタンも同じ幅の2列(作戦記録・出勤簿だけ横いっぱいに伸ばすのはやめた。2026-11-18 制作者の指摘)。
	   チュートリアル(始めたばかりの人にだけ出る)は1段まるごと */
	.mode-nav .mode-tutorial {
		grid-column: 1 / -1;
	}
}


/* ============================================================ 資料室: 骨組み */

.tips-main {
	max-width: 980px;
}

.tips-lead {
	margin: 4px 0 0;
	font-size: var(--fs-s);
}

.tips-mode {
	margin: 4px 0 0;
	color: var(--sub);
	font-size: var(--fs-xs);
}

.tips-mode .k {
	color: var(--muted);
}

.tips-app > * + * {
	margin-top: 22px;
}

.tp-toc {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 14px;
}

.tp-toc .btn.sm {
	padding: 4px 8px;
}

.tp-box {
	scroll-margin-top: 8px;
}

.tp-lead {
	margin: 0 0 10px;
	font-size: var(--fs-s);
}

.tp-src {
	color: var(--muted);
}

/* 本文中のリンク(kb.css の既定は --sub で地の文と見分けにくいので、点線の下線を付ける) */
.tips-app p a:not(.btn),
.tips-app h4 a,
.tips-app .kv th a,
.tp-see a,
.tp-num .lbl {
	color: var(--fg-hi);
	text-decoration: underline dotted var(--line-hi);
	text-underline-offset: 3px;
}

.tips-app p a:not(.btn):hover,
.tips-app h4 a:hover,
.tips-app .kv th a:hover,
.tp-see a:hover,
.tp-num .lbl:hover,
.tips-app a:focus-visible {
	color: var(--fg);
	text-decoration-color: currentColor;
}

/* ============================================================ 用語集: 検索・絞り込み */

.tp-search {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tp-q-label {
	flex: none;
	color: var(--fg);
}

.tp-q-label::before {
	content: "> ";
	color: var(--muted);
}

.tp-q {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 34px;
}

.tp-count {
	flex: none;
	color: var(--sub);
	font-size: var(--fs-s);
}

.tp-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
	margin-top: 8px;
	font-size: var(--fs-s);
}

.tp-chip {
	min-height: 28px;
	padding: 2px 8px;
	color: var(--sub);
	background: var(--bg);
	border: 1px solid var(--line-hi);
	cursor: pointer;
}

.tp-chip:hover,
.tp-chip:focus-visible {
	color: var(--fg);
	border-color: var(--fg);
}

.tp-chip[aria-pressed="true"] {
	color: var(--bg);
	background: var(--fg);
	border-color: var(--fg);
}

/* ============================================================ 用語集: 一覧 */

.tp-list {
	margin-top: 10px;
}

.tp-group + .tp-group {
	margin-top: 16px;
}

.tp-group-h,
.tp-rule-h {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0 0 8px;
	padding-bottom: 3px;
	color: var(--fg-hi);
	border-bottom: 1px dotted var(--line-hi);
	font-size: var(--fs-m);
}

.tp-group-h .meta,
.tp-rule-h .meta,
.tp-outcome h4 .meta,
.tp-flow h4 .meta {
	margin-left: auto;
	color: var(--muted);
	font-size: var(--fs-xs);
	font-weight: normal;
	white-space: nowrap;
}

.tp-terms {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
	gap: 8px;
}

.tp-term {
	min-width: 0;
	padding: 6px 9px 8px;
	background: var(--bg-1);
	border: 1px solid var(--line);
	scroll-margin-top: 10px;
}

.tp-term:focus {
	outline: none;
}

/* 関連リンクから飛んだ先 = HUD の角ブラケット(kb.css の .hud と同じ描き方) */
.tp-term.is-hit {
	position: relative;
	border-color: var(--fg-hi);
}

.tp-term.is-hit::before {
	content: "";
	position: absolute;
	inset: -4px;
	pointer-events: none;
	--c: var(--fg-hi);
	background:
		linear-gradient(var(--c), var(--c)) left top / var(--bracket) 1px,
		linear-gradient(var(--c), var(--c)) left top / 1px var(--bracket),
		linear-gradient(var(--c), var(--c)) right top / var(--bracket) 1px,
		linear-gradient(var(--c), var(--c)) right top / 1px var(--bracket),
		linear-gradient(var(--c), var(--c)) left bottom / var(--bracket) 1px,
		linear-gradient(var(--c), var(--c)) left bottom / 1px var(--bracket),
		linear-gradient(var(--c), var(--c)) right bottom / var(--bracket) 1px,
		linear-gradient(var(--c), var(--c)) right bottom / 1px var(--bracket);
	background-repeat: no-repeat;
}

.tp-term-h {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0;
	font-size: var(--fs-l);
	overflow-wrap: anywhere;
}

.tp-name {
	color: var(--fg-hi);
}

.tp-term-h .tag {
	color: var(--fg-hi);
}

.tp-term-h .tag[data-tag="攻性"] {
	color: var(--alert);
}

.tp-term-h .rar {
	font-size: var(--fs-s);
}

.tp-kana {
	color: var(--muted);
	font-size: var(--fs-xs);
}

.tp-en {
	margin-left: auto;
	color: var(--muted);
	font-size: var(--fs-xs);
	letter-spacing: .04em;
	white-space: nowrap;
}

.tp-like {
	display: flex;
	flex-wrap: wrap;
	gap: 0 6px;
	margin: 3px 0 0;
	font-size: var(--fs-s);
}

.tp-like .k {
	padding: 0 4px;
	color: var(--sub);
	border: 1px solid var(--line-hi);
	font-size: var(--fs-xs);
	line-height: 1.6;
	white-space: nowrap;
}

.tp-like .v {
	color: var(--warn);
}

.tp-desc {
	margin: 4px 0 0;
	font-size: var(--fs-s);
	line-height: 1.7;
}

.tp-extra {
	margin: 4px 0 0;
	color: var(--sub);
	font-size: var(--fs-xs);
}

.tp-extra::before {
	content: "// ";
	color: var(--muted);
}

.tp-flavor {
	margin: 4px 0 0;
	color: var(--muted);
	font-family: var(--sans);
	font-size: var(--fs-xs);
	font-style: italic;
}

.tp-see {
	display: flex;
	flex-wrap: wrap;
	gap: 0 8px;
	margin: 4px 0 0;
	font-size: var(--fs-xs);
}

.tp-see .k {
	color: var(--muted);
}

.tp-rv {
	color: var(--fg-hi);
	font-weight: bold;
}

.tp-empty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 12px 0;
	color: var(--sub);
}

/* ============================================================ ルール */

.tp-nums {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 6px;
	margin: 0 0 4px;
	padding: 0;
	list-style: none;
}

.tp-num {
	display: grid;
	gap: 0;
	padding: 5px 8px;
	background: var(--bg-1);
	border: 1px solid var(--line);
	border-left: 3px solid var(--fg);
}

.tp-num .en {
	color: var(--muted);
	font-size: var(--fs-xs);
	letter-spacing: .06em;
}

.tp-num .val {
	color: var(--fg-hi);
	font-size: var(--fs-xl);
	line-height: 1.2;
}

.tp-num .val .tp-rv {
	font-weight: normal;
}

.tp-num .val small {
	margin-left: 2px;
	color: var(--sub);
	font-size: var(--fs-s);
}

.tp-num .lbl {
	font-size: var(--fs-s);
}

.tp-rule {
	margin-top: 20px;
	scroll-margin-top: 10px;
}

.tp-rule > p {
	margin: 0 0 8px;
	font-size: var(--fs-s);
	line-height: 1.7;
}

.tp-rule > p.tp-more {
	margin-top: 8px;
}

.tp-outcomes {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
	gap: 8px;
}

.tp-outcome {
	padding: 6px 9px 8px;
	background: var(--bg-1);
	border: 1px solid var(--line);
	border-top: 3px solid var(--fg);
}

.tp-outcome[data-side="atk"] {
	border-top-color: var(--alert);
}

.tp-outcome h4,
.tp-flow h4 {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0;
	font-size: var(--fs-m);
}

.tp-outcome p {
	margin: 4px 0 0;
	font-size: var(--fs-s);
}

.tp-outcome .tp-who {
	color: var(--sub);
}

.tp-outcome[data-side="atk"] .tp-who {
	color: var(--alert-hi);
}

.tp-flow {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: flow;
}

.tp-flow > li {
	position: relative;
	padding: 6px 9px 6px 34px;
	background: var(--bg-1);
	border: 1px solid var(--line);
	counter-increment: flow;
}

.tp-flow > li::before {
	content: counter(flow, decimal-leading-zero);
	position: absolute;
	top: 6px;
	left: 8px;
	color: var(--muted);
	font-size: var(--fs-s);
}

.tp-flow ul {
	margin: 4px 0 0;
	padding-left: 1.2em;
	font-size: var(--fs-s);
	line-height: 1.7;
}

.tp-flow ul li::marker {
	content: "- ";
	color: var(--muted);
}

.tp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-s);
}

.tp-table th,
.tp-table td {
	padding: 4px 8px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px dotted var(--line);
	overflow-wrap: anywhere;
}

.tp-table thead th {
	color: var(--sub);
	font-weight: normal;
	border-bottom: 1px solid var(--line-hi);
}

.tp-table tbody th {
	color: var(--fg);
	font-weight: normal;
}

.tp-table + .tp-steps,
.tp-steps + .tp-table {
	margin-top: 10px;
}

.tp-steps {
	display: grid;
	gap: 4px;
	margin: 0;
	padding-left: 1.6em;
	font-size: var(--fs-s);
	line-height: 1.7;
}

.tp-steps b {
	margin-right: 8px;
	color: var(--fg-hi);
	font-weight: normal;
}

.tp-steps b::after {
	content: " >";
	color: var(--muted);
}

.tp-kv th {
	min-width: 6.5em;
}

.tp-kv td {
	font-size: var(--fs-s);
}

/* ============================================================ 狭い画面 */

@media screen and (max-width: 480px) {
	.tp-search {
		flex-wrap: wrap;
	}

	.tp-q {
		flex-basis: calc(100% - 4em);
	}

	.tp-count {
		margin-left: auto;
	}

	.tp-flow > li {
		padding-left: 30px;
	}

	/* サーバー対戦/練習の比較表は、行ごとのカードにする */
	.tp-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.tp-table,
	.tp-table tbody,
	.tp-table tr,
	.tp-table th,
	.tp-table td {
		display: block;
		width: auto;
	}

	.tp-table tr {
		padding: 4px 0;
		border-bottom: 1px dotted var(--line);
	}

	.tp-table th,
	.tp-table td {
		padding: 1px 4px;
		border: 0;
	}

	.tp-table td[data-label]::before {
		content: attr(data-label) ": ";
		color: var(--muted);
	}
}

@media (forced-colors: active) {
	.tp-chip[aria-pressed="true"] {
		forced-color-adjust: none;
		color: Canvas;
		background: Highlight;
	}
}

/* ============================================================ 人物(資料室。assets/js/tips/persons.js) */

.tp-pgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
	gap: 10px;
}

.tp-pcard {
	position: relative;
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	gap: 10px;
	align-items: start;
	min-width: 0;
	padding: 8px;
	color: var(--fg);
	font: inherit;
	text-align: left;
	background: var(--bg);
	border: 1px solid var(--line);
	cursor: pointer;
}

.tp-pcard:hover:not(:disabled),
.tp-pcard:focus-visible {
	border-color: var(--fg);
}

.tp-pcard:disabled {
	cursor: default;
	opacity: 0.85;
}

.tp-pface {
	display: block;
	width: 72px;
	height: 72px;
	padding: 4px;
	border: 1px solid var(--line);
}

.tp-pf {
	display: block;
	width: 64px;
	height: 64px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.tp-pbody {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.tp-pname {
	color: var(--fg-hi);
	overflow-wrap: anywhere;
}

.tp-pcard.is-locked .tp-pname {
	color: var(--muted);
}

.tp-pfac {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--sub);
	font-size: var(--fs-xs);
}

.tp-pem {
	width: 16px;
	height: 16px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.tp-ppost {
	color: var(--sub);
	font-size: var(--fs-s);
	overflow-wrap: anywhere;
}

.tp-pbio {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--muted);
	font-size: var(--fs-s);
}

.tp-new {
	position: absolute;
	top: 4px;
	right: 4px;
	padding: 0 4px;
	color: var(--bg);
	background: var(--warn);
	font-size: var(--fs-xs);
}

.tp-pdlg {
	box-sizing: border-box;
	width: min(92vw, 560px);
	max-height: 90vh;
	padding: 14px;
	overflow: auto;
	color: var(--fg);
	background: var(--bg);
	border: 1px solid var(--fg);
}

.tp-pdlg::backdrop {
	background: rgba(0, 0, 0, 0.7);
}

.tp-pbig {
	display: grid;
	grid-template-columns: 136px minmax(0, 1fr);
	gap: 14px;
	align-items: start;
}

.tp-pbig-face {
	padding: 4px;
	border: 1px solid var(--line);
}

.tp-pbig-face .tp-pf {
	width: 128px;
	height: 128px;
}

.tp-pbig-name {
	margin: 0 0 4px;
	color: var(--fg-hi);
	overflow-wrap: anywhere;
}

.tp-pbig-bio {
	margin: 8px 0 0;
	line-height: 1.7;
}

.tp-pbig-act {
	margin-top: 12px;
	text-align: right;
}

@media screen and (max-width: 480px) {
	.tp-pbig {
		grid-template-columns: minmax(0, 1fr);
	}

	.tp-pbig-face {
		justify-self: center;
	}
}
