.list-page {
	--tab-height: 60px;
	--safe-top: 0px;
	--safe-bottom: 0px;
	padding-bottom: 76px;
	padding-bottom: calc(var(--tab-height) + 16px + var(--safe-bottom));
}

@supports (padding: env(safe-area-inset-bottom)) {
	.list-page {
		--safe-top: env(safe-area-inset-top);
		--safe-bottom: env(safe-area-inset-bottom);
	}
}

/* Match the outer edges of the cards, including when the last row is incomplete. */
.list-frame {
	width: calc(100% - 16px);
	margin-right: auto;
	margin-left: auto;
	padding-right: 0;
	padding-left: 0;
}
@supports (width: max(8px, env(safe-area-inset-left))) {
	.list-frame {
		--gutter: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
		width: calc(100% - var(--gutter) - var(--gutter));
	}
}
@media (min-width: 576px)  { .list-frame { max-width: 532px; } }
@media (min-width: 768px)  { .list-frame { max-width: 712px; } }
@media (min-width: 992px)  { .list-frame { max-width: 952px; } }
@media (min-width: 1200px) { .list-frame { max-width: 1130px; } }

#channel_list_container { margin-top: 8px; }
#channel_list.row { margin-left: -.25rem; margin-right: -.25rem; }
.mast { background: #343a40; color: white; font-size: 20px; overflow-wrap: break-word; }
.mast a { display: inline-block; padding: 8px 0; color: inherit; }

.site-navigation {
	position: fixed;
	z-index: 1030;
	right: 0;
	bottom: 0;
	left: 0;
	padding-bottom: var(--safe-bottom);
	background: white;
}
.primary-tabs {
	display: flex;
	background: white;
	border: 1px solid #bfccd7;
	border-bottom: 0;
}
.primary-tabs > * { flex: 1 1 0%; min-width: 0; }
.primary-tabs > * + * { border-left: 1px solid #d6dde5; }
.tab-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 59px;
	min-height: calc(var(--tab-height) - 1px);
	padding: 3px 0;
	color: #273545;
	font-size: .8125rem;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
}
.tab-label:hover { color: #0759bd; text-decoration: none; }
.site-navigation svg, .preference-guide svg, #modal_bookmark_setting svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.tab-label svg { width: 24px; height: 24px; flex-shrink: 0; margin-bottom: 4px; }
.primary-tabs > a[aria-current="page"],
.primary-tabs summary.is-current .tab-label,
.primary-tabs details[open] .tab-label,
.category-cell > a[aria-current="page"] { color: white; background: #0759bd; }
.primary-tabs.menu-open > a[aria-current="page"] { color: #273545; background: white; }
.primary-tabs:has(details[open]) > a[aria-current="page"] { color: #273545; background: white; }
.primary-tabs summary { list-style: none; cursor: pointer; }
.primary-tabs summary::-webkit-details-marker { display: none; }

.menu-panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	max-height: calc(100vh - 76px);
	max-height: calc(100vh - var(--tab-height) - 16px - var(--safe-bottom) - var(--safe-top));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	border-top: 1px solid #abb9c6;
	background: white;
}
@supports (height: 100dvh) {
	.menu-panel { max-height: calc(100dvh - var(--tab-height) - 16px - var(--safe-bottom) - var(--safe-top)); }
}
.menu-tools, .category-links { display: flex; flex-wrap: wrap; }
/* Extend the surfaces to the viewport edges; keep controls clear of side cutouts. */
.primary-tabs, .menu-panel {
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
}
.menu-tools > * {
	display: flex;
	align-items: center;
	flex: 0 0 50%;
	max-width: 50%;
	min-width: 0;
	min-height: 44px;
	padding: 6px 4px;
	background: transparent;
	border: 0;
	border-right: 1px solid #d7dee5;
	border-bottom: 1px solid #d7dee5;
	justify-content: center;
	color: #273545;
	font-size: 15px;
	text-align: left;
	line-height: 1.3;
	cursor: pointer;
}
.menu-tools > :hover, .menu-tools > [aria-current="page"] { text-decoration: underline; }
.menu-tools svg { width: 20px; height: 20px; flex-shrink: 0; margin-right: 8px; color: #273545; }
.category-search h2 { margin: 0; padding: 8px 12px; color: #192c43; font-size: 18px; font-weight: 700; }
.list-end-menu {
	padding: 8px;
	border: 1px solid #d6dde5;
	background: white;
}
.list-end-menu .category-links { border-left: 1px solid #d7dee5; }
.list-end-menu h2 { padding-left: 4px; }
.list-end-menu h2 label { margin: 0; }
.category-links { border-top: 1px solid #d7dee5; }
.category-cell { padding: 0; }
.category-cell > a {
	display: flex;
	height: 100%;
	align-items: center;
	min-height: 44px;
	padding: 3px 12px;
	border-right: 1px solid #d7dee5;
	border-bottom: 1px solid #d7dee5;
	color: #0758a8;
	background: white;
	font-weight: 700;
	text-align: left;
	word-break: break-word;
	overflow-wrap: anywhere;
}
.category-search form { display: flex; align-items: flex-start; padding: 12px; }
.list-end-menu form { padding: 0 4px 8px; }
.category-search .headline-search-field { flex: 1 1 0%; min-width: 0; }
.category-search input, .category-search button[type="submit"] { min-height: 44px; font-size: 16px; }
.category-search button[type="submit"] {
	margin-left: 8px;
	padding: 4px 18px;
	color: #167333;
	background: white;
	border: 1px solid #258542;
	font-weight: 700;
}
.preference-guide > a {
	margin-left: 8px;
	padding: 4px 18px;
	color: white;
	background: #0759bd;
	border-radius: 4px;
	font-weight: 700;
}
.headline-search-error { color: #a22127; font-size: .875rem; }
.site-navigation :focus, .preference-guide > a:focus { outline: 2px solid currentColor; outline-offset: -3px; }

.preference-empty {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 128px);
	min-height: calc(100vh - var(--tab-height) - 68px - var(--safe-bottom));
	padding: 16px;
	background: white;
	border: 1px solid #d6dde5;
	color: #192c43;
}
@supports (height: 100dvh) {
	.preference-empty { min-height: calc(100dvh - var(--tab-height) - 68px - var(--safe-bottom)); }
}
#preference-heading { font-size: 1.5rem; font-weight: 700; }
.preference-guide {
	display: flex;
	flex: 1 0 auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 20px 0;
	text-align: center;
}
.preference-guide > svg { width: 72px; height: 72px; margin-bottom: 16px; }
.preference-guide h2 { font-size: 1.25rem; font-weight: 700; }
.preference-guide > a { display: inline-flex; align-items: center; margin: 0; padding: 12px 24px; }
.preference-guide > a svg { width: 20px; height: 20px; margin-right: 6px; flex-shrink: 0; }

.list-page #page_top {
	bottom: 76px;
	bottom: calc(var(--tab-height) + var(--safe-bottom) + 8px);
	visibility: hidden;
}
.list-page #page_top.is-visible { visibility: visible; }

@media (min-width: 768px) {
	.list-page { --tab-height: 56px; }
	.tab-label { font-size: 1rem; }
}
@media (min-width: 992px) {
	.menu-tools > * { flex-basis: 25%; max-width: 25%; }
}
/* Keep touch targets at least 44px on tablets and hybrid devices. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
	.menu-tools > *, .category-cell > a { min-height: 36px; }
	.category-search input, .category-search button[type="submit"] { min-height: 38px; }
}
@media (any-pointer: coarse) {
	.menu-tools > *, .category-cell > a, .category-search input, .category-search button[type="submit"] { min-height: 44px; }
}

#modal_bookmark_setting { display: flex; align-items: center; }
#modal_bookmark_setting svg { width: 1em; height: 1em; margin-right: .4em; }
#load_setting_modal h2 { font-size: 1.25rem; font-weight: 700; }
.bookmark-guide { margin-bottom: 1rem; }
.bookmark-guide summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	list-style: none;
	font-weight: 700;
	cursor: pointer;
}
.bookmark-guide summary::-webkit-details-marker { display: none; }
.bookmark-guide ul { margin: .5rem 0; padding-left: 1.5rem; }
.bookmark-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: .375rem .625rem;
	border: 1px solid #0759bd;
	border-radius: .25rem;
	background: white;
	color: #0759bd;
	font-weight: 700;
}
.bookmark-action svg {
	width: 20px;
	height: 20px;
	margin-right: .35rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linejoin: round;
}
.bookmark-copy { display: flex; position: relative; margin-bottom: 1rem; }
#bookmark-url {
	flex: 1 1 0%;
	min-width: 0;
	padding: .5rem;
	background: #f4f6f8;
	border: 1px solid #aab7c4;
	border-radius: .25rem 0 0 .25rem;
	font-size: 1rem;
	word-break: break-all;
	resize: vertical;
}
.bookmark-copy button {
	flex-direction: column;
	border-radius: 0 .25rem .25rem 0;
	background: #eaf5ff;
}
.bookmark-copy svg { margin: 0 0 .25rem; }
#bookmark-copy-status {
	position: absolute;
	right: 0;
	bottom: 100%;
	z-index: 1;
	max-width: 100%;
	margin: 0 0 .25rem;
	font-size: inherit;
	line-height: inherit;
	color: white;
	pointer-events: none;
}
#bookmark-copy-status:not(:empty) {
	padding: .375em .75em;
	border-radius: .5em;
	background: #343434;
	box-shadow: 0 .125em .5em rgba(0, 0, 0, .25);
}
#bookmark-copy-status.copy-error:not(:empty) { background: #842922; }
