/* ====================================================================
   縄跳びカード メーカー（sports-tools/nawatobi-card-maker、2026-11-14）
   - プレビュー（.nc-paper）は用紙と同じ縦横比の箱。中身（見本画像 → SVG）が入れ替わっても高さは変わらない。
   - ボタン・選択肢は高さを固定（書体の切り替わりで行の高さが動かないように）。
   - 印刷時は .nc-print-root（JS が body の直下に置く SVG）だけを用紙いっぱいに出す。
   ==================================================================== */

:root {
	--nc-main: #f76707;
	--nc-main-dark: #d9480f;
	--nc-soft: #fff4e6;
}

/* ---------- 区切り ---------- */
.nc-section {
	padding: 18px 20px 16px;
}

.nc-section--edit {
	border-top: 1px solid var(--color-border);
}

.nc-section-title {
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 700;
	line-height: 22px;
	color: var(--color-text);
	margin: 0 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nc-section-title--second {
	margin-top: 16px;
}

.nc-step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--nc-main);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.nc-share-note {
	margin: 0;
	padding: 10px 20px;
	min-height: 44px;
	font-size: 13px;
	line-height: 1.7;
	color: #1d4f8c;
	background: #e6f0fb;
	border-bottom: 1px solid var(--color-border);
	border-radius: var(--radius) var(--radius) 0 0;
}

/* ---------- 選択肢（学年・形） ---------- */
.nc-chips {
	display: grid;
	gap: 8px;
}

.nc-chips--grade {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nc-chips--type {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nc-chip {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	height: 56px;
	padding: 0 6px;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	background: #fff;
	color: var(--color-text);
	font-family: inherit;
	cursor: pointer;
	overflow: hidden;
}

.nc-chip-main {
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 700;
	line-height: 20px;
	white-space: nowrap;
}

.nc-chip-sub {
	font-size: 11.5px;
	line-height: 16px;
	color: var(--color-text-muted);
	white-space: nowrap;
}

.nc-chip:hover {
	border-color: var(--nc-main);
}

.nc-chip.is-active {
	border-color: var(--nc-main);
	background: var(--nc-soft);
	box-shadow: inset 0 0 0 1px var(--nc-main);
}

.nc-chip.is-active .nc-chip-main {
	color: var(--nc-main-dark);
}

.nc-chip:focus-visible,
.nc-btn:focus-visible,
.nc-theme:focus-visible,
.nc-paper-opt:focus-visible,
.nc-mini:focus-visible {
	outline: 3px solid rgba(247, 103, 7, 0.35);
	outline-offset: 2px;
}

/* ---------- プレビュー ---------- */
.nc-stage {
	padding: 18px 20px;
	background: #efece6;
	border-top: 1px solid var(--color-border);
	border-bottom: 1px solid var(--color-border);
}

.nc-paper {
	width: 100%;
	max-width: 560px;
	margin: 0 auto;
	aspect-ratio: 210 / 297;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
	overflow: hidden;
}

.nc-paper.is-b5 {
	aspect-ratio: 182 / 257;
}

.nc-paper img,
.nc-paper svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---------- ボタン ---------- */
.nc-actions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	padding: 16px 20px 0;
}

.nc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 14px;
	border: 1.5px solid var(--nc-main);
	border-radius: var(--radius);
	background: var(--nc-main);
	color: #fff;
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
}

.nc-btn:hover {
	background: var(--nc-main-dark);
	border-color: var(--nc-main-dark);
}

.nc-btn--sub {
	background: #fff;
	color: var(--nc-main-dark);
}

.nc-btn--sub:hover {
	background: var(--nc-soft);
	border-color: var(--nc-main);
}

.nc-btn--small {
	height: 40px;
	font-size: 13.5px;
}

.nc-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.nc-actions-note {
	margin: 0;
	padding: 8px 20px 16px;
	font-size: 12px;
	line-height: 1.6;
	color: var(--color-text-muted);
}

/* ---------- 入力 ---------- */
.nc-form {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px 16px;
}

.nc-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.nc-field--wide {
	grid-column: 1 / -1;
}

.nc-label {
	font-size: 13px;
	font-weight: 700;
	line-height: 20px;
	color: var(--color-text);
}

.nc-input,
.nc-select {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	line-height: 1.4;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	font-size: 15px;
	font-family: inherit;
	color: var(--color-text);
	background: #fff;
	box-sizing: border-box;
}

.nc-input:focus,
.nc-select:focus,
.nc-skill-name:focus,
.nc-cell:focus {
	outline: none;
	border-color: var(--nc-main);
	box-shadow: 0 0 0 3px rgba(247, 103, 7, 0.18);
}

/* 級の数／○の数：同じ場所に重ねて、片方だけ見せる（切り替えで高さが変わらない） */
.nc-field--stack {
	display: grid;
}

.nc-stack-item {
	grid-area: 1 / 1;
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.nc-stack-item.is-hidden {
	visibility: hidden;
}

.nc-swatches {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 44px;
}

.nc-theme {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--nc-sw);
	box-shadow: 0 0 0 1.5px var(--color-border);
	cursor: pointer;
}

.nc-theme.is-active {
	box-shadow: 0 0 0 2.5px var(--nc-main);
}

.nc-toggle {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	height: 44px;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	background: #fff;
}

.nc-paper-opt {
	border: none;
	background: transparent;
	font-family: var(--font-display);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	color: var(--color-text-secondary);
	cursor: pointer;
}

.nc-paper-opt + .nc-paper-opt {
	border-left: 1.5px solid var(--color-border);
}

.nc-paper-opt.is-active {
	background: var(--nc-soft);
	color: var(--nc-main-dark);
}

/* ---------- 開閉する設定 ---------- */
.nc-details {
	margin-top: 14px;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	background: #fff;
}

.nc-summary {
	display: flex;
	align-items: center;
	height: 48px;
	padding: 0 14px;
	font-family: var(--font-display);
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--color-text);
	cursor: pointer;
	list-style: none;
}

.nc-summary::-webkit-details-marker {
	display: none;
}

.nc-summary::after {
	content: '';
	width: 9px;
	height: 9px;
	margin-left: auto;
	border-right: 2px solid var(--color-text-secondary);
	border-bottom: 2px solid var(--color-text-secondary);
	transform: rotate(45deg) translate(-2px, -2px);
}

.nc-details[open] > .nc-summary::after {
	transform: rotate(-135deg) translate(-2px, -2px);
}

.nc-details[open] > .nc-summary {
	border-bottom: 1px solid var(--color-border);
}

.nc-details-body {
	padding: 14px;
}

.nc-hint {
	margin: 0 0 10px;
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--color-text-secondary);
}

.nc-hint--form {
	margin: 10px 0 0;
}

.nc-sub-title {
	margin: 18px 0 6px;
	font-family: var(--font-display);
	font-size: 14px;
	font-weight: 700;
	line-height: 22px;
	color: var(--color-text);
}

.nc-skill-list {
	list-style: none;
	display: grid;
	gap: 6px;
	margin: 0 0 10px;
	padding: 0;
}

.nc-skill-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 40px 40px 40px;
	gap: 6px;
}

.nc-skill-name {
	width: 100%;
	height: 40px;
	padding: 0 10px;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	font-size: 15px;
	font-family: inherit;
	line-height: 1.4;
	color: var(--color-text);
	background: #fff;
	box-sizing: border-box;
}

.nc-mini {
	height: 40px;
	padding: 0;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius);
	background: #fff;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	color: var(--color-text-secondary);
	cursor: pointer;
}

.nc-mini:hover:not(:disabled) {
	border-color: var(--nc-main);
	color: var(--nc-main-dark);
}

.nc-mini:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.nc-mini--del {
	color: #c92a2a;
}

.nc-add-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 110px;
	gap: 8px;
}

.nc-add-row .nc-select {
	height: 40px;
}

.nc-matrix-wrap {
	margin: 0 0 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
}

.nc-matrix {
	border-collapse: collapse;
	font-size: 12.5px;
	line-height: 1.3;
	min-width: 100%;
}

.nc-matrix th,
.nc-matrix td {
	padding: 3px;
	border-bottom: 1px solid var(--color-border);
	text-align: center;
	white-space: nowrap;
}

.nc-matrix thead th {
	padding: 6px 5px;
	background: #faf8f4;
	font-weight: 700;
	color: var(--color-text-secondary);
	max-width: 84px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nc-matrix tbody th {
	padding: 0 8px;
	background: #faf8f4;
	font-weight: 700;
	color: var(--color-text-secondary);
	text-align: left;
	position: sticky;
	left: 0;
	max-width: 110px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nc-matrix tbody tr:last-child th,
.nc-matrix tbody tr:last-child td {
	border-bottom: none;
}

.nc-cell {
	width: 48px;
	height: 36px;
	padding: 0 2px;
	border: 1.5px solid var(--color-border);
	border-radius: 6px;
	font-size: 15px;
	font-family: inherit;
	line-height: 1.2;
	text-align: center;
	color: var(--color-text);
	background: #fff;
	box-sizing: border-box;
}

.nc-checks {
	display: grid;
	gap: 4px;
	margin-top: 12px;
}

.nc-check {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--color-text);
	cursor: pointer;
}

.nc-check input {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	accent-color: var(--nc-main);
}

.nc-reset-row {
	margin-top: 14px;
	display: flex;
	justify-content: flex-end;
}

/* ---------- 本文 ---------- */
.nc-samples {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 22px 24px;
	margin-top: 16px;
}

.nc-sample-title {
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--color-text);
	margin: 0 0 4px;
}

.nc-sample-text {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.75;
	color: var(--color-text-secondary);
}

.nc-sample-pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.nc-sample-fig {
	margin: 0;
}

.nc-sample-imglink {
	display: block;
	aspect-ratio: 210 / 297;
	border: 1px solid var(--color-border);
	background: #fff;
	overflow: hidden;
}

.nc-sample-imglink img {
	display: block;
	width: 100%;
	height: 100%;
}

.nc-sample-cap {
	margin-top: 6px;
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--color-text-secondary);
}

.nc-sample-link {
	display: block;
	color: var(--nc-main-dark);
	font-weight: 700;
}

.nc-type-list {
	margin: 0 0 14px;
	display: grid;
	gap: 10px;
}

.nc-type-row {
	padding: 12px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: #fbfaf7;
}

.nc-type-row dt {
	font-family: var(--font-display);
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--nc-main-dark);
}

.nc-type-row dd {
	margin: 2px 0 0;
	font-size: 13.5px;
	line-height: 1.8;
	color: var(--color-text-secondary);
}

.nc-table-wrap {
	margin-top: 14px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.nc-doc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
	line-height: 1.7;
}

.nc-doc-table th,
.nc-doc-table td {
	padding: 9px 10px;
	border: 1px solid var(--color-border);
	text-align: left;
	vertical-align: top;
}

.nc-doc-table thead th {
	background: #faf8f4;
	font-weight: 700;
	color: var(--color-text);
	white-space: nowrap;
}

.nc-doc-table tbody th {
	font-weight: 700;
	color: var(--color-text);
	white-space: nowrap;
	background: #fff;
}

.nc-doc-table td {
	color: var(--color-text-secondary);
}

.nc-doc-grade {
	white-space: nowrap;
}

.nc-plain-list {
	margin: 12px 0;
	padding-left: 1.3em;
	display: grid;
	gap: 8px;
	font-size: 14px;
	line-height: 1.85;
	color: var(--color-text-secondary);
}

.nc-plain-list strong {
	color: var(--color-text);
}

.nc-source {
	margin: 12px 0 0;
	font-size: 12px;
	line-height: 1.7;
	color: var(--color-text-muted);
}

.nc-safety {
	margin-top: 14px;
	padding: 12px 14px;
	border-radius: var(--radius);
	background: #fdecec;
	color: #7a2016;
	font-size: 13.5px;
	line-height: 1.7;
}

.nc-related {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.nc-related a {
	display: block;
	padding: 12px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--color-text);
	font-size: 13px;
	line-height: 1.6;
	background: #fff;
}

.nc-related a:hover {
	border-color: var(--nc-main);
	background: var(--nc-soft);
}

.nc-related a strong {
	display: block;
	color: var(--nc-main-dark);
	margin-bottom: 2px;
}

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
	.nc-section {
		padding: 16px 16px 14px;
	}

	.nc-chips--grade {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nc-stage {
		padding: 14px 16px;
	}

	.nc-actions {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		padding: 14px 16px 0;
	}

	.nc-actions .nc-btn:last-child {
		grid-column: 1 / -1;
	}

	.nc-actions-note {
		padding: 8px 16px 14px;
	}

	.nc-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* 色の丸は 5 つ並ぶので、スマホでは 1 行まるごと使う */
	.nc-field--swatch,
	.nc-field--stack {
		grid-column: 1 / -1;
	}

	.nc-share-note {
		padding: 10px 16px;
		min-height: 66px;
	}

	.nc-samples {
		grid-template-columns: minmax(0, 1fr);
	}

	.nc-related {
		grid-template-columns: minmax(0, 1fr);
	}

	/* 技の一覧：スマホでは表をやめて、技ごとに「名前／とび方／学年」を縦に積む */
	.nc-doc-table,
	.nc-doc-table tbody {
		display: block;
	}

	.nc-doc-table thead {
		display: none;
	}

	.nc-doc-table tr {
		display: block;
		padding: 11px 0;
		border-bottom: 1px solid var(--color-border);
	}

	.nc-doc-table tr:last-child {
		border-bottom: none;
		padding-bottom: 0;
	}

	.nc-doc-table th,
	.nc-doc-table td {
		display: block;
		padding: 0;
		border: none;
	}

	.nc-doc-table tbody th {
		font-family: var(--font-display);
		font-size: 14.5px;
		margin-bottom: 2px;
	}

	.nc-doc-grade {
		margin-top: 3px;
		font-size: 12.5px;
		white-space: normal;
		color: var(--color-text-muted);
	}

	.nc-doc-grade::before {
		content: '見本に入っている学年：';
	}
}

/* ---------- 印刷：カードだけを出す ----------
   既定（Chrome・Edge・Firefox・Android）：html・body・印刷用の箱の高さを 100%（＝用紙 1 ページぶん）にして、その中に SVG を収める。
   用紙の大きさや余白が違っても 1 ページに収まる。箱は通常の流れに置く。
   ※ 固定配置（position: fixed）は使わない。PC の Chrome では、固定配置の要素は「画面の高さ」より下の部分が印刷に出ない
     （2026-11-22、すごろくメーカーの印刷プレビューで確認。ウィンドウを低くすると、出ない範囲が広がる。ヘッドレスの PDF 出力では起きない）。
   Safari（iPhone・iPad・Mac、.nc-print-flow）：高さ 100% が用紙ではなく画面を基準に決まることがあるので、
   用紙の刷れる幅の 94% に合わせる（高さは幅から決まる）。カード自身の上下の余白は JS 側で詰めてあり、高さは幅の約 1.28 倍。
   刷れる範囲が縦に短いとき（上下の余白が広いプリンター）でも 2 ページ目（白紙）にあふれないよう、余裕を持たせている。
   html・body の高さの指定（100%・100vh）も外し、用紙より背の高い箱を作らない。 */
.nc-print-root {
	display: none;
}

@media print {
	html,
	body.nc-printing {
		height: 100%;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
	}

	body.nc-printing > *:not(.nc-print-root) {
		display: none !important;
	}

	body.nc-printing .nc-print-root {
		display: block;
		position: static;
		width: 100%;
		height: 100%;
		margin: 0;
		padding: 0;
		overflow: hidden;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	body.nc-printing .nc-print-sheet {
		width: 100%;
		height: 100%;
	}

	body.nc-printing .nc-print-root svg {
		display: block;
		width: 100%;
		height: 100%;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	/* Safari 向け */
	html.nc-print-flow,
	html.nc-print-flow body.nc-printing {
		height: auto !important;
		min-height: 0 !important;
	}

	body.nc-printing.nc-print-flow .nc-print-root {
		position: static;
		width: 94%;
		height: auto;
		margin: 0 auto;
		padding: 0;
		overflow: hidden;
		break-inside: avoid;
		page-break-inside: avoid;
		break-after: avoid;
		page-break-after: avoid;
	}

	body.nc-printing.nc-print-flow .nc-print-sheet {
		position: relative;
		height: 0;
		padding-bottom: var(--nc-ratio, 136.1905%);
	}

	body.nc-printing.nc-print-flow .nc-print-root svg {
		position: absolute;
		left: 0;
		top: 0;
	}
}
