.ftoc-widget {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 99998;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1e1e1e;
	transition: opacity 0.2s ease;
}

.ftoc-widget.ftoc-hidden {
	display: none;
}

.ftoc-pos-right { right: 20px; }
.ftoc-pos-left  { left: 20px; }

/* --- Toggle button (always visible) --- */
.ftoc-toggle {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: #1a73e8;
	border: none;
	box-shadow: 0 4px 12px rgba(0,0,0,0.2);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	position: relative;
}

.ftoc-toggle-icon {
	display: block;
	width: 18px;
	height: 12px;
	position: relative;
}
.ftoc-toggle-icon::before,
.ftoc-toggle-icon::after,
.ftoc-toggle-icon {
	background: #fff;
}
.ftoc-toggle-icon,
.ftoc-toggle-icon::before,
.ftoc-toggle-icon::after {
	height: 2px;
	border-radius: 1px;
}
.ftoc-toggle-icon::before,
.ftoc-toggle-icon::after {
	content: "";
	position: absolute;
	left: 0;
	width: 100%;
}
.ftoc-toggle-icon::before { top: -5px; }
.ftoc-toggle-icon::after  { top: 5px; }

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px,1px,1px,1px);
}

/* --- Expandable panel --- */
.ftoc-panel {
	position: absolute;
	top: 50%;
	transform: translateY(-50%) scale(0.95);
	width: 260px;
	max-height: 60vh;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 8px 30px rgba(0,0,0,0.18);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.ftoc-pos-right .ftoc-panel { right: 56px; }
.ftoc-pos-left  .ftoc-panel { left: 56px; }

.ftoc-widget:not(.ftoc-collapsed) .ftoc-panel {
	opacity: 1;
	transform: translateY(-50%) scale(1);
	pointer-events: auto;
}

.ftoc-widget:not(.ftoc-collapsed) .ftoc-toggle {
	background: #0d5bba;
}

.ftoc-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid #ececec;
	background: #fafafa;
}

.ftoc-panel-title {
	font-weight: 600;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #333;
}

.ftoc-close {
	background: none;
	border: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #888;
	padding: 0 2px;
}
.ftoc-close:hover { color: #222; }

.ftoc-nav {
	overflow-y: auto;
	padding: 10px 0;
}

.ftoc-list,
.ftoc-list ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ftoc-list ul {
	padding-left: 14px;
}

.ftoc-list li a {
	display: block;
	padding: 6px 16px;
	color: #444;
	text-decoration: none;
	border-left: 2px solid transparent;
	transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.ftoc-list li a:hover {
	background: #f2f6ff;
	color: #1a73e8;
}

.ftoc-list li a.ftoc-active {
	color: #1a73e8;
	border-left-color: #1a73e8;
	background: #f2f6ff;
	font-weight: 600;
}

.ftoc-list .ftoc-level-h3 > a { padding-left: 26px; font-size: 13px; }
.ftoc-list .ftoc-level-h4 > a { padding-left: 36px; font-size: 12.5px; }
.ftoc-list .ftoc-level-h5 > a { padding-left: 46px; font-size: 12px; }

@media (max-width: 782px) {
	.ftoc-panel { width: 220px; max-height: 50vh; }
	.ftoc-toggle { width: 40px; height: 40px; }
}
